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