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 = {
49 .ocr_mask = MMC_VDD_29_30,
51 .capabilities = MMC_CAP_4_BIT_DATA |
52 MMC_CAP_SD_HIGHSPEED |
53 MMC_CAP_MMC_HIGHSPEED,
55 .sigdir = MCI_ST_FBCLKEN |
59 #ifdef CONFIG_STE_DMA40
60 .dma_filter = stedma40_filter,
61 .dma_rx_param = &mop500_sdi0_dma_cfg_rx,
62 .dma_tx_param = &mop500_sdi0_dma_cfg_tx,
66 static void sdi0_configure(struct device *parent)
68 /* Add the device, force v2 to subrevision 1 */
69 db8500_add_sdi0(parent, &mop500_sdi0_data, U8500_SDI_V2_PERIPHID);
72 void mop500_sdi_tc35892_init(struct device *parent)
74 mop500_sdi0_data.gpio_cd = GPIO_SDMMC_CD;
75 sdi0_configure(parent);
81 #ifdef CONFIG_STE_DMA40
82 static struct stedma40_chan_cfg sdi1_dma_cfg_rx = {
83 .mode = STEDMA40_MODE_LOGICAL,
84 .dir = DMA_DEV_TO_MEM,
85 .dev_type = DB8500_DMA_DEV32_SD_MM1,
88 static struct stedma40_chan_cfg sdi1_dma_cfg_tx = {
89 .mode = STEDMA40_MODE_LOGICAL,
90 .dir = DMA_MEM_TO_DEV,
91 .dev_type = DB8500_DMA_DEV32_SD_MM1,
95 struct mmci_platform_data mop500_sdi1_data = {
96 .ocr_mask = MMC_VDD_29_30,
98 .capabilities = MMC_CAP_4_BIT_DATA,
101 #ifdef CONFIG_STE_DMA40
102 .dma_filter = stedma40_filter,
103 .dma_rx_param = &sdi1_dma_cfg_rx,
104 .dma_tx_param = &sdi1_dma_cfg_tx,
109 * SDI 2 (POP eMMC, not on DB8500ed)
112 #ifdef CONFIG_STE_DMA40
113 struct stedma40_chan_cfg mop500_sdi2_dma_cfg_rx = {
114 .mode = STEDMA40_MODE_LOGICAL,
115 .dir = DMA_DEV_TO_MEM,
116 .dev_type = DB8500_DMA_DEV28_SD_MM2,
119 static struct stedma40_chan_cfg mop500_sdi2_dma_cfg_tx = {
120 .mode = STEDMA40_MODE_LOGICAL,
121 .dir = DMA_MEM_TO_DEV,
122 .dev_type = DB8500_DMA_DEV28_SD_MM2,
126 struct mmci_platform_data mop500_sdi2_data = {
127 .ocr_mask = MMC_VDD_165_195,
129 .capabilities = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA |
130 MMC_CAP_MMC_HIGHSPEED,
133 #ifdef CONFIG_STE_DMA40
134 .dma_filter = stedma40_filter,
135 .dma_rx_param = &mop500_sdi2_dma_cfg_rx,
136 .dma_tx_param = &mop500_sdi2_dma_cfg_tx,
141 * SDI 4 (on-board eMMC)
144 #ifdef CONFIG_STE_DMA40
145 struct stedma40_chan_cfg mop500_sdi4_dma_cfg_rx = {
146 .mode = STEDMA40_MODE_LOGICAL,
147 .dir = DMA_DEV_TO_MEM,
148 .dev_type = DB8500_DMA_DEV42_SD_MM4,
151 static struct stedma40_chan_cfg mop500_sdi4_dma_cfg_tx = {
152 .mode = STEDMA40_MODE_LOGICAL,
153 .dir = DMA_MEM_TO_DEV,
154 .dev_type = DB8500_DMA_DEV42_SD_MM4,
158 struct mmci_platform_data mop500_sdi4_data = {
159 .ocr_mask = MMC_VDD_29_30,
161 .capabilities = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA |
162 MMC_CAP_MMC_HIGHSPEED,
165 #ifdef CONFIG_STE_DMA40
166 .dma_filter = stedma40_filter,
167 .dma_rx_param = &mop500_sdi4_dma_cfg_rx,
168 .dma_tx_param = &mop500_sdi4_dma_cfg_tx,
172 void __init mop500_sdi_init(struct device *parent)
175 db8500_add_sdi2(parent, &mop500_sdi2_data, U8500_SDI_V2_PERIPHID);
177 db8500_add_sdi4(parent, &mop500_sdi4_data, U8500_SDI_V2_PERIPHID);
180 * On boards with the TC35892 GPIO expander, sdi0 will finally
181 * be added when the TC35892 initializes and calls
182 * mop500_sdi_tc35892_init() above.
186 void __init snowball_sdi_init(struct device *parent)
188 /* On Snowball MMC_CAP_SD_HIGHSPEED isn't supported (Hardware issue?) */
189 mop500_sdi0_data.capabilities &= ~MMC_CAP_SD_HIGHSPEED;
191 db8500_add_sdi4(parent, &mop500_sdi4_data, U8500_SDI_V2_PERIPHID);
192 /* External Micro SD slot */
193 mop500_sdi0_data.gpio_cd = SNOWBALL_SDMMC_CD_GPIO;
194 mop500_sdi0_data.cd_invert = true;
195 sdi0_configure(parent);
198 void __init hrefv60_sdi_init(struct device *parent)
201 db8500_add_sdi2(parent, &mop500_sdi2_data, U8500_SDI_V2_PERIPHID);
203 db8500_add_sdi4(parent, &mop500_sdi4_data, U8500_SDI_V2_PERIPHID);
204 /* External Micro SD slot */
205 mop500_sdi0_data.gpio_cd = HREFV60_SDMMC_CD_GPIO;
206 sdi0_configure(parent);
207 /* WLAN SDIO channel */
208 db8500_add_sdi1(parent, &mop500_sdi1_data, U8500_SDI_V2_PERIPHID);