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>
11 #include <plat/gpio-nomadik.h>
12 #include <plat/pincfg.h>
13 #include <plat/ste_dma40.h>
15 #include <mach/devices.h>
16 #include <mach/hardware.h>
17 #include <mach/irqs.h>
20 #include "ste-dma40-db8500.h"
21 #include "board-mop500.h"
22 #include "devices-db8500.h"
23 #include "pins-db8500.h"
25 static struct stedma40_chan_cfg msp0_dma_rx = {
26 .high_priority = true,
27 .dir = STEDMA40_PERIPH_TO_MEM,
29 .src_dev_type = DB8500_DMA_DEV31_MSP0_RX_SLIM0_CH0_RX,
30 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
32 .src_info.psize = STEDMA40_PSIZE_LOG_4,
33 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
35 /* data_width is set during configuration */
38 static struct stedma40_chan_cfg msp0_dma_tx = {
39 .high_priority = true,
40 .dir = STEDMA40_MEM_TO_PERIPH,
42 .src_dev_type = STEDMA40_DEV_DST_MEMORY,
43 .dst_dev_type = DB8500_DMA_DEV31_MSP0_TX_SLIM0_CH0_TX,
45 .src_info.psize = STEDMA40_PSIZE_LOG_4,
46 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
48 /* data_width is set during configuration */
51 struct msp_i2s_platform_data msp0_platform_data = {
53 .msp_i2s_dma_rx = &msp0_dma_rx,
54 .msp_i2s_dma_tx = &msp0_dma_tx,
57 static struct stedma40_chan_cfg msp1_dma_rx = {
58 .high_priority = true,
59 .dir = STEDMA40_PERIPH_TO_MEM,
61 .src_dev_type = DB8500_DMA_DEV30_MSP3_RX,
62 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
64 .src_info.psize = STEDMA40_PSIZE_LOG_4,
65 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
67 /* data_width is set during configuration */
70 static struct stedma40_chan_cfg msp1_dma_tx = {
71 .high_priority = true,
72 .dir = STEDMA40_MEM_TO_PERIPH,
74 .src_dev_type = STEDMA40_DEV_DST_MEMORY,
75 .dst_dev_type = DB8500_DMA_DEV30_MSP1_TX,
77 .src_info.psize = STEDMA40_PSIZE_LOG_4,
78 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
80 /* data_width is set during configuration */
83 struct msp_i2s_platform_data msp1_platform_data = {
85 .msp_i2s_dma_rx = NULL,
86 .msp_i2s_dma_tx = &msp1_dma_tx,
89 static struct stedma40_chan_cfg msp2_dma_rx = {
90 .high_priority = true,
91 .dir = STEDMA40_PERIPH_TO_MEM,
93 .src_dev_type = DB8500_DMA_DEV14_MSP2_RX,
94 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
96 /* MSP2 DMA doesn't work with PSIZE == 4 on DB8500v2 */
97 .src_info.psize = STEDMA40_PSIZE_LOG_1,
98 .dst_info.psize = STEDMA40_PSIZE_LOG_1,
100 /* data_width is set during configuration */
103 static struct stedma40_chan_cfg msp2_dma_tx = {
104 .high_priority = true,
105 .dir = STEDMA40_MEM_TO_PERIPH,
107 .src_dev_type = STEDMA40_DEV_DST_MEMORY,
108 .dst_dev_type = DB8500_DMA_DEV14_MSP2_TX,
110 .src_info.psize = STEDMA40_PSIZE_LOG_4,
111 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
113 .use_fixed_channel = true,
116 /* data_width is set during configuration */
119 static struct platform_device *db8500_add_msp_i2s(struct device *parent,
121 resource_size_t base, int irq,
122 struct msp_i2s_platform_data *pdata)
124 struct platform_device *pdev;
125 struct resource res[] = {
126 DEFINE_RES_MEM(base, SZ_4K),
130 pr_info("Register platform-device 'ux500-msp-i2s', id %d, irq %d\n",
132 pdev = platform_device_register_resndata(parent, "ux500-msp-i2s", id,
133 res, ARRAY_SIZE(res),
134 pdata, sizeof(*pdata));
136 pr_err("Failed to register platform-device 'ux500-msp-i2s.%d'!\n",
144 /* Platform device for ASoC MOP500 machine */
145 static struct platform_device snd_soc_mop500 = {
146 .name = "snd-soc-mop500",
149 .platform_data = NULL,
153 /* Platform device for Ux500-PCM */
154 static struct platform_device ux500_pcm = {
158 .platform_data = NULL,
162 struct msp_i2s_platform_data msp2_platform_data = {
164 .msp_i2s_dma_rx = &msp2_dma_rx,
165 .msp_i2s_dma_tx = &msp2_dma_tx,
168 struct msp_i2s_platform_data msp3_platform_data = {
170 .msp_i2s_dma_rx = &msp1_dma_rx,
171 .msp_i2s_dma_tx = NULL,
174 void mop500_audio_init(struct device *parent)
176 pr_info("%s: Register platform-device 'snd-soc-mop500'.\n", __func__);
177 platform_device_register(&snd_soc_mop500);
179 pr_info("Initialize MSP I2S-devices.\n");
180 db8500_add_msp_i2s(parent, 0, U8500_MSP0_BASE, IRQ_DB8500_MSP0,
181 &msp0_platform_data);
182 db8500_add_msp_i2s(parent, 1, U8500_MSP1_BASE, IRQ_DB8500_MSP1,
183 &msp1_platform_data);
184 db8500_add_msp_i2s(parent, 2, U8500_MSP2_BASE, IRQ_DB8500_MSP2,
185 &msp2_platform_data);
186 db8500_add_msp_i2s(parent, 3, U8500_MSP3_BASE, IRQ_DB8500_MSP1,
187 &msp3_platform_data);
190 /* Due for removal once the MSP driver has been fully DT:ed. */
191 void mop500_of_audio_init(struct device *parent)
193 pr_info("%s: Register platform-device 'ux500-pcm'\n", __func__);
194 platform_device_register(&ux500_pcm);