Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
| 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 | #include <linux/kernel.h> |
| 14 | #include <linux/platform_device.h> |
| 15 | #include <linux/io.h> |
| 16 | #include <linux/irq.h> |
Kenneth Heitke | 748593a | 2011-07-15 15:45:11 -0600 | [diff] [blame] | 17 | #include <linux/i2c.h> |
Sagar Dharia | 8bdcdaf | 2011-09-16 16:01:15 -0600 | [diff] [blame^] | 18 | #include <linux/slimbus/slimbus.h> |
Kenneth Heitke | 36920d3 | 2011-07-20 16:44:30 -0600 | [diff] [blame] | 19 | #include <linux/msm_ssbi.h> |
Stepan Moskovchenko | eed82a5 | 2011-09-02 13:19:23 -0700 | [diff] [blame] | 20 | #include <linux/spi/spi.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 21 | #include <asm/mach-types.h> |
| 22 | #include <asm/mach/arch.h> |
| 23 | #include <asm/hardware/gic.h> |
Sahitya Tummala | 3586ed9 | 2011-08-03 09:13:23 +0530 | [diff] [blame] | 24 | #include <asm/mach/mmc.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 25 | |
| 26 | #include <mach/board.h> |
| 27 | #include <mach/msm_iomap.h> |
| 28 | #include <linux/usb/msm_hsusb.h> |
| 29 | #include <linux/usb/android.h> |
| 30 | #include <mach/socinfo.h> |
Harini Jayaraman | c4c5869 | 2011-07-19 14:50:10 -0600 | [diff] [blame] | 31 | #include <mach/msm_spi.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 32 | #include "timer.h" |
| 33 | #include "devices.h" |
Joel King | 4ebccc6 | 2011-07-22 09:43:22 -0700 | [diff] [blame] | 34 | #include <mach/gpio.h> |
| 35 | #include <mach/gpiomux.h> |
| 36 | |
Jay Chokshi | ea67c62 | 2011-07-29 17:12:26 -0700 | [diff] [blame] | 37 | #include "board-apq8064.h" |
| 38 | |
Sahitya Tummala | b4d883f | 2011-08-23 10:44:51 +0530 | [diff] [blame] | 39 | /* APQ8064 have 4 SDCC controllers */ |
| 40 | enum sdcc_controllers { |
| 41 | SDCC1, |
| 42 | SDCC2, |
| 43 | SDCC3, |
| 44 | SDCC4, |
| 45 | MAX_SDCC_CONTROLLER |
| 46 | }; |
| 47 | |
| 48 | /* All SDCC controllers requires VDD/VCC voltage */ |
| 49 | static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = { |
| 50 | /* SDCC1 : eMMC card connected */ |
| 51 | [SDCC1] = { |
| 52 | .name = "sdc_vdd", |
| 53 | .set_voltage_sup = 1, |
| 54 | .high_vol_level = 2950000, |
| 55 | .low_vol_level = 2950000, |
| 56 | .always_on = 1, |
| 57 | .lpm_sup = 1, |
| 58 | .lpm_uA = 9000, |
| 59 | .hpm_uA = 200000, /* 200mA */ |
| 60 | }, |
| 61 | /* SDCC3 : External card slot connected */ |
| 62 | [SDCC3] = { |
| 63 | .name = "sdc_vdd", |
| 64 | .set_voltage_sup = 1, |
| 65 | .high_vol_level = 2950000, |
| 66 | .low_vol_level = 2950000, |
| 67 | .hpm_uA = 600000, /* 600mA */ |
| 68 | } |
| 69 | }; |
| 70 | |
| 71 | /* Only slots having eMMC card will require VCCQ voltage */ |
| 72 | static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = { |
| 73 | /* SDCC1 : eMMC card connected */ |
| 74 | [SDCC1] = { |
| 75 | .name = "sdc_vccq", |
| 76 | .set_voltage_sup = 1, |
| 77 | .always_on = 1, |
| 78 | .high_vol_level = 1800000, |
| 79 | .low_vol_level = 1800000, |
| 80 | .hpm_uA = 200000, /* 200mA */ |
| 81 | } |
| 82 | }; |
| 83 | |
| 84 | /* All SDCC controllers may require voting for VDD PAD voltage */ |
| 85 | static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = { |
| 86 | /* SDCC3 : External card slot connected */ |
| 87 | [SDCC3] = { |
| 88 | .name = "sdc_vddp", |
| 89 | .set_voltage_sup = 1, |
| 90 | .high_vol_level = 2950000, |
| 91 | .low_vol_level = 1850000, |
| 92 | .always_on = 1, |
| 93 | .lpm_sup = 1, |
| 94 | /* Max. Active current required is 16 mA */ |
| 95 | .hpm_uA = 16000, |
| 96 | /* |
| 97 | * Sleep current required is ~300 uA. But min. vote can be |
| 98 | * in terms of mA (min. 1 mA). So let's vote for 2 mA |
| 99 | * during sleep. |
| 100 | */ |
| 101 | .lpm_uA = 2000, |
| 102 | } |
| 103 | }; |
| 104 | |
| 105 | static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = { |
| 106 | /* SDCC1 : eMMC card connected */ |
| 107 | [SDCC1] = { |
| 108 | .vdd_data = &mmc_vdd_reg_data[SDCC1], |
| 109 | .vccq_data = &mmc_vccq_reg_data[SDCC1], |
| 110 | }, |
| 111 | /* SDCC3 : External card slot connected */ |
| 112 | [SDCC3] = { |
| 113 | .vdd_data = &mmc_vdd_reg_data[SDCC3], |
| 114 | .vddp_data = &mmc_vddp_reg_data[SDCC3], |
| 115 | } |
| 116 | }; |
| 117 | |
| 118 | /* SDC1 pad data */ |
| 119 | static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = { |
| 120 | {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA}, |
| 121 | {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA}, |
| 122 | {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA} |
| 123 | }; |
| 124 | |
| 125 | static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = { |
| 126 | {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA}, |
| 127 | {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA}, |
| 128 | {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA} |
| 129 | }; |
| 130 | |
| 131 | static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = { |
| 132 | {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP}, |
| 133 | {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP} |
| 134 | }; |
| 135 | |
| 136 | static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = { |
| 137 | {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN}, |
| 138 | {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN} |
| 139 | }; |
| 140 | |
| 141 | /* SDC3 pad data */ |
| 142 | static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = { |
| 143 | {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA}, |
| 144 | {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA}, |
| 145 | {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA} |
| 146 | }; |
| 147 | |
| 148 | static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = { |
| 149 | {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA}, |
| 150 | {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA}, |
| 151 | {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA} |
| 152 | }; |
| 153 | |
| 154 | static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = { |
| 155 | {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP}, |
| 156 | {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP} |
| 157 | }; |
| 158 | |
| 159 | static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = { |
| 160 | {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_DOWN}, |
| 161 | {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_DOWN} |
| 162 | }; |
| 163 | |
| 164 | static struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = { |
| 165 | [SDCC1] = { |
| 166 | .on = sdc1_pad_pull_on_cfg, |
| 167 | .off = sdc1_pad_pull_off_cfg, |
| 168 | .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg) |
| 169 | }, |
| 170 | [SDCC3] = { |
| 171 | .on = sdc3_pad_pull_on_cfg, |
| 172 | .off = sdc3_pad_pull_off_cfg, |
| 173 | .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg) |
| 174 | }, |
| 175 | }; |
| 176 | |
| 177 | static struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = { |
| 178 | [SDCC1] = { |
| 179 | .on = sdc1_pad_drv_on_cfg, |
| 180 | .off = sdc1_pad_drv_off_cfg, |
| 181 | .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg) |
| 182 | }, |
| 183 | [SDCC3] = { |
| 184 | .on = sdc3_pad_drv_on_cfg, |
| 185 | .off = sdc3_pad_drv_off_cfg, |
| 186 | .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg) |
| 187 | }, |
| 188 | }; |
| 189 | |
| 190 | static struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = { |
| 191 | [SDCC1] = { |
| 192 | .pull = &mmc_pad_pull_data[SDCC1], |
| 193 | .drv = &mmc_pad_drv_data[SDCC1] |
| 194 | }, |
| 195 | [SDCC3] = { |
| 196 | .pull = &mmc_pad_pull_data[SDCC3], |
| 197 | .drv = &mmc_pad_drv_data[SDCC3] |
| 198 | }, |
| 199 | }; |
| 200 | |
| 201 | static struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = { |
| 202 | [SDCC1] = { |
| 203 | .pad_data = &mmc_pad_data[SDCC1], |
| 204 | }, |
| 205 | [SDCC3] = { |
| 206 | .pad_data = &mmc_pad_data[SDCC3], |
| 207 | }, |
| 208 | }; |
| 209 | |
Sahitya Tummala | 3586ed9 | 2011-08-03 09:13:23 +0530 | [diff] [blame] | 210 | #ifdef CONFIG_MMC_MSM_SDC1_SUPPORT |
| 211 | static unsigned int sdc1_sup_clk_rates[] = { |
| 212 | 400000, 24000000, 48000000, 96000000 |
| 213 | }; |
| 214 | |
| 215 | static struct mmc_platform_data sdc1_data = { |
| 216 | .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29, |
| 217 | .mmc_bus_width = MMC_CAP_4_BIT_DATA, |
| 218 | .sup_clk_table = sdc1_sup_clk_rates, |
| 219 | .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates), |
Sahitya Tummala | b4d883f | 2011-08-23 10:44:51 +0530 | [diff] [blame] | 220 | .pin_data = &mmc_slot_pin_data[SDCC1], |
| 221 | .vreg_data = &mmc_slot_vreg_data[SDCC1], |
| 222 | .sdcc_v4_sup = true, |
Sahitya Tummala | 3586ed9 | 2011-08-03 09:13:23 +0530 | [diff] [blame] | 223 | }; |
| 224 | static struct mmc_platform_data *apq8064_sdc1_pdata = &sdc1_data; |
| 225 | #else |
| 226 | static struct mmc_platform_data *apq8064_sdc1_pdata; |
| 227 | #endif |
| 228 | |
| 229 | #ifdef CONFIG_MMC_MSM_SDC3_SUPPORT |
| 230 | static unsigned int sdc3_sup_clk_rates[] = { |
| 231 | 400000, 24000000, 48000000, 96000000 |
| 232 | }; |
| 233 | |
| 234 | static struct mmc_platform_data sdc3_data = { |
| 235 | .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29, |
| 236 | .mmc_bus_width = MMC_CAP_4_BIT_DATA, |
| 237 | .sup_clk_table = sdc3_sup_clk_rates, |
| 238 | .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates), |
Sahitya Tummala | b4d883f | 2011-08-23 10:44:51 +0530 | [diff] [blame] | 239 | .pin_data = &mmc_slot_pin_data[SDCC3], |
| 240 | .vreg_data = &mmc_slot_vreg_data[SDCC3], |
| 241 | .sdcc_v4_sup = true, |
Sahitya Tummala | 3586ed9 | 2011-08-03 09:13:23 +0530 | [diff] [blame] | 242 | }; |
| 243 | static struct mmc_platform_data *apq8064_sdc3_pdata = &sdc3_data; |
| 244 | #else |
| 245 | static struct mmc_platform_data *apq8064_sdc3_pdata; |
| 246 | #endif |
| 247 | |
| 248 | static void __init apq8064_init_mmc(void) |
| 249 | { |
Amol Jadi | 7d4ce03 | 2011-09-09 17:07:18 -0700 | [diff] [blame] | 250 | if ((machine_is_apq8064_rumi3()) || machine_is_apq8064_sim()) { |
Sahitya Tummala | b07e1ae | 2011-09-02 11:58:42 +0530 | [diff] [blame] | 251 | if (apq8064_sdc1_pdata) { |
Sahitya Tummala | d9df327 | 2011-08-19 16:50:46 +0530 | [diff] [blame] | 252 | apq8064_sdc1_pdata->disable_bam = true; |
Sahitya Tummala | b07e1ae | 2011-09-02 11:58:42 +0530 | [diff] [blame] | 253 | apq8064_sdc1_pdata->disable_runtime_pm = true; |
Sahitya Tummala | 85fa070 | 2011-09-15 09:39:37 +0530 | [diff] [blame] | 254 | apq8064_sdc1_pdata->disable_cmd23 = true; |
Sahitya Tummala | b07e1ae | 2011-09-02 11:58:42 +0530 | [diff] [blame] | 255 | } |
| 256 | if (apq8064_sdc3_pdata) { |
Sahitya Tummala | d9df327 | 2011-08-19 16:50:46 +0530 | [diff] [blame] | 257 | apq8064_sdc3_pdata->disable_bam = true; |
Sahitya Tummala | b07e1ae | 2011-09-02 11:58:42 +0530 | [diff] [blame] | 258 | apq8064_sdc3_pdata->disable_runtime_pm = true; |
Sahitya Tummala | 85fa070 | 2011-09-15 09:39:37 +0530 | [diff] [blame] | 259 | apq8064_sdc3_pdata->disable_cmd23 = true; |
Sahitya Tummala | b07e1ae | 2011-09-02 11:58:42 +0530 | [diff] [blame] | 260 | } |
Sahitya Tummala | d9df327 | 2011-08-19 16:50:46 +0530 | [diff] [blame] | 261 | } |
Sahitya Tummala | 3586ed9 | 2011-08-03 09:13:23 +0530 | [diff] [blame] | 262 | apq8064_add_sdcc(1, apq8064_sdc1_pdata); |
| 263 | apq8064_add_sdcc(3, apq8064_sdc3_pdata); |
| 264 | } |
| 265 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 266 | static void __init apq8064_map_io(void) |
| 267 | { |
| 268 | msm_map_apq8064_io(); |
| 269 | } |
| 270 | |
| 271 | static void __init apq8064_init_irq(void) |
| 272 | { |
| 273 | unsigned int i; |
| 274 | gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE, |
| 275 | (void *)MSM_QGIC_CPU_BASE); |
| 276 | |
| 277 | /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */ |
| 278 | writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4); |
| 279 | |
| 280 | writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET); |
| 281 | mb(); |
| 282 | |
| 283 | /* |
| 284 | * FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet |
| 285 | * as they are configured as level, which does not play nice with |
| 286 | * handle_percpu_irq. |
| 287 | */ |
| 288 | for (i = GIC_PPI_START; i < GIC_SPI_START; i++) { |
| 289 | if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE) |
| 290 | irq_set_handler(i, handle_percpu_irq); |
| 291 | } |
| 292 | } |
| 293 | |
| 294 | static struct platform_device *common_devices[] __initdata = { |
Kenneth Heitke | 748593a | 2011-07-15 15:45:11 -0600 | [diff] [blame] | 295 | &apq8064_device_qup_i2c_gsbi4, |
Harini Jayaraman | c4c5869 | 2011-07-19 14:50:10 -0600 | [diff] [blame] | 296 | &apq8064_device_qup_spi_gsbi5, |
Sagar Dharia | 8bdcdaf | 2011-09-16 16:01:15 -0600 | [diff] [blame^] | 297 | &apq8064_slim_ctrl, |
Jay Chokshi | 9c25f07 | 2011-09-23 18:19:15 -0700 | [diff] [blame] | 298 | &apq8064_device_ssbi_pmic1, |
| 299 | &apq8064_device_ssbi_pmic2, |
Harini Jayaraman | c4c5869 | 2011-07-19 14:50:10 -0600 | [diff] [blame] | 300 | }; |
| 301 | |
Joel King | 4e7ad22 | 2011-08-17 15:47:38 -0700 | [diff] [blame] | 302 | static struct platform_device *sim_devices[] __initdata = { |
| 303 | &apq8064_device_dmov, |
Stepan Moskovchenko | 2701a44 | 2011-08-19 13:47:22 -0700 | [diff] [blame] | 304 | &apq8064_device_uart_gsbi3, |
Yan He | 06913ce | 2011-08-26 16:33:46 -0700 | [diff] [blame] | 305 | &msm_device_sps_apq8064, |
Stepan Moskovchenko | 2701a44 | 2011-08-19 13:47:22 -0700 | [diff] [blame] | 306 | }; |
| 307 | |
| 308 | static struct platform_device *rumi3_devices[] __initdata = { |
| 309 | &apq8064_device_uart_gsbi1, |
Joel King | 4e7ad22 | 2011-08-17 15:47:38 -0700 | [diff] [blame] | 310 | }; |
| 311 | |
Harini Jayaraman | c4c5869 | 2011-07-19 14:50:10 -0600 | [diff] [blame] | 312 | static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = { |
| 313 | .max_clock_speed = 26000000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 314 | }; |
| 315 | |
| 316 | static struct msm_otg_platform_data msm_otg_pdata = { |
| 317 | .mode = USB_PERIPHERAL, |
| 318 | .otg_control = OTG_PHY_CONTROL, |
| 319 | .phy_type = SNPS_28NM_INTEGRATED_PHY, |
| 320 | .pclk_src_name = "dfab_usb_hs_clk", |
| 321 | }; |
| 322 | |
Stepan Moskovchenko | eed82a5 | 2011-09-02 13:19:23 -0700 | [diff] [blame] | 323 | #define KS8851_IRQ_GPIO 43 |
| 324 | |
| 325 | static struct spi_board_info spi_board_info[] __initdata = { |
| 326 | { |
| 327 | .modalias = "ks8851", |
| 328 | .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO), |
| 329 | .max_speed_hz = 19200000, |
| 330 | .bus_num = 0, |
| 331 | .chip_select = 2, |
| 332 | .mode = SPI_MODE_0, |
| 333 | }, |
| 334 | }; |
| 335 | |
| 336 | #ifdef CONFIG_KS8851 |
| 337 | static struct gpiomux_setting gpio_eth_config = { |
| 338 | .pull = GPIOMUX_PULL_NONE, |
| 339 | .drv = GPIOMUX_DRV_8MA, |
| 340 | .func = GPIOMUX_FUNC_GPIO, |
| 341 | }; |
| 342 | |
| 343 | /* The SPI configurations apply to GSBI 5*/ |
| 344 | static struct gpiomux_setting gpio_spi_config = { |
| 345 | .func = GPIOMUX_FUNC_2, |
| 346 | .drv = GPIOMUX_DRV_8MA, |
| 347 | .pull = GPIOMUX_PULL_NONE, |
| 348 | }; |
| 349 | |
| 350 | /* The SPI configurations apply to GSBI 5 chip select 2*/ |
| 351 | static struct gpiomux_setting gpio_spi_cs2_config = { |
| 352 | .func = GPIOMUX_FUNC_3, |
| 353 | .drv = GPIOMUX_DRV_8MA, |
| 354 | .pull = GPIOMUX_PULL_NONE, |
| 355 | }; |
| 356 | #endif |
| 357 | |
| 358 | struct msm_gpiomux_config apq8064_ethernet_configs[NR_GPIO_IRQS] = { |
| 359 | #ifdef CONFIG_KS8851 |
| 360 | { |
| 361 | .gpio = KS8851_IRQ_GPIO, |
| 362 | .settings = { |
| 363 | [GPIOMUX_SUSPENDED] = &gpio_eth_config, |
| 364 | [GPIOMUX_ACTIVE] = &gpio_eth_config, |
| 365 | } |
| 366 | }, |
| 367 | #endif |
| 368 | }; |
| 369 | |
| 370 | static struct msm_gpiomux_config apq8064_gsbi_configs[] __initdata = { |
| 371 | #ifdef CONFIG_KS8851 |
| 372 | { |
| 373 | .gpio = 51, /* GSBI5 QUP SPI_DATA_MOSI */ |
| 374 | .settings = { |
| 375 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 376 | }, |
| 377 | }, |
| 378 | { |
| 379 | .gpio = 52, /* GSBI5 QUP SPI_DATA_MISO */ |
| 380 | .settings = { |
| 381 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 382 | }, |
| 383 | }, |
| 384 | { |
| 385 | .gpio = 31, /* GSBI5 QUP SPI_CS2_N */ |
| 386 | .settings = { |
| 387 | [GPIOMUX_SUSPENDED] = &gpio_spi_cs2_config, |
| 388 | }, |
| 389 | }, |
| 390 | { |
| 391 | .gpio = 54, /* GSBI5 QUP SPI_CLK */ |
| 392 | .settings = { |
| 393 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 394 | }, |
| 395 | }, |
| 396 | #endif |
| 397 | }; |
| 398 | |
Jay Chokshi | bc3d98d | 2011-08-10 17:14:23 -0700 | [diff] [blame] | 399 | static struct pm8xxx_mpp_platform_data |
| 400 | apq8064_pm8921_mpp_pdata __devinitdata = { |
| 401 | .mpp_base = PM8921_MPP_PM_TO_SYS(1), |
| 402 | }; |
| 403 | |
| 404 | static struct pm8xxx_gpio_platform_data |
| 405 | apq8064_pm8921_gpio_pdata __devinitdata = { |
| 406 | .gpio_base = PM8921_GPIO_PM_TO_SYS(1), |
| 407 | }; |
| 408 | |
| 409 | static struct pm8xxx_irq_platform_data |
| 410 | apq8064_pm8921_irq_pdata __devinitdata = { |
| 411 | .irq_base = PM8921_IRQ_BASE, |
Jay Chokshi | 44873f7 | 2011-08-30 17:24:26 -0700 | [diff] [blame] | 412 | .devirq = PM8921_USR_IRQ_N, |
| 413 | .irq_trigger_flag = IRQF_TRIGGER_HIGH, |
Jay Chokshi | 9e926e7 | 2011-09-23 19:19:58 -0700 | [diff] [blame] | 414 | .dev_id = 0, |
Jay Chokshi | bc3d98d | 2011-08-10 17:14:23 -0700 | [diff] [blame] | 415 | }; |
| 416 | |
| 417 | static struct pm8921_platform_data |
| 418 | apq8064_pm8921_platform_data __devinitdata = { |
Jay Chokshi | ea67c62 | 2011-07-29 17:12:26 -0700 | [diff] [blame] | 419 | .regulator_pdatas = msm8064_pm8921_regulator_pdata, |
Jay Chokshi | bc3d98d | 2011-08-10 17:14:23 -0700 | [diff] [blame] | 420 | .irq_pdata = &apq8064_pm8921_irq_pdata, |
| 421 | .gpio_pdata = &apq8064_pm8921_gpio_pdata, |
| 422 | .mpp_pdata = &apq8064_pm8921_mpp_pdata, |
Jay Chokshi | ea67c62 | 2011-07-29 17:12:26 -0700 | [diff] [blame] | 423 | }; |
| 424 | |
Jay Chokshi | 44873f7 | 2011-08-30 17:24:26 -0700 | [diff] [blame] | 425 | static struct pm8xxx_irq_platform_data |
| 426 | apq8064_pm8821_irq_pdata __devinitdata = { |
| 427 | .irq_base = PM8821_IRQ_BASE, |
| 428 | .devirq = PM8821_USR_IRQ_N, |
| 429 | .irq_trigger_flag = IRQF_TRIGGER_HIGH, |
Jay Chokshi | 9e926e7 | 2011-09-23 19:19:58 -0700 | [diff] [blame] | 430 | .dev_id = 1, |
Jay Chokshi | 44873f7 | 2011-08-30 17:24:26 -0700 | [diff] [blame] | 431 | }; |
| 432 | |
| 433 | static struct pm8xxx_mpp_platform_data |
| 434 | apq8064_pm8821_mpp_pdata __devinitdata = { |
| 435 | .mpp_base = PM8821_MPP_PM_TO_SYS(1), |
| 436 | }; |
| 437 | |
| 438 | static struct pm8821_platform_data |
| 439 | apq8064_pm8821_platform_data __devinitdata = { |
| 440 | .irq_pdata = &apq8064_pm8821_irq_pdata, |
| 441 | .mpp_pdata = &apq8064_pm8821_mpp_pdata, |
| 442 | }; |
| 443 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 444 | static struct msm_ssbi_platform_data apq8064_ssbi_pm8921_pdata __devinitdata = { |
| 445 | .controller_type = MSM_SBI_CTRL_PMIC_ARBITER, |
| 446 | .slave = { |
Jay Chokshi | ea67c62 | 2011-07-29 17:12:26 -0700 | [diff] [blame] | 447 | .name = "pm8921-core", |
Jay Chokshi | bc3d98d | 2011-08-10 17:14:23 -0700 | [diff] [blame] | 448 | .platform_data = &apq8064_pm8921_platform_data, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 449 | }, |
| 450 | }; |
| 451 | |
| 452 | static struct msm_ssbi_platform_data apq8064_ssbi_pm8821_pdata __devinitdata = { |
| 453 | .controller_type = MSM_SBI_CTRL_PMIC_ARBITER, |
| 454 | .slave = { |
Jay Chokshi | 44873f7 | 2011-08-30 17:24:26 -0700 | [diff] [blame] | 455 | .name = "pm8821-core", |
| 456 | .platform_data = &apq8064_pm8821_platform_data, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 457 | }, |
| 458 | }; |
| 459 | |
Sagar Dharia | 8bdcdaf | 2011-09-16 16:01:15 -0600 | [diff] [blame^] | 460 | static struct slim_boardinfo apq8064_slim_devices[] = { |
| 461 | /* Add slimbus slaves as needed */ |
| 462 | }; |
| 463 | |
Kenneth Heitke | 748593a | 2011-07-15 15:45:11 -0600 | [diff] [blame] | 464 | static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = { |
| 465 | .clk_freq = 100000, |
| 466 | .src_clk_rate = 24000000, |
Kenneth Heitke | 748593a | 2011-07-15 15:45:11 -0600 | [diff] [blame] | 467 | }; |
| 468 | |
| 469 | static void __init apq8064_i2c_init(void) |
| 470 | { |
| 471 | apq8064_device_qup_i2c_gsbi4.dev.platform_data = |
| 472 | &apq8064_i2c_qup_gsbi4_pdata; |
| 473 | } |
| 474 | |
Stepan Moskovchenko | eed82a5 | 2011-09-02 13:19:23 -0700 | [diff] [blame] | 475 | static int __init gpiomux_init(void) |
| 476 | { |
| 477 | int rc; |
| 478 | |
| 479 | rc = msm_gpiomux_init(NR_GPIO_IRQS); |
| 480 | if (rc) { |
| 481 | pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc); |
| 482 | return rc; |
| 483 | } |
| 484 | msm_gpiomux_install(apq8064_ethernet_configs, |
| 485 | ARRAY_SIZE(apq8064_ethernet_configs)); |
| 486 | |
| 487 | msm_gpiomux_install(apq8064_gsbi_configs, |
| 488 | ARRAY_SIZE(apq8064_gsbi_configs)); |
| 489 | return 0; |
| 490 | } |
| 491 | |
| 492 | #ifdef CONFIG_KS8851 |
| 493 | static int ethernet_init(void) |
| 494 | { |
| 495 | int ret; |
| 496 | ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq"); |
| 497 | if (ret) { |
| 498 | pr_err("ks8851 gpio_request failed: %d\n", ret); |
| 499 | goto fail; |
| 500 | } |
| 501 | |
| 502 | return 0; |
| 503 | fail: |
| 504 | return ret; |
| 505 | } |
| 506 | #else |
| 507 | static int ethernet_init(void) |
| 508 | { |
| 509 | return 0; |
| 510 | } |
| 511 | #endif |
| 512 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 513 | static void __init apq8064_common_init(void) |
| 514 | { |
| 515 | if (socinfo_init() < 0) |
| 516 | pr_err("socinfo_init() failed!\n"); |
Stephen Boyd | bb600ae | 2011-08-02 20:11:40 -0700 | [diff] [blame] | 517 | msm_clock_init(&apq8064_dummy_clock_init_data); |
Joel King | 4ebccc6 | 2011-07-22 09:43:22 -0700 | [diff] [blame] | 518 | gpiomux_init(); |
Kenneth Heitke | 748593a | 2011-07-15 15:45:11 -0600 | [diff] [blame] | 519 | apq8064_i2c_init(); |
Kenneth Heitke | 36920d3 | 2011-07-20 16:44:30 -0600 | [diff] [blame] | 520 | |
Harini Jayaraman | c4c5869 | 2011-07-19 14:50:10 -0600 | [diff] [blame] | 521 | apq8064_device_qup_spi_gsbi5.dev.platform_data = |
| 522 | &apq8064_qup_spi_gsbi5_pdata; |
Kenneth Heitke | 36920d3 | 2011-07-20 16:44:30 -0600 | [diff] [blame] | 523 | apq8064_device_ssbi_pmic1.dev.platform_data = |
Jay Chokshi | ea67c62 | 2011-07-29 17:12:26 -0700 | [diff] [blame] | 524 | &apq8064_ssbi_pm8921_pdata; |
Kenneth Heitke | 36920d3 | 2011-07-20 16:44:30 -0600 | [diff] [blame] | 525 | apq8064_device_ssbi_pmic2.dev.platform_data = |
| 526 | &apq8064_ssbi_pm8821_pdata; |
Stepan Moskovchenko | 14aa649 | 2011-08-08 15:15:01 -0700 | [diff] [blame] | 527 | apq8064_device_otg.dev.platform_data = &msm_otg_pdata; |
| 528 | apq8064_device_gadget_peripheral.dev.parent = &apq8064_device_otg.dev; |
Jay Chokshi | bc3d98d | 2011-08-10 17:14:23 -0700 | [diff] [blame] | 529 | apq8064_pm8921_platform_data.num_regulators = |
Jay Chokshi | ea67c62 | 2011-07-29 17:12:26 -0700 | [diff] [blame] | 530 | msm8064_pm8921_regulator_pdata_len; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 531 | platform_add_devices(common_devices, ARRAY_SIZE(common_devices)); |
Sahitya Tummala | 3586ed9 | 2011-08-03 09:13:23 +0530 | [diff] [blame] | 532 | apq8064_init_mmc(); |
Sagar Dharia | 8bdcdaf | 2011-09-16 16:01:15 -0600 | [diff] [blame^] | 533 | slim_register_board_info(apq8064_slim_devices, |
| 534 | ARRAY_SIZE(apq8064_slim_devices)); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 535 | } |
| 536 | |
| 537 | static void __init apq8064_sim_init(void) |
| 538 | { |
| 539 | apq8064_common_init(); |
Joel King | 4e7ad22 | 2011-08-17 15:47:38 -0700 | [diff] [blame] | 540 | platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices)); |
| 541 | } |
| 542 | |
| 543 | static void __init apq8064_rumi3_init(void) |
| 544 | { |
Jay Chokshi | 9c25f07 | 2011-09-23 18:19:15 -0700 | [diff] [blame] | 545 | apq8064_pm8921_irq_pdata.devirq = 0; |
| 546 | apq8064_pm8821_irq_pdata.devirq = 0; |
Joel King | 4e7ad22 | 2011-08-17 15:47:38 -0700 | [diff] [blame] | 547 | apq8064_common_init(); |
Stepan Moskovchenko | eed82a5 | 2011-09-02 13:19:23 -0700 | [diff] [blame] | 548 | ethernet_init(); |
Stepan Moskovchenko | 2701a44 | 2011-08-19 13:47:22 -0700 | [diff] [blame] | 549 | platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices)); |
Stepan Moskovchenko | eed82a5 | 2011-09-02 13:19:23 -0700 | [diff] [blame] | 550 | spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 551 | } |
| 552 | |
| 553 | MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR") |
| 554 | .map_io = apq8064_map_io, |
| 555 | .init_irq = apq8064_init_irq, |
| 556 | .timer = &msm_timer, |
| 557 | .init_machine = apq8064_sim_init, |
| 558 | MACHINE_END |
| 559 | |
Joel King | 4e7ad22 | 2011-08-17 15:47:38 -0700 | [diff] [blame] | 560 | MACHINE_START(APQ8064_RUMI3, "QCT APQ8064 RUMI3") |
| 561 | .map_io = apq8064_map_io, |
| 562 | .init_irq = apq8064_init_irq, |
| 563 | .timer = &msm_timer, |
| 564 | .init_machine = apq8064_rumi3_init, |
| 565 | MACHINE_END |
| 566 | |