Sravan Kumar Ambapuram | b22cf4d | 2012-01-02 21:45:04 +0530 | [diff] [blame] | 1 | /* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved. |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [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 | #include <linux/kernel.h> |
| 13 | #include <linux/init.h> |
| 14 | #include <linux/gpio_event.h> |
Taniya Das | 2b16d1d | 2011-12-02 14:44:19 +0530 | [diff] [blame] | 15 | #include <linux/memblock.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 16 | #include <asm/mach-types.h> |
Murali Nalajala | 41786ab | 2012-03-06 10:47:32 +0530 | [diff] [blame] | 17 | #include <linux/memblock.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 18 | #include <asm/mach/arch.h> |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 19 | #include <asm/hardware/gic.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 20 | #include <mach/board.h> |
| 21 | #include <mach/msm_iomap.h> |
| 22 | #include <mach/msm_hsusb.h> |
| 23 | #include <mach/rpc_hsusb.h> |
| 24 | #include <mach/rpc_pmapp.h> |
| 25 | #include <mach/usbdiag.h> |
| 26 | #include <mach/msm_memtypes.h> |
| 27 | #include <mach/msm_serial_hs.h> |
| 28 | #include <linux/usb/android.h> |
| 29 | #include <linux/platform_device.h> |
| 30 | #include <linux/io.h> |
| 31 | #include <linux/gpio.h> |
| 32 | #include <mach/vreg.h> |
| 33 | #include <mach/pmic.h> |
| 34 | #include <mach/socinfo.h> |
| 35 | #include <linux/mtd/nand.h> |
| 36 | #include <linux/mtd/partitions.h> |
| 37 | #include <asm/mach/mmc.h> |
| 38 | #include <linux/i2c.h> |
| 39 | #include <linux/i2c/sx150x.h> |
| 40 | #include <linux/gpio.h> |
| 41 | #include <linux/android_pmem.h> |
| 42 | #include <linux/bootmem.h> |
| 43 | #include <linux/mfd/marimba.h> |
| 44 | #include <mach/vreg.h> |
| 45 | #include <linux/power_supply.h> |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 46 | #include <linux/regulator/consumer.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 47 | #include <mach/rpc_pmapp.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 48 | #include <mach/msm_battery.h> |
| 49 | #include <linux/smsc911x.h> |
| 50 | #include <linux/atmel_maxtouch.h> |
Laura Abbott | 8f3d58b | 2011-12-18 10:47:03 -0800 | [diff] [blame] | 51 | #include <linux/fmem.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 52 | #include "devices.h" |
| 53 | #include "timer.h" |
Justin Paupore | b3a33b7 | 2011-08-23 15:30:32 -0700 | [diff] [blame] | 54 | #include "board-msm7x27a-regulator.h" |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 55 | #include "devices-msm7x2xa.h" |
Matt Wagantall | 7cca464 | 2012-02-01 16:43:24 -0800 | [diff] [blame] | 56 | #include "pm.h" |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 57 | #include <mach/rpc_server_handset.h> |
| 58 | #include <mach/socinfo.h> |
Maheshkumar Sivasubramanian | 8ccc16e | 2011-10-25 15:59:57 -0600 | [diff] [blame] | 59 | #include "pm-boot.h" |
Chintan Pandya | cf467fc | 2011-12-01 17:11:11 +0530 | [diff] [blame] | 60 | #include "board-msm7627a.h" |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 61 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 62 | #if defined(CONFIG_GPIO_SX150X) |
| 63 | enum { |
| 64 | SX150X_CORE, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 65 | }; |
| 66 | |
| 67 | static struct sx150x_platform_data sx150x_data[] __initdata = { |
| 68 | [SX150X_CORE] = { |
| 69 | .gpio_base = GPIO_CORE_EXPANDER_BASE, |
| 70 | .oscio_is_gpo = false, |
| 71 | .io_pullup_ena = 0, |
pankaj kumar | c5c0139 | 2011-08-12 13:44:05 +0530 | [diff] [blame] | 72 | .io_pulldn_ena = 0x02, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 73 | .io_open_drain_ena = 0xfef8, |
| 74 | .irq_summary = -1, |
| 75 | }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 76 | }; |
| 77 | #endif |
| 78 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 79 | |
Santosh Sajjan | 6822c68 | 2011-07-26 10:49:36 +0530 | [diff] [blame] | 80 | static struct platform_device msm_wlan_ar6000_pm_device = { |
| 81 | .name = "wlan_ar6000_pm_dev", |
| 82 | .id = -1, |
| 83 | }; |
| 84 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 85 | #if defined(CONFIG_I2C) && defined(CONFIG_GPIO_SX150X) |
| 86 | static struct i2c_board_info core_exp_i2c_info[] __initdata = { |
| 87 | { |
| 88 | I2C_BOARD_INFO("sx1509q", 0x3e), |
| 89 | }, |
| 90 | }; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 91 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 92 | static void __init register_i2c_devices(void) |
| 93 | { |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 94 | if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf() || |
| 95 | machine_is_msm8625_surf()) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 96 | sx150x_data[SX150X_CORE].io_open_drain_ena = 0xe0f0; |
| 97 | |
| 98 | core_exp_i2c_info[0].platform_data = |
| 99 | &sx150x_data[SX150X_CORE]; |
| 100 | |
| 101 | i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID, |
| 102 | core_exp_i2c_info, |
| 103 | ARRAY_SIZE(core_exp_i2c_info)); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 104 | } |
| 105 | #endif |
| 106 | |
| 107 | static struct msm_gpio qup_i2c_gpios_io[] = { |
| 108 | { GPIO_CFG(60, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 109 | "qup_scl" }, |
| 110 | { GPIO_CFG(61, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 111 | "qup_sda" }, |
| 112 | { GPIO_CFG(131, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 113 | "qup_scl" }, |
| 114 | { GPIO_CFG(132, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 115 | "qup_sda" }, |
| 116 | }; |
| 117 | |
| 118 | static struct msm_gpio qup_i2c_gpios_hw[] = { |
| 119 | { GPIO_CFG(60, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 120 | "qup_scl" }, |
| 121 | { GPIO_CFG(61, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 122 | "qup_sda" }, |
| 123 | { GPIO_CFG(131, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 124 | "qup_scl" }, |
| 125 | { GPIO_CFG(132, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 126 | "qup_sda" }, |
| 127 | }; |
| 128 | |
| 129 | static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type) |
| 130 | { |
| 131 | int rc; |
| 132 | |
| 133 | if (adap_id < 0 || adap_id > 1) |
| 134 | return; |
| 135 | |
| 136 | /* Each adapter gets 2 lines from the table */ |
| 137 | if (config_type) |
| 138 | rc = msm_gpios_request_enable(&qup_i2c_gpios_hw[adap_id*2], 2); |
| 139 | else |
| 140 | rc = msm_gpios_request_enable(&qup_i2c_gpios_io[adap_id*2], 2); |
| 141 | if (rc < 0) |
| 142 | pr_err("QUP GPIO request/enable failed: %d\n", rc); |
| 143 | } |
| 144 | |
| 145 | static struct msm_i2c_platform_data msm_gsbi0_qup_i2c_pdata = { |
| 146 | .clk_freq = 100000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 147 | .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config, |
| 148 | }; |
| 149 | |
| 150 | static struct msm_i2c_platform_data msm_gsbi1_qup_i2c_pdata = { |
| 151 | .clk_freq = 100000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 152 | .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config, |
| 153 | }; |
| 154 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 155 | static struct android_usb_platform_data android_usb_pdata = { |
| 156 | .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num, |
| 157 | }; |
| 158 | |
| 159 | static struct platform_device android_usb_device = { |
| 160 | .name = "android_usb", |
| 161 | .id = -1, |
| 162 | .dev = { |
| 163 | .platform_data = &android_usb_pdata, |
| 164 | }, |
| 165 | }; |
| 166 | |
| 167 | #ifdef CONFIG_USB_EHCI_MSM_72K |
| 168 | static void msm_hsusb_vbus_power(unsigned phy_info, int on) |
| 169 | { |
| 170 | int rc = 0; |
| 171 | unsigned gpio; |
| 172 | |
| 173 | gpio = GPIO_HOST_VBUS_EN; |
| 174 | |
| 175 | rc = gpio_request(gpio, "i2c_host_vbus_en"); |
| 176 | if (rc < 0) { |
| 177 | pr_err("failed to request %d GPIO\n", gpio); |
| 178 | return; |
| 179 | } |
| 180 | gpio_direction_output(gpio, !!on); |
| 181 | gpio_set_value_cansleep(gpio, !!on); |
| 182 | gpio_free(gpio); |
| 183 | } |
| 184 | |
| 185 | static struct msm_usb_host_platform_data msm_usb_host_pdata = { |
| 186 | .phy_info = (USB_PHY_INTEGRATED | USB_PHY_MODEL_45NM), |
| 187 | }; |
| 188 | |
| 189 | static void __init msm7x2x_init_host(void) |
| 190 | { |
| 191 | msm_add_host(0, &msm_usb_host_pdata); |
| 192 | } |
| 193 | #endif |
| 194 | |
| 195 | #ifdef CONFIG_USB_MSM_OTG_72K |
| 196 | static int hsusb_rpc_connect(int connect) |
| 197 | { |
| 198 | if (connect) |
| 199 | return msm_hsusb_rpc_connect(); |
| 200 | else |
| 201 | return msm_hsusb_rpc_close(); |
| 202 | } |
| 203 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 204 | static struct regulator *reg_hsusb; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 205 | static int msm_hsusb_ldo_init(int init) |
| 206 | { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 207 | int rc = 0; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 208 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 209 | if (init) { |
| 210 | reg_hsusb = regulator_get(NULL, "usb"); |
| 211 | if (IS_ERR(reg_hsusb)) { |
| 212 | rc = PTR_ERR(reg_hsusb); |
| 213 | pr_err("%s: could not get regulator: %d\n", |
| 214 | __func__, rc); |
| 215 | goto out; |
| 216 | } |
| 217 | |
| 218 | rc = regulator_set_voltage(reg_hsusb, 3300000, 3300000); |
| 219 | if (rc) { |
| 220 | pr_err("%s: could not set voltage: %d\n", |
| 221 | __func__, rc); |
| 222 | goto reg_free; |
| 223 | } |
| 224 | |
| 225 | return 0; |
| 226 | } |
| 227 | /* else fall through */ |
| 228 | reg_free: |
| 229 | regulator_put(reg_hsusb); |
| 230 | out: |
| 231 | reg_hsusb = NULL; |
| 232 | return rc; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 233 | } |
| 234 | |
| 235 | static int msm_hsusb_ldo_enable(int enable) |
| 236 | { |
| 237 | static int ldo_status; |
| 238 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 239 | if (IS_ERR_OR_NULL(reg_hsusb)) |
| 240 | return reg_hsusb ? PTR_ERR(reg_hsusb) : -ENODEV; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 241 | |
| 242 | if (ldo_status == enable) |
| 243 | return 0; |
| 244 | |
| 245 | ldo_status = enable; |
| 246 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 247 | return enable ? |
| 248 | regulator_enable(reg_hsusb) : |
| 249 | regulator_disable(reg_hsusb); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 250 | } |
| 251 | |
| 252 | #ifndef CONFIG_USB_EHCI_MSM_72K |
| 253 | static int msm_hsusb_pmic_notif_init(void (*callback)(int online), int init) |
| 254 | { |
| 255 | int ret = 0; |
| 256 | |
| 257 | if (init) |
| 258 | ret = msm_pm_app_rpc_init(callback); |
| 259 | else |
| 260 | msm_pm_app_rpc_deinit(callback); |
| 261 | |
| 262 | return ret; |
| 263 | } |
| 264 | #endif |
| 265 | |
| 266 | static struct msm_otg_platform_data msm_otg_pdata = { |
| 267 | #ifndef CONFIG_USB_EHCI_MSM_72K |
| 268 | .pmic_vbus_notif_init = msm_hsusb_pmic_notif_init, |
| 269 | #else |
| 270 | .vbus_power = msm_hsusb_vbus_power, |
| 271 | #endif |
| 272 | .rpc_connect = hsusb_rpc_connect, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 273 | .pemp_level = PRE_EMPHASIS_WITH_20_PERCENT, |
| 274 | .cdr_autoreset = CDR_AUTO_RESET_DISABLE, |
| 275 | .drv_ampl = HS_DRV_AMPLITUDE_DEFAULT, |
| 276 | .se1_gating = SE1_GATING_DISABLE, |
| 277 | .ldo_init = msm_hsusb_ldo_init, |
| 278 | .ldo_enable = msm_hsusb_ldo_enable, |
| 279 | .chg_init = hsusb_chg_init, |
| 280 | .chg_connected = hsusb_chg_connected, |
| 281 | .chg_vbus_draw = hsusb_chg_vbus_draw, |
| 282 | }; |
| 283 | #endif |
| 284 | |
| 285 | static struct msm_hsusb_gadget_platform_data msm_gadget_pdata = { |
| 286 | .is_phy_status_timer_on = 1, |
| 287 | }; |
| 288 | |
| 289 | static struct resource smc91x_resources[] = { |
| 290 | [0] = { |
| 291 | .start = 0x90000300, |
| 292 | .end = 0x900003ff, |
| 293 | .flags = IORESOURCE_MEM, |
| 294 | }, |
| 295 | [1] = { |
| 296 | .start = MSM_GPIO_TO_INT(4), |
| 297 | .end = MSM_GPIO_TO_INT(4), |
| 298 | .flags = IORESOURCE_IRQ, |
| 299 | }, |
| 300 | }; |
| 301 | |
| 302 | static struct platform_device smc91x_device = { |
| 303 | .name = "smc91x", |
| 304 | .id = 0, |
| 305 | .num_resources = ARRAY_SIZE(smc91x_resources), |
| 306 | .resource = smc91x_resources, |
| 307 | }; |
| 308 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 309 | #ifdef CONFIG_SERIAL_MSM_HS |
| 310 | static struct msm_serial_hs_platform_data msm_uart_dm1_pdata = { |
| 311 | .inject_rx_on_wakeup = 1, |
| 312 | .rx_to_inject = 0xFD, |
| 313 | }; |
| 314 | #endif |
| 315 | static struct msm_pm_platform_data msm7x27a_pm_data[MSM_PM_SLEEP_MODE_NR] = { |
Murali Nalajala | b10363d | 2012-01-12 16:29:01 +0530 | [diff] [blame] | 316 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 317 | .idle_supported = 1, |
| 318 | .suspend_supported = 1, |
| 319 | .idle_enabled = 1, |
| 320 | .suspend_enabled = 1, |
| 321 | .latency = 16000, |
| 322 | .residency = 20000, |
| 323 | }, |
Murali Nalajala | b10363d | 2012-01-12 16:29:01 +0530 | [diff] [blame] | 324 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN)] = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 325 | .idle_supported = 1, |
| 326 | .suspend_supported = 1, |
| 327 | .idle_enabled = 1, |
| 328 | .suspend_enabled = 1, |
| 329 | .latency = 12000, |
| 330 | .residency = 20000, |
| 331 | }, |
Murali Nalajala | b10363d | 2012-01-12 16:29:01 +0530 | [diff] [blame] | 332 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT)] = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 333 | .idle_supported = 1, |
| 334 | .suspend_supported = 1, |
| 335 | .idle_enabled = 0, |
| 336 | .suspend_enabled = 1, |
| 337 | .latency = 2000, |
| 338 | .residency = 0, |
| 339 | }, |
Murali Nalajala | b10363d | 2012-01-12 16:29:01 +0530 | [diff] [blame] | 340 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 341 | .idle_supported = 1, |
| 342 | .suspend_supported = 1, |
| 343 | .idle_enabled = 1, |
| 344 | .suspend_enabled = 1, |
| 345 | .latency = 2, |
| 346 | .residency = 0, |
| 347 | }, |
| 348 | }; |
| 349 | |
Sujit Reddy Thumma | ca0c106 | 2012-02-24 14:47:05 +0530 | [diff] [blame] | 350 | u32 msm7627a_power_collapse_latency(enum msm_pm_sleep_mode mode) |
| 351 | { |
| 352 | switch (mode) { |
| 353 | case MSM_PM_SLEEP_MODE_POWER_COLLAPSE: |
| 354 | return msm7x27a_pm_data |
| 355 | [MSM_PM_SLEEP_MODE_POWER_COLLAPSE].latency; |
| 356 | case MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN: |
| 357 | return msm7x27a_pm_data |
| 358 | [MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN].latency; |
| 359 | case MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT: |
| 360 | return msm7x27a_pm_data |
| 361 | [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].latency; |
| 362 | case MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT: |
| 363 | return msm7x27a_pm_data |
| 364 | [MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT].latency; |
| 365 | default: |
| 366 | return 0; |
| 367 | } |
| 368 | } |
| 369 | |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 370 | 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] | 371 | .mode = MSM_PM_BOOT_CONFIG_RESET_VECTOR_PHYS, |
| 372 | .p_addr = 0, |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 373 | }; |
| 374 | |
Murali Nalajala | d1f67b0 | 2012-02-10 00:23:49 +0530 | [diff] [blame] | 375 | /* 8625 PM platform data */ |
| 376 | static struct msm_pm_platform_data msm8625_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = { |
| 377 | /* CORE0 entries */ |
| 378 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = { |
| 379 | .idle_supported = 1, |
| 380 | .suspend_supported = 1, |
| 381 | .idle_enabled = 0, |
| 382 | .suspend_enabled = 0, |
| 383 | .latency = 16000, |
| 384 | .residency = 20000, |
| 385 | }, |
| 386 | |
| 387 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN)] = { |
| 388 | .idle_supported = 1, |
| 389 | .suspend_supported = 1, |
| 390 | .idle_enabled = 0, |
| 391 | .suspend_enabled = 0, |
| 392 | .latency = 12000, |
| 393 | .residency = 20000, |
| 394 | }, |
| 395 | |
| 396 | /* picked latency & redisdency values from 7x30 */ |
| 397 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = { |
| 398 | .idle_supported = 1, |
| 399 | .suspend_supported = 1, |
| 400 | .idle_enabled = 0, |
| 401 | .suspend_enabled = 0, |
| 402 | .latency = 500, |
| 403 | .residency = 6000, |
| 404 | }, |
| 405 | |
| 406 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = { |
| 407 | .idle_supported = 1, |
| 408 | .suspend_supported = 1, |
| 409 | .idle_enabled = 1, |
| 410 | .suspend_enabled = 1, |
| 411 | .latency = 2, |
| 412 | .residency = 10, |
| 413 | }, |
| 414 | |
| 415 | /* picked latency & redisdency values from 7x30 */ |
| 416 | [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = { |
| 417 | .idle_supported = 1, |
| 418 | .suspend_supported = 1, |
| 419 | .idle_enabled = 0, |
| 420 | .suspend_enabled = 0, |
| 421 | .latency = 500, |
| 422 | .residency = 6000, |
| 423 | }, |
| 424 | |
| 425 | [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = { |
| 426 | .idle_supported = 1, |
| 427 | .suspend_supported = 1, |
| 428 | .idle_enabled = 1, |
| 429 | .suspend_enabled = 1, |
| 430 | .latency = 2, |
| 431 | .residency = 10, |
| 432 | }, |
| 433 | |
| 434 | }; |
| 435 | |
Murali Nalajala | 41786ab | 2012-03-06 10:47:32 +0530 | [diff] [blame] | 436 | static struct msm_pm_boot_platform_data msm_pm_8625_boot_pdata __initdata = { |
| 437 | .mode = MSM_PM_BOOT_CONFIG_REMAP_BOOT_ADDR, |
| 438 | .v_addr = MSM_CFG_CTL_BASE, |
| 439 | }; |
| 440 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 441 | static u32 msm_calculate_batt_capacity(u32 current_voltage); |
| 442 | |
| 443 | static struct msm_psy_batt_pdata msm_psy_batt_data = { |
| 444 | .voltage_min_design = 2800, |
| 445 | .voltage_max_design = 4300, |
| 446 | .avail_chg_sources = AC_CHG | USB_CHG , |
| 447 | .batt_technology = POWER_SUPPLY_TECHNOLOGY_LION, |
| 448 | .calculate_capacity = &msm_calculate_batt_capacity, |
| 449 | }; |
| 450 | |
| 451 | static u32 msm_calculate_batt_capacity(u32 current_voltage) |
| 452 | { |
| 453 | u32 low_voltage = msm_psy_batt_data.voltage_min_design; |
| 454 | u32 high_voltage = msm_psy_batt_data.voltage_max_design; |
| 455 | |
| 456 | return (current_voltage - low_voltage) * 100 |
| 457 | / (high_voltage - low_voltage); |
| 458 | } |
| 459 | |
| 460 | static struct platform_device msm_batt_device = { |
| 461 | .name = "msm-battery", |
| 462 | .id = -1, |
| 463 | .dev.platform_data = &msm_psy_batt_data, |
| 464 | }; |
| 465 | |
| 466 | static struct smsc911x_platform_config smsc911x_config = { |
| 467 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH, |
| 468 | .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, |
| 469 | .flags = SMSC911X_USE_16BIT, |
| 470 | }; |
| 471 | |
| 472 | static struct resource smsc911x_resources[] = { |
| 473 | [0] = { |
| 474 | .start = 0x90000000, |
| 475 | .end = 0x90007fff, |
| 476 | .flags = IORESOURCE_MEM, |
| 477 | }, |
| 478 | [1] = { |
| 479 | .start = MSM_GPIO_TO_INT(48), |
| 480 | .end = MSM_GPIO_TO_INT(48), |
| 481 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 482 | }, |
| 483 | }; |
| 484 | |
| 485 | static struct platform_device smsc911x_device = { |
| 486 | .name = "smsc911x", |
| 487 | .id = 0, |
| 488 | .num_resources = ARRAY_SIZE(smsc911x_resources), |
| 489 | .resource = smsc911x_resources, |
| 490 | .dev = { |
| 491 | .platform_data = &smsc911x_config, |
| 492 | }, |
| 493 | }; |
| 494 | |
| 495 | static struct msm_gpio smsc911x_gpios[] = { |
| 496 | { GPIO_CFG(48, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_6MA), |
| 497 | "smsc911x_irq" }, |
| 498 | { GPIO_CFG(49, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_6MA), |
| 499 | "eth_fifo_sel" }, |
| 500 | }; |
| 501 | |
| 502 | #define ETH_FIFO_SEL_GPIO 49 |
| 503 | static void msm7x27a_cfg_smsc911x(void) |
| 504 | { |
| 505 | int res; |
| 506 | |
| 507 | res = msm_gpios_request_enable(smsc911x_gpios, |
| 508 | ARRAY_SIZE(smsc911x_gpios)); |
| 509 | if (res) { |
| 510 | pr_err("%s: unable to enable gpios for SMSC911x\n", __func__); |
| 511 | return; |
| 512 | } |
| 513 | |
| 514 | /* ETH_FIFO_SEL */ |
| 515 | res = gpio_direction_output(ETH_FIFO_SEL_GPIO, 0); |
| 516 | if (res) { |
| 517 | pr_err("%s: unable to get direction for gpio %d\n", __func__, |
| 518 | ETH_FIFO_SEL_GPIO); |
| 519 | msm_gpios_disable_free(smsc911x_gpios, |
| 520 | ARRAY_SIZE(smsc911x_gpios)); |
| 521 | return; |
| 522 | } |
| 523 | gpio_set_value(ETH_FIFO_SEL_GPIO, 0); |
| 524 | } |
| 525 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 526 | #if defined(CONFIG_SERIAL_MSM_HSL_CONSOLE) \ |
| 527 | && defined(CONFIG_MSM_SHARED_GPIO_FOR_UART2DM) |
| 528 | static struct msm_gpio uart2dm_gpios[] = { |
| 529 | {GPIO_CFG(19, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 530 | "uart2dm_rfr_n" }, |
| 531 | {GPIO_CFG(20, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 532 | "uart2dm_cts_n" }, |
| 533 | {GPIO_CFG(21, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 534 | "uart2dm_rx" }, |
| 535 | {GPIO_CFG(108, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 536 | "uart2dm_tx" }, |
| 537 | }; |
| 538 | |
| 539 | static void msm7x27a_cfg_uart2dm_serial(void) |
| 540 | { |
| 541 | int ret; |
| 542 | ret = msm_gpios_request_enable(uart2dm_gpios, |
| 543 | ARRAY_SIZE(uart2dm_gpios)); |
| 544 | if (ret) |
| 545 | pr_err("%s: unable to enable gpios for uart2dm\n", __func__); |
| 546 | } |
| 547 | #else |
| 548 | static void msm7x27a_cfg_uart2dm_serial(void) { } |
| 549 | #endif |
| 550 | |
Laura Abbott | 8f3d58b | 2011-12-18 10:47:03 -0800 | [diff] [blame] | 551 | struct fmem_platform_data fmem_pdata; |
| 552 | |
| 553 | struct platform_device fmem_device = { |
| 554 | .name = "fmem", |
| 555 | .id = -1, |
| 556 | .dev = { .platform_data = &fmem_pdata }, |
| 557 | }; |
| 558 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 559 | static struct platform_device *rumi_sim_devices[] __initdata = { |
| 560 | &msm_device_dmov, |
| 561 | &msm_device_smd, |
| 562 | &smc91x_device, |
| 563 | &msm_device_uart1, |
| 564 | &msm_device_nand, |
| 565 | &msm_device_uart_dm1, |
| 566 | &msm_gsbi0_qup_i2c_device, |
| 567 | &msm_gsbi1_qup_i2c_device, |
| 568 | }; |
| 569 | |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 570 | static struct platform_device *msm8625_rumi3_devices[] __initdata = { |
| 571 | &msm8625_device_dmov, |
Angshuman Sarkar | fb1cce9 | 2012-02-21 15:20:43 +0530 | [diff] [blame] | 572 | &msm8625_device_smd, |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 573 | &msm8625_device_uart1, |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 574 | &msm8625_gsbi0_qup_i2c_device, |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 575 | }; |
| 576 | |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 577 | static struct platform_device *msm7627a_surf_ffa_devices[] __initdata = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 578 | &msm_device_dmov, |
| 579 | &msm_device_smd, |
| 580 | &msm_device_uart1, |
| 581 | &msm_device_uart_dm1, |
| 582 | &msm_device_uart_dm2, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 583 | &msm_gsbi0_qup_i2c_device, |
| 584 | &msm_gsbi1_qup_i2c_device, |
| 585 | &msm_device_otg, |
| 586 | &msm_device_gadget_peripheral, |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 587 | &smsc911x_device, |
| 588 | &msm_kgsl_3d0, |
| 589 | }; |
| 590 | |
| 591 | static struct platform_device *common_devices[] __initdata = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 592 | &android_usb_device, |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 593 | &fmem_device, |
| 594 | &msm_device_nand, |
Manish Dewangan | 3a26099 | 2011-06-24 18:01:34 +0530 | [diff] [blame] | 595 | &asoc_msm_pcm, |
| 596 | &asoc_msm_dai0, |
| 597 | &asoc_msm_dai1, |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 598 | &msm_batt_device, |
| 599 | }; |
| 600 | |
| 601 | static struct platform_device *msm8625_surf_devices[] __initdata = { |
| 602 | &msm8625_device_dmov, |
| 603 | &msm8625_device_uart1, |
| 604 | &msm8625_device_uart_dm1, |
| 605 | &msm8625_device_uart_dm2, |
| 606 | &msm8625_gsbi0_qup_i2c_device, |
| 607 | &msm8625_gsbi1_qup_i2c_device, |
Taniya Das | f266530 | 2012-02-28 16:54:54 +0530 | [diff] [blame] | 608 | &msm8625_device_smd, |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 609 | &msm8625_device_otg, |
| 610 | &msm8625_device_gadget_peripheral, |
Ranjhith Kalisamy | 4ec2e10 | 2012-03-06 12:27:50 +0530 | [diff] [blame] | 611 | &msm8625_kgsl_3d0, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 612 | }; |
| 613 | |
Taniya Das | 2b16d1d | 2011-12-02 14:44:19 +0530 | [diff] [blame] | 614 | static void __init msm8625_reserve(void) |
| 615 | { |
Chintan Pandya | 12ec56a | 2012-03-13 15:47:12 +0530 | [diff] [blame] | 616 | msm7627a_reserve(); |
Taniya Das | fe04d4f | 2012-03-14 11:13:21 +0530 | [diff] [blame] | 617 | memblock_remove(MSM8625_SECONDARY_PHYS, SZ_8); |
Murali Nalajala | feedeae | 2012-03-28 16:15:32 +0530 | [diff] [blame] | 618 | memblock_remove(MSM8625_WARM_BOOT_PHYS, SZ_32); |
Taniya Das | 2b16d1d | 2011-12-02 14:44:19 +0530 | [diff] [blame] | 619 | } |
| 620 | |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 621 | static void __init msm7x27a_device_i2c_init(void) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 622 | { |
| 623 | msm_gsbi0_qup_i2c_device.dev.platform_data = &msm_gsbi0_qup_i2c_pdata; |
| 624 | msm_gsbi1_qup_i2c_device.dev.platform_data = &msm_gsbi1_qup_i2c_pdata; |
| 625 | } |
| 626 | |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 627 | static void __init msm8625_device_i2c_init(void) |
| 628 | { |
| 629 | msm8625_gsbi0_qup_i2c_device.dev.platform_data = |
| 630 | &msm_gsbi0_qup_i2c_pdata; |
| 631 | msm8625_gsbi1_qup_i2c_device.dev.platform_data = |
| 632 | &msm_gsbi1_qup_i2c_pdata; |
| 633 | } |
| 634 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 635 | #define MSM_EBI2_PHYS 0xa0d00000 |
| 636 | #define MSM_EBI2_XMEM_CS2_CFG1 0xa0d10030 |
| 637 | |
| 638 | static void __init msm7x27a_init_ebi2(void) |
| 639 | { |
| 640 | uint32_t ebi2_cfg; |
| 641 | void __iomem *ebi2_cfg_ptr; |
| 642 | |
| 643 | ebi2_cfg_ptr = ioremap_nocache(MSM_EBI2_PHYS, sizeof(uint32_t)); |
| 644 | if (!ebi2_cfg_ptr) |
| 645 | return; |
| 646 | |
| 647 | ebi2_cfg = readl(ebi2_cfg_ptr); |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 648 | if (machine_is_msm7x27a_rumi3() || machine_is_msm7x27a_surf() || |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 649 | machine_is_msm7625a_surf() || machine_is_msm8625_surf()) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 650 | ebi2_cfg |= (1 << 4); /* CS2 */ |
| 651 | |
| 652 | writel(ebi2_cfg, ebi2_cfg_ptr); |
| 653 | iounmap(ebi2_cfg_ptr); |
| 654 | |
| 655 | /* Enable A/D MUX[bit 31] from EBI2_XMEM_CS2_CFG1 */ |
| 656 | ebi2_cfg_ptr = ioremap_nocache(MSM_EBI2_XMEM_CS2_CFG1, |
| 657 | sizeof(uint32_t)); |
| 658 | if (!ebi2_cfg_ptr) |
| 659 | return; |
| 660 | |
| 661 | ebi2_cfg = readl(ebi2_cfg_ptr); |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 662 | if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 663 | ebi2_cfg |= (1 << 31); |
| 664 | |
| 665 | writel(ebi2_cfg, ebi2_cfg_ptr); |
| 666 | iounmap(ebi2_cfg_ptr); |
| 667 | } |
| 668 | |
Justin Paupore | b3a33b7 | 2011-08-23 15:30:32 -0700 | [diff] [blame] | 669 | static struct platform_device msm_proccomm_regulator_dev = { |
| 670 | .name = PROCCOMM_REGULATOR_DEV_NAME, |
| 671 | .id = -1, |
| 672 | .dev = { |
| 673 | .platform_data = &msm7x27a_proccomm_regulator_data |
| 674 | } |
| 675 | }; |
| 676 | |
Trilok Soni | 16f61af | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 677 | static void __init msm7627a_rumi3_init(void) |
| 678 | { |
| 679 | msm7x27a_init_ebi2(); |
| 680 | platform_add_devices(rumi_sim_devices, |
| 681 | ARRAY_SIZE(rumi_sim_devices)); |
| 682 | } |
| 683 | |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 684 | static void __init msm8625_rumi3_init(void) |
| 685 | { |
| 686 | msm7x2x_misc_init(); |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 687 | msm_adsp_add_pdev(); |
| 688 | msm8625_device_i2c_init(); |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 689 | platform_add_devices(msm8625_rumi3_devices, |
| 690 | ARRAY_SIZE(msm8625_rumi3_devices)); |
Murali Nalajala | 41786ab | 2012-03-06 10:47:32 +0530 | [diff] [blame] | 691 | |
Murali Nalajala | d1f67b0 | 2012-02-10 00:23:49 +0530 | [diff] [blame] | 692 | msm_pm_set_platform_data(msm8625_pm_data, |
| 693 | ARRAY_SIZE(msm8625_pm_data)); |
Murali Nalajala | 41786ab | 2012-03-06 10:47:32 +0530 | [diff] [blame] | 694 | BUG_ON(msm_pm_boot_init(&msm_pm_8625_boot_pdata)); |
| 695 | msm8x25_spm_device_init(); |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 696 | } |
| 697 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 698 | #define UART1DM_RX_GPIO 45 |
Santosh Sajjan | b479f0f | 2011-08-18 21:00:44 +0530 | [diff] [blame] | 699 | |
| 700 | #if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE) |
| 701 | static int __init msm7x27a_init_ar6000pm(void) |
| 702 | { |
Santosh Sajjan | 374d659 | 2012-01-19 23:16:46 +0530 | [diff] [blame] | 703 | msm_wlan_ar6000_pm_device.dev.platform_data = &ar600x_wlan_power; |
Santosh Sajjan | b479f0f | 2011-08-18 21:00:44 +0530 | [diff] [blame] | 704 | return platform_device_register(&msm_wlan_ar6000_pm_device); |
| 705 | } |
| 706 | #else |
| 707 | static int __init msm7x27a_init_ar6000pm(void) { return 0; } |
| 708 | #endif |
| 709 | |
Justin Paupore | b3a33b7 | 2011-08-23 15:30:32 -0700 | [diff] [blame] | 710 | static void __init msm7x27a_init_regulators(void) |
| 711 | { |
| 712 | int rc = platform_device_register(&msm_proccomm_regulator_dev); |
| 713 | if (rc) |
| 714 | pr_err("%s: could not register regulator device: %d\n", |
| 715 | __func__, rc); |
| 716 | } |
| 717 | |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 718 | static void __init msm7x27a_add_footswitch_devices(void) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 719 | { |
Trilok Soni | 16f61af | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 720 | platform_add_devices(msm_footswitch_devices, |
| 721 | msm_num_footswitch_devices); |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 722 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 723 | |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 724 | static void __init msm7x27a_add_platform_devices(void) |
| 725 | { |
| 726 | if (machine_is_msm8625_surf()) { |
| 727 | platform_add_devices(msm8625_surf_devices, |
| 728 | ARRAY_SIZE(msm8625_surf_devices)); |
| 729 | } else { |
| 730 | platform_add_devices(msm7627a_surf_ffa_devices, |
| 731 | ARRAY_SIZE(msm7627a_surf_ffa_devices)); |
| 732 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 733 | |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 734 | platform_add_devices(common_devices, |
| 735 | ARRAY_SIZE(common_devices)); |
| 736 | } |
| 737 | |
| 738 | static void __init msm7x27a_uartdm_config(void) |
| 739 | { |
| 740 | msm7x27a_cfg_uart2dm_serial(); |
| 741 | msm_uart_dm1_pdata.wakeup_irq = gpio_to_irq(UART1DM_RX_GPIO); |
| 742 | if (cpu_is_msm8625()) |
| 743 | msm8625_device_uart_dm1.dev.platform_data = |
| 744 | &msm_uart_dm1_pdata; |
| 745 | else |
| 746 | msm_device_uart_dm1.dev.platform_data = &msm_uart_dm1_pdata; |
| 747 | } |
| 748 | |
| 749 | static void __init msm7x27a_otg_gadget(void) |
| 750 | { |
| 751 | msm_otg_pdata.swfi_latency = |
| 752 | msm7x27a_pm_data[ |
| 753 | MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].latency; |
| 754 | if (cpu_is_msm8625()) { |
| 755 | msm8625_device_otg.dev.platform_data = &msm_otg_pdata; |
| 756 | msm8625_device_gadget_peripheral.dev.platform_data = |
| 757 | &msm_gadget_pdata; |
| 758 | } else { |
| 759 | msm_device_otg.dev.platform_data = &msm_otg_pdata; |
| 760 | msm_device_gadget_peripheral.dev.platform_data = |
| 761 | &msm_gadget_pdata; |
| 762 | } |
| 763 | } |
| 764 | |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 765 | static void __init msm7x27a_pm_init(void) |
| 766 | { |
Murali Nalajala | 8ee084e | 2012-03-07 00:09:38 +0530 | [diff] [blame] | 767 | if (machine_is_msm8625_surf()) { |
| 768 | msm_pm_set_platform_data(msm8625_pm_data, |
| 769 | ARRAY_SIZE(msm8625_pm_data)); |
| 770 | BUG_ON(msm_pm_boot_init(&msm_pm_8625_boot_pdata)); |
| 771 | msm8x25_spm_device_init(); |
| 772 | } else { |
| 773 | msm_pm_set_platform_data(msm7x27a_pm_data, |
| 774 | ARRAY_SIZE(msm7x27a_pm_data)); |
| 775 | BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata)); |
| 776 | } |
Murali Nalajala | 2a0bbda | 2012-03-28 12:12:54 +0530 | [diff] [blame] | 777 | |
| 778 | msm_pm_register_irqs(); |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 779 | } |
| 780 | |
| 781 | static void __init msm7x2x_init(void) |
| 782 | { |
| 783 | msm7x2x_misc_init(); |
| 784 | |
| 785 | /* Initialize regulators first so that other devices can use them */ |
| 786 | msm7x27a_init_regulators(); |
| 787 | msm_adsp_add_pdev(); |
| 788 | if (cpu_is_msm8625()) |
| 789 | msm8625_device_i2c_init(); |
| 790 | else |
| 791 | msm7x27a_device_i2c_init(); |
| 792 | msm7x27a_init_ebi2(); |
| 793 | msm7x27a_uartdm_config(); |
| 794 | |
| 795 | msm7x27a_otg_gadget(); |
| 796 | msm7x27a_cfg_smsc911x(); |
| 797 | |
| 798 | msm7x27a_add_footswitch_devices(); |
| 799 | msm7x27a_add_platform_devices(); |
| 800 | /* Ensure ar6000pm device is registered before MMC/SDC */ |
| 801 | msm7x27a_init_ar6000pm(); |
| 802 | msm7627a_init_mmc(); |
| 803 | msm_fb_add_devices(); |
| 804 | msm7x2x_init_host(); |
| 805 | msm7x27a_pm_init(); |
| 806 | register_i2c_devices(); |
| 807 | msm7627a_bt_power_init(); |
| 808 | msm7627a_camera_init(); |
Chintan Pandya | 0d45319 | 2012-03-09 13:20:33 +0530 | [diff] [blame] | 809 | msm7627a_add_io_devices(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 810 | /*7x25a kgsl initializations*/ |
| 811 | msm7x25a_kgsl_3d0_init(); |
Sudhakara Rao Tentu | 38ad6e1 | 2012-03-30 15:25:18 -0700 | [diff] [blame^] | 812 | /*8x25 kgsl initializations*/ |
| 813 | msm8x25_kgsl_3d0_init(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 814 | } |
| 815 | |
| 816 | static void __init msm7x2x_init_early(void) |
| 817 | { |
Chintan Pandya | 250c2e5 | 2012-01-19 17:15:49 +0530 | [diff] [blame] | 818 | msm_msm7627a_allocate_memory_regions(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 819 | } |
| 820 | |
| 821 | MACHINE_START(MSM7X27A_RUMI3, "QCT MSM7x27a RUMI3") |
| 822 | .boot_params = PHYS_OFFSET + 0x100, |
| 823 | .map_io = msm_common_io_init, |
Chintan Pandya | 12ec56a | 2012-03-13 15:47:12 +0530 | [diff] [blame] | 824 | .reserve = msm7627a_reserve, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 825 | .init_irq = msm_init_irq, |
Trilok Soni | 16f61af | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 826 | .init_machine = msm7627a_rumi3_init, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 827 | .timer = &msm_timer, |
| 828 | .init_early = msm7x2x_init_early, |
Taniya Das | 86e0e13 | 2011-10-19 11:32:00 +0530 | [diff] [blame] | 829 | .handle_irq = vic_handle_irq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 830 | MACHINE_END |
| 831 | MACHINE_START(MSM7X27A_SURF, "QCT MSM7x27a SURF") |
| 832 | .boot_params = PHYS_OFFSET + 0x100, |
| 833 | .map_io = msm_common_io_init, |
Chintan Pandya | 12ec56a | 2012-03-13 15:47:12 +0530 | [diff] [blame] | 834 | .reserve = msm7627a_reserve, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 835 | .init_irq = msm_init_irq, |
| 836 | .init_machine = msm7x2x_init, |
| 837 | .timer = &msm_timer, |
| 838 | .init_early = msm7x2x_init_early, |
Taniya Das | 86e0e13 | 2011-10-19 11:32:00 +0530 | [diff] [blame] | 839 | .handle_irq = vic_handle_irq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 840 | MACHINE_END |
| 841 | MACHINE_START(MSM7X27A_FFA, "QCT MSM7x27a FFA") |
| 842 | .boot_params = PHYS_OFFSET + 0x100, |
| 843 | .map_io = msm_common_io_init, |
Chintan Pandya | 12ec56a | 2012-03-13 15:47:12 +0530 | [diff] [blame] | 844 | .reserve = msm7627a_reserve, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 845 | .init_irq = msm_init_irq, |
| 846 | .init_machine = msm7x2x_init, |
| 847 | .timer = &msm_timer, |
| 848 | .init_early = msm7x2x_init_early, |
Taniya Das | 86e0e13 | 2011-10-19 11:32:00 +0530 | [diff] [blame] | 849 | .handle_irq = vic_handle_irq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 850 | MACHINE_END |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 851 | MACHINE_START(MSM7625A_SURF, "QCT MSM7625a SURF") |
| 852 | .boot_params = PHYS_OFFSET + 0x100, |
| 853 | .map_io = msm_common_io_init, |
Chintan Pandya | 12ec56a | 2012-03-13 15:47:12 +0530 | [diff] [blame] | 854 | .reserve = msm7627a_reserve, |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 855 | .init_irq = msm_init_irq, |
| 856 | .init_machine = msm7x2x_init, |
| 857 | .timer = &msm_timer, |
| 858 | .init_early = msm7x2x_init_early, |
Taniya Das | 86e0e13 | 2011-10-19 11:32:00 +0530 | [diff] [blame] | 859 | .handle_irq = vic_handle_irq, |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 860 | MACHINE_END |
| 861 | MACHINE_START(MSM7625A_FFA, "QCT MSM7625a FFA") |
| 862 | .boot_params = PHYS_OFFSET + 0x100, |
| 863 | .map_io = msm_common_io_init, |
Chintan Pandya | 12ec56a | 2012-03-13 15:47:12 +0530 | [diff] [blame] | 864 | .reserve = msm7627a_reserve, |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 865 | .init_irq = msm_init_irq, |
| 866 | .init_machine = msm7x2x_init, |
| 867 | .timer = &msm_timer, |
| 868 | .init_early = msm7x2x_init_early, |
Taniya Das | 86e0e13 | 2011-10-19 11:32:00 +0530 | [diff] [blame] | 869 | .handle_irq = vic_handle_irq, |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 870 | MACHINE_END |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 871 | MACHINE_START(MSM8625_RUMI3, "QCT MSM8625 RUMI3") |
| 872 | .boot_params = PHYS_OFFSET + 0x100, |
| 873 | .map_io = msm8625_map_io, |
Taniya Das | 2b16d1d | 2011-12-02 14:44:19 +0530 | [diff] [blame] | 874 | .reserve = msm8625_reserve, |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 875 | .init_irq = msm8625_init_irq, |
| 876 | .init_machine = msm8625_rumi3_init, |
| 877 | .timer = &msm_timer, |
| 878 | .handle_irq = gic_handle_irq, |
| 879 | MACHINE_END |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 880 | MACHINE_START(MSM8625_SURF, "QCT MSM8625 SURF") |
| 881 | .boot_params = PHYS_OFFSET + 0x100, |
| 882 | .map_io = msm8625_map_io, |
| 883 | .reserve = msm8625_reserve, |
| 884 | .init_irq = msm8625_init_irq, |
| 885 | .init_machine = msm7x2x_init, |
| 886 | .timer = &msm_timer, |
| 887 | .init_early = msm7x2x_init_early, |
| 888 | .handle_irq = gic_handle_irq, |
| 889 | MACHINE_END |