Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -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> |
Harini Jayaraman | eba5267 | 2011-09-08 15:13:00 -0600 | [diff] [blame] | 15 | #include <linux/i2c.h> |
Kenneth Heitke | af3d3cf | 2011-09-08 11:45:31 -0700 | [diff] [blame] | 16 | #include <linux/msm_ssbi.h> |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 17 | #include <linux/memblock.h> |
Rohit Vaswani | a681589 | 2011-12-15 20:20:39 -0800 | [diff] [blame] | 18 | #include <linux/usb/android.h> |
| 19 | #include <linux/usb/msm_hsusb.h> |
| 20 | #include <linux/mfd/pm8xxx/pm8xxx-adc.h> |
| 21 | #include <linux/leds.h> |
| 22 | #include <linux/leds-pm8xxx.h> |
| 23 | #include <linux/power/ltc4088-charger.h> |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 24 | #include <asm/mach-types.h> |
| 25 | #include <asm/mach/arch.h> |
Marc Zyngier | 89bdafd1 | 2011-12-22 11:39:20 +0530 | [diff] [blame] | 26 | #include <asm/hardware/gic.h> |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 27 | #include <mach/board.h> |
| 28 | #include <mach/msm_iomap.h> |
| 29 | #include <mach/gpio.h> |
Harini Jayaraman | 738c931 | 2011-09-08 15:22:38 -0600 | [diff] [blame] | 30 | #include <mach/msm_spi.h> |
Gagan Mac | 7a82764 | 2011-09-22 19:42:21 -0600 | [diff] [blame] | 31 | #include <mach/msm_bus_board.h> |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 32 | #include "timer.h" |
| 33 | #include "devices.h" |
David Collins | fb88c43 | 2011-08-25 15:12:47 -0700 | [diff] [blame] | 34 | #include "board-9615.h" |
Maheshkumar Sivasubramanian | 4923db2 | 2011-09-15 09:28:15 -0600 | [diff] [blame] | 35 | #include "cpuidle.h" |
| 36 | #include "pm.h" |
Vikram Mulukutla | b5e1cda | 2011-10-04 16:17:22 -0700 | [diff] [blame] | 37 | #include "acpuclock.h" |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 38 | #include "pm-boot.h" |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 39 | |
Siddartha Mohanadoss | 5f60b45 | 2011-10-05 11:49:00 -0700 | [diff] [blame] | 40 | static struct pm8xxx_adc_amux pm8018_adc_channels_data[] = { |
| 41 | {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1, |
| 42 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 43 | {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1, |
| 44 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 45 | {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1, |
| 46 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 47 | {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2, |
| 48 | ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM}, |
| 49 | {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV2, |
| 50 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 51 | {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 52 | ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM}, |
| 53 | {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 54 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 55 | {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 56 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 57 | {"pa_therm0", ADC_MPP_1_AMUX3, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 58 | ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM}, |
| 59 | }; |
| 60 | |
| 61 | static struct pm8xxx_adc_properties pm8018_adc_data = { |
| 62 | .adc_vdd_reference = 1800, /* milli-voltage for this adc */ |
| 63 | .bitresolution = 15, |
| 64 | .bipolar = 0, |
| 65 | }; |
| 66 | |
| 67 | static struct pm8xxx_adc_platform_data pm8018_adc_pdata = { |
| 68 | .adc_channel = pm8018_adc_channels_data, |
| 69 | .adc_num_board_channel = ARRAY_SIZE(pm8018_adc_channels_data), |
| 70 | .adc_prop = &pm8018_adc_data, |
| 71 | }; |
| 72 | |
David Collins | fb88c43 | 2011-08-25 15:12:47 -0700 | [diff] [blame] | 73 | static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = { |
| 74 | .irq_base = PM8018_IRQ_BASE, |
| 75 | .devirq = MSM_GPIO_TO_INT(87), |
| 76 | .irq_trigger_flag = IRQF_TRIGGER_LOW, |
| 77 | }; |
| 78 | |
| 79 | static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = { |
| 80 | .gpio_base = PM8018_GPIO_PM_TO_SYS(1), |
| 81 | }; |
| 82 | |
| 83 | static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = { |
| 84 | .mpp_base = PM8018_MPP_PM_TO_SYS(1), |
| 85 | }; |
| 86 | |
| 87 | static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = { |
| 88 | .rtc_write_enable = false, |
Ashay Jaiswal | db5e6dc | 2011-10-12 11:02:47 +0530 | [diff] [blame] | 89 | .rtc_alarm_powerup = false, |
David Collins | fb88c43 | 2011-08-25 15:12:47 -0700 | [diff] [blame] | 90 | }; |
| 91 | |
| 92 | static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = { |
| 93 | .pull_up = 1, |
Jing Lin | eecdc06 | 2011-11-17 09:47:09 -0800 | [diff] [blame] | 94 | .kpd_trigger_delay_us = 15625, |
David Collins | fb88c43 | 2011-08-25 15:12:47 -0700 | [diff] [blame] | 95 | .wakeup = 1, |
| 96 | }; |
| 97 | |
| 98 | static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = { |
| 99 | .priority = 0, |
| 100 | }; |
| 101 | |
Jay Chokshi | eb5d0d5 | 2011-09-28 17:16:20 -0700 | [diff] [blame] | 102 | #define PM8018_LED_KB_MAX_CURRENT 20 /* I = 20mA */ |
| 103 | #define PM8XXX_LED_PWM_PERIOD_US 1000 |
| 104 | |
| 105 | /** |
| 106 | * PM8XXX_PWM_CHANNEL_NONE shall be used when LED shall not be |
| 107 | * driven using PWM feature. |
| 108 | */ |
| 109 | #define PM8XXX_PWM_CHANNEL_NONE -1 |
| 110 | |
| 111 | static struct led_info pm8018_led_info[] = { |
| 112 | [0] = { |
| 113 | .name = "led:kb", |
| 114 | }, |
| 115 | }; |
| 116 | |
| 117 | static struct led_platform_data pm8018_led_core_pdata = { |
| 118 | .num_leds = ARRAY_SIZE(pm8018_led_info), |
| 119 | .leds = pm8018_led_info, |
| 120 | }; |
| 121 | |
| 122 | static struct pm8xxx_led_config pm8018_led_configs[] = { |
| 123 | [0] = { |
| 124 | .id = PM8XXX_ID_LED_KB_LIGHT, |
| 125 | .mode = PM8XXX_LED_MODE_PWM3, |
| 126 | .max_current = PM8018_LED_KB_MAX_CURRENT, |
| 127 | .pwm_channel = 2, |
| 128 | .pwm_period_us = PM8XXX_LED_PWM_PERIOD_US, |
| 129 | }, |
| 130 | }; |
| 131 | |
| 132 | static struct pm8xxx_led_platform_data pm8xxx_leds_pdata = { |
| 133 | .led_core = &pm8018_led_core_pdata, |
| 134 | .configs = pm8018_led_configs, |
| 135 | .num_configs = ARRAY_SIZE(pm8018_led_configs), |
| 136 | }; |
| 137 | |
Jay Chokshi | dc8028b | 2011-12-01 16:17:34 -0800 | [diff] [blame] | 138 | #ifdef CONFIG_LTC4088_CHARGER |
| 139 | static struct ltc4088_charger_platform_data ltc4088_chg_pdata = { |
| 140 | .gpio_mode_select_d0 = 7, |
| 141 | .gpio_mode_select_d1 = 6, |
| 142 | .gpio_mode_select_d2 = 4, |
| 143 | }; |
| 144 | #endif |
| 145 | |
David Collins | fb88c43 | 2011-08-25 15:12:47 -0700 | [diff] [blame] | 146 | static struct pm8018_platform_data pm8018_platform_data __devinitdata = { |
| 147 | .irq_pdata = &pm8xxx_irq_pdata, |
| 148 | .gpio_pdata = &pm8xxx_gpio_pdata, |
| 149 | .mpp_pdata = &pm8xxx_mpp_pdata, |
| 150 | .rtc_pdata = &pm8xxx_rtc_pdata, |
| 151 | .pwrkey_pdata = &pm8xxx_pwrkey_pdata, |
| 152 | .misc_pdata = &pm8xxx_misc_pdata, |
David Collins | 00b31e6 | 2011-08-31 20:00:10 -0700 | [diff] [blame] | 153 | .regulator_pdatas = msm_pm8018_regulator_pdata, |
Siddartha Mohanadoss | 5f60b45 | 2011-10-05 11:49:00 -0700 | [diff] [blame] | 154 | .adc_pdata = &pm8018_adc_pdata, |
Jay Chokshi | eb5d0d5 | 2011-09-28 17:16:20 -0700 | [diff] [blame] | 155 | .leds_pdata = &pm8xxx_leds_pdata, |
David Collins | fb88c43 | 2011-08-25 15:12:47 -0700 | [diff] [blame] | 156 | }; |
| 157 | |
Kenneth Heitke | af3d3cf | 2011-09-08 11:45:31 -0700 | [diff] [blame] | 158 | static struct msm_ssbi_platform_data msm9615_ssbi_pm8018_pdata __devinitdata = { |
| 159 | .controller_type = MSM_SBI_CTRL_PMIC_ARBITER, |
| 160 | .slave = { |
David Collins | fb88c43 | 2011-08-25 15:12:47 -0700 | [diff] [blame] | 161 | .name = PM8018_CORE_DEV_NAME, |
| 162 | .platform_data = &pm8018_platform_data, |
Kenneth Heitke | af3d3cf | 2011-09-08 11:45:31 -0700 | [diff] [blame] | 163 | }, |
| 164 | }; |
| 165 | |
David Collins | bea297a | 2011-09-28 13:11:14 -0700 | [diff] [blame] | 166 | static struct platform_device msm9615_device_rpm_regulator __devinitdata = { |
| 167 | .name = "rpm-regulator", |
| 168 | .id = -1, |
| 169 | .dev = { |
| 170 | .platform_data = &msm_rpm_regulator_9615_pdata, |
| 171 | }, |
| 172 | }; |
| 173 | |
David Collins | 0f9942a | 2011-10-31 09:47:34 -0700 | [diff] [blame] | 174 | static struct platform_device msm9615_device_ext_2p95v_vreg = { |
| 175 | .name = GPIO_REGULATOR_DEV_NAME, |
| 176 | .id = 18, |
| 177 | .dev = { |
| 178 | .platform_data = |
| 179 | &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_2P95V], |
| 180 | }, |
| 181 | }; |
| 182 | |
Maheshkumar Sivasubramanian | 4923db2 | 2011-09-15 09:28:15 -0600 | [diff] [blame] | 183 | static struct msm_cpuidle_state msm_cstates[] __initdata = { |
| 184 | {0, 0, "C0", "WFI", |
| 185 | MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT}, |
| 186 | |
| 187 | {0, 1, "C1", "STANDALONE_POWER_COLLAPSE", |
| 188 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE}, |
| 189 | |
| 190 | {0, 2, "C2", "POWER_COLLAPSE", |
| 191 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE}, |
| 192 | }; |
| 193 | static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR] = { |
| 194 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = { |
| 195 | .idle_supported = 1, |
| 196 | .suspend_supported = 1, |
| 197 | .idle_enabled = 0, |
| 198 | .suspend_enabled = 0, |
| 199 | }, |
| 200 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = { |
| 201 | .idle_supported = 1, |
| 202 | .suspend_supported = 1, |
| 203 | .idle_enabled = 0, |
| 204 | .suspend_enabled = 0, |
| 205 | }, |
| 206 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = { |
| 207 | .idle_supported = 1, |
| 208 | .suspend_supported = 1, |
| 209 | .idle_enabled = 1, |
| 210 | .suspend_enabled = 1, |
| 211 | }, |
| 212 | }; |
Krishna Konda | dd79446 | 2011-10-01 00:19:29 -0700 | [diff] [blame] | 213 | |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 214 | static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = { |
| 215 | .mode = MSM_PM_BOOT_CONFIG_REMAP_BOOT_ADDR, |
| 216 | .v_addr = MSM_APCS_GLB_BASE + 0x24, |
| 217 | }; |
| 218 | |
Gagan Mac | 7a82764 | 2011-09-22 19:42:21 -0600 | [diff] [blame] | 219 | static void __init msm9615_init_buses(void) |
| 220 | { |
| 221 | #ifdef CONFIG_MSM_BUS_SCALING |
| 222 | msm_bus_rpm_set_mt_mask(); |
| 223 | msm_bus_9615_sys_fabric_pdata.rpm_enabled = 1; |
| 224 | msm_bus_9615_sys_fabric.dev.platform_data = |
| 225 | &msm_bus_9615_sys_fabric_pdata; |
| 226 | msm_bus_def_fab.dev.platform_data = &msm_bus_9615_def_fab_pdata; |
| 227 | #endif |
| 228 | } |
| 229 | |
Harini Jayaraman | 738c931 | 2011-09-08 15:22:38 -0600 | [diff] [blame] | 230 | static struct msm_spi_platform_data msm9615_qup_spi_gsbi3_pdata = { |
| 231 | .max_clock_speed = 24000000, |
| 232 | }; |
| 233 | |
Harini Jayaraman | eba5267 | 2011-09-08 15:13:00 -0600 | [diff] [blame] | 234 | static struct msm_i2c_platform_data msm9615_i2c_qup_gsbi5_pdata = { |
| 235 | .clk_freq = 100000, |
| 236 | .src_clk_rate = 24000000, |
| 237 | }; |
| 238 | |
Amit Blay | 6a8d4f3 | 2011-11-21 10:36:25 +0200 | [diff] [blame] | 239 | #define USB_5V_EN 3 |
| 240 | #define PM_USB_5V_EN PM8018_GPIO_PM_TO_SYS(USB_5V_EN) |
| 241 | |
| 242 | static void msm_hsusb_vbus_power(bool on) |
| 243 | { |
| 244 | int rc; |
| 245 | static bool vbus_is_on; |
| 246 | struct pm_gpio usb_vbus = { |
| 247 | .direction = PM_GPIO_DIR_OUT, |
| 248 | .pull = PM_GPIO_PULL_NO, |
| 249 | .output_buffer = PM_GPIO_OUT_BUF_CMOS, |
| 250 | .output_value = 0, |
| 251 | .vin_sel = 2, |
| 252 | .out_strength = PM_GPIO_STRENGTH_HIGH, |
| 253 | .function = PM_GPIO_FUNC_NORMAL, |
| 254 | .inv_int_pol = 0, |
| 255 | }; |
| 256 | |
| 257 | if (vbus_is_on == on) |
| 258 | return; |
| 259 | |
| 260 | if (on) { |
| 261 | rc = pm8xxx_gpio_config(PM_USB_5V_EN, &usb_vbus); |
| 262 | if (rc) { |
| 263 | pr_err("failed to config usb_5v_en gpio\n"); |
| 264 | return; |
| 265 | } |
| 266 | |
| 267 | rc = gpio_request(PM_USB_5V_EN, |
| 268 | "usb_5v_en"); |
| 269 | if (rc < 0) { |
| 270 | pr_err("failed to request usb_5v_en gpio\n"); |
| 271 | return; |
| 272 | } |
| 273 | |
| 274 | rc = gpio_direction_output(PM_USB_5V_EN, 1); |
| 275 | if (rc) { |
| 276 | pr_err("%s: unable to set_direction for gpio [%d]\n", |
| 277 | __func__, PM_USB_5V_EN); |
| 278 | goto free_usb_5v_en; |
| 279 | } |
| 280 | |
| 281 | vbus_is_on = true; |
| 282 | return; |
| 283 | } |
| 284 | gpio_set_value(PM_USB_5V_EN, 0); |
| 285 | free_usb_5v_en: |
| 286 | gpio_free(PM_USB_5V_EN); |
| 287 | vbus_is_on = false; |
| 288 | } |
| 289 | |
Anji jonnala | a8b8d73 | 2011-12-06 10:03:24 +0530 | [diff] [blame] | 290 | static int shelby_phy_init_seq[] = { |
| 291 | 0x44, 0x80,/* set VBUS valid threshold and |
| 292 | disconnect valid threshold */ |
| 293 | 0x38, 0x81, /* update DC voltage level */ |
| 294 | 0x14, 0x82,/* set preemphasis and rise/fall time */ |
| 295 | 0x13, 0x83,/* set source impedance adjustment */ |
| 296 | -1}; |
| 297 | |
Ofir Cohen | 40a4e86 | 2011-12-08 15:17:52 +0200 | [diff] [blame] | 298 | #define USB_BAM_PHY_BASE 0x12502000 |
| 299 | #define USB_BAM_PHY_SIZE 0x10000 |
| 300 | #define A2_BAM_PHY_BASE 0x124C2000 |
| 301 | static struct usb_bam_pipe_connect msm_usb_bam_connections[4][2] = { |
| 302 | [0][USB_TO_PEER_PERIPHERAL] = { |
| 303 | .src_phy_addr = USB_BAM_PHY_BASE, |
| 304 | .src_pipe_index = 11, |
| 305 | .dst_phy_addr = A2_BAM_PHY_BASE, |
| 306 | .dst_pipe_index = 0, |
Ofir Cohen | 29cd575 | 2011-12-14 17:20:30 +0200 | [diff] [blame] | 307 | .data_fifo_base_offset = 0x1100, |
| 308 | .data_fifo_size = 0x600, |
| 309 | .desc_fifo_base_offset = 0x1700, |
Ofir Cohen | 40a4e86 | 2011-12-08 15:17:52 +0200 | [diff] [blame] | 310 | .desc_fifo_size = 0x300, |
| 311 | }, |
| 312 | [0][PEER_PERIPHERAL_TO_USB] = { |
| 313 | .src_phy_addr = A2_BAM_PHY_BASE, |
| 314 | .src_pipe_index = 1, |
| 315 | .dst_phy_addr = USB_BAM_PHY_BASE, |
| 316 | .dst_pipe_index = 10, |
| 317 | .data_fifo_base_offset = 0xa00, |
Ofir Cohen | 29cd575 | 2011-12-14 17:20:30 +0200 | [diff] [blame] | 318 | .data_fifo_size = 0x600, |
| 319 | .desc_fifo_base_offset = 0x1000, |
Ofir Cohen | 40a4e86 | 2011-12-08 15:17:52 +0200 | [diff] [blame] | 320 | .desc_fifo_size = 0x100, |
| 321 | }, |
| 322 | }; |
| 323 | |
| 324 | static struct msm_usb_bam_platform_data msm_usb_bam_pdata = { |
| 325 | .connections = &msm_usb_bam_connections[0][0], |
| 326 | .usb_bam_phy_base = USB_BAM_PHY_BASE, |
| 327 | .usb_bam_phy_size = USB_BAM_PHY_SIZE, |
| 328 | .usb_bam_num_pipes = 32, |
| 329 | }; |
| 330 | |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 331 | static struct msm_otg_platform_data msm_otg_pdata = { |
Amit Blay | 6a8d4f3 | 2011-11-21 10:36:25 +0200 | [diff] [blame] | 332 | .mode = USB_OTG, |
| 333 | .otg_control = OTG_PHY_CONTROL, |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 334 | .phy_type = SNPS_28NM_INTEGRATED_PHY, |
Amit Blay | 6a8d4f3 | 2011-11-21 10:36:25 +0200 | [diff] [blame] | 335 | .pclk_src_name = "dfab_usb_hs_clk", |
| 336 | .vbus_power = msm_hsusb_vbus_power, |
Ofir Cohen | 4da266f | 2012-01-03 10:19:29 +0200 | [diff] [blame^] | 337 | .disable_reset_on_disconnect = true, |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 338 | }; |
| 339 | |
| 340 | static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum) |
| 341 | { |
| 342 | return 0; |
| 343 | } |
| 344 | |
| 345 | static struct android_usb_platform_data android_usb_pdata = { |
| 346 | .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num, |
| 347 | }; |
| 348 | |
| 349 | static struct platform_device android_usb_device = { |
| 350 | .name = "android_usb", |
| 351 | .id = -1, |
| 352 | .dev = { |
| 353 | .platform_data = &android_usb_pdata, |
| 354 | }, |
| 355 | }; |
| 356 | |
Rohit Vaswani | 149f0a7 | 2011-11-09 15:21:28 -0800 | [diff] [blame] | 357 | static struct platform_device msm_wlan_ar6000_pm_device = { |
| 358 | .name = "wlan_ar6000_pm_dev", |
| 359 | .id = -1, |
| 360 | }; |
| 361 | |
| 362 | static int __init msm9615_init_ar6000pm(void) |
| 363 | { |
| 364 | return platform_device_register(&msm_wlan_ar6000_pm_device); |
| 365 | } |
| 366 | |
Jay Chokshi | dc8028b | 2011-12-01 16:17:34 -0800 | [diff] [blame] | 367 | #ifdef CONFIG_LTC4088_CHARGER |
| 368 | static struct platform_device msm_device_charger = { |
| 369 | .name = LTC4088_CHARGER_DEV_NAME, |
| 370 | .id = -1, |
| 371 | .dev = { |
| 372 | .platform_data = <c4088_chg_pdata, |
| 373 | }, |
| 374 | }; |
| 375 | #endif |
| 376 | |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 377 | static struct platform_device *common_devices[] = { |
| 378 | &msm9615_device_dmov, |
| 379 | &msm_device_smd, |
Jay Chokshi | dc8028b | 2011-12-01 16:17:34 -0800 | [diff] [blame] | 380 | #ifdef CONFIG_LTC4088_CHARGER |
| 381 | &msm_device_charger, |
| 382 | #endif |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 383 | &msm_device_otg, |
| 384 | &msm_device_gadget_peripheral, |
Amit Blay | 6a8d4f3 | 2011-11-21 10:36:25 +0200 | [diff] [blame] | 385 | &msm_device_hsusb_host, |
Ofir Cohen | 40a4e86 | 2011-12-08 15:17:52 +0200 | [diff] [blame] | 386 | &msm_device_usb_bam, |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 387 | &android_usb_device, |
| 388 | &msm9615_device_uart_gsbi4, |
David Collins | 0f9942a | 2011-10-31 09:47:34 -0700 | [diff] [blame] | 389 | &msm9615_device_ext_2p95v_vreg, |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 390 | &msm9615_device_ssbi_pmic1, |
| 391 | &msm9615_device_qup_i2c_gsbi5, |
| 392 | &msm9615_device_qup_spi_gsbi3, |
| 393 | &msm_device_sps, |
| 394 | &msm9615_device_tsens, |
| 395 | &msm_device_nand, |
Eric Holmberg | 0c96e70 | 2011-11-08 18:04:31 -0700 | [diff] [blame] | 396 | &msm_device_bam_dmux, |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 397 | &msm_rpm_device, |
| 398 | #ifdef CONFIG_HW_RANDOM_MSM |
| 399 | &msm_device_rng, |
| 400 | #endif |
| 401 | |
| 402 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 403 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) |
Ramesh Masavarapu | aa28b5b | 2011-10-21 10:26:03 -0700 | [diff] [blame] | 404 | &msm9615_qcrypto_device, |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 405 | #endif |
| 406 | |
| 407 | #if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 408 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
Ramesh Masavarapu | aa28b5b | 2011-10-21 10:26:03 -0700 | [diff] [blame] | 409 | &msm9615_qcedev_device, |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 410 | #endif |
Jeff Ohlstein | 7e66855 | 2011-10-06 16:17:25 -0700 | [diff] [blame] | 411 | &msm9615_device_watchdog, |
Gagan Mac | 7a82764 | 2011-09-22 19:42:21 -0600 | [diff] [blame] | 412 | &msm_bus_9615_sys_fabric, |
| 413 | &msm_bus_def_fab, |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 414 | }; |
| 415 | |
Harini Jayaraman | eba5267 | 2011-09-08 15:13:00 -0600 | [diff] [blame] | 416 | static void __init msm9615_i2c_init(void) |
| 417 | { |
| 418 | msm9615_device_qup_i2c_gsbi5.dev.platform_data = |
| 419 | &msm9615_i2c_qup_gsbi5_pdata; |
| 420 | } |
| 421 | |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 422 | static void __init msm9615_reserve(void) |
| 423 | { |
| 424 | msm_pm_boot_pdata.p_addr = memblock_alloc(SZ_8, SZ_64K); |
| 425 | } |
| 426 | |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 427 | static void __init msm9615_common_init(void) |
| 428 | { |
| 429 | msm9615_device_init(); |
Rohit Vaswani | a681589 | 2011-12-15 20:20:39 -0800 | [diff] [blame] | 430 | msm9615_init_gpiomux(); |
Harini Jayaraman | eba5267 | 2011-09-08 15:13:00 -0600 | [diff] [blame] | 431 | msm9615_i2c_init(); |
David Collins | 00b31e6 | 2011-08-31 20:00:10 -0700 | [diff] [blame] | 432 | regulator_suppress_info_printing(); |
David Collins | bea297a | 2011-09-28 13:11:14 -0700 | [diff] [blame] | 433 | platform_device_register(&msm9615_device_rpm_regulator); |
Gagan Mac | 7a82764 | 2011-09-22 19:42:21 -0600 | [diff] [blame] | 434 | msm_clock_init(&msm9615_clock_init_data); |
| 435 | msm9615_init_buses(); |
Harini Jayaraman | 738c931 | 2011-09-08 15:22:38 -0600 | [diff] [blame] | 436 | msm9615_device_qup_spi_gsbi3.dev.platform_data = |
| 437 | &msm9615_qup_spi_gsbi3_pdata; |
Kenneth Heitke | af3d3cf | 2011-09-08 11:45:31 -0700 | [diff] [blame] | 438 | msm9615_device_ssbi_pmic1.dev.platform_data = |
| 439 | &msm9615_ssbi_pm8018_pdata; |
David Collins | 00b31e6 | 2011-08-31 20:00:10 -0700 | [diff] [blame] | 440 | pm8018_platform_data.num_regulators = msm_pm8018_regulator_pdata_len; |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 441 | |
| 442 | msm_device_otg.dev.platform_data = &msm_otg_pdata; |
Anji jonnala | a8b8d73 | 2011-12-06 10:03:24 +0530 | [diff] [blame] | 443 | msm_otg_pdata.phy_init_seq = shelby_phy_init_seq; |
Ofir Cohen | 40a4e86 | 2011-12-08 15:17:52 +0200 | [diff] [blame] | 444 | msm_device_usb_bam.dev.platform_data = &msm_usb_bam_pdata; |
Rohit Vaswani | 0966687 | 2011-08-23 17:41:54 -0700 | [diff] [blame] | 445 | platform_add_devices(common_devices, ARRAY_SIZE(common_devices)); |
Krishna Konda | dd79446 | 2011-10-01 00:19:29 -0700 | [diff] [blame] | 446 | |
Vikram Mulukutla | b5e1cda | 2011-10-04 16:17:22 -0700 | [diff] [blame] | 447 | acpuclk_init(&acpuclk_9615_soc_data); |
| 448 | |
Rohit Vaswani | 149f0a7 | 2011-11-09 15:21:28 -0800 | [diff] [blame] | 449 | /* Ensure ar6000pm device is registered before MMC/SDC */ |
| 450 | msm9615_init_ar6000pm(); |
| 451 | |
Krishna Konda | dd79446 | 2011-10-01 00:19:29 -0700 | [diff] [blame] | 452 | msm9615_init_mmc(); |
Maheshkumar Sivasubramanian | 4923db2 | 2011-09-15 09:28:15 -0600 | [diff] [blame] | 453 | msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data)); |
| 454 | msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ); |
| 455 | msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates), |
| 456 | msm_pm_data); |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 457 | BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata)); |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 458 | } |
| 459 | |
| 460 | static void __init msm9615_cdp_init(void) |
| 461 | { |
| 462 | msm9615_common_init(); |
| 463 | } |
| 464 | |
| 465 | static void __init msm9615_mtp_init(void) |
| 466 | { |
| 467 | msm9615_common_init(); |
| 468 | } |
| 469 | |
| 470 | MACHINE_START(MSM9615_CDP, "QCT MSM9615 CDP") |
| 471 | .map_io = msm9615_map_io, |
| 472 | .init_irq = msm9615_init_irq, |
Marc Zyngier | 89bdafd1 | 2011-12-22 11:39:20 +0530 | [diff] [blame] | 473 | .handle_irq = gic_handle_irq, |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 474 | .timer = &msm_timer, |
| 475 | .init_machine = msm9615_cdp_init, |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 476 | .reserve = msm9615_reserve, |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 477 | MACHINE_END |
| 478 | |
| 479 | MACHINE_START(MSM9615_MTP, "QCT MSM9615 MTP") |
| 480 | .map_io = msm9615_map_io, |
| 481 | .init_irq = msm9615_init_irq, |
Marc Zyngier | 89bdafd1 | 2011-12-22 11:39:20 +0530 | [diff] [blame] | 482 | .handle_irq = gic_handle_irq, |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 483 | .timer = &msm_timer, |
| 484 | .init_machine = msm9615_mtp_init, |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 485 | .reserve = msm9615_reserve, |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 486 | MACHINE_END |