2 * Copyright (C) ST-Ericsson SA 2010
4 * Author: Hanumath Prasad <hanumath.prasad@stericsson.com>
5 * License terms: GNU General Public License (GPL) version 2
8 #include <linux/kernel.h>
9 #include <linux/gpio.h>
10 #include <linux/amba/bus.h>
11 #include <linux/amba/mmci.h>
12 #include <linux/mmc/host.h>
13 #include <linux/platform_device.h>
14 #include <linux/platform_data/dma-ste-dma40.h>
16 #include <asm/mach-types.h>
19 #include "db8500-regs.h"
20 #include "devices-db8500.h"
21 #include "board-mop500.h"
22 #include "ste-dma40-db8500.h"
25 * v2 has a new version of this block that need to be forced, the number found
26 * in hardware is incorrect
28 #define U8500_SDI_V2_PERIPHID 0x10480180
31 * SDI 0 (MicroSD slot)
34 #ifdef CONFIG_STE_DMA40
35 struct stedma40_chan_cfg mop500_sdi0_dma_cfg_rx
= {
36 .mode
= STEDMA40_MODE_LOGICAL
,
37 .dir
= DMA_DEV_TO_MEM
,
38 .dev_type
= DB8500_DMA_DEV29_SD_MM0
,
41 static struct stedma40_chan_cfg mop500_sdi0_dma_cfg_tx
= {
42 .mode
= STEDMA40_MODE_LOGICAL
,
43 .dir
= DMA_MEM_TO_DEV
,
44 .dev_type
= DB8500_DMA_DEV29_SD_MM0
,
48 struct mmci_platform_data mop500_sdi0_data
= {
50 .capabilities
= MMC_CAP_4_BIT_DATA
|
51 MMC_CAP_SD_HIGHSPEED
|
52 MMC_CAP_MMC_HIGHSPEED
|
57 .sigdir
= MCI_ST_FBCLKEN
|
61 #ifdef CONFIG_STE_DMA40
62 .dma_filter
= stedma40_filter
,
63 .dma_rx_param
= &mop500_sdi0_dma_cfg_rx
,
64 .dma_tx_param
= &mop500_sdi0_dma_cfg_tx
,
68 static void sdi0_configure(struct device
*parent
)
70 /* Add the device, force v2 to subrevision 1 */
71 db8500_add_sdi0(parent
, &mop500_sdi0_data
, U8500_SDI_V2_PERIPHID
);
74 void mop500_sdi_tc35892_init(struct device
*parent
)
76 mop500_sdi0_data
.gpio_cd
= GPIO_SDMMC_CD
;
77 sdi0_configure(parent
);
83 #ifdef CONFIG_STE_DMA40
84 static struct stedma40_chan_cfg sdi1_dma_cfg_rx
= {
85 .mode
= STEDMA40_MODE_LOGICAL
,
86 .dir
= DMA_DEV_TO_MEM
,
87 .dev_type
= DB8500_DMA_DEV32_SD_MM1
,
90 static struct stedma40_chan_cfg sdi1_dma_cfg_tx
= {
91 .mode
= STEDMA40_MODE_LOGICAL
,
92 .dir
= DMA_MEM_TO_DEV
,
93 .dev_type
= DB8500_DMA_DEV32_SD_MM1
,
97 struct mmci_platform_data mop500_sdi1_data
= {
98 .ocr_mask
= MMC_VDD_29_30
,
100 .capabilities
= MMC_CAP_4_BIT_DATA
|
101 MMC_CAP_NONREMOVABLE
,
104 #ifdef CONFIG_STE_DMA40
105 .dma_filter
= stedma40_filter
,
106 .dma_rx_param
= &sdi1_dma_cfg_rx
,
107 .dma_tx_param
= &sdi1_dma_cfg_tx
,
112 * SDI 2 (POP eMMC, not on DB8500ed)
115 #ifdef CONFIG_STE_DMA40
116 struct stedma40_chan_cfg mop500_sdi2_dma_cfg_rx
= {
117 .mode
= STEDMA40_MODE_LOGICAL
,
118 .dir
= DMA_DEV_TO_MEM
,
119 .dev_type
= DB8500_DMA_DEV28_SD_MM2
,
122 static struct stedma40_chan_cfg mop500_sdi2_dma_cfg_tx
= {
123 .mode
= STEDMA40_MODE_LOGICAL
,
124 .dir
= DMA_MEM_TO_DEV
,
125 .dev_type
= DB8500_DMA_DEV28_SD_MM2
,
129 struct mmci_platform_data mop500_sdi2_data
= {
130 .ocr_mask
= MMC_VDD_165_195
,
132 .capabilities
= MMC_CAP_4_BIT_DATA
|
134 MMC_CAP_NONREMOVABLE
|
135 MMC_CAP_MMC_HIGHSPEED
|
140 #ifdef CONFIG_STE_DMA40
141 .dma_filter
= stedma40_filter
,
142 .dma_rx_param
= &mop500_sdi2_dma_cfg_rx
,
143 .dma_tx_param
= &mop500_sdi2_dma_cfg_tx
,
148 * SDI 4 (on-board eMMC)
151 #ifdef CONFIG_STE_DMA40
152 struct stedma40_chan_cfg mop500_sdi4_dma_cfg_rx
= {
153 .mode
= STEDMA40_MODE_LOGICAL
,
154 .dir
= DMA_DEV_TO_MEM
,
155 .dev_type
= DB8500_DMA_DEV42_SD_MM4
,
158 static struct stedma40_chan_cfg mop500_sdi4_dma_cfg_tx
= {
159 .mode
= STEDMA40_MODE_LOGICAL
,
160 .dir
= DMA_MEM_TO_DEV
,
161 .dev_type
= DB8500_DMA_DEV42_SD_MM4
,
165 struct mmci_platform_data mop500_sdi4_data
= {
167 .capabilities
= MMC_CAP_4_BIT_DATA
|
169 MMC_CAP_NONREMOVABLE
|
170 MMC_CAP_MMC_HIGHSPEED
|
175 #ifdef CONFIG_STE_DMA40
176 .dma_filter
= stedma40_filter
,
177 .dma_rx_param
= &mop500_sdi4_dma_cfg_rx
,
178 .dma_tx_param
= &mop500_sdi4_dma_cfg_tx
,
182 void __init
mop500_sdi_init(struct device
*parent
)
185 db8500_add_sdi2(parent
, &mop500_sdi2_data
, U8500_SDI_V2_PERIPHID
);
187 db8500_add_sdi4(parent
, &mop500_sdi4_data
, U8500_SDI_V2_PERIPHID
);
190 * On boards with the TC35892 GPIO expander, sdi0 will finally
191 * be added when the TC35892 initializes and calls
192 * mop500_sdi_tc35892_init() above.
196 void __init
snowball_sdi_init(struct device
*parent
)
198 /* On Snowball MMC_CAP_SD_HIGHSPEED isn't supported (Hardware issue?) */
199 mop500_sdi0_data
.capabilities
&= ~MMC_CAP_SD_HIGHSPEED
;
201 db8500_add_sdi4(parent
, &mop500_sdi4_data
, U8500_SDI_V2_PERIPHID
);
202 /* External Micro SD slot */
203 mop500_sdi0_data
.gpio_cd
= SNOWBALL_SDMMC_CD_GPIO
;
204 mop500_sdi0_data
.cd_invert
= true;
205 sdi0_configure(parent
);
208 void __init
hrefv60_sdi_init(struct device
*parent
)
211 db8500_add_sdi2(parent
, &mop500_sdi2_data
, U8500_SDI_V2_PERIPHID
);
213 db8500_add_sdi4(parent
, &mop500_sdi4_data
, U8500_SDI_V2_PERIPHID
);
214 /* External Micro SD slot */
215 mop500_sdi0_data
.gpio_cd
= HREFV60_SDMMC_CD_GPIO
;
216 sdi0_configure(parent
);
217 /* WLAN SDIO channel */
218 db8500_add_sdi1(parent
, &mop500_sdi1_data
, U8500_SDI_V2_PERIPHID
);