Hanumath Prasad | 008f8a2 | 2010-08-19 12:06:32 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) ST-Ericsson SA 2010 |
| 3 | * |
| 4 | * Author: Hanumath Prasad <hanumath.prasad@stericsson.com> |
| 5 | * License terms: GNU General Public License (GPL) version 2 |
| 6 | */ |
| 7 | |
| 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> |
Linus Walleij | 865fab6 | 2012-10-18 14:20:16 +0200 | [diff] [blame] | 14 | #include <linux/platform_data/dma-ste-dma40.h> |
Hanumath Prasad | 008f8a2 | 2010-08-19 12:06:32 +0100 | [diff] [blame] | 15 | |
Linus Walleij | 4b4f757 | 2011-02-15 15:01:35 +0100 | [diff] [blame] | 16 | #include <asm/mach-types.h> |
Arnd Bergmann | e657bcf | 2013-03-21 22:51:12 +0100 | [diff] [blame] | 17 | #include "devices.h" |
Hanumath Prasad | 008f8a2 | 2010-08-19 12:06:32 +0100 | [diff] [blame] | 18 | |
Linus Walleij | 174e779 | 2013-03-19 15:41:55 +0100 | [diff] [blame] | 19 | #include "db8500-regs.h" |
Rabin Vincent | fbf1ead | 2010-09-29 19:46:32 +0530 | [diff] [blame] | 20 | #include "devices-db8500.h" |
Hanumath Prasad | 008f8a2 | 2010-08-19 12:06:32 +0100 | [diff] [blame] | 21 | #include "board-mop500.h" |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 22 | #include "ste-dma40-db8500.h" |
Hanumath Prasad | 008f8a2 | 2010-08-19 12:06:32 +0100 | [diff] [blame] | 23 | |
Hanumath Prasad | 008f8a2 | 2010-08-19 12:06:32 +0100 | [diff] [blame] | 24 | /* |
Linus Walleij | c15def1 | 2011-12-15 13:38:40 +0100 | [diff] [blame] | 25 | * v2 has a new version of this block that need to be forced, the number found |
| 26 | * in hardware is incorrect |
| 27 | */ |
| 28 | #define U8500_SDI_V2_PERIPHID 0x10480180 |
| 29 | |
| 30 | /* |
Rabin Vincent | b8410a1 | 2010-08-09 19:18:17 +0530 | [diff] [blame] | 31 | * SDI 0 (MicroSD slot) |
| 32 | */ |
| 33 | |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 34 | #ifdef CONFIG_STE_DMA40 |
| 35 | struct stedma40_chan_cfg mop500_sdi0_dma_cfg_rx = { |
| 36 | .mode = STEDMA40_MODE_LOGICAL, |
| 37 | .dir = STEDMA40_PERIPH_TO_MEM, |
| 38 | .src_dev_type = DB8500_DMA_DEV29_SD_MM0_RX, |
| 39 | .dst_dev_type = STEDMA40_DEV_DST_MEMORY, |
| 40 | .src_info.data_width = STEDMA40_WORD_WIDTH, |
| 41 | .dst_info.data_width = STEDMA40_WORD_WIDTH, |
| 42 | }; |
| 43 | |
| 44 | static struct stedma40_chan_cfg mop500_sdi0_dma_cfg_tx = { |
| 45 | .mode = STEDMA40_MODE_LOGICAL, |
| 46 | .dir = STEDMA40_MEM_TO_PERIPH, |
| 47 | .src_dev_type = STEDMA40_DEV_SRC_MEMORY, |
| 48 | .dst_dev_type = DB8500_DMA_DEV29_SD_MM0_TX, |
| 49 | .src_info.data_width = STEDMA40_WORD_WIDTH, |
| 50 | .dst_info.data_width = STEDMA40_WORD_WIDTH, |
| 51 | }; |
| 52 | #endif |
| 53 | |
Lee Jones | 5e1ac7d | 2012-05-29 14:40:04 +0800 | [diff] [blame] | 54 | struct mmci_platform_data mop500_sdi0_data = { |
Ulf Hansson | b6ff56a | 2013-05-23 15:13:45 +0200 | [diff] [blame] | 55 | .f_max = 100000000, |
Linus Walleij | 02a7343 | 2011-03-30 16:00:39 +0200 | [diff] [blame] | 56 | .capabilities = MMC_CAP_4_BIT_DATA | |
| 57 | MMC_CAP_SD_HIGHSPEED | |
Ulf Hansson | fd1cc1b | 2013-05-23 15:13:48 +0200 | [diff] [blame] | 58 | MMC_CAP_MMC_HIGHSPEED | |
| 59 | MMC_CAP_ERASE, |
Rabin Vincent | b8410a1 | 2010-08-09 19:18:17 +0530 | [diff] [blame] | 60 | .gpio_wp = -1, |
Ulf Hansson | bc52181 | 2011-12-13 16:57:55 +0100 | [diff] [blame] | 61 | .sigdir = MCI_ST_FBCLKEN | |
| 62 | MCI_ST_CMDDIREN | |
| 63 | MCI_ST_DATA0DIREN | |
| 64 | MCI_ST_DATA2DIREN, |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 65 | #ifdef CONFIG_STE_DMA40 |
| 66 | .dma_filter = stedma40_filter, |
| 67 | .dma_rx_param = &mop500_sdi0_dma_cfg_rx, |
| 68 | .dma_tx_param = &mop500_sdi0_dma_cfg_tx, |
| 69 | #endif |
Rabin Vincent | b8410a1 | 2010-08-09 19:18:17 +0530 | [diff] [blame] | 70 | }; |
| 71 | |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 72 | static void sdi0_configure(struct device *parent) |
Rabin Vincent | b8410a1 | 2010-08-09 19:18:17 +0530 | [diff] [blame] | 73 | { |
Linus Walleij | 7293031 | 2011-03-24 16:13:13 +0100 | [diff] [blame] | 74 | /* Add the device, force v2 to subrevision 1 */ |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 75 | db8500_add_sdi0(parent, &mop500_sdi0_data, U8500_SDI_V2_PERIPHID); |
Rabin Vincent | b8410a1 | 2010-08-09 19:18:17 +0530 | [diff] [blame] | 76 | } |
| 77 | |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 78 | void mop500_sdi_tc35892_init(struct device *parent) |
Linus Walleij | 4b4f757 | 2011-02-15 15:01:35 +0100 | [diff] [blame] | 79 | { |
| 80 | mop500_sdi0_data.gpio_cd = GPIO_SDMMC_CD; |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 81 | sdi0_configure(parent); |
Linus Walleij | 4b4f757 | 2011-02-15 15:01:35 +0100 | [diff] [blame] | 82 | } |
| 83 | |
Rabin Vincent | b8410a1 | 2010-08-09 19:18:17 +0530 | [diff] [blame] | 84 | /* |
Stefan Nilsson XK | 76d6717 | 2011-10-26 10:50:42 +0200 | [diff] [blame] | 85 | * SDI1 (SDIO WLAN) |
| 86 | */ |
| 87 | #ifdef CONFIG_STE_DMA40 |
| 88 | static struct stedma40_chan_cfg sdi1_dma_cfg_rx = { |
| 89 | .mode = STEDMA40_MODE_LOGICAL, |
| 90 | .dir = STEDMA40_PERIPH_TO_MEM, |
| 91 | .src_dev_type = DB8500_DMA_DEV32_SD_MM1_RX, |
| 92 | .dst_dev_type = STEDMA40_DEV_DST_MEMORY, |
| 93 | .src_info.data_width = STEDMA40_WORD_WIDTH, |
| 94 | .dst_info.data_width = STEDMA40_WORD_WIDTH, |
| 95 | }; |
| 96 | |
| 97 | static struct stedma40_chan_cfg sdi1_dma_cfg_tx = { |
| 98 | .mode = STEDMA40_MODE_LOGICAL, |
| 99 | .dir = STEDMA40_MEM_TO_PERIPH, |
| 100 | .src_dev_type = STEDMA40_DEV_SRC_MEMORY, |
| 101 | .dst_dev_type = DB8500_DMA_DEV32_SD_MM1_TX, |
| 102 | .src_info.data_width = STEDMA40_WORD_WIDTH, |
| 103 | .dst_info.data_width = STEDMA40_WORD_WIDTH, |
| 104 | }; |
| 105 | #endif |
| 106 | |
Lee Jones | 9cf24b1 | 2012-08-30 16:11:08 +0100 | [diff] [blame] | 107 | struct mmci_platform_data mop500_sdi1_data = { |
Stefan Nilsson XK | 76d6717 | 2011-10-26 10:50:42 +0200 | [diff] [blame] | 108 | .ocr_mask = MMC_VDD_29_30, |
Ulf Hansson | b6ff56a | 2013-05-23 15:13:45 +0200 | [diff] [blame] | 109 | .f_max = 100000000, |
Ulf Hansson | a7de8b30 | 2013-05-23 15:13:49 +0200 | [diff] [blame^] | 110 | .capabilities = MMC_CAP_4_BIT_DATA | |
| 111 | MMC_CAP_NONREMOVABLE, |
Stefan Nilsson XK | 76d6717 | 2011-10-26 10:50:42 +0200 | [diff] [blame] | 112 | .gpio_cd = -1, |
| 113 | .gpio_wp = -1, |
| 114 | #ifdef CONFIG_STE_DMA40 |
| 115 | .dma_filter = stedma40_filter, |
| 116 | .dma_rx_param = &sdi1_dma_cfg_rx, |
| 117 | .dma_tx_param = &sdi1_dma_cfg_tx, |
| 118 | #endif |
| 119 | }; |
| 120 | |
| 121 | /* |
Hanumath Prasad | 008f8a2 | 2010-08-19 12:06:32 +0100 | [diff] [blame] | 122 | * SDI 2 (POP eMMC, not on DB8500ed) |
| 123 | */ |
| 124 | |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 125 | #ifdef CONFIG_STE_DMA40 |
| 126 | struct stedma40_chan_cfg mop500_sdi2_dma_cfg_rx = { |
| 127 | .mode = STEDMA40_MODE_LOGICAL, |
| 128 | .dir = STEDMA40_PERIPH_TO_MEM, |
| 129 | .src_dev_type = DB8500_DMA_DEV28_SD_MM2_RX, |
| 130 | .dst_dev_type = STEDMA40_DEV_DST_MEMORY, |
| 131 | .src_info.data_width = STEDMA40_WORD_WIDTH, |
| 132 | .dst_info.data_width = STEDMA40_WORD_WIDTH, |
| 133 | }; |
| 134 | |
| 135 | static struct stedma40_chan_cfg mop500_sdi2_dma_cfg_tx = { |
| 136 | .mode = STEDMA40_MODE_LOGICAL, |
| 137 | .dir = STEDMA40_MEM_TO_PERIPH, |
| 138 | .src_dev_type = STEDMA40_DEV_SRC_MEMORY, |
| 139 | .dst_dev_type = DB8500_DMA_DEV28_SD_MM2_TX, |
| 140 | .src_info.data_width = STEDMA40_WORD_WIDTH, |
| 141 | .dst_info.data_width = STEDMA40_WORD_WIDTH, |
| 142 | }; |
| 143 | #endif |
| 144 | |
Lee Jones | 9cf24b1 | 2012-08-30 16:11:08 +0100 | [diff] [blame] | 145 | struct mmci_platform_data mop500_sdi2_data = { |
Hanumath Prasad | 008f8a2 | 2010-08-19 12:06:32 +0100 | [diff] [blame] | 146 | .ocr_mask = MMC_VDD_165_195, |
Ulf Hansson | b6ff56a | 2013-05-23 15:13:45 +0200 | [diff] [blame] | 147 | .f_max = 100000000, |
Ulf Hansson | a2be776 | 2013-05-23 15:13:47 +0200 | [diff] [blame] | 148 | .capabilities = MMC_CAP_4_BIT_DATA | |
| 149 | MMC_CAP_8_BIT_DATA | |
Ulf Hansson | a7de8b30 | 2013-05-23 15:13:49 +0200 | [diff] [blame^] | 150 | MMC_CAP_NONREMOVABLE | |
Ulf Hansson | a2be776 | 2013-05-23 15:13:47 +0200 | [diff] [blame] | 151 | MMC_CAP_MMC_HIGHSPEED | |
Ulf Hansson | fd1cc1b | 2013-05-23 15:13:48 +0200 | [diff] [blame] | 152 | MMC_CAP_ERASE | |
Ulf Hansson | a2be776 | 2013-05-23 15:13:47 +0200 | [diff] [blame] | 153 | MMC_CAP_CMD23, |
Hanumath Prasad | 008f8a2 | 2010-08-19 12:06:32 +0100 | [diff] [blame] | 154 | .gpio_cd = -1, |
| 155 | .gpio_wp = -1, |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 156 | #ifdef CONFIG_STE_DMA40 |
| 157 | .dma_filter = stedma40_filter, |
| 158 | .dma_rx_param = &mop500_sdi2_dma_cfg_rx, |
| 159 | .dma_tx_param = &mop500_sdi2_dma_cfg_tx, |
| 160 | #endif |
Hanumath Prasad | 008f8a2 | 2010-08-19 12:06:32 +0100 | [diff] [blame] | 161 | }; |
| 162 | |
| 163 | /* |
| 164 | * SDI 4 (on-board eMMC) |
| 165 | */ |
| 166 | |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 167 | #ifdef CONFIG_STE_DMA40 |
| 168 | struct stedma40_chan_cfg mop500_sdi4_dma_cfg_rx = { |
| 169 | .mode = STEDMA40_MODE_LOGICAL, |
| 170 | .dir = STEDMA40_PERIPH_TO_MEM, |
| 171 | .src_dev_type = DB8500_DMA_DEV42_SD_MM4_RX, |
| 172 | .dst_dev_type = STEDMA40_DEV_DST_MEMORY, |
| 173 | .src_info.data_width = STEDMA40_WORD_WIDTH, |
| 174 | .dst_info.data_width = STEDMA40_WORD_WIDTH, |
| 175 | }; |
| 176 | |
| 177 | static struct stedma40_chan_cfg mop500_sdi4_dma_cfg_tx = { |
| 178 | .mode = STEDMA40_MODE_LOGICAL, |
| 179 | .dir = STEDMA40_MEM_TO_PERIPH, |
| 180 | .src_dev_type = STEDMA40_DEV_SRC_MEMORY, |
| 181 | .dst_dev_type = DB8500_DMA_DEV42_SD_MM4_TX, |
| 182 | .src_info.data_width = STEDMA40_WORD_WIDTH, |
| 183 | .dst_info.data_width = STEDMA40_WORD_WIDTH, |
| 184 | }; |
| 185 | #endif |
| 186 | |
Lee Jones | 5e1ac7d | 2012-05-29 14:40:04 +0800 | [diff] [blame] | 187 | struct mmci_platform_data mop500_sdi4_data = { |
Ulf Hansson | b6ff56a | 2013-05-23 15:13:45 +0200 | [diff] [blame] | 188 | .f_max = 100000000, |
Ulf Hansson | a2be776 | 2013-05-23 15:13:47 +0200 | [diff] [blame] | 189 | .capabilities = MMC_CAP_4_BIT_DATA | |
| 190 | MMC_CAP_8_BIT_DATA | |
Ulf Hansson | a7de8b30 | 2013-05-23 15:13:49 +0200 | [diff] [blame^] | 191 | MMC_CAP_NONREMOVABLE | |
Ulf Hansson | a2be776 | 2013-05-23 15:13:47 +0200 | [diff] [blame] | 192 | MMC_CAP_MMC_HIGHSPEED | |
Ulf Hansson | fd1cc1b | 2013-05-23 15:13:48 +0200 | [diff] [blame] | 193 | MMC_CAP_ERASE | |
Ulf Hansson | a2be776 | 2013-05-23 15:13:47 +0200 | [diff] [blame] | 194 | MMC_CAP_CMD23, |
Hanumath Prasad | 008f8a2 | 2010-08-19 12:06:32 +0100 | [diff] [blame] | 195 | .gpio_cd = -1, |
| 196 | .gpio_wp = -1, |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 197 | #ifdef CONFIG_STE_DMA40 |
| 198 | .dma_filter = stedma40_filter, |
| 199 | .dma_rx_param = &mop500_sdi4_dma_cfg_rx, |
| 200 | .dma_tx_param = &mop500_sdi4_dma_cfg_tx, |
| 201 | #endif |
Hanumath Prasad | 008f8a2 | 2010-08-19 12:06:32 +0100 | [diff] [blame] | 202 | }; |
| 203 | |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 204 | void __init mop500_sdi_init(struct device *parent) |
Hanumath Prasad | 008f8a2 | 2010-08-19 12:06:32 +0100 | [diff] [blame] | 205 | { |
Linus Walleij | c15def1 | 2011-12-15 13:38:40 +0100 | [diff] [blame] | 206 | /* PoP:ed eMMC */ |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 207 | db8500_add_sdi2(parent, &mop500_sdi2_data, U8500_SDI_V2_PERIPHID); |
Bibek Basu | 4bc3a69 | 2011-02-15 10:46:59 +0100 | [diff] [blame] | 208 | /* On-board eMMC */ |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 209 | db8500_add_sdi4(parent, &mop500_sdi4_data, U8500_SDI_V2_PERIPHID); |
| 210 | |
Linus Walleij | edaa86a | 2010-12-02 12:05:18 +0100 | [diff] [blame] | 211 | /* |
Linus Walleij | 4b4f757 | 2011-02-15 15:01:35 +0100 | [diff] [blame] | 212 | * On boards with the TC35892 GPIO expander, sdi0 will finally |
| 213 | * be added when the TC35892 initializes and calls |
Linus Walleij | edaa86a | 2010-12-02 12:05:18 +0100 | [diff] [blame] | 214 | * mop500_sdi_tc35892_init() above. |
| 215 | */ |
Hanumath Prasad | 008f8a2 | 2010-08-19 12:06:32 +0100 | [diff] [blame] | 216 | } |
Lee Jones | 110c2c2 | 2011-08-26 16:54:07 +0100 | [diff] [blame] | 217 | |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 218 | void __init snowball_sdi_init(struct device *parent) |
Lee Jones | 110c2c2 | 2011-08-26 16:54:07 +0100 | [diff] [blame] | 219 | { |
Philippe Langlais | 2ab1159 | 2012-01-20 09:20:40 +0100 | [diff] [blame] | 220 | /* On Snowball MMC_CAP_SD_HIGHSPEED isn't supported (Hardware issue?) */ |
| 221 | mop500_sdi0_data.capabilities &= ~MMC_CAP_SD_HIGHSPEED; |
Lee Jones | 110c2c2 | 2011-08-26 16:54:07 +0100 | [diff] [blame] | 222 | /* On-board eMMC */ |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 223 | db8500_add_sdi4(parent, &mop500_sdi4_data, U8500_SDI_V2_PERIPHID); |
Linus Walleij | c15def1 | 2011-12-15 13:38:40 +0100 | [diff] [blame] | 224 | /* External Micro SD slot */ |
Lee Jones | 110c2c2 | 2011-08-26 16:54:07 +0100 | [diff] [blame] | 225 | mop500_sdi0_data.gpio_cd = SNOWBALL_SDMMC_CD_GPIO; |
| 226 | mop500_sdi0_data.cd_invert = true; |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 227 | sdi0_configure(parent); |
Lee Jones | 110c2c2 | 2011-08-26 16:54:07 +0100 | [diff] [blame] | 228 | } |
| 229 | |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 230 | void __init hrefv60_sdi_init(struct device *parent) |
Lee Jones | 110c2c2 | 2011-08-26 16:54:07 +0100 | [diff] [blame] | 231 | { |
Linus Walleij | c15def1 | 2011-12-15 13:38:40 +0100 | [diff] [blame] | 232 | /* PoP:ed eMMC */ |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 233 | db8500_add_sdi2(parent, &mop500_sdi2_data, U8500_SDI_V2_PERIPHID); |
Lee Jones | 110c2c2 | 2011-08-26 16:54:07 +0100 | [diff] [blame] | 234 | /* On-board eMMC */ |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 235 | db8500_add_sdi4(parent, &mop500_sdi4_data, U8500_SDI_V2_PERIPHID); |
Linus Walleij | c15def1 | 2011-12-15 13:38:40 +0100 | [diff] [blame] | 236 | /* External Micro SD slot */ |
Lee Jones | 110c2c2 | 2011-08-26 16:54:07 +0100 | [diff] [blame] | 237 | mop500_sdi0_data.gpio_cd = HREFV60_SDMMC_CD_GPIO; |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 238 | sdi0_configure(parent); |
Linus Walleij | c15def1 | 2011-12-15 13:38:40 +0100 | [diff] [blame] | 239 | /* WLAN SDIO channel */ |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 240 | db8500_add_sdi1(parent, &mop500_sdi1_data, U8500_SDI_V2_PERIPHID); |
Lee Jones | 110c2c2 | 2011-08-26 16:54:07 +0100 | [diff] [blame] | 241 | } |