Sravan Kumar Ambapuram | b22cf4d | 2012-01-02 21:45:04 +0530 | [diff] [blame] | 1 | /* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved. |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [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 | #include <linux/kernel.h> |
| 14 | #include <linux/init.h> |
| 15 | #include <linux/gpio_event.h> |
Pankaj Kumar | 6f84174 | 2011-10-10 15:52:14 +0530 | [diff] [blame] | 16 | #include <linux/usb/android.h> |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 17 | #include <linux/platform_device.h> |
| 18 | #include <linux/io.h> |
| 19 | #include <linux/gpio.h> |
| 20 | #include <linux/mtd/nand.h> |
| 21 | #include <linux/mtd/partitions.h> |
| 22 | #include <linux/i2c.h> |
| 23 | #include <linux/android_pmem.h> |
| 24 | #include <linux/bootmem.h> |
| 25 | #include <linux/mfd/marimba.h> |
| 26 | #include <linux/power_supply.h> |
Pankaj Kumar | 3cec058 | 2011-11-18 11:13:29 +0530 | [diff] [blame] | 27 | #include <linux/regulator/consumer.h> |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 28 | #include <linux/memblock.h> |
Mohan Pallaka | 5afe985 | 2012-01-12 23:12:06 +0530 | [diff] [blame] | 29 | #include <linux/input/ft5x06_ts.h> |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 30 | #include <asm/mach/mmc.h> |
| 31 | #include <asm/mach-types.h> |
| 32 | #include <asm/mach/arch.h> |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 33 | #include <asm/hardware/gic.h> |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 34 | #include <mach/board.h> |
| 35 | #include <mach/msm_iomap.h> |
| 36 | #include <mach/msm_hsusb.h> |
| 37 | #include <mach/rpc_hsusb.h> |
| 38 | #include <mach/rpc_pmapp.h> |
| 39 | #include <mach/usbdiag.h> |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 40 | #include <mach/msm_memtypes.h> |
| 41 | #include <mach/msm_serial_hs.h> |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 42 | #include <mach/pmic.h> |
| 43 | #include <mach/socinfo.h> |
| 44 | #include <mach/vreg.h> |
| 45 | #include <mach/rpc_pmapp.h> |
| 46 | #include <mach/msm_battery.h> |
| 47 | #include <mach/rpc_server_handset.h> |
| 48 | #include <mach/socinfo.h> |
Pankaj Kumar | 27c0264 | 2011-09-22 15:55:55 +0530 | [diff] [blame] | 49 | #include "board-msm7x27a-regulator.h" |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 50 | #include "devices.h" |
| 51 | #include "devices-msm7x2xa.h" |
Matt Wagantall | 7cca464 | 2012-02-01 16:43:24 -0800 | [diff] [blame] | 52 | #include "pm.h" |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 53 | #include "timer.h" |
Murali Nalajala | a182784 | 2011-11-13 14:12:39 +0530 | [diff] [blame] | 54 | #include "pm-boot.h" |
Pankaj Kumar | 3cec058 | 2011-11-18 11:13:29 +0530 | [diff] [blame] | 55 | #include "board-msm7x27a-regulator.h" |
Chintan Pandya | cf467fc | 2011-12-01 17:11:11 +0530 | [diff] [blame] | 56 | #include "board-msm7627a.h" |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 57 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 58 | static struct platform_device msm_wlan_ar6000_pm_device = { |
| 59 | .name = "wlan_ar6000_pm_dev", |
| 60 | .id = -1, |
| 61 | }; |
| 62 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 63 | static struct msm_gpio qup_i2c_gpios_io[] = { |
| 64 | { GPIO_CFG(60, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 65 | "qup_scl" }, |
| 66 | { GPIO_CFG(61, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 67 | "qup_sda" }, |
| 68 | { GPIO_CFG(131, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 69 | "qup_scl" }, |
| 70 | { GPIO_CFG(132, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 71 | "qup_sda" }, |
| 72 | }; |
| 73 | |
| 74 | static struct msm_gpio qup_i2c_gpios_hw[] = { |
| 75 | { GPIO_CFG(60, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 76 | "qup_scl" }, |
| 77 | { GPIO_CFG(61, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 78 | "qup_sda" }, |
| 79 | { GPIO_CFG(131, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 80 | "qup_scl" }, |
| 81 | { GPIO_CFG(132, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 82 | "qup_sda" }, |
| 83 | }; |
| 84 | |
| 85 | static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type) |
| 86 | { |
| 87 | int rc; |
| 88 | |
| 89 | if (adap_id < 0 || adap_id > 1) |
| 90 | return; |
| 91 | |
| 92 | /* Each adapter gets 2 lines from the table */ |
| 93 | if (config_type) |
| 94 | rc = msm_gpios_request_enable(&qup_i2c_gpios_hw[adap_id*2], 2); |
| 95 | else |
| 96 | rc = msm_gpios_request_enable(&qup_i2c_gpios_io[adap_id*2], 2); |
| 97 | if (rc < 0) |
| 98 | pr_err("QUP GPIO request/enable failed: %d\n", rc); |
| 99 | } |
| 100 | |
| 101 | static struct msm_i2c_platform_data msm_gsbi0_qup_i2c_pdata = { |
| 102 | .clk_freq = 100000, |
| 103 | .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config, |
| 104 | }; |
| 105 | |
| 106 | static struct msm_i2c_platform_data msm_gsbi1_qup_i2c_pdata = { |
| 107 | .clk_freq = 100000, |
| 108 | .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config, |
| 109 | }; |
| 110 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 111 | static struct android_usb_platform_data android_usb_pdata = { |
Pankaj Kumar | 6f84174 | 2011-10-10 15:52:14 +0530 | [diff] [blame] | 112 | .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num, |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 113 | }; |
| 114 | |
| 115 | static struct platform_device android_usb_device = { |
| 116 | .name = "android_usb", |
| 117 | .id = -1, |
| 118 | .dev = { |
| 119 | .platform_data = &android_usb_pdata, |
| 120 | }, |
| 121 | }; |
| 122 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 123 | #ifdef CONFIG_USB_EHCI_MSM_72K |
| 124 | static void msm_hsusb_vbus_power(unsigned phy_info, int on) |
| 125 | { |
| 126 | int rc = 0; |
| 127 | unsigned gpio; |
| 128 | |
Chintan Pandya | 4076270 | 2011-12-06 13:47:06 +0530 | [diff] [blame] | 129 | gpio = QRD_GPIO_HOST_VBUS_EN; |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 130 | |
| 131 | rc = gpio_request(gpio, "i2c_host_vbus_en"); |
| 132 | if (rc < 0) { |
| 133 | pr_err("failed to request %d GPIO\n", gpio); |
| 134 | return; |
| 135 | } |
| 136 | gpio_direction_output(gpio, !!on); |
| 137 | gpio_set_value_cansleep(gpio, !!on); |
| 138 | gpio_free(gpio); |
| 139 | } |
| 140 | |
| 141 | static struct msm_usb_host_platform_data msm_usb_host_pdata = { |
| 142 | .phy_info = (USB_PHY_INTEGRATED | USB_PHY_MODEL_45NM), |
| 143 | }; |
| 144 | |
| 145 | static void __init msm7627a_init_host(void) |
| 146 | { |
| 147 | msm_add_host(0, &msm_usb_host_pdata); |
| 148 | } |
| 149 | #endif |
| 150 | |
| 151 | #ifdef CONFIG_USB_MSM_OTG_72K |
| 152 | static int hsusb_rpc_connect(int connect) |
| 153 | { |
| 154 | if (connect) |
| 155 | return msm_hsusb_rpc_connect(); |
| 156 | else |
| 157 | return msm_hsusb_rpc_close(); |
| 158 | } |
| 159 | |
Pankaj Kumar | 27c0264 | 2011-09-22 15:55:55 +0530 | [diff] [blame] | 160 | static struct regulator *reg_hsusb; |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 161 | static int msm_hsusb_ldo_init(int init) |
| 162 | { |
Pankaj Kumar | 27c0264 | 2011-09-22 15:55:55 +0530 | [diff] [blame] | 163 | int rc = 0; |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 164 | |
Pankaj Kumar | 27c0264 | 2011-09-22 15:55:55 +0530 | [diff] [blame] | 165 | if (init) { |
| 166 | reg_hsusb = regulator_get(NULL, "usb"); |
| 167 | if (IS_ERR(reg_hsusb)) { |
| 168 | rc = PTR_ERR(reg_hsusb); |
| 169 | pr_err("%s: could not get regulator: %d\n", |
| 170 | __func__, rc); |
| 171 | goto out; |
| 172 | } |
| 173 | |
| 174 | rc = regulator_set_voltage(reg_hsusb, 3300000, 3300000); |
| 175 | if (rc) { |
| 176 | pr_err("%s: could not set voltage: %d\n", |
| 177 | __func__, rc); |
| 178 | goto reg_free; |
| 179 | } |
| 180 | |
| 181 | return 0; |
| 182 | } |
| 183 | /* else fall through */ |
| 184 | reg_free: |
| 185 | regulator_put(reg_hsusb); |
| 186 | out: |
| 187 | reg_hsusb = NULL; |
| 188 | return rc; |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 189 | } |
| 190 | |
| 191 | static int msm_hsusb_ldo_enable(int enable) |
| 192 | { |
| 193 | static int ldo_status; |
| 194 | |
Pankaj Kumar | 27c0264 | 2011-09-22 15:55:55 +0530 | [diff] [blame] | 195 | if (IS_ERR_OR_NULL(reg_hsusb)) |
| 196 | return reg_hsusb ? PTR_ERR(reg_hsusb) : -ENODEV; |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 197 | |
| 198 | if (ldo_status == enable) |
| 199 | return 0; |
| 200 | |
| 201 | ldo_status = enable; |
| 202 | |
Pankaj Kumar | 27c0264 | 2011-09-22 15:55:55 +0530 | [diff] [blame] | 203 | return enable ? |
| 204 | regulator_enable(reg_hsusb) : |
| 205 | regulator_disable(reg_hsusb); |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 206 | } |
| 207 | |
| 208 | #ifndef CONFIG_USB_EHCI_MSM_72K |
| 209 | static int msm_hsusb_pmic_notif_init(void (*callback)(int online), int init) |
| 210 | { |
| 211 | int ret = 0; |
| 212 | |
| 213 | if (init) |
| 214 | ret = msm_pm_app_rpc_init(callback); |
| 215 | else |
| 216 | msm_pm_app_rpc_deinit(callback); |
| 217 | |
| 218 | return ret; |
| 219 | } |
| 220 | #endif |
| 221 | |
| 222 | static struct msm_otg_platform_data msm_otg_pdata = { |
| 223 | #ifndef CONFIG_USB_EHCI_MSM_72K |
| 224 | .pmic_vbus_notif_init = msm_hsusb_pmic_notif_init, |
| 225 | #else |
| 226 | .vbus_power = msm_hsusb_vbus_power, |
| 227 | #endif |
| 228 | .rpc_connect = hsusb_rpc_connect, |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 229 | .pemp_level = PRE_EMPHASIS_WITH_20_PERCENT, |
| 230 | .cdr_autoreset = CDR_AUTO_RESET_DISABLE, |
| 231 | .drv_ampl = HS_DRV_AMPLITUDE_DEFAULT, |
| 232 | .se1_gating = SE1_GATING_DISABLE, |
| 233 | .ldo_init = msm_hsusb_ldo_init, |
| 234 | .ldo_enable = msm_hsusb_ldo_enable, |
| 235 | .chg_init = hsusb_chg_init, |
| 236 | .chg_connected = hsusb_chg_connected, |
| 237 | .chg_vbus_draw = hsusb_chg_vbus_draw, |
| 238 | }; |
| 239 | #endif |
| 240 | |
| 241 | static struct msm_hsusb_gadget_platform_data msm_gadget_pdata = { |
| 242 | .is_phy_status_timer_on = 1, |
| 243 | }; |
| 244 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 245 | #ifdef CONFIG_SERIAL_MSM_HS |
| 246 | static struct msm_serial_hs_platform_data msm_uart_dm1_pdata = { |
| 247 | .inject_rx_on_wakeup = 1, |
| 248 | .rx_to_inject = 0xFD, |
| 249 | }; |
| 250 | #endif |
| 251 | static struct msm_pm_platform_data msm7627a_pm_data[MSM_PM_SLEEP_MODE_NR] = { |
| 252 | [MSM_PM_SLEEP_MODE_POWER_COLLAPSE] = { |
| 253 | .idle_supported = 1, |
| 254 | .suspend_supported = 1, |
| 255 | .idle_enabled = 1, |
| 256 | .suspend_enabled = 1, |
| 257 | .latency = 16000, |
| 258 | .residency = 20000, |
| 259 | }, |
| 260 | [MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN] = { |
| 261 | .idle_supported = 1, |
| 262 | .suspend_supported = 1, |
| 263 | .idle_enabled = 1, |
| 264 | .suspend_enabled = 1, |
| 265 | .latency = 12000, |
| 266 | .residency = 20000, |
| 267 | }, |
| 268 | [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT] = { |
| 269 | .idle_supported = 1, |
| 270 | .suspend_supported = 1, |
| 271 | .idle_enabled = 0, |
| 272 | .suspend_enabled = 1, |
| 273 | .latency = 2000, |
| 274 | .residency = 0, |
| 275 | }, |
| 276 | [MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT] = { |
| 277 | .idle_supported = 1, |
| 278 | .suspend_supported = 1, |
| 279 | .idle_enabled = 1, |
| 280 | .suspend_enabled = 1, |
| 281 | .latency = 2, |
| 282 | .residency = 0, |
| 283 | }, |
| 284 | }; |
| 285 | |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 286 | static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = { |
Sravan Kumar Ambapuram | b22cf4d | 2012-01-02 21:45:04 +0530 | [diff] [blame] | 287 | .mode = MSM_PM_BOOT_CONFIG_RESET_VECTOR_PHYS, |
| 288 | .p_addr = 0, |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 289 | }; |
| 290 | |
Murali Nalajala | 4c996be | 2012-03-12 17:05:41 +0530 | [diff] [blame] | 291 | /* 8625 PM platform data */ |
| 292 | static struct msm_pm_platform_data msm8625_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = { |
| 293 | /* CORE0 entries */ |
| 294 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = { |
| 295 | .idle_supported = 1, |
| 296 | .suspend_supported = 1, |
| 297 | .idle_enabled = 0, |
| 298 | .suspend_enabled = 0, |
| 299 | .latency = 16000, |
| 300 | .residency = 20000, |
| 301 | }, |
| 302 | |
| 303 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN)] = { |
| 304 | .idle_supported = 1, |
| 305 | .suspend_supported = 1, |
| 306 | .idle_enabled = 0, |
| 307 | .suspend_enabled = 0, |
| 308 | .latency = 12000, |
| 309 | .residency = 20000, |
| 310 | }, |
| 311 | |
| 312 | /* picked latency & redisdency values from 7x30 */ |
| 313 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = { |
| 314 | .idle_supported = 1, |
| 315 | .suspend_supported = 1, |
| 316 | .idle_enabled = 0, |
| 317 | .suspend_enabled = 0, |
| 318 | .latency = 500, |
| 319 | .residency = 6000, |
| 320 | }, |
| 321 | |
| 322 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = { |
| 323 | .idle_supported = 1, |
| 324 | .suspend_supported = 1, |
| 325 | .idle_enabled = 1, |
| 326 | .suspend_enabled = 1, |
| 327 | .latency = 2, |
| 328 | .residency = 10, |
| 329 | }, |
| 330 | |
| 331 | /* picked latency & redisdency values from 7x30 */ |
| 332 | [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = { |
| 333 | .idle_supported = 1, |
| 334 | .suspend_supported = 1, |
| 335 | .idle_enabled = 0, |
| 336 | .suspend_enabled = 0, |
| 337 | .latency = 500, |
| 338 | .residency = 6000, |
| 339 | }, |
| 340 | |
| 341 | [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = { |
| 342 | .idle_supported = 1, |
| 343 | .suspend_supported = 1, |
| 344 | .idle_enabled = 1, |
| 345 | .suspend_enabled = 1, |
| 346 | .latency = 2, |
| 347 | .residency = 10, |
| 348 | }, |
| 349 | |
| 350 | }; |
| 351 | |
| 352 | static struct msm_pm_boot_platform_data msm_pm_8625_boot_pdata __initdata = { |
| 353 | .mode = MSM_PM_BOOT_CONFIG_REMAP_BOOT_ADDR, |
| 354 | .v_addr = MSM_CFG_CTL_BASE, |
| 355 | }; |
| 356 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 357 | static u32 msm_calculate_batt_capacity(u32 current_voltage); |
| 358 | |
| 359 | static struct msm_psy_batt_pdata msm_psy_batt_data = { |
| 360 | .voltage_min_design = 2800, |
| 361 | .voltage_max_design = 4300, |
| 362 | .avail_chg_sources = AC_CHG | USB_CHG , |
| 363 | .batt_technology = POWER_SUPPLY_TECHNOLOGY_LION, |
| 364 | .calculate_capacity = &msm_calculate_batt_capacity, |
| 365 | }; |
| 366 | |
| 367 | static u32 msm_calculate_batt_capacity(u32 current_voltage) |
| 368 | { |
| 369 | u32 low_voltage = msm_psy_batt_data.voltage_min_design; |
| 370 | u32 high_voltage = msm_psy_batt_data.voltage_max_design; |
| 371 | |
| 372 | return (current_voltage - low_voltage) * 100 |
| 373 | / (high_voltage - low_voltage); |
| 374 | } |
| 375 | |
| 376 | static struct platform_device msm_batt_device = { |
| 377 | .name = "msm-battery", |
| 378 | .id = -1, |
| 379 | .dev.platform_data = &msm_psy_batt_data, |
| 380 | }; |
| 381 | |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 382 | static struct platform_device *common_devices[] __initdata = { |
| 383 | &android_usb_device, |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 384 | &msm_batt_device, |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 385 | &asoc_msm_pcm, |
| 386 | &asoc_msm_dai0, |
| 387 | &asoc_msm_dai1, |
| 388 | }; |
| 389 | |
| 390 | static struct platform_device *qrd7627a_devices[] __initdata = { |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 391 | &msm_device_dmov, |
| 392 | &msm_device_smd, |
| 393 | &msm_device_uart1, |
| 394 | &msm_device_uart_dm1, |
| 395 | &msm_gsbi0_qup_i2c_device, |
| 396 | &msm_gsbi1_qup_i2c_device, |
| 397 | &msm_device_otg, |
| 398 | &msm_device_gadget_peripheral, |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 399 | &msm_kgsl_3d0, |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 400 | }; |
| 401 | |
Chintan Pandya | b1bad0e | 2012-02-06 19:04:51 +0530 | [diff] [blame] | 402 | static struct platform_device *qrd3_devices[] __initdata = { |
| 403 | &msm_device_nand, |
| 404 | }; |
| 405 | |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 406 | static struct platform_device *msm8625_evb_devices[] __initdata = { |
| 407 | &msm8625_device_dmov, |
| 408 | &msm8625_device_smd, |
| 409 | &msm8625_gsbi0_qup_i2c_device, |
| 410 | &msm8625_gsbi1_qup_i2c_device, |
| 411 | &msm8625_device_uart1, |
Ram Mohan Korukonda | 5ee9fb8 | 2012-03-09 12:10:01 +0530 | [diff] [blame] | 412 | &msm8625_device_uart_dm1, |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 413 | &msm8625_device_otg, |
| 414 | &msm8625_device_gadget_peripheral, |
Aparna Mallavarapu | d95d8fc | 2012-03-08 12:07:37 +0530 | [diff] [blame] | 415 | &msm8625_kgsl_3d0, |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 416 | }; |
| 417 | |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 418 | static void __init msm7627a_device_i2c_init(void) |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 419 | { |
| 420 | msm_gsbi0_qup_i2c_device.dev.platform_data = &msm_gsbi0_qup_i2c_pdata; |
| 421 | msm_gsbi1_qup_i2c_device.dev.platform_data = &msm_gsbi1_qup_i2c_pdata; |
| 422 | } |
| 423 | |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 424 | static void __init msm8625_device_i2c_init(void) |
| 425 | { |
| 426 | msm8625_gsbi0_qup_i2c_device.dev.platform_data |
| 427 | = &msm_gsbi0_qup_i2c_pdata; |
| 428 | msm8625_gsbi1_qup_i2c_device.dev.platform_data |
| 429 | = &msm_gsbi1_qup_i2c_pdata; |
| 430 | } |
| 431 | |
Pankaj Kumar | 3cec058 | 2011-11-18 11:13:29 +0530 | [diff] [blame] | 432 | static struct platform_device msm_proccomm_regulator_dev = { |
| 433 | .name = PROCCOMM_REGULATOR_DEV_NAME, |
| 434 | .id = -1, |
| 435 | .dev = { |
| 436 | .platform_data = &msm7x27a_proccomm_regulator_data |
| 437 | } |
| 438 | }; |
| 439 | |
| 440 | static void __init msm7627a_init_regulators(void) |
| 441 | { |
| 442 | int rc = platform_device_register(&msm_proccomm_regulator_dev); |
| 443 | if (rc) |
| 444 | pr_err("%s: could not register regulator device: %d\n", |
| 445 | __func__, rc); |
| 446 | } |
| 447 | |
Santosh Sajjan | 374d659 | 2012-01-19 23:16:46 +0530 | [diff] [blame] | 448 | static int __init msm_qrd_init_ar6000pm(void) |
| 449 | { |
| 450 | msm_wlan_ar6000_pm_device.dev.platform_data = &ar600x_wlan_power; |
| 451 | return platform_device_register(&msm_wlan_ar6000_pm_device); |
| 452 | } |
| 453 | |
Taniya Das | e380a2d | 2012-03-09 13:02:41 +0530 | [diff] [blame] | 454 | static void __init msm_add_footswitch_devices(void) |
| 455 | { |
| 456 | platform_add_devices(msm_footswitch_devices, |
| 457 | msm_num_footswitch_devices); |
| 458 | } |
| 459 | |
Chintan Pandya | b1bad0e | 2012-02-06 19:04:51 +0530 | [diff] [blame] | 460 | static void add_platform_devices(void) |
| 461 | { |
Taniya Das | bd09654 | 2012-03-15 17:43:45 +0530 | [diff] [blame] | 462 | if (machine_is_msm8625_evb() || machine_is_msm8625_qrd7()) { |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 463 | platform_add_devices(msm8625_evb_devices, |
| 464 | ARRAY_SIZE(msm8625_evb_devices)); |
Aparna Mallavarapu | beafcbc | 2012-03-13 16:57:39 +0530 | [diff] [blame] | 465 | platform_add_devices(qrd3_devices, |
Taniya Das | bd09654 | 2012-03-15 17:43:45 +0530 | [diff] [blame] | 466 | ARRAY_SIZE(qrd3_devices)); |
Aparna Mallavarapu | beafcbc | 2012-03-13 16:57:39 +0530 | [diff] [blame] | 467 | } else { |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 468 | platform_add_devices(qrd7627a_devices, |
| 469 | ARRAY_SIZE(qrd7627a_devices)); |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 470 | } |
Taniya Das | bd09654 | 2012-03-15 17:43:45 +0530 | [diff] [blame] | 471 | |
| 472 | if (machine_is_msm7627a_qrd3()) |
| 473 | platform_add_devices(qrd3_devices, |
| 474 | ARRAY_SIZE(qrd3_devices)); |
| 475 | |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 476 | platform_add_devices(common_devices, |
| 477 | ARRAY_SIZE(common_devices)); |
Chintan Pandya | b1bad0e | 2012-02-06 19:04:51 +0530 | [diff] [blame] | 478 | } |
| 479 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 480 | #define UART1DM_RX_GPIO 45 |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 481 | static void __init qrd7627a_uart1dm_config(void) |
| 482 | { |
| 483 | msm_uart_dm1_pdata.wakeup_irq = gpio_to_irq(UART1DM_RX_GPIO); |
| 484 | if (cpu_is_msm8625()) |
| 485 | msm8625_device_uart_dm1.dev.platform_data = |
| 486 | &msm_uart_dm1_pdata; |
| 487 | else |
| 488 | msm_device_uart_dm1.dev.platform_data = &msm_uart_dm1_pdata; |
| 489 | } |
| 490 | |
| 491 | static void __init qrd7627a_otg_gadget(void) |
| 492 | { |
| 493 | msm_otg_pdata.swfi_latency = msm7627a_pm_data |
| 494 | [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].latency; |
| 495 | |
| 496 | if (cpu_is_msm8625()) { |
| 497 | msm8625_device_otg.dev.platform_data = &msm_otg_pdata; |
| 498 | msm8625_device_gadget_peripheral.dev.platform_data = |
| 499 | &msm_gadget_pdata; |
| 500 | |
| 501 | } else { |
| 502 | msm_device_otg.dev.platform_data = &msm_otg_pdata; |
| 503 | msm_device_gadget_peripheral.dev.platform_data = |
| 504 | &msm_gadget_pdata; |
| 505 | } |
| 506 | } |
| 507 | |
Taniya Das | bd09654 | 2012-03-15 17:43:45 +0530 | [diff] [blame] | 508 | static void __init msm_pm_init(void) |
| 509 | { |
Taniya Das | bd09654 | 2012-03-15 17:43:45 +0530 | [diff] [blame] | 510 | |
Aparna Mallavarapu | 6d969eb | 2012-04-03 15:10:25 +0530 | [diff] [blame^] | 511 | if (!cpu_is_msm8625()) { |
Taniya Das | bd09654 | 2012-03-15 17:43:45 +0530 | [diff] [blame] | 512 | msm_pm_set_platform_data(msm7627a_pm_data, |
| 513 | ARRAY_SIZE(msm7627a_pm_data)); |
| 514 | BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata)); |
| 515 | } else { |
| 516 | msm_pm_set_platform_data(msm8625_pm_data, |
| 517 | ARRAY_SIZE(msm8625_pm_data)); |
| 518 | BUG_ON(msm_pm_boot_init(&msm_pm_8625_boot_pdata)); |
| 519 | msm8x25_spm_device_init(); |
| 520 | } |
| 521 | } |
| 522 | |
Chintan Pandya | 12ec56a | 2012-03-13 15:47:12 +0530 | [diff] [blame] | 523 | static void __init qrd8625_reserve(void) |
| 524 | { |
| 525 | memblock_remove(MSM8625_SECONDARY_PHYS, SZ_8); |
| 526 | qrd7627a_reserve(); |
| 527 | memblock_remove(MSM8625_WARM_BOOT_PHYS, SZ_32); |
| 528 | msm_pm_8625_boot_pdata.p_addr = memblock_alloc(SZ_8, SZ_64K); |
| 529 | } |
| 530 | |
Taniya Das | c868a2e | 2012-01-03 10:18:47 +0530 | [diff] [blame] | 531 | static void __init msm_qrd_init(void) |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 532 | { |
| 533 | msm7x2x_misc_init(); |
Pankaj Kumar | 3cec058 | 2011-11-18 11:13:29 +0530 | [diff] [blame] | 534 | msm7627a_init_regulators(); |
Chintan Pandya | 12ec56a | 2012-03-13 15:47:12 +0530 | [diff] [blame] | 535 | msm_adsp_add_pdev(); |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 536 | |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 537 | if (cpu_is_msm8625()) |
| 538 | msm8625_device_i2c_init(); |
| 539 | else |
| 540 | msm7627a_device_i2c_init(); |
| 541 | |
| 542 | /* uart1dm*/ |
| 543 | qrd7627a_uart1dm_config(); |
| 544 | /*OTG gadget*/ |
| 545 | qrd7627a_otg_gadget(); |
Taniya Das | c868a2e | 2012-01-03 10:18:47 +0530 | [diff] [blame] | 546 | |
Taniya Das | e380a2d | 2012-03-09 13:02:41 +0530 | [diff] [blame] | 547 | msm_add_footswitch_devices(); |
Chintan Pandya | b1bad0e | 2012-02-06 19:04:51 +0530 | [diff] [blame] | 548 | add_platform_devices(); |
Taniya Das | c868a2e | 2012-01-03 10:18:47 +0530 | [diff] [blame] | 549 | |
Santosh Sajjan | 374d659 | 2012-01-19 23:16:46 +0530 | [diff] [blame] | 550 | /* Ensure ar6000pm device is registered before MMC/SDC */ |
| 551 | msm_qrd_init_ar6000pm(); |
Chintan Pandya | cf467fc | 2011-12-01 17:11:11 +0530 | [diff] [blame] | 552 | msm7627a_init_mmc(); |
| 553 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 554 | #ifdef CONFIG_USB_EHCI_MSM_72K |
| 555 | msm7627a_init_host(); |
| 556 | #endif |
Taniya Das | bd09654 | 2012-03-15 17:43:45 +0530 | [diff] [blame] | 557 | msm_pm_init(); |
Murali Nalajala | a182784 | 2011-11-13 14:12:39 +0530 | [diff] [blame] | 558 | |
Murali Nalajala | 2a0bbda | 2012-03-28 12:12:54 +0530 | [diff] [blame] | 559 | msm_pm_register_irqs(); |
Taniya Das | 0a5303a | 2011-08-23 18:47:48 +0530 | [diff] [blame] | 560 | msm_fb_add_devices(); |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 561 | |
| 562 | #if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE) |
Chintan Pandya | 13490c0 | 2011-12-20 13:03:36 +0530 | [diff] [blame] | 563 | msm7627a_bt_power_init(); |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 564 | #endif |
Taniya Das | da40882 | 2011-09-06 12:54:06 +0530 | [diff] [blame] | 565 | |
Chintan Pandya | 4076270 | 2011-12-06 13:47:06 +0530 | [diff] [blame] | 566 | msm7627a_camera_init(); |
Chintan Pandya | 0d45319 | 2012-03-09 13:20:33 +0530 | [diff] [blame] | 567 | qrd7627a_add_io_devices(); |
Aparna Mallavarapu | d95d8fc | 2012-03-08 12:07:37 +0530 | [diff] [blame] | 568 | msm7x25a_kgsl_3d0_init(); |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 569 | } |
| 570 | |
| 571 | static void __init qrd7627a_init_early(void) |
| 572 | { |
| 573 | msm_msm7627a_allocate_memory_regions(); |
| 574 | } |
| 575 | |
| 576 | MACHINE_START(MSM7627A_QRD1, "QRD MSM7627a QRD1") |
| 577 | .boot_params = PHYS_OFFSET + 0x100, |
| 578 | .map_io = msm_common_io_init, |
Chintan Pandya | 12ec56a | 2012-03-13 15:47:12 +0530 | [diff] [blame] | 579 | .reserve = qrd7627a_reserve, |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 580 | .init_irq = msm_init_irq, |
Taniya Das | c868a2e | 2012-01-03 10:18:47 +0530 | [diff] [blame] | 581 | .init_machine = msm_qrd_init, |
| 582 | .timer = &msm_timer, |
| 583 | .init_early = qrd7627a_init_early, |
| 584 | .handle_irq = vic_handle_irq, |
| 585 | MACHINE_END |
Chintan Pandya | b1bad0e | 2012-02-06 19:04:51 +0530 | [diff] [blame] | 586 | MACHINE_START(MSM7627A_QRD3, "QRD MSM7627a QRD3") |
| 587 | .boot_params = PHYS_OFFSET + 0x100, |
| 588 | .map_io = msm_common_io_init, |
Chintan Pandya | 12ec56a | 2012-03-13 15:47:12 +0530 | [diff] [blame] | 589 | .reserve = qrd7627a_reserve, |
Chintan Pandya | b1bad0e | 2012-02-06 19:04:51 +0530 | [diff] [blame] | 590 | .init_irq = msm_init_irq, |
| 591 | .init_machine = msm_qrd_init, |
| 592 | .timer = &msm_timer, |
| 593 | .init_early = qrd7627a_init_early, |
| 594 | .handle_irq = vic_handle_irq, |
| 595 | MACHINE_END |
Taniya Das | c868a2e | 2012-01-03 10:18:47 +0530 | [diff] [blame] | 596 | MACHINE_START(MSM7627A_EVB, "QRD MSM7627a EVB") |
| 597 | .boot_params = PHYS_OFFSET + 0x100, |
| 598 | .map_io = msm_common_io_init, |
Chintan Pandya | 12ec56a | 2012-03-13 15:47:12 +0530 | [diff] [blame] | 599 | .reserve = qrd7627a_reserve, |
Taniya Das | c868a2e | 2012-01-03 10:18:47 +0530 | [diff] [blame] | 600 | .init_irq = msm_init_irq, |
| 601 | .init_machine = msm_qrd_init, |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 602 | .timer = &msm_timer, |
| 603 | .init_early = qrd7627a_init_early, |
Pankaj Kumar | bf8a2a3 | 2011-10-21 11:47:21 +0530 | [diff] [blame] | 604 | .handle_irq = vic_handle_irq, |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 605 | MACHINE_END |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 606 | MACHINE_START(MSM8625_EVB, "QRD MSM8625 EVB") |
| 607 | .boot_params = PHYS_OFFSET + 0x100, |
| 608 | .map_io = msm8625_map_io, |
Chintan Pandya | 12ec56a | 2012-03-13 15:47:12 +0530 | [diff] [blame] | 609 | .reserve = qrd8625_reserve, |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 610 | .init_irq = msm8625_init_irq, |
| 611 | .init_machine = msm_qrd_init, |
| 612 | .timer = &msm_timer, |
| 613 | .init_early = qrd7627a_init_early, |
| 614 | .handle_irq = gic_handle_irq, |
| 615 | MACHINE_END |
Taniya Das | bd09654 | 2012-03-15 17:43:45 +0530 | [diff] [blame] | 616 | MACHINE_START(MSM8625_QRD7, "QRD MSM8625 QRD7") |
| 617 | .boot_params = PHYS_OFFSET + 0x100, |
| 618 | .map_io = msm8625_map_io, |
Chintan Pandya | 12ec56a | 2012-03-13 15:47:12 +0530 | [diff] [blame] | 619 | .reserve = qrd8625_reserve, |
Taniya Das | bd09654 | 2012-03-15 17:43:45 +0530 | [diff] [blame] | 620 | .init_irq = msm8625_init_irq, |
| 621 | .init_machine = msm_qrd_init, |
| 622 | .timer = &msm_timer, |
| 623 | .init_early = qrd7627a_init_early, |
| 624 | .handle_irq = gic_handle_irq, |
| 625 | MACHINE_END |