2 * Copyright (C) ST-Ericsson SA 2010
4 * License terms: GNU General Public License (GPL), version 2
7 #include <linux/platform_device.h>
8 #include <linux/init.h>
9 #include <linux/gpio.h>
10 #include <linux/platform_data/pinctrl-nomadik.h>
12 #include <plat/ste_dma40.h>
14 #include <mach/devices.h>
15 #include <mach/hardware.h>
16 #include <mach/irqs.h>
19 #include "ste-dma40-db8500.h"
20 #include "board-mop500.h"
21 #include "devices-db8500.h"
22 #include "pins-db8500.h"
24 static struct stedma40_chan_cfg msp0_dma_rx
= {
25 .high_priority
= true,
26 .dir
= STEDMA40_PERIPH_TO_MEM
,
28 .src_dev_type
= DB8500_DMA_DEV31_MSP0_RX_SLIM0_CH0_RX
,
29 .dst_dev_type
= STEDMA40_DEV_DST_MEMORY
,
31 .src_info
.psize
= STEDMA40_PSIZE_LOG_4
,
32 .dst_info
.psize
= STEDMA40_PSIZE_LOG_4
,
34 /* data_width is set during configuration */
37 static struct stedma40_chan_cfg msp0_dma_tx
= {
38 .high_priority
= true,
39 .dir
= STEDMA40_MEM_TO_PERIPH
,
41 .src_dev_type
= STEDMA40_DEV_DST_MEMORY
,
42 .dst_dev_type
= DB8500_DMA_DEV31_MSP0_TX_SLIM0_CH0_TX
,
44 .src_info
.psize
= STEDMA40_PSIZE_LOG_4
,
45 .dst_info
.psize
= STEDMA40_PSIZE_LOG_4
,
47 /* data_width is set during configuration */
50 struct msp_i2s_platform_data msp0_platform_data
= {
52 .msp_i2s_dma_rx
= &msp0_dma_rx
,
53 .msp_i2s_dma_tx
= &msp0_dma_tx
,
56 static struct stedma40_chan_cfg msp1_dma_rx
= {
57 .high_priority
= true,
58 .dir
= STEDMA40_PERIPH_TO_MEM
,
60 .src_dev_type
= DB8500_DMA_DEV30_MSP3_RX
,
61 .dst_dev_type
= STEDMA40_DEV_DST_MEMORY
,
63 .src_info
.psize
= STEDMA40_PSIZE_LOG_4
,
64 .dst_info
.psize
= STEDMA40_PSIZE_LOG_4
,
66 /* data_width is set during configuration */
69 static struct stedma40_chan_cfg msp1_dma_tx
= {
70 .high_priority
= true,
71 .dir
= STEDMA40_MEM_TO_PERIPH
,
73 .src_dev_type
= STEDMA40_DEV_DST_MEMORY
,
74 .dst_dev_type
= DB8500_DMA_DEV30_MSP1_TX
,
76 .src_info
.psize
= STEDMA40_PSIZE_LOG_4
,
77 .dst_info
.psize
= STEDMA40_PSIZE_LOG_4
,
79 /* data_width is set during configuration */
82 struct msp_i2s_platform_data msp1_platform_data
= {
84 .msp_i2s_dma_rx
= NULL
,
85 .msp_i2s_dma_tx
= &msp1_dma_tx
,
88 static struct stedma40_chan_cfg msp2_dma_rx
= {
89 .high_priority
= true,
90 .dir
= STEDMA40_PERIPH_TO_MEM
,
92 .src_dev_type
= DB8500_DMA_DEV14_MSP2_RX
,
93 .dst_dev_type
= STEDMA40_DEV_DST_MEMORY
,
95 /* MSP2 DMA doesn't work with PSIZE == 4 on DB8500v2 */
96 .src_info
.psize
= STEDMA40_PSIZE_LOG_1
,
97 .dst_info
.psize
= STEDMA40_PSIZE_LOG_1
,
99 /* data_width is set during configuration */
102 static struct stedma40_chan_cfg msp2_dma_tx
= {
103 .high_priority
= true,
104 .dir
= STEDMA40_MEM_TO_PERIPH
,
106 .src_dev_type
= STEDMA40_DEV_DST_MEMORY
,
107 .dst_dev_type
= DB8500_DMA_DEV14_MSP2_TX
,
109 .src_info
.psize
= STEDMA40_PSIZE_LOG_4
,
110 .dst_info
.psize
= STEDMA40_PSIZE_LOG_4
,
112 .use_fixed_channel
= true,
115 /* data_width is set during configuration */
118 static struct platform_device
*db8500_add_msp_i2s(struct device
*parent
,
120 resource_size_t base
, int irq
,
121 struct msp_i2s_platform_data
*pdata
)
123 struct platform_device
*pdev
;
124 struct resource res
[] = {
125 DEFINE_RES_MEM(base
, SZ_4K
),
129 pr_info("Register platform-device 'ux500-msp-i2s', id %d, irq %d\n",
131 pdev
= platform_device_register_resndata(parent
, "ux500-msp-i2s", id
,
132 res
, ARRAY_SIZE(res
),
133 pdata
, sizeof(*pdata
));
135 pr_err("Failed to register platform-device 'ux500-msp-i2s.%d'!\n",
143 /* Platform device for ASoC MOP500 machine */
144 static struct platform_device snd_soc_mop500
= {
145 .name
= "snd-soc-mop500",
148 .platform_data
= NULL
,
152 /* Platform device for Ux500-PCM */
153 static struct platform_device ux500_pcm
= {
157 .platform_data
= NULL
,
161 struct msp_i2s_platform_data msp2_platform_data
= {
163 .msp_i2s_dma_rx
= &msp2_dma_rx
,
164 .msp_i2s_dma_tx
= &msp2_dma_tx
,
167 struct msp_i2s_platform_data msp3_platform_data
= {
169 .msp_i2s_dma_rx
= &msp1_dma_rx
,
170 .msp_i2s_dma_tx
= NULL
,
173 void mop500_audio_init(struct device
*parent
)
175 pr_info("%s: Register platform-device 'snd-soc-mop500'.\n", __func__
);
176 platform_device_register(&snd_soc_mop500
);
178 pr_info("Initialize MSP I2S-devices.\n");
179 db8500_add_msp_i2s(parent
, 0, U8500_MSP0_BASE
, IRQ_DB8500_MSP0
,
180 &msp0_platform_data
);
181 db8500_add_msp_i2s(parent
, 1, U8500_MSP1_BASE
, IRQ_DB8500_MSP1
,
182 &msp1_platform_data
);
183 db8500_add_msp_i2s(parent
, 2, U8500_MSP2_BASE
, IRQ_DB8500_MSP2
,
184 &msp2_platform_data
);
185 db8500_add_msp_i2s(parent
, 3, U8500_MSP3_BASE
, IRQ_DB8500_MSP1
,
186 &msp3_platform_data
);
189 /* Due for removal once the MSP driver has been fully DT:ed. */
190 void mop500_of_audio_init(struct device
*parent
)
192 pr_info("%s: Register platform-device 'ux500-pcm'\n", __func__
);
193 platform_device_register(&ux500_pcm
);