Duy Truong | 790f06d | 2013-02-13 16:38:12 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. |
Stepan Moskovchenko | 0c547bb | 2011-11-30 13:29:12 -0800 | [diff] [blame] | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | * |
| 12 | */ |
| 13 | |
| 14 | #include <linux/init.h> |
| 15 | #include <linux/ioport.h> |
| 16 | #include <linux/platform_device.h> |
| 17 | #include <linux/bootmem.h> |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 18 | #include <linux/gpio.h> |
Stepan Moskovchenko | 0c547bb | 2011-11-30 13:29:12 -0800 | [diff] [blame] | 19 | #include <asm/mach-types.h> |
| 20 | #include <asm/mach/mmc.h> |
Stepan Moskovchenko | 0c547bb | 2011-11-30 13:29:12 -0800 | [diff] [blame] | 21 | #include <mach/board.h> |
Stepan Moskovchenko | 0c547bb | 2011-11-30 13:29:12 -0800 | [diff] [blame] | 22 | #include <mach/gpiomux.h> |
| 23 | #include "devices.h" |
Stepan Moskovchenko | 5a83dba | 2011-12-05 17:30:17 -0800 | [diff] [blame] | 24 | #include "board-8960.h" |
Subhash Jadavani | bcd435f | 2012-04-24 18:26:49 +0530 | [diff] [blame] | 25 | #include "board-storage-common-a.h" |
Stepan Moskovchenko | 0c547bb | 2011-11-30 13:29:12 -0800 | [diff] [blame] | 26 | |
| 27 | /* MSM8960 has 5 SDCC controllers */ |
| 28 | enum sdcc_controllers { |
| 29 | SDCC1, |
| 30 | SDCC2, |
| 31 | SDCC3, |
| 32 | SDCC4, |
| 33 | SDCC5, |
| 34 | MAX_SDCC_CONTROLLER |
| 35 | }; |
| 36 | |
| 37 | /* All SDCC controllers require VDD/VCC voltage */ |
| 38 | static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = { |
| 39 | /* SDCC1 : eMMC card connected */ |
| 40 | [SDCC1] = { |
| 41 | .name = "sdc_vdd", |
| 42 | .high_vol_level = 2950000, |
| 43 | .low_vol_level = 2950000, |
| 44 | .always_on = 1, |
| 45 | .lpm_sup = 1, |
| 46 | .lpm_uA = 9000, |
| 47 | .hpm_uA = 200000, /* 200mA */ |
| 48 | }, |
Pratibhasagar V | 57c808e | 2012-01-12 13:47:30 +0530 | [diff] [blame] | 49 | /* SDCC2 : SDIO slot connected */ |
| 50 | [SDCC2] = { |
| 51 | .name = "sdc_vdd", |
| 52 | .high_vol_level = 1800000, |
| 53 | .low_vol_level = 1800000, |
| 54 | .always_on = 1, |
| 55 | .lpm_sup = 1, |
| 56 | .lpm_uA = 9000, |
| 57 | .hpm_uA = 200000, /* 200mA */ |
| 58 | }, |
Stepan Moskovchenko | 0c547bb | 2011-11-30 13:29:12 -0800 | [diff] [blame] | 59 | /* SDCC3 : External card slot connected */ |
| 60 | [SDCC3] = { |
| 61 | .name = "sdc_vdd", |
| 62 | .high_vol_level = 2950000, |
| 63 | .low_vol_level = 2950000, |
| 64 | .hpm_uA = 600000, /* 600mA */ |
| 65 | } |
| 66 | }; |
| 67 | |
Subhash Jadavani | 937c750 | 2012-06-01 15:34:46 +0530 | [diff] [blame] | 68 | /* SDCC controllers may require voting for IO operating voltage */ |
| 69 | static struct msm_mmc_reg_data mmc_vdd_io_reg_data[MAX_SDCC_CONTROLLER] = { |
Stepan Moskovchenko | 0c547bb | 2011-11-30 13:29:12 -0800 | [diff] [blame] | 70 | /* SDCC1 : eMMC card connected */ |
| 71 | [SDCC1] = { |
Subhash Jadavani | 937c750 | 2012-06-01 15:34:46 +0530 | [diff] [blame] | 72 | .name = "sdc_vdd_io", |
Stepan Moskovchenko | 0c547bb | 2011-11-30 13:29:12 -0800 | [diff] [blame] | 73 | .always_on = 1, |
| 74 | .high_vol_level = 1800000, |
| 75 | .low_vol_level = 1800000, |
| 76 | .hpm_uA = 200000, /* 200mA */ |
Subhash Jadavani | 937c750 | 2012-06-01 15:34:46 +0530 | [diff] [blame] | 77 | }, |
Stepan Moskovchenko | 0c547bb | 2011-11-30 13:29:12 -0800 | [diff] [blame] | 78 | /* SDCC3 : External card slot connected */ |
| 79 | [SDCC3] = { |
Subhash Jadavani | 937c750 | 2012-06-01 15:34:46 +0530 | [diff] [blame] | 80 | .name = "sdc_vdd_io", |
Stepan Moskovchenko | 0c547bb | 2011-11-30 13:29:12 -0800 | [diff] [blame] | 81 | .high_vol_level = 2950000, |
| 82 | .low_vol_level = 1850000, |
| 83 | .always_on = 1, |
| 84 | .lpm_sup = 1, |
| 85 | /* Max. Active current required is 16 mA */ |
| 86 | .hpm_uA = 16000, |
| 87 | /* |
| 88 | * Sleep current required is ~300 uA. But min. vote can be |
| 89 | * in terms of mA (min. 1 mA). So let's vote for 2 mA |
| 90 | * during sleep. |
| 91 | */ |
| 92 | .lpm_uA = 2000, |
Pratibhasagar V | 26cf265 | 2012-01-12 17:31:21 +0530 | [diff] [blame] | 93 | }, |
| 94 | /* SDCC4 : SDIO slot connected */ |
| 95 | [SDCC4] = { |
Subhash Jadavani | 937c750 | 2012-06-01 15:34:46 +0530 | [diff] [blame] | 96 | .name = "sdc_vdd_io", |
Pratibhasagar V | 26cf265 | 2012-01-12 17:31:21 +0530 | [diff] [blame] | 97 | .high_vol_level = 1800000, |
| 98 | .low_vol_level = 1800000, |
| 99 | .always_on = 1, |
| 100 | .lpm_sup = 1, |
| 101 | .hpm_uA = 200000, /* 200mA */ |
| 102 | .lpm_uA = 2000, |
| 103 | }, |
Stepan Moskovchenko | 0c547bb | 2011-11-30 13:29:12 -0800 | [diff] [blame] | 104 | }; |
| 105 | |
| 106 | static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = { |
| 107 | /* SDCC1 : eMMC card connected */ |
| 108 | [SDCC1] = { |
| 109 | .vdd_data = &mmc_vdd_reg_data[SDCC1], |
Subhash Jadavani | 937c750 | 2012-06-01 15:34:46 +0530 | [diff] [blame] | 110 | .vdd_io_data = &mmc_vdd_io_reg_data[SDCC1], |
Stepan Moskovchenko | 0c547bb | 2011-11-30 13:29:12 -0800 | [diff] [blame] | 111 | }, |
Pratibhasagar V | 57c808e | 2012-01-12 13:47:30 +0530 | [diff] [blame] | 112 | /* SDCC2 : SDIO card slot connected */ |
| 113 | [SDCC2] = { |
| 114 | .vdd_data = &mmc_vdd_reg_data[SDCC2], |
| 115 | }, |
Stepan Moskovchenko | 0c547bb | 2011-11-30 13:29:12 -0800 | [diff] [blame] | 116 | /* SDCC3 : External card slot connected */ |
| 117 | [SDCC3] = { |
| 118 | .vdd_data = &mmc_vdd_reg_data[SDCC3], |
Subhash Jadavani | 937c750 | 2012-06-01 15:34:46 +0530 | [diff] [blame] | 119 | .vdd_io_data = &mmc_vdd_io_reg_data[SDCC3], |
Pratibhasagar V | 26cf265 | 2012-01-12 17:31:21 +0530 | [diff] [blame] | 120 | }, |
| 121 | /* SDCC4 : SDIO card slot connected */ |
| 122 | [SDCC4] = { |
Subhash Jadavani | 937c750 | 2012-06-01 15:34:46 +0530 | [diff] [blame] | 123 | .vdd_io_data = &mmc_vdd_io_reg_data[SDCC4], |
Pratibhasagar V | 26cf265 | 2012-01-12 17:31:21 +0530 | [diff] [blame] | 124 | }, |
Stepan Moskovchenko | 0c547bb | 2011-11-30 13:29:12 -0800 | [diff] [blame] | 125 | }; |
| 126 | |
| 127 | /* SDC1 pad data */ |
| 128 | static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = { |
| 129 | {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA}, |
| 130 | {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA}, |
| 131 | {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA} |
| 132 | }; |
| 133 | |
| 134 | static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = { |
| 135 | {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA}, |
| 136 | {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA}, |
| 137 | {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA} |
| 138 | }; |
| 139 | |
| 140 | static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = { |
| 141 | {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL}, |
| 142 | {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP}, |
| 143 | {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP} |
| 144 | }; |
| 145 | |
| 146 | static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = { |
| 147 | {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL}, |
Subhash Jadavani | 32a4398 | 2012-01-20 16:51:06 +0530 | [diff] [blame] | 148 | {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP}, |
| 149 | {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP} |
Stepan Moskovchenko | 0c547bb | 2011-11-30 13:29:12 -0800 | [diff] [blame] | 150 | }; |
| 151 | |
| 152 | /* SDC3 pad data */ |
| 153 | static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = { |
| 154 | {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA}, |
| 155 | {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA}, |
| 156 | {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA} |
| 157 | }; |
| 158 | |
| 159 | static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = { |
| 160 | {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA}, |
| 161 | {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA}, |
| 162 | {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA} |
| 163 | }; |
| 164 | |
| 165 | static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = { |
| 166 | {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL}, |
| 167 | {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP}, |
| 168 | {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP} |
| 169 | }; |
| 170 | |
| 171 | static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = { |
| 172 | {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL}, |
| 173 | /* |
| 174 | * SDC3 CMD line should be PULLed UP otherwise fluid platform will |
| 175 | * see transitions (1 -> 0 and 0 -> 1) on card detection line, |
| 176 | * which would result in false card detection interrupts. |
| 177 | */ |
| 178 | {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP}, |
| 179 | /* |
| 180 | * Keeping DATA lines status to PULL UP will make sure that |
| 181 | * there is no current leak during sleep if external pull up |
| 182 | * is connected to DATA lines. |
| 183 | */ |
| 184 | {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP} |
| 185 | }; |
| 186 | |
| 187 | static struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = { |
| 188 | [SDCC1] = { |
| 189 | .on = sdc1_pad_pull_on_cfg, |
| 190 | .off = sdc1_pad_pull_off_cfg, |
| 191 | .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg) |
| 192 | }, |
| 193 | [SDCC3] = { |
| 194 | .on = sdc3_pad_pull_on_cfg, |
| 195 | .off = sdc3_pad_pull_off_cfg, |
| 196 | .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg) |
| 197 | }, |
| 198 | }; |
| 199 | |
| 200 | static struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = { |
| 201 | [SDCC1] = { |
| 202 | .on = sdc1_pad_drv_on_cfg, |
| 203 | .off = sdc1_pad_drv_off_cfg, |
| 204 | .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg) |
| 205 | }, |
| 206 | [SDCC3] = { |
| 207 | .on = sdc3_pad_drv_on_cfg, |
| 208 | .off = sdc3_pad_drv_off_cfg, |
| 209 | .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg) |
| 210 | }, |
| 211 | }; |
| 212 | |
Pratibhasagar V | 57c808e | 2012-01-12 13:47:30 +0530 | [diff] [blame] | 213 | struct msm_mmc_gpio sdc2_gpio[] = { |
| 214 | {92, "sdc2_dat_3"}, |
| 215 | {91, "sdc2_dat_2"}, |
| 216 | {90, "sdc2_dat_1"}, |
| 217 | {89, "sdc2_dat_0"}, |
| 218 | {97, "sdc2_cmd"}, |
| 219 | {98, "sdc2_clk"} |
| 220 | }; |
| 221 | |
Pratibhasagar V | 26cf265 | 2012-01-12 17:31:21 +0530 | [diff] [blame] | 222 | struct msm_mmc_gpio sdc4_gpio[] = { |
| 223 | {83, "sdc4_dat_3"}, |
| 224 | {84, "sdc4_dat_2"}, |
| 225 | {85, "sdc4_dat_1"}, |
| 226 | {86, "sdc4_dat_0"}, |
| 227 | {87, "sdc4_cmd"}, |
| 228 | {88, "sdc4_clk"} |
| 229 | }; |
| 230 | |
Pratibhasagar V | 57c808e | 2012-01-12 13:47:30 +0530 | [diff] [blame] | 231 | struct msm_mmc_gpio_data mmc_gpio_data[MAX_SDCC_CONTROLLER] = { |
| 232 | [SDCC2] = { |
| 233 | .gpio = sdc2_gpio, |
| 234 | .size = ARRAY_SIZE(sdc2_gpio), |
Pratibhasagar V | 26cf265 | 2012-01-12 17:31:21 +0530 | [diff] [blame] | 235 | }, |
| 236 | [SDCC4] = { |
| 237 | .gpio = sdc4_gpio, |
| 238 | .size = ARRAY_SIZE(sdc4_gpio), |
| 239 | }, |
Pratibhasagar V | 57c808e | 2012-01-12 13:47:30 +0530 | [diff] [blame] | 240 | }; |
| 241 | |
Stepan Moskovchenko | 0c547bb | 2011-11-30 13:29:12 -0800 | [diff] [blame] | 242 | static struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = { |
| 243 | [SDCC1] = { |
| 244 | .pull = &mmc_pad_pull_data[SDCC1], |
| 245 | .drv = &mmc_pad_drv_data[SDCC1] |
| 246 | }, |
| 247 | [SDCC3] = { |
| 248 | .pull = &mmc_pad_pull_data[SDCC3], |
| 249 | .drv = &mmc_pad_drv_data[SDCC3] |
| 250 | }, |
| 251 | }; |
| 252 | |
| 253 | static struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = { |
| 254 | [SDCC1] = { |
| 255 | .pad_data = &mmc_pad_data[SDCC1], |
| 256 | }, |
Pratibhasagar V | 57c808e | 2012-01-12 13:47:30 +0530 | [diff] [blame] | 257 | [SDCC2] = { |
| 258 | .is_gpio = 1, |
| 259 | .gpio_data = &mmc_gpio_data[SDCC2], |
| 260 | }, |
Stepan Moskovchenko | 0c547bb | 2011-11-30 13:29:12 -0800 | [diff] [blame] | 261 | [SDCC3] = { |
| 262 | .pad_data = &mmc_pad_data[SDCC3], |
| 263 | }, |
Pratibhasagar V | 26cf265 | 2012-01-12 17:31:21 +0530 | [diff] [blame] | 264 | [SDCC4] = { |
| 265 | .is_gpio = 1, |
| 266 | .gpio_data = &mmc_gpio_data[SDCC4], |
| 267 | }, |
Stepan Moskovchenko | 0c547bb | 2011-11-30 13:29:12 -0800 | [diff] [blame] | 268 | }; |
| 269 | |
Subhash Jadavani | 55e188e | 2012-04-13 11:31:08 +0530 | [diff] [blame] | 270 | #define MSM_MPM_PIN_SDC1_DAT1 17 |
| 271 | #define MSM_MPM_PIN_SDC3_DAT1 21 |
| 272 | |
Stepan Moskovchenko | 0c547bb | 2011-11-30 13:29:12 -0800 | [diff] [blame] | 273 | static unsigned int sdc1_sup_clk_rates[] = { |
Subhash Jadavani | 871b1a8 | 2012-06-14 16:08:38 +0530 | [diff] [blame] | 274 | 400000, 24000000, 48000000, 96000000 |
Stepan Moskovchenko | 0c547bb | 2011-11-30 13:29:12 -0800 | [diff] [blame] | 275 | }; |
| 276 | |
Terence Hampson | 2e1705f | 2012-04-11 19:55:29 -0400 | [diff] [blame] | 277 | #ifdef CONFIG_MMC_MSM_SDC3_SUPPORT |
Stepan Moskovchenko | 0c547bb | 2011-11-30 13:29:12 -0800 | [diff] [blame] | 278 | static unsigned int sdc3_sup_clk_rates[] = { |
Subhash Jadavani | 2f64f5a | 2011-12-06 17:17:23 +0530 | [diff] [blame] | 279 | 400000, 24000000, 48000000, 96000000, 192000000 |
Stepan Moskovchenko | 0c547bb | 2011-11-30 13:29:12 -0800 | [diff] [blame] | 280 | }; |
Terence Hampson | 2e1705f | 2012-04-11 19:55:29 -0400 | [diff] [blame] | 281 | #endif |
Stepan Moskovchenko | 0c547bb | 2011-11-30 13:29:12 -0800 | [diff] [blame] | 282 | |
| 283 | #ifdef CONFIG_MMC_MSM_SDC1_SUPPORT |
| 284 | static struct mmc_platform_data msm8960_sdc1_data = { |
| 285 | .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29, |
| 286 | #ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT |
| 287 | .mmc_bus_width = MMC_CAP_8_BIT_DATA, |
| 288 | #else |
| 289 | .mmc_bus_width = MMC_CAP_4_BIT_DATA, |
| 290 | #endif |
| 291 | .sup_clk_table = sdc1_sup_clk_rates, |
| 292 | .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates), |
Stepan Moskovchenko | 0c547bb | 2011-11-30 13:29:12 -0800 | [diff] [blame] | 293 | .nonremovable = 1, |
| 294 | .vreg_data = &mmc_slot_vreg_data[SDCC1], |
Subhash Jadavani | 933e6a6 | 2011-12-26 18:05:04 +0530 | [diff] [blame] | 295 | .pin_data = &mmc_slot_pin_data[SDCC1], |
Subhash Jadavani | 55e188e | 2012-04-13 11:31:08 +0530 | [diff] [blame] | 296 | .mpm_sdiowakeup_int = MSM_MPM_PIN_SDC1_DAT1, |
Subhash Jadavani | bcd435f | 2012-04-24 18:26:49 +0530 | [diff] [blame] | 297 | .msm_bus_voting_data = &sps_to_ddr_bus_voting_data, |
Subhash Jadavani | cb6f9ce | 2012-06-26 11:57:10 +0530 | [diff] [blame] | 298 | .uhs_caps2 = MMC_CAP2_HS200_1_8V_SDR, |
Stepan Moskovchenko | 0c547bb | 2011-11-30 13:29:12 -0800 | [diff] [blame] | 299 | }; |
| 300 | #endif |
| 301 | |
Pratibhasagar V | 57c808e | 2012-01-12 13:47:30 +0530 | [diff] [blame] | 302 | #ifdef CONFIG_MMC_MSM_SDC2_SUPPORT |
| 303 | static unsigned int sdc2_sup_clk_rates[] = { |
| 304 | 400000, 24000000, 48000000 |
| 305 | }; |
| 306 | |
| 307 | static struct mmc_platform_data msm8960_sdc2_data = { |
| 308 | .ocr_mask = MMC_VDD_165_195, |
| 309 | .mmc_bus_width = MMC_CAP_4_BIT_DATA, |
| 310 | .sup_clk_table = sdc2_sup_clk_rates, |
| 311 | .sup_clk_cnt = ARRAY_SIZE(sdc2_sup_clk_rates), |
Pratibhasagar V | 57c808e | 2012-01-12 13:47:30 +0530 | [diff] [blame] | 312 | .vreg_data = &mmc_slot_vreg_data[SDCC2], |
| 313 | .pin_data = &mmc_slot_pin_data[SDCC2], |
| 314 | .sdiowakeup_irq = MSM_GPIO_TO_INT(90), |
Subhash Jadavani | bcd435f | 2012-04-24 18:26:49 +0530 | [diff] [blame] | 315 | .msm_bus_voting_data = &sps_to_ddr_bus_voting_data, |
Pratibhasagar V | 57c808e | 2012-01-12 13:47:30 +0530 | [diff] [blame] | 316 | }; |
| 317 | #endif |
| 318 | |
Stepan Moskovchenko | 0c547bb | 2011-11-30 13:29:12 -0800 | [diff] [blame] | 319 | #ifdef CONFIG_MMC_MSM_SDC3_SUPPORT |
| 320 | static struct mmc_platform_data msm8960_sdc3_data = { |
| 321 | .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29, |
| 322 | .mmc_bus_width = MMC_CAP_4_BIT_DATA, |
| 323 | .sup_clk_table = sdc3_sup_clk_rates, |
| 324 | .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates), |
Stepan Moskovchenko | 0c547bb | 2011-11-30 13:29:12 -0800 | [diff] [blame] | 325 | #ifdef CONFIG_MMC_MSM_SDC3_WP_SUPPORT |
| 326 | .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16), |
| 327 | #endif |
| 328 | .vreg_data = &mmc_slot_vreg_data[SDCC3], |
| 329 | .pin_data = &mmc_slot_pin_data[SDCC3], |
Ming-yi Lin | 9baad17 | 2012-10-17 11:50:15 +0800 | [diff] [blame] | 330 | #ifndef CONFIG_MMC_MSM_SDC3_POLLING |
Stepan Moskovchenko | 0c547bb | 2011-11-30 13:29:12 -0800 | [diff] [blame] | 331 | .status_gpio = PM8921_GPIO_PM_TO_SYS(26), |
| 332 | .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26), |
| 333 | .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, |
Ming-yi Lin | 9baad17 | 2012-10-17 11:50:15 +0800 | [diff] [blame] | 334 | #endif |
Krishna Konda | 360aa42 | 2011-12-06 18:27:41 -0800 | [diff] [blame] | 335 | .is_status_gpio_active_low = true, |
Stepan Moskovchenko | 0c547bb | 2011-11-30 13:29:12 -0800 | [diff] [blame] | 336 | .xpc_cap = 1, |
| 337 | .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 | |
| 338 | MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 | |
Subhash Jadavani | 2f64f5a | 2011-12-06 17:17:23 +0530 | [diff] [blame] | 339 | MMC_CAP_UHS_SDR104 | MMC_CAP_MAX_CURRENT_600), |
Subhash Jadavani | 55e188e | 2012-04-13 11:31:08 +0530 | [diff] [blame] | 340 | .mpm_sdiowakeup_int = MSM_MPM_PIN_SDC3_DAT1, |
Subhash Jadavani | bcd435f | 2012-04-24 18:26:49 +0530 | [diff] [blame] | 341 | .msm_bus_voting_data = &sps_to_ddr_bus_voting_data, |
Stepan Moskovchenko | 0c547bb | 2011-11-30 13:29:12 -0800 | [diff] [blame] | 342 | }; |
| 343 | #endif |
| 344 | |
Pratibhasagar V | 26cf265 | 2012-01-12 17:31:21 +0530 | [diff] [blame] | 345 | #ifdef CONFIG_MMC_MSM_SDC4_SUPPORT |
| 346 | static unsigned int sdc4_sup_clk_rates[] = { |
| 347 | 400000, 24000000, 48000000 |
| 348 | }; |
| 349 | |
| 350 | static struct mmc_platform_data msm8960_sdc4_data = { |
| 351 | .ocr_mask = MMC_VDD_165_195, |
| 352 | .mmc_bus_width = MMC_CAP_4_BIT_DATA, |
| 353 | .sup_clk_table = sdc4_sup_clk_rates, |
| 354 | .sup_clk_cnt = ARRAY_SIZE(sdc4_sup_clk_rates), |
Pratibhasagar V | 26cf265 | 2012-01-12 17:31:21 +0530 | [diff] [blame] | 355 | .vreg_data = &mmc_slot_vreg_data[SDCC4], |
| 356 | .pin_data = &mmc_slot_pin_data[SDCC4], |
| 357 | .sdiowakeup_irq = MSM_GPIO_TO_INT(85), |
Subhash Jadavani | bcd435f | 2012-04-24 18:26:49 +0530 | [diff] [blame] | 358 | .msm_bus_voting_data = &sps_to_ddr_bus_voting_data, |
Pratibhasagar V | 26cf265 | 2012-01-12 17:31:21 +0530 | [diff] [blame] | 359 | }; |
| 360 | #endif |
| 361 | |
Stepan Moskovchenko | 0c547bb | 2011-11-30 13:29:12 -0800 | [diff] [blame] | 362 | void __init msm8960_init_mmc(void) |
| 363 | { |
| 364 | #ifdef CONFIG_MMC_MSM_SDC1_SUPPORT |
Subhash Jadavani | 871b1a8 | 2012-06-14 16:08:38 +0530 | [diff] [blame] | 365 | /* |
| 366 | * When eMMC runs in DDR mode on CDP platform, we have |
| 367 | * seen instability due to DATA CRC errors. These errors are |
| 368 | * attributed to long physical path between MSM and eMMC on CDP. |
| 369 | * So let's not enable the DDR mode on CDP platform but let other |
| 370 | * platforms take advantage of eMMC DDR mode. |
| 371 | */ |
| 372 | if (!machine_is_msm8960_cdp()) |
| 373 | msm8960_sdc1_data.uhs_caps |= (MMC_CAP_1_8V_DDR | |
| 374 | MMC_CAP_UHS_DDR50); |
Stepan Moskovchenko | 0c547bb | 2011-11-30 13:29:12 -0800 | [diff] [blame] | 375 | /* SDC1 : eMMC card connected */ |
| 376 | msm_add_sdcc(1, &msm8960_sdc1_data); |
| 377 | #endif |
Pratibhasagar V | 57c808e | 2012-01-12 13:47:30 +0530 | [diff] [blame] | 378 | #ifdef CONFIG_MMC_MSM_SDC2_SUPPORT |
| 379 | /* SDC2: SDIO slot for WLAN*/ |
| 380 | msm_add_sdcc(2, &msm8960_sdc2_data); |
| 381 | #endif |
Stepan Moskovchenko | 0c547bb | 2011-11-30 13:29:12 -0800 | [diff] [blame] | 382 | #ifdef CONFIG_MMC_MSM_SDC3_SUPPORT |
Stepan Moskovchenko | 0c547bb | 2011-11-30 13:29:12 -0800 | [diff] [blame] | 383 | /* SDC3: External card slot */ |
| 384 | msm_add_sdcc(3, &msm8960_sdc3_data); |
| 385 | #endif |
Pratibhasagar V | 26cf265 | 2012-01-12 17:31:21 +0530 | [diff] [blame] | 386 | #ifdef CONFIG_MMC_MSM_SDC4_SUPPORT |
| 387 | /* SDC4: SDIO slot for WLAN */ |
| 388 | msm_add_sdcc(4, &msm8960_sdc4_data); |
| 389 | #endif |
Stepan Moskovchenko | 0c547bb | 2011-11-30 13:29:12 -0800 | [diff] [blame] | 390 | } |