Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
| 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | * |
| 12 | */ |
| 13 | #include <linux/kernel.h> |
| 14 | #include <linux/platform_device.h> |
| 15 | #include <linux/io.h> |
| 16 | #include <linux/irq.h> |
| 17 | #include <linux/i2c.h> |
| 18 | #include <linux/i2c/sx150x.h> |
| 19 | #include <linux/i2c/isl9519.h> |
| 20 | #include <linux/gpio.h> |
| 21 | #include <linux/msm_ssbi.h> |
| 22 | #include <linux/regulator/gpio-regulator.h> |
| 23 | #include <linux/mfd/pm8xxx/pm8921.h> |
| 24 | #include <linux/mfd/pm8xxx/pm8xxx-adc.h> |
| 25 | #include <linux/regulator/consumer.h> |
| 26 | #include <linux/spi/spi.h> |
| 27 | #include <linux/slimbus/slimbus.h> |
| 28 | #include <linux/bootmem.h> |
| 29 | #include <linux/msm_kgsl.h> |
| 30 | #ifdef CONFIG_ANDROID_PMEM |
| 31 | #include <linux/android_pmem.h> |
| 32 | #endif |
| 33 | #include <linux/cyttsp.h> |
| 34 | #include <linux/dma-mapping.h> |
| 35 | #include <linux/platform_data/qcom_crypto_device.h> |
| 36 | #include <linux/platform_data/qcom_wcnss_device.h> |
| 37 | #include <linux/leds.h> |
| 38 | #include <linux/leds-pm8xxx.h> |
| 39 | #include <linux/i2c/atmel_mxt_ts.h> |
| 40 | #include <linux/msm_tsens.h> |
| 41 | #include <linux/ks8851.h> |
| 42 | #include <linux/i2c/isa1200.h> |
| 43 | |
| 44 | #include <asm/mach-types.h> |
| 45 | #include <asm/mach/arch.h> |
| 46 | #include <asm/setup.h> |
| 47 | #include <asm/hardware/gic.h> |
| 48 | #include <asm/mach/mmc.h> |
| 49 | |
| 50 | #include <mach/board.h> |
| 51 | #include <mach/msm_iomap.h> |
| 52 | #include <mach/msm_spi.h> |
| 53 | #ifdef CONFIG_USB_MSM_OTG_72K |
| 54 | #include <mach/msm_hsusb.h> |
| 55 | #else |
| 56 | #include <linux/usb/msm_hsusb.h> |
| 57 | #endif |
| 58 | #include <linux/usb/android.h> |
| 59 | #include <mach/usbdiag.h> |
| 60 | #include <mach/socinfo.h> |
| 61 | #include <mach/rpm.h> |
| 62 | #include <mach/gpio.h> |
| 63 | #include <mach/gpiomux.h> |
| 64 | #include <mach/msm_bus_board.h> |
| 65 | #include <mach/msm_memtypes.h> |
| 66 | #include <mach/dma.h> |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 67 | #include <mach/msm_xo.h> |
| 68 | #include <mach/restart.h> |
| 69 | |
| 70 | #ifdef CONFIG_WCD9310_CODEC |
| 71 | #include <linux/slimbus/slimbus.h> |
| 72 | #include <linux/mfd/wcd9310/core.h> |
| 73 | #include <linux/mfd/wcd9310/pdata.h> |
| 74 | #endif |
| 75 | |
| 76 | #include <linux/ion.h> |
| 77 | #include <mach/ion.h> |
| 78 | #include <mach/mdm2.h> |
| 79 | |
| 80 | #include "timer.h" |
| 81 | #include "devices.h" |
| 82 | #include "devices-msm8x60.h" |
| 83 | #include "spm.h" |
| 84 | #include "board-msm8930.h" |
| 85 | #include "pm.h" |
| 86 | #include "cpuidle.h" |
| 87 | #include "rpm_resources.h" |
| 88 | #include "mpm.h" |
| 89 | #include "acpuclock.h" |
| 90 | #include "rpm_log.h" |
| 91 | #include "smd_private.h" |
| 92 | #include "pm-boot.h" |
| 93 | #include "msm_watchdog.h" |
| 94 | |
| 95 | #define PLATFORM_IS_CHARM25() \ |
| 96 | (machine_is_msm8930_cdp() && \ |
| 97 | (socinfo_get_platform_subtype() == 1) \ |
| 98 | ) |
| 99 | |
| 100 | static struct platform_device msm_fm_platform_init = { |
| 101 | .name = "iris_fm", |
| 102 | .id = -1, |
| 103 | }; |
| 104 | |
| 105 | #define KS8851_RST_GPIO 89 |
| 106 | #define KS8851_IRQ_GPIO 90 |
| 107 | |
| 108 | /* The SPI configurations apply to GSBI 1*/ |
| 109 | static struct gpiomux_setting spi_active = { |
| 110 | .func = GPIOMUX_FUNC_1, |
| 111 | .drv = GPIOMUX_DRV_12MA, |
| 112 | .pull = GPIOMUX_PULL_NONE, |
| 113 | }; |
| 114 | |
| 115 | static struct gpiomux_setting spi_suspended_config = { |
| 116 | .func = GPIOMUX_FUNC_GPIO, |
| 117 | .drv = GPIOMUX_DRV_2MA, |
| 118 | .pull = GPIOMUX_PULL_DOWN, |
| 119 | }; |
| 120 | |
| 121 | static struct gpiomux_setting spi_active_config2 = { |
| 122 | .func = GPIOMUX_FUNC_2, |
| 123 | .drv = GPIOMUX_DRV_8MA, |
| 124 | .pull = GPIOMUX_PULL_NONE, |
| 125 | }; |
| 126 | |
| 127 | static struct gpiomux_setting spi_suspended_config2 = { |
| 128 | .func = GPIOMUX_FUNC_GPIO, |
| 129 | .drv = GPIOMUX_DRV_2MA, |
| 130 | .pull = GPIOMUX_PULL_UP, |
| 131 | }; |
| 132 | |
| 133 | static struct gpiomux_setting gsbi3_suspended_cfg = { |
| 134 | .func = GPIOMUX_FUNC_1, |
| 135 | .drv = GPIOMUX_DRV_2MA, |
| 136 | .pull = GPIOMUX_PULL_KEEPER, |
| 137 | }; |
| 138 | |
| 139 | static struct gpiomux_setting gsbi3_active_cfg = { |
| 140 | .func = GPIOMUX_FUNC_1, |
| 141 | .drv = GPIOMUX_DRV_8MA, |
| 142 | .pull = GPIOMUX_PULL_NONE, |
| 143 | }; |
| 144 | |
| 145 | static struct gpiomux_setting gsbi5 = { |
| 146 | .func = GPIOMUX_FUNC_1, |
| 147 | .drv = GPIOMUX_DRV_8MA, |
| 148 | .pull = GPIOMUX_PULL_NONE, |
| 149 | }; |
| 150 | |
| 151 | static struct gpiomux_setting gsbi10 = { |
| 152 | .func = GPIOMUX_FUNC_2, |
| 153 | .drv = GPIOMUX_DRV_8MA, |
| 154 | .pull = GPIOMUX_PULL_NONE, |
| 155 | }; |
| 156 | |
| 157 | static struct gpiomux_setting gsbi12 = { |
| 158 | .func = GPIOMUX_FUNC_1, |
| 159 | .drv = GPIOMUX_DRV_8MA, |
| 160 | .pull = GPIOMUX_PULL_NONE, |
| 161 | }; |
| 162 | |
| 163 | static struct gpiomux_setting cdc_mclk = { |
| 164 | .func = GPIOMUX_FUNC_1, |
| 165 | .drv = GPIOMUX_DRV_8MA, |
| 166 | .pull = GPIOMUX_PULL_NONE, |
| 167 | }; |
| 168 | |
| 169 | static struct gpiomux_setting audio_auxpcm[] = { |
| 170 | /* Suspended state */ |
| 171 | { |
| 172 | .func = GPIOMUX_FUNC_GPIO, |
| 173 | .drv = GPIOMUX_DRV_2MA, |
| 174 | .pull = GPIOMUX_PULL_NONE, |
| 175 | }, |
| 176 | /* Active state */ |
| 177 | { |
| 178 | .func = GPIOMUX_FUNC_1, |
| 179 | .drv = GPIOMUX_DRV_2MA, |
| 180 | .pull = GPIOMUX_PULL_NONE, |
| 181 | }, |
| 182 | }; |
| 183 | |
| 184 | #if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE) |
| 185 | static struct gpiomux_setting gpio_eth_config = { |
| 186 | .pull = GPIOMUX_PULL_NONE, |
| 187 | .drv = GPIOMUX_DRV_8MA, |
| 188 | .func = GPIOMUX_FUNC_GPIO, |
| 189 | }; |
| 190 | #endif |
| 191 | |
| 192 | static struct gpiomux_setting slimbus = { |
| 193 | .func = GPIOMUX_FUNC_1, |
| 194 | .drv = GPIOMUX_DRV_8MA, |
| 195 | .pull = GPIOMUX_PULL_KEEPER, |
| 196 | }; |
| 197 | |
| 198 | static struct msm_gpiomux_config msm8960_gpiomux_configs[NR_GPIO_IRQS] = { |
| 199 | #if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE) |
| 200 | { |
| 201 | .gpio = KS8851_IRQ_GPIO, |
| 202 | .settings = { |
| 203 | [GPIOMUX_SUSPENDED] = &gpio_eth_config, |
| 204 | } |
| 205 | }, |
| 206 | { |
| 207 | .gpio = KS8851_RST_GPIO, |
| 208 | .settings = { |
| 209 | [GPIOMUX_SUSPENDED] = &gpio_eth_config, |
| 210 | } |
| 211 | }, |
| 212 | #endif |
| 213 | }; |
| 214 | |
| 215 | static struct msm_gpiomux_config msm8960_gsbi_configs[] __initdata = { |
| 216 | { |
| 217 | .gpio = 6, /* GSBI1 QUP SPI_DATA_MOSI */ |
| 218 | .settings = { |
| 219 | [GPIOMUX_SUSPENDED] = &spi_suspended_config, |
| 220 | [GPIOMUX_ACTIVE] = &spi_active, |
| 221 | }, |
| 222 | }, |
| 223 | { |
| 224 | .gpio = 7, /* GSBI1 QUP SPI_DATA_MISO */ |
| 225 | .settings = { |
| 226 | [GPIOMUX_SUSPENDED] = &spi_suspended_config, |
| 227 | [GPIOMUX_ACTIVE] = &spi_active, |
| 228 | }, |
| 229 | }, |
| 230 | { |
| 231 | .gpio = 8, /* GSBI1 QUP SPI_CS_N */ |
| 232 | .settings = { |
| 233 | [GPIOMUX_SUSPENDED] = &spi_suspended_config, |
| 234 | [GPIOMUX_ACTIVE] = &spi_active, |
| 235 | }, |
| 236 | }, |
| 237 | { |
| 238 | .gpio = 9, /* GSBI1 QUP SPI_CLK */ |
| 239 | .settings = { |
| 240 | [GPIOMUX_SUSPENDED] = &spi_suspended_config, |
| 241 | [GPIOMUX_ACTIVE] = &spi_active, |
| 242 | }, |
| 243 | }, |
| 244 | { |
| 245 | .gpio = 14, /* GSBI1 SPI_CS_1 */ |
| 246 | .settings = { |
| 247 | [GPIOMUX_SUSPENDED] = &spi_suspended_config2, |
| 248 | [GPIOMUX_ACTIVE] = &spi_active_config2, |
| 249 | }, |
| 250 | }, |
| 251 | { |
| 252 | .gpio = 16, /* GSBI3 I2C QUP SDA */ |
| 253 | .settings = { |
| 254 | [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg, |
| 255 | [GPIOMUX_ACTIVE] = &gsbi3_active_cfg, |
| 256 | }, |
| 257 | }, |
| 258 | { |
| 259 | .gpio = 17, /* GSBI3 I2C QUP SCL */ |
| 260 | .settings = { |
| 261 | [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg, |
| 262 | [GPIOMUX_ACTIVE] = &gsbi3_active_cfg, |
| 263 | }, |
| 264 | }, |
| 265 | { |
| 266 | .gpio = 22, /* GSBI5 UART2 */ |
| 267 | .settings = { |
| 268 | [GPIOMUX_SUSPENDED] = &gsbi5, |
| 269 | }, |
| 270 | }, |
| 271 | { |
| 272 | .gpio = 23, /* GSBI5 UART2 */ |
| 273 | .settings = { |
| 274 | [GPIOMUX_SUSPENDED] = &gsbi5, |
| 275 | }, |
| 276 | }, |
| 277 | { |
| 278 | .gpio = 24, /* GSBI5 UART2 */ |
| 279 | .settings = { |
| 280 | [GPIOMUX_SUSPENDED] = &gsbi5, |
| 281 | }, |
| 282 | }, |
| 283 | { |
| 284 | .gpio = 25, /* GSBI5 UART2 */ |
| 285 | .settings = { |
| 286 | [GPIOMUX_SUSPENDED] = &gsbi5, |
| 287 | }, |
| 288 | }, |
| 289 | { |
| 290 | .gpio = 44, /* GSBI12 I2C QUP SDA */ |
| 291 | .settings = { |
| 292 | [GPIOMUX_SUSPENDED] = &gsbi12, |
| 293 | }, |
| 294 | }, |
| 295 | { |
| 296 | .gpio = 45, /* GSBI12 I2C QUP SCL */ |
| 297 | .settings = { |
| 298 | [GPIOMUX_SUSPENDED] = &gsbi12, |
| 299 | }, |
| 300 | }, |
| 301 | { |
| 302 | .gpio = 73, /* GSBI10 I2C QUP SDA */ |
| 303 | .settings = { |
| 304 | [GPIOMUX_SUSPENDED] = &gsbi10, |
| 305 | }, |
| 306 | }, |
| 307 | { |
| 308 | .gpio = 74, /* GSBI10 I2C QUP SCL */ |
| 309 | .settings = { |
| 310 | [GPIOMUX_SUSPENDED] = &gsbi10, |
| 311 | }, |
| 312 | }, |
| 313 | }; |
| 314 | |
| 315 | static struct msm_gpiomux_config msm8960_slimbus_config[] __initdata = { |
| 316 | { |
| 317 | .gpio = 60, /* slimbus data */ |
| 318 | .settings = { |
| 319 | [GPIOMUX_SUSPENDED] = &slimbus, |
| 320 | }, |
| 321 | }, |
| 322 | { |
| 323 | .gpio = 61, /* slimbus clk */ |
| 324 | .settings = { |
| 325 | [GPIOMUX_SUSPENDED] = &slimbus, |
| 326 | }, |
| 327 | }, |
| 328 | }; |
| 329 | |
| 330 | static struct msm_gpiomux_config msm8960_audio_codec_configs[] __initdata = { |
| 331 | { |
| 332 | .gpio = 59, |
| 333 | .settings = { |
| 334 | [GPIOMUX_SUSPENDED] = &cdc_mclk, |
| 335 | }, |
| 336 | }, |
| 337 | }; |
| 338 | |
| 339 | static struct msm_gpiomux_config msm8960_audio_auxpcm_configs[] __initdata = { |
| 340 | { |
| 341 | .gpio = 63, |
| 342 | .settings = { |
| 343 | [GPIOMUX_SUSPENDED] = &audio_auxpcm[0], |
| 344 | [GPIOMUX_ACTIVE] = &audio_auxpcm[1], |
| 345 | }, |
| 346 | }, |
| 347 | { |
| 348 | .gpio = 64, |
| 349 | .settings = { |
| 350 | [GPIOMUX_SUSPENDED] = &audio_auxpcm[0], |
| 351 | [GPIOMUX_ACTIVE] = &audio_auxpcm[1], |
| 352 | }, |
| 353 | }, |
| 354 | { |
| 355 | .gpio = 65, |
| 356 | .settings = { |
| 357 | [GPIOMUX_SUSPENDED] = &audio_auxpcm[0], |
| 358 | [GPIOMUX_ACTIVE] = &audio_auxpcm[1], |
| 359 | }, |
| 360 | }, |
| 361 | { |
| 362 | .gpio = 66, |
| 363 | .settings = { |
| 364 | [GPIOMUX_SUSPENDED] = &audio_auxpcm[0], |
| 365 | [GPIOMUX_ACTIVE] = &audio_auxpcm[1], |
| 366 | }, |
| 367 | }, |
| 368 | }; |
| 369 | |
| 370 | static struct gpiomux_setting wcnss_5wire_suspend_cfg = { |
| 371 | .func = GPIOMUX_FUNC_GPIO, |
| 372 | .drv = GPIOMUX_DRV_2MA, |
| 373 | .pull = GPIOMUX_PULL_UP, |
| 374 | }; |
| 375 | |
| 376 | static struct gpiomux_setting wcnss_5wire_active_cfg = { |
| 377 | .func = GPIOMUX_FUNC_1, |
| 378 | .drv = GPIOMUX_DRV_6MA, |
| 379 | .pull = GPIOMUX_PULL_DOWN, |
| 380 | }; |
| 381 | |
| 382 | static struct msm_gpiomux_config wcnss_5wire_interface[] = { |
| 383 | { |
| 384 | .gpio = 84, |
| 385 | .settings = { |
| 386 | [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg, |
| 387 | [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg, |
| 388 | }, |
| 389 | }, |
| 390 | { |
| 391 | .gpio = 85, |
| 392 | .settings = { |
| 393 | [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg, |
| 394 | [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg, |
| 395 | }, |
| 396 | }, |
| 397 | { |
| 398 | .gpio = 86, |
| 399 | .settings = { |
| 400 | [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg, |
| 401 | [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg, |
| 402 | }, |
| 403 | }, |
| 404 | { |
| 405 | .gpio = 87, |
| 406 | .settings = { |
| 407 | [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg, |
| 408 | [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg, |
| 409 | }, |
| 410 | }, |
| 411 | { |
| 412 | .gpio = 88, |
| 413 | .settings = { |
| 414 | [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg, |
| 415 | [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg, |
| 416 | }, |
| 417 | }, |
| 418 | }; |
| 419 | |
| 420 | static struct gpiomux_setting cyts_resout_sus_cfg = { |
| 421 | .func = GPIOMUX_FUNC_GPIO, |
| 422 | .drv = GPIOMUX_DRV_6MA, |
| 423 | .pull = GPIOMUX_PULL_UP, |
| 424 | }; |
| 425 | |
| 426 | static struct gpiomux_setting cyts_resout_act_cfg = { |
| 427 | .func = GPIOMUX_FUNC_GPIO, |
| 428 | .drv = GPIOMUX_DRV_6MA, |
| 429 | .pull = GPIOMUX_PULL_UP, |
| 430 | }; |
| 431 | |
| 432 | static struct gpiomux_setting cyts_sleep_sus_cfg = { |
| 433 | .func = GPIOMUX_FUNC_GPIO, |
| 434 | .drv = GPIOMUX_DRV_6MA, |
| 435 | .pull = GPIOMUX_PULL_DOWN, |
| 436 | }; |
| 437 | |
| 438 | static struct gpiomux_setting cyts_sleep_act_cfg = { |
| 439 | .func = GPIOMUX_FUNC_GPIO, |
| 440 | .drv = GPIOMUX_DRV_6MA, |
| 441 | .pull = GPIOMUX_PULL_DOWN, |
| 442 | }; |
| 443 | |
| 444 | static struct gpiomux_setting cyts_int_act_cfg = { |
| 445 | .func = GPIOMUX_FUNC_GPIO, |
| 446 | .drv = GPIOMUX_DRV_8MA, |
| 447 | .pull = GPIOMUX_PULL_UP, |
| 448 | }; |
| 449 | |
| 450 | static struct gpiomux_setting cyts_int_sus_cfg = { |
| 451 | .func = GPIOMUX_FUNC_GPIO, |
| 452 | .drv = GPIOMUX_DRV_2MA, |
| 453 | .pull = GPIOMUX_PULL_DOWN, |
| 454 | }; |
| 455 | |
| 456 | static struct msm_gpiomux_config msm8960_cyts_configs[] __initdata = { |
| 457 | { /* TS INTERRUPT */ |
| 458 | .gpio = 11, |
| 459 | .settings = { |
| 460 | [GPIOMUX_ACTIVE] = &cyts_int_act_cfg, |
| 461 | [GPIOMUX_SUSPENDED] = &cyts_int_sus_cfg, |
| 462 | }, |
| 463 | }, |
| 464 | { /* TS SLEEP */ |
| 465 | .gpio = 50, |
| 466 | .settings = { |
| 467 | [GPIOMUX_ACTIVE] = &cyts_sleep_act_cfg, |
| 468 | [GPIOMUX_SUSPENDED] = &cyts_sleep_sus_cfg, |
| 469 | }, |
| 470 | }, |
| 471 | { /* TS RESOUT */ |
| 472 | .gpio = 52, |
| 473 | .settings = { |
| 474 | [GPIOMUX_ACTIVE] = &cyts_resout_act_cfg, |
| 475 | [GPIOMUX_SUSPENDED] = &cyts_resout_sus_cfg, |
| 476 | }, |
| 477 | }, |
| 478 | }; |
| 479 | |
| 480 | #ifdef CONFIG_USB_EHCI_MSM_HSIC |
| 481 | static struct gpiomux_setting hsic_act_cfg = { |
| 482 | .func = GPIOMUX_FUNC_1, |
| 483 | .drv = GPIOMUX_DRV_12MA, |
| 484 | .pull = GPIOMUX_PULL_NONE, |
| 485 | }; |
| 486 | |
| 487 | static struct gpiomux_setting hsic_sus_cfg = { |
| 488 | .func = GPIOMUX_FUNC_GPIO, |
| 489 | .drv = GPIOMUX_DRV_2MA, |
| 490 | .pull = GPIOMUX_PULL_DOWN, |
| 491 | .dir = GPIOMUX_OUT_LOW, |
| 492 | }; |
| 493 | |
| 494 | static struct gpiomux_setting hsic_hub_act_cfg = { |
| 495 | .func = GPIOMUX_FUNC_GPIO, |
| 496 | .drv = GPIOMUX_DRV_2MA, |
| 497 | .pull = GPIOMUX_PULL_NONE, |
| 498 | }; |
| 499 | |
| 500 | static struct msm_gpiomux_config msm8960_hsic_configs[] = { |
| 501 | { |
| 502 | .gpio = 150, /*HSIC_STROBE */ |
| 503 | .settings = { |
| 504 | [GPIOMUX_ACTIVE] = &hsic_act_cfg, |
| 505 | [GPIOMUX_SUSPENDED] = &hsic_sus_cfg, |
| 506 | }, |
| 507 | }, |
| 508 | { |
| 509 | .gpio = 151, /* HSIC_DATA */ |
| 510 | .settings = { |
| 511 | [GPIOMUX_ACTIVE] = &hsic_act_cfg, |
| 512 | [GPIOMUX_SUSPENDED] = &hsic_sus_cfg, |
| 513 | }, |
| 514 | }, |
| 515 | { |
| 516 | .gpio = 91, /* HSIC_HUB_RESET */ |
| 517 | .settings = { |
| 518 | [GPIOMUX_ACTIVE] = &hsic_hub_act_cfg, |
| 519 | [GPIOMUX_SUSPENDED] = &hsic_sus_cfg, |
| 520 | }, |
| 521 | }, |
| 522 | }; |
| 523 | #endif |
| 524 | |
| 525 | #define HAP_SHIFT_LVL_OE_GPIO 47 |
| 526 | |
| 527 | static struct gpiomux_setting hap_lvl_shft_suspended_config = { |
| 528 | .func = GPIOMUX_FUNC_GPIO, |
| 529 | .drv = GPIOMUX_DRV_2MA, |
| 530 | .pull = GPIOMUX_PULL_DOWN, |
| 531 | }; |
| 532 | |
| 533 | static struct gpiomux_setting hap_lvl_shft_active_config = { |
| 534 | .func = GPIOMUX_FUNC_GPIO, |
| 535 | .drv = GPIOMUX_DRV_8MA, |
| 536 | .pull = GPIOMUX_PULL_UP, |
| 537 | }; |
| 538 | |
| 539 | static struct msm_gpiomux_config hap_lvl_shft_config[] __initdata = { |
| 540 | { |
| 541 | .gpio = HAP_SHIFT_LVL_OE_GPIO, |
| 542 | .settings = { |
| 543 | [GPIOMUX_SUSPENDED] = &hap_lvl_shft_suspended_config, |
| 544 | [GPIOMUX_ACTIVE] = &hap_lvl_shft_active_config, |
| 545 | }, |
| 546 | }, |
| 547 | }; |
| 548 | |
| 549 | #if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE) |
| 550 | |
| 551 | struct sx150x_platform_data msm8930_sx150x_data[] = { |
| 552 | [SX150X_CAM] = { |
| 553 | .gpio_base = GPIO_CAM_EXPANDER_BASE, |
| 554 | .oscio_is_gpo = false, |
| 555 | .io_pullup_ena = 0x0, |
| 556 | .io_pulldn_ena = 0xc0, |
| 557 | .io_open_drain_ena = 0x0, |
| 558 | .irq_summary = -1, |
| 559 | }, |
| 560 | }; |
| 561 | |
| 562 | #endif |
| 563 | |
| 564 | #define MSM_PMEM_ADSP_SIZE 0x3800000 |
| 565 | #define MSM_PMEM_AUDIO_SIZE 0x28B000 |
| 566 | #ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY |
| 567 | #define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */ |
| 568 | #else |
| 569 | #define MSM_PMEM_SIZE 0x1C00000 /* 28 Mbytes */ |
| 570 | #endif |
| 571 | |
| 572 | |
| 573 | #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION |
| 574 | #define MSM_PMEM_KERNEL_EBI1_SIZE 0xB0C000 |
| 575 | #define MSM_ION_EBI_SIZE (MSM_PMEM_SIZE + 0x600000) |
| 576 | #define MSM_ION_ADSP_SIZE MSM_PMEM_ADSP_SIZE |
| 577 | #define MSM_ION_HEAP_NUM 4 |
| 578 | #else |
| 579 | #define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000 |
| 580 | #define MSM_ION_HEAP_NUM 2 |
| 581 | #endif |
| 582 | |
| 583 | #ifdef CONFIG_KERNEL_PMEM_EBI_REGION |
| 584 | static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE; |
| 585 | static int __init pmem_kernel_ebi1_size_setup(char *p) |
| 586 | { |
| 587 | pmem_kernel_ebi1_size = memparse(p, NULL); |
| 588 | return 0; |
| 589 | } |
| 590 | early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup); |
| 591 | #endif |
| 592 | |
| 593 | #ifdef CONFIG_ANDROID_PMEM |
| 594 | static unsigned pmem_size = MSM_PMEM_SIZE; |
| 595 | static int __init pmem_size_setup(char *p) |
| 596 | { |
| 597 | pmem_size = memparse(p, NULL); |
| 598 | return 0; |
| 599 | } |
| 600 | early_param("pmem_size", pmem_size_setup); |
| 601 | |
| 602 | static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE; |
| 603 | |
| 604 | static int __init pmem_adsp_size_setup(char *p) |
| 605 | { |
| 606 | pmem_adsp_size = memparse(p, NULL); |
| 607 | return 0; |
| 608 | } |
| 609 | early_param("pmem_adsp_size", pmem_adsp_size_setup); |
| 610 | |
| 611 | static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE; |
| 612 | |
| 613 | static int __init pmem_audio_size_setup(char *p) |
| 614 | { |
| 615 | pmem_audio_size = memparse(p, NULL); |
| 616 | return 0; |
| 617 | } |
| 618 | early_param("pmem_audio_size", pmem_audio_size_setup); |
| 619 | #endif |
| 620 | |
| 621 | #ifdef CONFIG_ANDROID_PMEM |
| 622 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION |
| 623 | static struct android_pmem_platform_data android_pmem_pdata = { |
| 624 | .name = "pmem", |
| 625 | .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING, |
| 626 | .cached = 1, |
| 627 | .memory_type = MEMTYPE_EBI1, |
| 628 | }; |
| 629 | |
| 630 | static struct platform_device android_pmem_device = { |
| 631 | .name = "android_pmem", |
| 632 | .id = 0, |
| 633 | .dev = {.platform_data = &android_pmem_pdata}, |
| 634 | }; |
| 635 | |
| 636 | static struct android_pmem_platform_data android_pmem_adsp_pdata = { |
| 637 | .name = "pmem_adsp", |
| 638 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 639 | .cached = 0, |
| 640 | .memory_type = MEMTYPE_EBI1, |
| 641 | }; |
| 642 | static struct platform_device android_pmem_adsp_device = { |
| 643 | .name = "android_pmem", |
| 644 | .id = 2, |
| 645 | .dev = { .platform_data = &android_pmem_adsp_pdata }, |
| 646 | }; |
| 647 | #endif |
| 648 | |
| 649 | static struct android_pmem_platform_data android_pmem_audio_pdata = { |
| 650 | .name = "pmem_audio", |
| 651 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 652 | .cached = 0, |
| 653 | .memory_type = MEMTYPE_EBI1, |
| 654 | }; |
| 655 | |
| 656 | static struct platform_device android_pmem_audio_device = { |
| 657 | .name = "android_pmem", |
| 658 | .id = 4, |
| 659 | .dev = { .platform_data = &android_pmem_audio_pdata }, |
| 660 | }; |
| 661 | #endif |
| 662 | |
| 663 | #define DSP_RAM_BASE_8960 0x8da00000 |
| 664 | #define DSP_RAM_SIZE_8960 0x1800000 |
| 665 | static int dspcrashd_pdata_8960 = 0xDEADDEAD; |
| 666 | |
| 667 | static struct resource resources_dspcrashd_8960[] = { |
| 668 | { |
| 669 | .name = "msm_dspcrashd", |
| 670 | .start = DSP_RAM_BASE_8960, |
| 671 | .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960, |
| 672 | .flags = IORESOURCE_DMA, |
| 673 | }, |
| 674 | }; |
| 675 | |
| 676 | static struct platform_device msm_device_dspcrashd_8960 = { |
| 677 | .name = "msm_dspcrashd", |
| 678 | .num_resources = ARRAY_SIZE(resources_dspcrashd_8960), |
| 679 | .resource = resources_dspcrashd_8960, |
| 680 | .dev = { .platform_data = &dspcrashd_pdata_8960 }, |
| 681 | }; |
| 682 | |
| 683 | static struct memtype_reserve msm8930_reserve_table[] __initdata = { |
| 684 | [MEMTYPE_SMI] = { |
| 685 | }, |
| 686 | [MEMTYPE_EBI0] = { |
| 687 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 688 | }, |
| 689 | [MEMTYPE_EBI1] = { |
| 690 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 691 | }, |
| 692 | }; |
| 693 | |
| 694 | static void __init size_pmem_devices(void) |
| 695 | { |
| 696 | #ifdef CONFIG_ANDROID_PMEM |
| 697 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION |
| 698 | android_pmem_adsp_pdata.size = pmem_adsp_size; |
| 699 | android_pmem_pdata.size = pmem_size; |
| 700 | #endif |
| 701 | android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE; |
| 702 | #endif |
| 703 | } |
| 704 | |
| 705 | static void __init reserve_memory_for(struct android_pmem_platform_data *p) |
| 706 | { |
| 707 | msm8930_reserve_table[p->memory_type].size += p->size; |
| 708 | } |
| 709 | |
| 710 | static void __init reserve_pmem_memory(void) |
| 711 | { |
| 712 | #ifdef CONFIG_ANDROID_PMEM |
| 713 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION |
| 714 | reserve_memory_for(&android_pmem_adsp_pdata); |
| 715 | reserve_memory_for(&android_pmem_pdata); |
| 716 | #endif |
| 717 | reserve_memory_for(&android_pmem_audio_pdata); |
| 718 | msm8930_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size; |
| 719 | #endif |
| 720 | } |
| 721 | |
| 722 | static int msm8930_paddr_to_memtype(unsigned int paddr) |
| 723 | { |
| 724 | return MEMTYPE_EBI1; |
| 725 | } |
| 726 | |
| 727 | #ifdef CONFIG_ION_MSM |
| 728 | static struct ion_platform_data ion_pdata = { |
| 729 | .nr = MSM_ION_HEAP_NUM, |
| 730 | .heaps = { |
| 731 | { |
| 732 | .id = ION_HEAP_SYSTEM_ID, |
| 733 | .type = ION_HEAP_TYPE_SYSTEM, |
| 734 | .name = ION_KMALLOC_HEAP_NAME, |
| 735 | }, |
| 736 | { |
| 737 | .id = ION_HEAP_SYSTEM_CONTIG_ID, |
| 738 | .type = ION_HEAP_TYPE_SYSTEM_CONTIG, |
| 739 | .name = ION_VMALLOC_HEAP_NAME, |
| 740 | }, |
| 741 | #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION |
| 742 | { |
| 743 | .id = ION_HEAP_EBI_ID, |
| 744 | .type = ION_HEAP_TYPE_CARVEOUT, |
| 745 | .name = ION_EBI1_HEAP_NAME, |
| 746 | .size = MSM_ION_EBI_SIZE, |
| 747 | .memory_type = ION_EBI_TYPE, |
| 748 | }, |
| 749 | { |
| 750 | .id = ION_HEAP_ADSP_ID, |
| 751 | .type = ION_HEAP_TYPE_CARVEOUT, |
| 752 | .name = ION_ADSP_HEAP_NAME, |
| 753 | .size = MSM_ION_ADSP_SIZE, |
| 754 | .memory_type = ION_EBI_TYPE, |
| 755 | }, |
| 756 | #endif |
| 757 | } |
| 758 | }; |
| 759 | |
| 760 | static struct platform_device ion_dev = { |
| 761 | .name = "ion-msm", |
| 762 | .id = 1, |
| 763 | .dev = { .platform_data = &ion_pdata }, |
| 764 | }; |
| 765 | #endif |
| 766 | |
| 767 | static void reserve_ion_memory(void) |
| 768 | { |
| 769 | #if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION) |
| 770 | msm8930_reserve_table[MEMTYPE_EBI1].size += MSM_ION_EBI_SIZE; |
| 771 | msm8930_reserve_table[MEMTYPE_EBI1].size += MSM_ION_ADSP_SIZE; |
| 772 | #endif |
| 773 | } |
| 774 | static void __init msm8930_calculate_reserve_sizes(void) |
| 775 | { |
| 776 | size_pmem_devices(); |
| 777 | reserve_pmem_memory(); |
| 778 | reserve_ion_memory(); |
| 779 | } |
| 780 | |
| 781 | static struct reserve_info msm8930_reserve_info __initdata = { |
| 782 | .memtype_reserve_table = msm8930_reserve_table, |
| 783 | .calculate_reserve_sizes = msm8930_calculate_reserve_sizes, |
| 784 | .paddr_to_memtype = msm8930_paddr_to_memtype, |
| 785 | }; |
| 786 | |
| 787 | static int msm8930_memory_bank_size(void) |
| 788 | { |
| 789 | return 1<<29; |
| 790 | } |
| 791 | |
| 792 | static void __init locate_unstable_memory(void) |
| 793 | { |
| 794 | struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1]; |
| 795 | unsigned long bank_size; |
| 796 | unsigned long low, high; |
| 797 | |
| 798 | bank_size = msm8930_memory_bank_size(); |
| 799 | low = meminfo.bank[0].start; |
| 800 | high = mb->start + mb->size; |
| 801 | |
| 802 | /* Check if 32 bit overflow occured */ |
| 803 | if (high < mb->start) |
| 804 | high = ~0UL; |
| 805 | |
| 806 | low &= ~(bank_size - 1); |
| 807 | |
| 808 | if (high - low <= bank_size) |
| 809 | return; |
| 810 | msm8930_reserve_info.low_unstable_address = low + bank_size; |
| 811 | /* To avoid overflow of u32 compute max_unstable_size |
| 812 | * by first subtracting low from mb->start) |
| 813 | * */ |
| 814 | msm8930_reserve_info.max_unstable_size = (mb->start - low) + |
| 815 | mb->size - bank_size; |
| 816 | |
| 817 | msm8930_reserve_info.bank_size = bank_size; |
| 818 | pr_info("low unstable address %lx max size %lx bank size %lx\n", |
| 819 | msm8930_reserve_info.low_unstable_address, |
| 820 | msm8930_reserve_info.max_unstable_size, |
| 821 | msm8930_reserve_info.bank_size); |
| 822 | } |
| 823 | |
| 824 | static void __init place_movable_zone(void) |
| 825 | { |
| 826 | movable_reserved_start = msm8930_reserve_info.low_unstable_address; |
| 827 | movable_reserved_size = msm8930_reserve_info.max_unstable_size; |
| 828 | pr_info("movable zone start %lx size %lx\n", |
| 829 | movable_reserved_start, movable_reserved_size); |
| 830 | } |
| 831 | |
| 832 | static void __init msm8930_early_memory(void) |
| 833 | { |
| 834 | reserve_info = &msm8930_reserve_info; |
| 835 | locate_unstable_memory(); |
| 836 | place_movable_zone(); |
| 837 | } |
| 838 | |
| 839 | static void __init msm8930_reserve(void) |
| 840 | { |
| 841 | msm_reserve(); |
| 842 | } |
| 843 | |
| 844 | static int msm8930_change_memory_power(u64 start, u64 size, |
| 845 | int change_type) |
| 846 | { |
| 847 | return soc_change_memory_power(start, size, change_type); |
| 848 | } |
| 849 | |
| 850 | static void __init msm8930_allocate_memory_regions(void) |
| 851 | { |
| 852 | msm8930_allocate_fb_region(); |
| 853 | } |
| 854 | |
| 855 | #ifdef CONFIG_WCD9310_CODEC |
| 856 | |
| 857 | #define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS) |
| 858 | |
| 859 | /* Micbias setting is based on 8660 CDP/MTP/FLUID requirement |
| 860 | * 4 micbiases are used to power various analog and digital |
| 861 | * microphones operating at 1800 mV. Technically, all micbiases |
| 862 | * can source from single cfilter since all microphones operate |
| 863 | * at the same voltage level. The arrangement below is to make |
| 864 | * sure all cfilters are exercised. LDO_H regulator ouput level |
| 865 | * does not need to be as high as 2.85V. It is choosen for |
| 866 | * microphone sensitivity purpose. |
| 867 | */ |
| 868 | static struct tabla_pdata tabla_platform_data = { |
| 869 | .slimbus_slave_device = { |
| 870 | .name = "tabla-slave", |
| 871 | .e_addr = {0, 0, 0x10, 0, 0x17, 2}, |
| 872 | }, |
| 873 | .irq = MSM_GPIO_TO_INT(62), |
| 874 | .irq_base = TABLA_INTERRUPT_BASE, |
| 875 | .num_irqs = NR_TABLA_IRQS, |
| 876 | .reset_gpio = PM8921_GPIO_PM_TO_SYS(34), |
| 877 | .micbias = { |
| 878 | .ldoh_v = TABLA_LDOH_2P85_V, |
| 879 | .cfilt1_mv = 1800, |
| 880 | .cfilt2_mv = 1800, |
| 881 | .cfilt3_mv = 1800, |
| 882 | .bias1_cfilt_sel = TABLA_CFILT1_SEL, |
| 883 | .bias2_cfilt_sel = TABLA_CFILT2_SEL, |
| 884 | .bias3_cfilt_sel = TABLA_CFILT3_SEL, |
| 885 | .bias4_cfilt_sel = TABLA_CFILT3_SEL, |
| 886 | } |
| 887 | }; |
| 888 | |
| 889 | static struct slim_device msm_slim_tabla = { |
| 890 | .name = "tabla-slim", |
| 891 | .e_addr = {0, 1, 0x10, 0, 0x17, 2}, |
| 892 | .dev = { |
| 893 | .platform_data = &tabla_platform_data, |
| 894 | }, |
| 895 | }; |
| 896 | |
| 897 | static struct tabla_pdata tabla20_platform_data = { |
| 898 | .slimbus_slave_device = { |
| 899 | .name = "tabla-slave", |
| 900 | .e_addr = {0, 0, 0x60, 0, 0x17, 2}, |
| 901 | }, |
| 902 | .irq = MSM_GPIO_TO_INT(62), |
| 903 | .irq_base = TABLA_INTERRUPT_BASE, |
| 904 | .num_irqs = NR_TABLA_IRQS, |
| 905 | .reset_gpio = PM8921_GPIO_PM_TO_SYS(34), |
| 906 | .micbias = { |
| 907 | .ldoh_v = TABLA_LDOH_2P85_V, |
| 908 | .cfilt1_mv = 1800, |
| 909 | .cfilt2_mv = 1800, |
| 910 | .cfilt3_mv = 1800, |
| 911 | .bias1_cfilt_sel = TABLA_CFILT1_SEL, |
| 912 | .bias2_cfilt_sel = TABLA_CFILT2_SEL, |
| 913 | .bias3_cfilt_sel = TABLA_CFILT3_SEL, |
| 914 | .bias4_cfilt_sel = TABLA_CFILT3_SEL, |
| 915 | } |
| 916 | }; |
| 917 | |
| 918 | static struct slim_device msm_slim_tabla20 = { |
| 919 | .name = "tabla2x-slim", |
| 920 | .e_addr = {0, 1, 0x60, 0, 0x17, 2}, |
| 921 | .dev = { |
| 922 | .platform_data = &tabla20_platform_data, |
| 923 | }, |
| 924 | }; |
| 925 | #endif |
| 926 | |
| 927 | static struct slim_boardinfo msm_slim_devices[] = { |
| 928 | #ifdef CONFIG_WCD9310_CODEC |
| 929 | { |
| 930 | .bus_num = 1, |
| 931 | .slim_slave = &msm_slim_tabla, |
| 932 | }, |
| 933 | { |
| 934 | .bus_num = 1, |
| 935 | .slim_slave = &msm_slim_tabla20, |
| 936 | }, |
| 937 | #endif |
| 938 | /* add more slimbus slaves as needed */ |
| 939 | }; |
| 940 | |
| 941 | #define MSM_WCNSS_PHYS 0x03000000 |
| 942 | #define MSM_WCNSS_SIZE 0x280000 |
| 943 | |
| 944 | static struct resource resources_wcnss_wlan[] = { |
| 945 | { |
| 946 | .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ, |
| 947 | .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ, |
| 948 | .name = "wcnss_wlanrx_irq", |
| 949 | .flags = IORESOURCE_IRQ, |
| 950 | }, |
| 951 | { |
| 952 | .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ, |
| 953 | .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ, |
| 954 | .name = "wcnss_wlantx_irq", |
| 955 | .flags = IORESOURCE_IRQ, |
| 956 | }, |
| 957 | { |
| 958 | .start = MSM_WCNSS_PHYS, |
| 959 | .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1, |
| 960 | .name = "wcnss_mmio", |
| 961 | .flags = IORESOURCE_MEM, |
| 962 | }, |
| 963 | { |
| 964 | .start = 84, |
| 965 | .end = 88, |
| 966 | .name = "wcnss_gpios_5wire", |
| 967 | .flags = IORESOURCE_IO, |
| 968 | }, |
| 969 | }; |
| 970 | |
| 971 | static struct qcom_wcnss_opts qcom_wcnss_pdata = { |
| 972 | .has_48mhz_xo = 1, |
| 973 | }; |
| 974 | |
| 975 | static struct platform_device msm_device_wcnss_wlan = { |
| 976 | .name = "wcnss_wlan", |
| 977 | .id = 0, |
| 978 | .num_resources = ARRAY_SIZE(resources_wcnss_wlan), |
| 979 | .resource = resources_wcnss_wlan, |
| 980 | .dev = {.platform_data = &qcom_wcnss_pdata}, |
| 981 | }; |
| 982 | |
| 983 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 984 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \ |
| 985 | defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 986 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
| 987 | |
| 988 | #define QCE_SIZE 0x10000 |
| 989 | #define QCE_0_BASE 0x18500000 |
| 990 | |
| 991 | #define QCE_HW_KEY_SUPPORT 0 |
| 992 | #define QCE_SHA_HMAC_SUPPORT 1 |
| 993 | #define QCE_SHARE_CE_RESOURCE 1 |
| 994 | #define QCE_CE_SHARED 0 |
| 995 | |
| 996 | static struct resource qcrypto_resources[] = { |
| 997 | [0] = { |
| 998 | .start = QCE_0_BASE, |
| 999 | .end = QCE_0_BASE + QCE_SIZE - 1, |
| 1000 | .flags = IORESOURCE_MEM, |
| 1001 | }, |
| 1002 | [1] = { |
| 1003 | .name = "crypto_channels", |
| 1004 | .start = DMOV_CE_IN_CHAN, |
| 1005 | .end = DMOV_CE_OUT_CHAN, |
| 1006 | .flags = IORESOURCE_DMA, |
| 1007 | }, |
| 1008 | [2] = { |
| 1009 | .name = "crypto_crci_in", |
| 1010 | .start = DMOV_CE_IN_CRCI, |
| 1011 | .end = DMOV_CE_IN_CRCI, |
| 1012 | .flags = IORESOURCE_DMA, |
| 1013 | }, |
| 1014 | [3] = { |
| 1015 | .name = "crypto_crci_out", |
| 1016 | .start = DMOV_CE_OUT_CRCI, |
| 1017 | .end = DMOV_CE_OUT_CRCI, |
| 1018 | .flags = IORESOURCE_DMA, |
| 1019 | }, |
| 1020 | }; |
| 1021 | |
| 1022 | static struct resource qcedev_resources[] = { |
| 1023 | [0] = { |
| 1024 | .start = QCE_0_BASE, |
| 1025 | .end = QCE_0_BASE + QCE_SIZE - 1, |
| 1026 | .flags = IORESOURCE_MEM, |
| 1027 | }, |
| 1028 | [1] = { |
| 1029 | .name = "crypto_channels", |
| 1030 | .start = DMOV_CE_IN_CHAN, |
| 1031 | .end = DMOV_CE_OUT_CHAN, |
| 1032 | .flags = IORESOURCE_DMA, |
| 1033 | }, |
| 1034 | [2] = { |
| 1035 | .name = "crypto_crci_in", |
| 1036 | .start = DMOV_CE_IN_CRCI, |
| 1037 | .end = DMOV_CE_IN_CRCI, |
| 1038 | .flags = IORESOURCE_DMA, |
| 1039 | }, |
| 1040 | [3] = { |
| 1041 | .name = "crypto_crci_out", |
| 1042 | .start = DMOV_CE_OUT_CRCI, |
| 1043 | .end = DMOV_CE_OUT_CRCI, |
| 1044 | .flags = IORESOURCE_DMA, |
| 1045 | }, |
| 1046 | }; |
| 1047 | |
| 1048 | #endif |
| 1049 | |
| 1050 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 1051 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) |
| 1052 | |
| 1053 | static struct msm_ce_hw_support qcrypto_ce_hw_suppport = { |
| 1054 | .ce_shared = QCE_CE_SHARED, |
| 1055 | .shared_ce_resource = QCE_SHARE_CE_RESOURCE, |
| 1056 | .hw_key_support = QCE_HW_KEY_SUPPORT, |
| 1057 | .sha_hmac = QCE_SHA_HMAC_SUPPORT, |
| 1058 | }; |
| 1059 | |
| 1060 | static struct platform_device qcrypto_device = { |
| 1061 | .name = "qcrypto", |
| 1062 | .id = 0, |
| 1063 | .num_resources = ARRAY_SIZE(qcrypto_resources), |
| 1064 | .resource = qcrypto_resources, |
| 1065 | .dev = { |
| 1066 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 1067 | .platform_data = &qcrypto_ce_hw_suppport, |
| 1068 | }, |
| 1069 | }; |
| 1070 | #endif |
| 1071 | |
| 1072 | #if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 1073 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
| 1074 | |
| 1075 | static struct msm_ce_hw_support qcedev_ce_hw_suppport = { |
| 1076 | .ce_shared = QCE_CE_SHARED, |
| 1077 | .shared_ce_resource = QCE_SHARE_CE_RESOURCE, |
| 1078 | .hw_key_support = QCE_HW_KEY_SUPPORT, |
| 1079 | .sha_hmac = QCE_SHA_HMAC_SUPPORT, |
| 1080 | }; |
| 1081 | |
| 1082 | static struct platform_device qcedev_device = { |
| 1083 | .name = "qce", |
| 1084 | .id = 0, |
| 1085 | .num_resources = ARRAY_SIZE(qcedev_resources), |
| 1086 | .resource = qcedev_resources, |
| 1087 | .dev = { |
| 1088 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 1089 | .platform_data = &qcedev_ce_hw_suppport, |
| 1090 | }, |
| 1091 | }; |
| 1092 | #endif |
| 1093 | |
| 1094 | #define MDM2AP_ERRFATAL 70 |
| 1095 | #define AP2MDM_ERRFATAL 95 |
| 1096 | #define MDM2AP_STATUS 69 |
| 1097 | #define AP2MDM_STATUS 94 |
| 1098 | #define AP2MDM_PMIC_RESET_N 80 |
| 1099 | #define AP2MDM_KPDPWR_N 81 |
| 1100 | |
| 1101 | static struct gpiomux_setting ap2mdm_cfg = { |
| 1102 | .func = GPIOMUX_FUNC_GPIO, |
| 1103 | .drv = GPIOMUX_DRV_8MA, |
| 1104 | .pull = GPIOMUX_PULL_DOWN, |
| 1105 | }; |
| 1106 | |
| 1107 | static struct gpiomux_setting mdm2ap_status_cfg = { |
| 1108 | .func = GPIOMUX_FUNC_GPIO, |
| 1109 | .drv = GPIOMUX_DRV_8MA, |
| 1110 | .pull = GPIOMUX_PULL_NONE, |
| 1111 | }; |
| 1112 | |
| 1113 | static struct gpiomux_setting mdm2ap_errfatal_cfg = { |
| 1114 | .func = GPIOMUX_FUNC_GPIO, |
| 1115 | .drv = GPIOMUX_DRV_16MA, |
| 1116 | .pull = GPIOMUX_PULL_DOWN, |
| 1117 | }; |
| 1118 | |
| 1119 | static struct gpiomux_setting ap2mdm_kpdpwr_n_cfg = { |
| 1120 | .func = GPIOMUX_FUNC_GPIO, |
| 1121 | .drv = GPIOMUX_DRV_8MA, |
| 1122 | .pull = GPIOMUX_PULL_NONE, |
| 1123 | }; |
| 1124 | |
| 1125 | static struct msm_gpiomux_config mdm_configs[] __initdata = { |
| 1126 | /* AP2MDM_STATUS */ |
| 1127 | { |
| 1128 | .gpio = AP2MDM_STATUS, |
| 1129 | .settings = { |
| 1130 | [GPIOMUX_SUSPENDED] = &ap2mdm_cfg, |
| 1131 | } |
| 1132 | }, |
| 1133 | /* MDM2AP_STATUS */ |
| 1134 | { |
| 1135 | .gpio = MDM2AP_STATUS, |
| 1136 | .settings = { |
| 1137 | [GPIOMUX_SUSPENDED] = &mdm2ap_status_cfg, |
| 1138 | } |
| 1139 | }, |
| 1140 | /* MDM2AP_ERRFATAL */ |
| 1141 | { |
| 1142 | .gpio = MDM2AP_ERRFATAL, |
| 1143 | .settings = { |
| 1144 | [GPIOMUX_SUSPENDED] = &mdm2ap_errfatal_cfg, |
| 1145 | } |
| 1146 | }, |
| 1147 | /* AP2MDM_ERRFATAL */ |
| 1148 | { |
| 1149 | .gpio = AP2MDM_ERRFATAL, |
| 1150 | .settings = { |
| 1151 | [GPIOMUX_SUSPENDED] = &ap2mdm_cfg, |
| 1152 | } |
| 1153 | }, |
| 1154 | /* AP2MDM_KPDPWR_N */ |
| 1155 | { |
| 1156 | .gpio = AP2MDM_KPDPWR_N, |
| 1157 | .settings = { |
| 1158 | [GPIOMUX_SUSPENDED] = &ap2mdm_kpdpwr_n_cfg, |
| 1159 | } |
| 1160 | }, |
| 1161 | /* AP2MDM_PMIC_RESET_N */ |
| 1162 | { |
| 1163 | .gpio = AP2MDM_PMIC_RESET_N, |
| 1164 | .settings = { |
| 1165 | [GPIOMUX_SUSPENDED] = &ap2mdm_kpdpwr_n_cfg, |
| 1166 | } |
| 1167 | } |
| 1168 | }; |
| 1169 | |
| 1170 | static struct resource mdm_resources[] = { |
| 1171 | { |
| 1172 | .start = MDM2AP_ERRFATAL, |
| 1173 | .end = MDM2AP_ERRFATAL, |
| 1174 | .name = "MDM2AP_ERRFATAL", |
| 1175 | .flags = IORESOURCE_IO, |
| 1176 | }, |
| 1177 | { |
| 1178 | .start = AP2MDM_ERRFATAL, |
| 1179 | .end = AP2MDM_ERRFATAL, |
| 1180 | .name = "AP2MDM_ERRFATAL", |
| 1181 | .flags = IORESOURCE_IO, |
| 1182 | }, |
| 1183 | { |
| 1184 | .start = MDM2AP_STATUS, |
| 1185 | .end = MDM2AP_STATUS, |
| 1186 | .name = "MDM2AP_STATUS", |
| 1187 | .flags = IORESOURCE_IO, |
| 1188 | }, |
| 1189 | { |
| 1190 | .start = AP2MDM_STATUS, |
| 1191 | .end = AP2MDM_STATUS, |
| 1192 | .name = "AP2MDM_STATUS", |
| 1193 | .flags = IORESOURCE_IO, |
| 1194 | }, |
| 1195 | { |
| 1196 | .start = AP2MDM_PMIC_RESET_N, |
| 1197 | .end = AP2MDM_PMIC_RESET_N, |
| 1198 | .name = "AP2MDM_PMIC_RESET_N", |
| 1199 | .flags = IORESOURCE_IO, |
| 1200 | }, |
| 1201 | { |
| 1202 | .start = AP2MDM_KPDPWR_N, |
| 1203 | .end = AP2MDM_KPDPWR_N, |
| 1204 | .name = "AP2MDM_KPDPWR_N", |
| 1205 | .flags = IORESOURCE_IO, |
| 1206 | }, |
| 1207 | }; |
| 1208 | |
| 1209 | static struct mdm_platform_data mdm_platform_data = { |
| 1210 | .mdm_version = "2.5", |
| 1211 | }; |
| 1212 | |
| 1213 | static struct platform_device mdm_device = { |
| 1214 | .name = "mdm2_modem", |
| 1215 | .id = -1, |
| 1216 | .num_resources = ARRAY_SIZE(mdm_resources), |
| 1217 | .resource = mdm_resources, |
| 1218 | .dev = { |
| 1219 | .platform_data = &mdm_platform_data, |
| 1220 | }, |
| 1221 | }; |
| 1222 | |
| 1223 | static struct platform_device *mdm_devices[] __initdata = { |
| 1224 | &mdm_device, |
| 1225 | }; |
| 1226 | |
| 1227 | static int __init gpiomux_init(void) |
| 1228 | { |
| 1229 | int rc; |
| 1230 | |
| 1231 | rc = msm_gpiomux_init(NR_GPIO_IRQS); |
| 1232 | if (rc) { |
| 1233 | pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc); |
| 1234 | return rc; |
| 1235 | } |
| 1236 | |
| 1237 | msm_gpiomux_install(msm8960_gpiomux_configs, |
| 1238 | ARRAY_SIZE(msm8960_gpiomux_configs)); |
| 1239 | |
| 1240 | msm_gpiomux_install(msm8960_gsbi_configs, |
| 1241 | ARRAY_SIZE(msm8960_gsbi_configs)); |
| 1242 | |
| 1243 | msm_gpiomux_install(msm8960_cyts_configs, |
| 1244 | ARRAY_SIZE(msm8960_cyts_configs)); |
| 1245 | |
| 1246 | msm_gpiomux_install(msm8960_slimbus_config, |
| 1247 | ARRAY_SIZE(msm8960_slimbus_config)); |
| 1248 | |
| 1249 | msm_gpiomux_install(msm8960_audio_codec_configs, |
| 1250 | ARRAY_SIZE(msm8960_audio_codec_configs)); |
| 1251 | |
| 1252 | msm_gpiomux_install(msm8960_audio_auxpcm_configs, |
| 1253 | ARRAY_SIZE(msm8960_audio_auxpcm_configs)); |
| 1254 | |
| 1255 | msm_gpiomux_install(wcnss_5wire_interface, |
| 1256 | ARRAY_SIZE(wcnss_5wire_interface)); |
| 1257 | |
| 1258 | if (machine_is_msm8930_mtp() || machine_is_msm8930_fluid() || |
| 1259 | machine_is_msm8930_cdp()) |
| 1260 | msm_gpiomux_install(hap_lvl_shft_config, |
| 1261 | ARRAY_SIZE(hap_lvl_shft_config)); |
| 1262 | |
| 1263 | if (PLATFORM_IS_CHARM25()) |
| 1264 | msm_gpiomux_install(mdm_configs, |
| 1265 | ARRAY_SIZE(mdm_configs)); |
| 1266 | |
| 1267 | return 0; |
| 1268 | } |
| 1269 | |
| 1270 | #define MSM_SHARED_RAM_PHYS 0x80000000 |
| 1271 | |
| 1272 | static void __init msm8930_map_io(void) |
| 1273 | { |
| 1274 | msm_shared_ram_phys = MSM_SHARED_RAM_PHYS; |
| 1275 | msm_map_msm8930_io(); |
| 1276 | |
| 1277 | if (socinfo_init() < 0) |
| 1278 | pr_err("socinfo_init() failed!\n"); |
| 1279 | } |
| 1280 | |
| 1281 | static void __init msm8930_init_irq(void) |
| 1282 | { |
| 1283 | unsigned int i; |
| 1284 | |
| 1285 | msm_mpm_irq_extn_init(); |
| 1286 | gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE, |
| 1287 | (void *)MSM_QGIC_CPU_BASE); |
| 1288 | |
| 1289 | /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */ |
| 1290 | writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4); |
| 1291 | |
| 1292 | writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET); |
| 1293 | mb(); |
| 1294 | |
| 1295 | /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet |
| 1296 | * as they are configured as level, which does not play nice with |
| 1297 | * handle_percpu_irq. |
| 1298 | */ |
| 1299 | for (i = GIC_PPI_START; i < GIC_SPI_START; i++) { |
| 1300 | if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE) |
| 1301 | irq_set_handler(i, handle_percpu_irq); |
| 1302 | } |
| 1303 | } |
| 1304 | |
| 1305 | static void __init msm8930_init_buses(void) |
| 1306 | { |
| 1307 | #ifdef CONFIG_MSM_BUS_SCALING |
| 1308 | msm_bus_rpm_set_mt_mask(); |
| 1309 | msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1; |
| 1310 | msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1; |
| 1311 | msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1; |
| 1312 | msm_bus_apps_fabric.dev.platform_data = |
| 1313 | &msm_bus_8960_apps_fabric_pdata; |
| 1314 | msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata; |
| 1315 | msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata; |
| 1316 | msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata; |
| 1317 | msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata; |
| 1318 | #endif |
| 1319 | } |
| 1320 | |
| 1321 | static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = { |
| 1322 | .max_clock_speed = 15060000, |
| 1323 | }; |
| 1324 | |
| 1325 | #ifdef CONFIG_USB_MSM_OTG_72K |
| 1326 | static struct msm_otg_platform_data msm_otg_pdata; |
| 1327 | #else |
| 1328 | #define USB_5V_EN 42 |
| 1329 | static void msm_hsusb_vbus_power(bool on) |
| 1330 | { |
| 1331 | int rc; |
| 1332 | static bool vbus_is_on; |
| 1333 | static struct regulator *mvs_otg_switch; |
| 1334 | |
| 1335 | if (vbus_is_on == on) |
| 1336 | return; |
| 1337 | |
| 1338 | if (on) { |
| 1339 | mvs_otg_switch = regulator_get(&msm8960_device_otg.dev, |
| 1340 | "vbus_otg"); |
| 1341 | if (IS_ERR(mvs_otg_switch)) { |
| 1342 | pr_err("Unable to get mvs_otg_switch\n"); |
| 1343 | return; |
| 1344 | } |
| 1345 | |
| 1346 | rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN), |
| 1347 | "usb_5v_en"); |
| 1348 | if (rc < 0) { |
| 1349 | pr_err("failed to request usb_5v_en gpio\n"); |
| 1350 | goto put_mvs_otg; |
| 1351 | } |
| 1352 | |
| 1353 | rc = gpio_direction_output(PM8921_GPIO_PM_TO_SYS(USB_5V_EN), 1); |
| 1354 | if (rc) { |
| 1355 | pr_err("%s: unable to set_direction for gpio [%d]\n", |
| 1356 | __func__, PM8921_GPIO_PM_TO_SYS(USB_5V_EN)); |
| 1357 | goto free_usb_5v_en; |
| 1358 | } |
| 1359 | |
| 1360 | if (regulator_enable(mvs_otg_switch)) { |
| 1361 | pr_err("unable to enable mvs_otg_switch\n"); |
| 1362 | goto err_ldo_gpio_set_dir; |
| 1363 | } |
| 1364 | |
| 1365 | vbus_is_on = true; |
| 1366 | return; |
| 1367 | } |
| 1368 | regulator_disable(mvs_otg_switch); |
| 1369 | err_ldo_gpio_set_dir: |
| 1370 | gpio_set_value(PM8921_GPIO_PM_TO_SYS(USB_5V_EN), 0); |
| 1371 | free_usb_5v_en: |
| 1372 | gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN)); |
| 1373 | put_mvs_otg: |
| 1374 | regulator_put(mvs_otg_switch); |
| 1375 | vbus_is_on = false; |
| 1376 | } |
| 1377 | |
| 1378 | static struct msm_otg_platform_data msm_otg_pdata = { |
| 1379 | .mode = USB_OTG, |
| 1380 | .otg_control = OTG_PMIC_CONTROL, |
| 1381 | .phy_type = SNPS_28NM_INTEGRATED_PHY, |
| 1382 | .pclk_src_name = "dfab_usb_hs_clk", |
| 1383 | .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE), |
| 1384 | .vbus_power = msm_hsusb_vbus_power, |
| 1385 | .power_budget = 750, |
| 1386 | }; |
| 1387 | #endif |
| 1388 | |
| 1389 | #ifdef CONFIG_USB_EHCI_MSM_HSIC |
| 1390 | #define HSIC_HUB_RESET_GPIO 91 |
| 1391 | static struct msm_hsic_host_platform_data msm_hsic_pdata = { |
| 1392 | .strobe = 150, |
| 1393 | .data = 151, |
| 1394 | }; |
| 1395 | #else |
| 1396 | static struct msm_hsic_host_platform_data msm_hsic_pdata; |
| 1397 | #endif |
| 1398 | |
| 1399 | #define PID_MAGIC_ID 0x71432909 |
| 1400 | #define SERIAL_NUM_MAGIC_ID 0x61945374 |
| 1401 | #define SERIAL_NUMBER_LENGTH 127 |
| 1402 | #define DLOAD_USB_BASE_ADD 0x2A03F0C8 |
| 1403 | |
| 1404 | struct magic_num_struct { |
| 1405 | uint32_t pid; |
| 1406 | uint32_t serial_num; |
| 1407 | }; |
| 1408 | |
| 1409 | struct dload_struct { |
| 1410 | uint32_t reserved1; |
| 1411 | uint32_t reserved2; |
| 1412 | uint32_t reserved3; |
| 1413 | uint16_t reserved4; |
| 1414 | uint16_t pid; |
| 1415 | char serial_number[SERIAL_NUMBER_LENGTH]; |
| 1416 | uint16_t reserved5; |
| 1417 | struct magic_num_struct magic_struct; |
| 1418 | }; |
| 1419 | |
| 1420 | static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum) |
| 1421 | { |
| 1422 | struct dload_struct __iomem *dload = 0; |
| 1423 | |
| 1424 | dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload)); |
| 1425 | if (!dload) { |
| 1426 | pr_err("%s: cannot remap I/O memory region: %08x\n", |
| 1427 | __func__, DLOAD_USB_BASE_ADD); |
| 1428 | return -ENXIO; |
| 1429 | } |
| 1430 | |
| 1431 | pr_debug("%s: dload:%p pid:%x serial_num:%s\n", |
| 1432 | __func__, dload, pid, snum); |
| 1433 | /* update pid */ |
| 1434 | dload->magic_struct.pid = PID_MAGIC_ID; |
| 1435 | dload->pid = pid; |
| 1436 | |
| 1437 | /* update serial number */ |
| 1438 | dload->magic_struct.serial_num = 0; |
| 1439 | if (!snum) { |
| 1440 | memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH); |
| 1441 | goto out; |
| 1442 | } |
| 1443 | |
| 1444 | dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID; |
| 1445 | strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH); |
| 1446 | out: |
| 1447 | iounmap(dload); |
| 1448 | return 0; |
| 1449 | } |
| 1450 | |
| 1451 | static struct android_usb_platform_data android_usb_pdata = { |
| 1452 | .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num, |
| 1453 | }; |
| 1454 | |
| 1455 | static struct platform_device android_usb_device = { |
| 1456 | .name = "android_usb", |
| 1457 | .id = -1, |
| 1458 | .dev = { |
| 1459 | .platform_data = &android_usb_pdata, |
| 1460 | }, |
| 1461 | }; |
| 1462 | |
| 1463 | static uint8_t spm_wfi_cmd_sequence[] __initdata = { |
| 1464 | 0x03, 0x0f, |
| 1465 | }; |
| 1466 | |
| 1467 | static uint8_t spm_power_collapse_without_rpm[] __initdata = { |
| 1468 | 0x00, 0x24, 0x54, 0x10, |
| 1469 | 0x09, 0x03, 0x01, |
| 1470 | 0x10, 0x54, 0x30, 0x0C, |
| 1471 | 0x24, 0x30, 0x0f, |
| 1472 | }; |
| 1473 | |
| 1474 | static uint8_t spm_power_collapse_with_rpm[] __initdata = { |
| 1475 | 0x00, 0x24, 0x54, 0x10, |
| 1476 | 0x09, 0x07, 0x01, 0x0B, |
| 1477 | 0x10, 0x54, 0x30, 0x0C, |
| 1478 | 0x24, 0x30, 0x0f, |
| 1479 | }; |
| 1480 | |
| 1481 | static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = { |
| 1482 | [0] = { |
| 1483 | .mode = MSM_SPM_MODE_CLOCK_GATING, |
| 1484 | .notify_rpm = false, |
| 1485 | .cmd = spm_wfi_cmd_sequence, |
| 1486 | }, |
| 1487 | [1] = { |
| 1488 | .mode = MSM_SPM_MODE_POWER_COLLAPSE, |
| 1489 | .notify_rpm = false, |
| 1490 | .cmd = spm_power_collapse_without_rpm, |
| 1491 | }, |
| 1492 | [2] = { |
| 1493 | .mode = MSM_SPM_MODE_POWER_COLLAPSE, |
| 1494 | .notify_rpm = true, |
| 1495 | .cmd = spm_power_collapse_with_rpm, |
| 1496 | }, |
| 1497 | }; |
| 1498 | |
| 1499 | static struct msm_spm_platform_data msm_spm_data[] __initdata = { |
| 1500 | [0] = { |
| 1501 | .reg_base_addr = MSM_SAW0_BASE, |
| 1502 | .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00, |
| 1503 | .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F, |
| 1504 | .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C, |
| 1505 | #if defined(CONFIG_MSM_AVS_HW) |
| 1506 | .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00, |
| 1507 | .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00, |
| 1508 | #endif |
| 1509 | .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01, |
| 1510 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202, |
| 1511 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C, |
| 1512 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C, |
| 1513 | .vctl_timeout_us = 50, |
| 1514 | .num_modes = ARRAY_SIZE(msm_spm_seq_list), |
| 1515 | .modes = msm_spm_seq_list, |
| 1516 | }, |
| 1517 | [1] = { |
| 1518 | .reg_base_addr = MSM_SAW1_BASE, |
| 1519 | .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00, |
| 1520 | .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F, |
| 1521 | .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C, |
| 1522 | #if defined(CONFIG_MSM_AVS_HW) |
| 1523 | .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00, |
| 1524 | .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00, |
| 1525 | #endif |
| 1526 | .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01, |
| 1527 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202, |
| 1528 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C, |
| 1529 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C, |
| 1530 | .vctl_timeout_us = 50, |
| 1531 | .num_modes = ARRAY_SIZE(msm_spm_seq_list), |
| 1532 | .modes = msm_spm_seq_list, |
| 1533 | }, |
| 1534 | }; |
| 1535 | |
| 1536 | static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = { |
| 1537 | 0x00, 0x20, 0x03, 0x20, |
| 1538 | 0x00, 0x0f, |
| 1539 | }; |
| 1540 | |
| 1541 | static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = { |
| 1542 | 0x00, 0x20, 0x34, 0x64, |
| 1543 | 0x48, 0x07, 0x48, 0x20, |
| 1544 | 0x50, 0x64, 0x04, 0x34, |
| 1545 | 0x50, 0x0f, |
| 1546 | }; |
| 1547 | static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = { |
| 1548 | 0x00, 0x10, 0x34, 0x64, |
| 1549 | 0x48, 0x07, 0x48, 0x10, |
| 1550 | 0x50, 0x64, 0x04, 0x34, |
| 1551 | 0x50, 0x0F, |
| 1552 | }; |
| 1553 | |
| 1554 | static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = { |
| 1555 | [0] = { |
| 1556 | .mode = MSM_SPM_L2_MODE_RETENTION, |
| 1557 | .notify_rpm = false, |
| 1558 | .cmd = l2_spm_wfi_cmd_sequence, |
| 1559 | }, |
| 1560 | [1] = { |
| 1561 | .mode = MSM_SPM_L2_MODE_GDHS, |
| 1562 | .notify_rpm = true, |
| 1563 | .cmd = l2_spm_gdhs_cmd_sequence, |
| 1564 | }, |
| 1565 | [2] = { |
| 1566 | .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE, |
| 1567 | .notify_rpm = true, |
| 1568 | .cmd = l2_spm_power_off_cmd_sequence, |
| 1569 | }, |
| 1570 | }; |
| 1571 | |
| 1572 | static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = { |
| 1573 | [0] = { |
| 1574 | .reg_base_addr = MSM_SAW_L2_BASE, |
| 1575 | .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00, |
| 1576 | .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00, |
| 1577 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202, |
| 1578 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE, |
| 1579 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020, |
| 1580 | .modes = msm_spm_l2_seq_list, |
| 1581 | .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list), |
| 1582 | }, |
| 1583 | }; |
| 1584 | |
| 1585 | #define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33) |
| 1586 | #define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20) |
| 1587 | |
| 1588 | static struct msm_xo_voter *xo_handle_d1; |
| 1589 | |
| 1590 | static int isa1200_power(int on) |
| 1591 | { |
| 1592 | int rc = 0; |
| 1593 | |
| 1594 | gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !!on); |
| 1595 | |
| 1596 | rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) : |
| 1597 | msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF); |
| 1598 | if (rc < 0) { |
| 1599 | pr_err("%s: failed to %svote for TCXO D1 buffer%d\n", |
| 1600 | __func__, on ? "" : "de-", rc); |
| 1601 | goto err_xo_vote; |
| 1602 | } |
| 1603 | |
| 1604 | return 0; |
| 1605 | |
| 1606 | err_xo_vote: |
| 1607 | gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !on); |
| 1608 | return rc; |
| 1609 | } |
| 1610 | |
| 1611 | static int isa1200_dev_setup(bool enable) |
| 1612 | { |
| 1613 | int rc = 0; |
| 1614 | |
| 1615 | struct pm_gpio hap_gpio_config = { |
| 1616 | .direction = PM_GPIO_DIR_OUT, |
| 1617 | .pull = PM_GPIO_PULL_NO, |
| 1618 | .out_strength = PM_GPIO_STRENGTH_HIGH, |
| 1619 | .function = PM_GPIO_FUNC_NORMAL, |
| 1620 | .inv_int_pol = 0, |
| 1621 | .vin_sel = 2, |
| 1622 | .output_buffer = PM_GPIO_OUT_BUF_CMOS, |
| 1623 | .output_value = 0, |
| 1624 | }; |
| 1625 | |
| 1626 | if (enable == true) { |
| 1627 | rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config); |
| 1628 | if (rc) { |
| 1629 | pr_err("%s: pm8921 gpio %d config failed(%d)\n", |
| 1630 | __func__, PM_HAP_EN_GPIO, rc); |
| 1631 | return rc; |
| 1632 | } |
| 1633 | |
| 1634 | rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config); |
| 1635 | if (rc) { |
| 1636 | pr_err("%s: pm8921 gpio %d config failed(%d)\n", |
| 1637 | __func__, PM_HAP_LEN_GPIO, rc); |
| 1638 | return rc; |
| 1639 | } |
| 1640 | |
| 1641 | rc = gpio_request(HAP_SHIFT_LVL_OE_GPIO, "hap_shft_lvl_oe"); |
| 1642 | if (rc) { |
| 1643 | pr_err("%s: unable to request gpio %d (%d)\n", |
| 1644 | __func__, HAP_SHIFT_LVL_OE_GPIO, rc); |
| 1645 | return rc; |
| 1646 | } |
| 1647 | |
| 1648 | rc = gpio_direction_output(HAP_SHIFT_LVL_OE_GPIO, 0); |
| 1649 | if (rc) { |
| 1650 | pr_err("%s: Unable to set direction\n", __func__); |
| 1651 | goto free_gpio; |
| 1652 | } |
| 1653 | |
| 1654 | xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200"); |
| 1655 | if (IS_ERR(xo_handle_d1)) { |
| 1656 | rc = PTR_ERR(xo_handle_d1); |
| 1657 | pr_err("%s: failed to get the handle for D1(%d)\n", |
| 1658 | __func__, rc); |
| 1659 | goto gpio_set_dir; |
| 1660 | } |
| 1661 | } else { |
| 1662 | gpio_free(HAP_SHIFT_LVL_OE_GPIO); |
| 1663 | |
| 1664 | msm_xo_put(xo_handle_d1); |
| 1665 | } |
| 1666 | |
| 1667 | return 0; |
| 1668 | |
| 1669 | gpio_set_dir: |
| 1670 | gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, 0); |
| 1671 | free_gpio: |
| 1672 | gpio_free(HAP_SHIFT_LVL_OE_GPIO); |
| 1673 | return rc; |
| 1674 | } |
| 1675 | |
| 1676 | static struct isa1200_regulator isa1200_reg_data[] = { |
| 1677 | { |
| 1678 | .name = "vcc_i2c", |
| 1679 | .min_uV = ISA_I2C_VTG_MIN_UV, |
| 1680 | .max_uV = ISA_I2C_VTG_MAX_UV, |
| 1681 | .load_uA = ISA_I2C_CURR_UA, |
| 1682 | }, |
| 1683 | }; |
| 1684 | |
| 1685 | static struct isa1200_platform_data isa1200_1_pdata = { |
| 1686 | .name = "vibrator", |
| 1687 | .dev_setup = isa1200_dev_setup, |
| 1688 | .power_on = isa1200_power, |
| 1689 | .hap_en_gpio = PM_HAP_EN_GPIO, |
| 1690 | .hap_len_gpio = PM_HAP_LEN_GPIO, |
| 1691 | .max_timeout = 15000, |
| 1692 | .mode_ctrl = PWM_GEN_MODE, |
| 1693 | .pwm_fd = { |
| 1694 | .pwm_div = 256, |
| 1695 | }, |
| 1696 | .is_erm = false, |
| 1697 | .smart_en = true, |
| 1698 | .ext_clk_en = true, |
| 1699 | .chip_en = 1, |
| 1700 | .regulator_info = isa1200_reg_data, |
| 1701 | .num_regulators = ARRAY_SIZE(isa1200_reg_data), |
| 1702 | }; |
| 1703 | |
| 1704 | static struct i2c_board_info msm_isa1200_board_info[] __initdata = { |
| 1705 | { |
| 1706 | I2C_BOARD_INFO("isa1200_1", 0x90>>1), |
| 1707 | .platform_data = &isa1200_1_pdata, |
| 1708 | }, |
| 1709 | }; |
| 1710 | |
| 1711 | #define CYTTSP_TS_GPIO_IRQ 11 |
| 1712 | #define CYTTSP_TS_SLEEP_GPIO 50 |
| 1713 | #define CYTTSP_TS_RESOUT_N_GPIO 52 |
| 1714 | |
| 1715 | /*virtual key support */ |
| 1716 | static ssize_t tma340_vkeys_show(struct kobject *kobj, |
| 1717 | struct kobj_attribute *attr, char *buf) |
| 1718 | { |
| 1719 | return snprintf(buf, 200, |
| 1720 | __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97" |
| 1721 | ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97" |
| 1722 | ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97" |
| 1723 | ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97" |
| 1724 | "\n"); |
| 1725 | } |
| 1726 | |
| 1727 | static struct kobj_attribute tma340_vkeys_attr = { |
| 1728 | .attr = { |
| 1729 | .mode = S_IRUGO, |
| 1730 | }, |
| 1731 | .show = &tma340_vkeys_show, |
| 1732 | }; |
| 1733 | |
| 1734 | static struct attribute *tma340_properties_attrs[] = { |
| 1735 | &tma340_vkeys_attr.attr, |
| 1736 | NULL |
| 1737 | }; |
| 1738 | |
| 1739 | static struct attribute_group tma340_properties_attr_group = { |
| 1740 | .attrs = tma340_properties_attrs, |
| 1741 | }; |
| 1742 | |
| 1743 | |
| 1744 | static int cyttsp_platform_init(struct i2c_client *client) |
| 1745 | { |
| 1746 | int rc = 0; |
| 1747 | static struct kobject *tma340_properties_kobj; |
| 1748 | |
| 1749 | tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c"; |
| 1750 | tma340_properties_kobj = kobject_create_and_add("board_properties", |
| 1751 | NULL); |
| 1752 | if (tma340_properties_kobj) |
| 1753 | rc = sysfs_create_group(tma340_properties_kobj, |
| 1754 | &tma340_properties_attr_group); |
| 1755 | if (!tma340_properties_kobj || rc) |
| 1756 | pr_err("%s: failed to create board_properties\n", |
| 1757 | __func__); |
| 1758 | |
| 1759 | return 0; |
| 1760 | } |
| 1761 | |
| 1762 | static struct cyttsp_regulator regulator_data[] = { |
| 1763 | { |
| 1764 | .name = "vdd", |
| 1765 | .min_uV = CY_TMA300_VTG_MIN_UV, |
| 1766 | .max_uV = CY_TMA300_VTG_MAX_UV, |
| 1767 | .hpm_load_uA = CY_TMA300_CURR_24HZ_UA, |
| 1768 | .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA, |
| 1769 | }, |
| 1770 | /* TODO: Remove after runtime PM is enabled in I2C driver */ |
| 1771 | { |
| 1772 | .name = "vcc_i2c", |
| 1773 | .min_uV = CY_I2C_VTG_MIN_UV, |
| 1774 | .max_uV = CY_I2C_VTG_MAX_UV, |
| 1775 | .hpm_load_uA = CY_I2C_CURR_UA, |
| 1776 | .lpm_load_uA = CY_I2C_SLEEP_CURR_UA, |
| 1777 | }, |
| 1778 | }; |
| 1779 | |
| 1780 | static struct cyttsp_platform_data cyttsp_pdata = { |
| 1781 | .panel_maxx = 634, |
| 1782 | .panel_maxy = 1166, |
| 1783 | .disp_maxx = 616, |
| 1784 | .disp_maxy = 1023, |
| 1785 | .disp_minx = 0, |
| 1786 | .disp_miny = 16, |
| 1787 | .flags = 0x01, |
| 1788 | .gen = CY_GEN3, /* or */ |
| 1789 | .use_st = CY_USE_ST, |
| 1790 | .use_mt = CY_USE_MT, |
| 1791 | .use_hndshk = CY_SEND_HNDSHK, |
| 1792 | .use_trk_id = CY_USE_TRACKING_ID, |
| 1793 | .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL, |
| 1794 | .use_gestures = CY_USE_GESTURES, |
| 1795 | .fw_fname = "cyttsp_8960_cdp.hex", |
| 1796 | /* activate up to 4 groups |
| 1797 | * and set active distance |
| 1798 | */ |
| 1799 | .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 | |
| 1800 | CY_GEST_GRP3 | CY_GEST_GRP4 | |
| 1801 | CY_ACT_DIST, |
| 1802 | /* change act_intrvl to customize the Active power state |
| 1803 | * scanning/processing refresh interval for Operating mode |
| 1804 | */ |
| 1805 | .act_intrvl = CY_ACT_INTRVL_DFLT, |
| 1806 | /* change tch_tmout to customize the touch timeout for the |
| 1807 | * Active power state for Operating mode |
| 1808 | */ |
| 1809 | .tch_tmout = CY_TCH_TMOUT_DFLT, |
| 1810 | /* change lp_intrvl to customize the Low Power power state |
| 1811 | * scanning/processing refresh interval for Operating mode |
| 1812 | */ |
| 1813 | .lp_intrvl = CY_LP_INTRVL_DFLT, |
| 1814 | .sleep_gpio = CYTTSP_TS_SLEEP_GPIO, |
| 1815 | .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO, |
| 1816 | .irq_gpio = CYTTSP_TS_GPIO_IRQ, |
| 1817 | .regulator_info = regulator_data, |
| 1818 | .num_regulators = ARRAY_SIZE(regulator_data), |
| 1819 | .init = cyttsp_platform_init, |
| 1820 | .correct_fw_ver = 9, |
| 1821 | }; |
| 1822 | |
| 1823 | static struct i2c_board_info cyttsp_info[] __initdata = { |
| 1824 | { |
| 1825 | I2C_BOARD_INFO(CY_I2C_NAME, 0x24), |
| 1826 | .platform_data = &cyttsp_pdata, |
| 1827 | #ifndef CY_USE_TIMER |
| 1828 | .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ), |
| 1829 | #endif /* CY_USE_TIMER */ |
| 1830 | }, |
| 1831 | }; |
| 1832 | |
| 1833 | /* configuration data */ |
| 1834 | static const u8 mxt_config_data[] = { |
| 1835 | /* T6 Object */ |
| 1836 | 0, 0, 0, 0, 0, 0, |
| 1837 | /* T38 Object */ |
| 1838 | 11, 2, 0, 11, 11, 11, 0, 0, 0, 0, |
| 1839 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1840 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1841 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1842 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1843 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1844 | 0, 0, 0, 0, |
| 1845 | /* T7 Object */ |
| 1846 | 100, 16, 50, |
| 1847 | /* T8 Object */ |
| 1848 | 8, 0, 0, 0, 0, 0, 8, 14, 50, 215, |
| 1849 | /* T9 Object */ |
| 1850 | 131, 0, 0, 26, 42, 0, 32, 63, 3, 5, |
| 1851 | 0, 2, 1, 113, 10, 10, 8, 10, 255, 2, |
| 1852 | 85, 5, 0, 0, 20, 20, 75, 25, 202, 29, |
| 1853 | 10, 10, 45, 46, |
| 1854 | /* T15 Object */ |
| 1855 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1856 | 0, |
| 1857 | /* T22 Object */ |
| 1858 | 5, 0, 0, 0, 0, 0, 0, 0, 30, 0, |
| 1859 | 0, 0, 5, 8, 10, 13, 0, |
| 1860 | /* T24 Object */ |
| 1861 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1862 | 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1863 | /* T25 Object */ |
| 1864 | 3, 0, 188, 52, 52, 33, 0, 0, 0, 0, |
| 1865 | 0, 0, 0, 0, |
| 1866 | /* T27 Object */ |
| 1867 | 0, 0, 0, 0, 0, 0, 0, |
| 1868 | /* T28 Object */ |
| 1869 | 0, 0, 0, 8, 12, 60, |
| 1870 | /* T40 Object */ |
| 1871 | 0, 0, 0, 0, 0, |
| 1872 | /* T41 Object */ |
| 1873 | 0, 0, 0, 0, 0, 0, |
| 1874 | /* T43 Object */ |
| 1875 | 0, 0, 0, 0, 0, 0, |
| 1876 | }; |
| 1877 | |
| 1878 | #define MXT_TS_GPIO_IRQ 11 |
| 1879 | #define MXT_TS_LDO_EN_GPIO 50 |
| 1880 | #define MXT_TS_RESET_GPIO 52 |
| 1881 | |
| 1882 | static struct mxt_platform_data mxt_platform_data = { |
| 1883 | .config = mxt_config_data, |
| 1884 | .config_length = ARRAY_SIZE(mxt_config_data), |
| 1885 | .x_size = 1365, |
| 1886 | .y_size = 767, |
| 1887 | .irqflags = IRQF_TRIGGER_FALLING, |
| 1888 | .i2c_pull_up = true, |
| 1889 | }; |
| 1890 | |
| 1891 | static struct i2c_board_info mxt_device_info[] __initdata = { |
| 1892 | { |
| 1893 | I2C_BOARD_INFO("atmel_mxt_ts", 0x5b), |
| 1894 | .platform_data = &mxt_platform_data, |
| 1895 | .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ), |
| 1896 | }, |
| 1897 | }; |
| 1898 | |
| 1899 | static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type) |
| 1900 | { |
| 1901 | } |
| 1902 | |
| 1903 | static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = { |
| 1904 | .clk_freq = 100000, |
| 1905 | .src_clk_rate = 24000000, |
| 1906 | .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config, |
| 1907 | }; |
| 1908 | |
| 1909 | static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = { |
| 1910 | .clk_freq = 100000, |
| 1911 | .src_clk_rate = 24000000, |
| 1912 | .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config, |
| 1913 | }; |
| 1914 | |
| 1915 | static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = { |
| 1916 | .clk_freq = 100000, |
| 1917 | .src_clk_rate = 24000000, |
| 1918 | .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config, |
| 1919 | }; |
| 1920 | |
| 1921 | static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = { |
| 1922 | .clk_freq = 100000, |
| 1923 | .src_clk_rate = 24000000, |
| 1924 | .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config, |
| 1925 | }; |
| 1926 | |
| 1927 | static struct msm_rpm_platform_data msm_rpm_data = { |
| 1928 | .reg_base_addrs = { |
| 1929 | [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE, |
| 1930 | [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400, |
| 1931 | [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600, |
| 1932 | [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00, |
| 1933 | }, |
| 1934 | |
| 1935 | .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ, |
| 1936 | .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ, |
| 1937 | .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ, |
| 1938 | .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008, |
| 1939 | .msm_apps_ipc_rpm_val = 4, |
| 1940 | }; |
| 1941 | |
| 1942 | static struct ks8851_pdata spi_eth_pdata = { |
| 1943 | .irq_gpio = KS8851_IRQ_GPIO, |
| 1944 | .rst_gpio = KS8851_RST_GPIO, |
| 1945 | }; |
| 1946 | |
| 1947 | static struct spi_board_info spi_board_info[] __initdata = { |
| 1948 | { |
| 1949 | .modalias = "ks8851", |
| 1950 | .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO), |
| 1951 | .max_speed_hz = 19200000, |
| 1952 | .bus_num = 0, |
| 1953 | .chip_select = 0, |
| 1954 | .mode = SPI_MODE_0, |
| 1955 | .platform_data = &spi_eth_pdata |
| 1956 | }, |
| 1957 | { |
| 1958 | .modalias = "dsi_novatek_3d_panel_spi", |
| 1959 | .max_speed_hz = 10800000, |
| 1960 | .bus_num = 0, |
| 1961 | .chip_select = 1, |
| 1962 | .mode = SPI_MODE_0, |
| 1963 | }, |
| 1964 | }; |
| 1965 | |
| 1966 | static struct platform_device msm_device_saw_core0 = { |
| 1967 | .name = "saw-regulator", |
| 1968 | .id = 0, |
| 1969 | .dev = { |
| 1970 | .platform_data = &msm_saw_regulator_pdata_s5, |
| 1971 | }, |
| 1972 | }; |
| 1973 | |
| 1974 | static struct platform_device msm_device_saw_core1 = { |
| 1975 | .name = "saw-regulator", |
| 1976 | .id = 1, |
| 1977 | .dev = { |
| 1978 | .platform_data = &msm_saw_regulator_pdata_s6, |
| 1979 | }, |
| 1980 | }; |
| 1981 | |
| 1982 | static struct tsens_platform_data msm_tsens_pdata = { |
| 1983 | .slope = 910, |
| 1984 | .tsens_factor = 1000, |
| 1985 | .hw_type = MSM_8960, |
| 1986 | .tsens_num_sensor = 5, |
| 1987 | }; |
| 1988 | |
| 1989 | static struct platform_device msm_tsens_device = { |
| 1990 | .name = "tsens8960-tm", |
| 1991 | .id = -1, |
| 1992 | .dev = { |
| 1993 | .platform_data = &msm_tsens_pdata, |
| 1994 | }, |
| 1995 | }; |
| 1996 | |
| 1997 | #ifdef CONFIG_MSM_FAKE_BATTERY |
| 1998 | static struct platform_device fish_battery_device = { |
| 1999 | .name = "fish_battery", |
| 2000 | }; |
| 2001 | #endif |
| 2002 | |
| 2003 | static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = { |
| 2004 | .name = GPIO_REGULATOR_DEV_NAME, |
| 2005 | .id = PM8921_MPP_PM_TO_SYS(7), |
| 2006 | .dev = { |
| 2007 | .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V], |
| 2008 | }, |
| 2009 | }; |
| 2010 | |
| 2011 | static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = { |
| 2012 | .name = GPIO_REGULATOR_DEV_NAME, |
| 2013 | .id = 91, |
| 2014 | .dev = { |
| 2015 | .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2], |
| 2016 | }, |
| 2017 | }; |
| 2018 | |
| 2019 | static struct platform_device msm8960_device_rpm_regulator __devinitdata = { |
| 2020 | .name = "rpm-regulator", |
| 2021 | .id = -1, |
| 2022 | .dev = { |
| 2023 | .platform_data = &msm_rpm_regulator_pdata, |
| 2024 | }, |
| 2025 | }; |
| 2026 | |
| 2027 | static struct msm_rpm_log_platform_data msm_rpm_log_pdata = { |
| 2028 | .phys_addr_base = 0x0010C000, |
| 2029 | .reg_offsets = { |
| 2030 | [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080, |
| 2031 | [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0, |
| 2032 | }, |
| 2033 | .phys_size = SZ_8K, |
| 2034 | .log_len = 4096, /* log's buffer length in bytes */ |
| 2035 | .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */ |
| 2036 | }; |
| 2037 | |
| 2038 | static struct platform_device msm_rpm_log_device = { |
| 2039 | .name = "msm_rpm_log", |
| 2040 | .id = -1, |
| 2041 | .dev = { |
| 2042 | .platform_data = &msm_rpm_log_pdata, |
| 2043 | }, |
| 2044 | }; |
| 2045 | |
| 2046 | static struct platform_device *common_devices[] __initdata = { |
| 2047 | &msm8960_device_dmov, |
| 2048 | &msm_device_smd, |
| 2049 | &msm8960_device_uart_gsbi5, |
| 2050 | &msm_device_uart_dm6, |
| 2051 | &msm_device_saw_core0, |
| 2052 | &msm_device_saw_core1, |
| 2053 | &msm8960_device_ext_5v_vreg, |
| 2054 | &msm8960_device_ext_l2_vreg, |
| 2055 | &msm8960_device_ssbi_pm8921, |
| 2056 | &msm8960_device_qup_spi_gsbi1, |
| 2057 | &msm8960_device_qup_i2c_gsbi3, |
| 2058 | &msm8960_device_qup_i2c_gsbi4, |
| 2059 | &msm8960_device_qup_i2c_gsbi10, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2060 | &msm8960_device_qup_i2c_gsbi12, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2061 | &msm_slim_ctrl, |
| 2062 | &msm_device_wcnss_wlan, |
| 2063 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 2064 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) |
| 2065 | &qcrypto_device, |
| 2066 | #endif |
| 2067 | |
| 2068 | #if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 2069 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
| 2070 | &qcedev_device, |
| 2071 | #endif |
| 2072 | #ifdef CONFIG_MSM_ROTATOR |
| 2073 | &msm_rotator_device, |
| 2074 | #endif |
| 2075 | &msm_device_sps, |
| 2076 | #ifdef CONFIG_MSM_FAKE_BATTERY |
| 2077 | &fish_battery_device, |
| 2078 | #endif |
| 2079 | #ifdef CONFIG_ANDROID_PMEM |
| 2080 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION |
| 2081 | &android_pmem_device, |
| 2082 | &android_pmem_adsp_device, |
| 2083 | #endif |
| 2084 | &android_pmem_audio_device, |
| 2085 | #endif |
| 2086 | &msm_device_vidc, |
| 2087 | &msm_device_bam_dmux, |
| 2088 | &msm_fm_platform_init, |
| 2089 | |
| 2090 | #ifdef CONFIG_HW_RANDOM_MSM |
| 2091 | &msm_device_rng, |
| 2092 | #endif |
| 2093 | &msm_rpm_device, |
| 2094 | #ifdef CONFIG_ION_MSM |
| 2095 | &ion_dev, |
| 2096 | #endif |
| 2097 | &msm_rpm_log_device, |
| 2098 | &msm_rpm_stat_device, |
| 2099 | &msm_device_tz_log, |
| 2100 | |
| 2101 | #ifdef CONFIG_MSM_QDSS |
| 2102 | &msm_etb_device, |
| 2103 | &msm_tpiu_device, |
| 2104 | &msm_funnel_device, |
| 2105 | &msm_debug_device, |
| 2106 | &msm_ptm_device, |
| 2107 | #endif |
| 2108 | &msm_device_dspcrashd_8960, |
| 2109 | &msm8960_device_watchdog, |
| 2110 | }; |
| 2111 | |
| 2112 | static struct platform_device *cdp_devices[] __initdata = { |
| 2113 | &msm8960_device_otg, |
| 2114 | &msm8960_device_gadget_peripheral, |
| 2115 | &msm_device_hsusb_host, |
| 2116 | &android_usb_device, |
| 2117 | &msm_pcm, |
| 2118 | &msm_pcm_routing, |
| 2119 | &msm_cpudai0, |
| 2120 | &msm_cpudai1, |
| 2121 | &msm_cpudai_hdmi_rx, |
| 2122 | &msm_cpudai_bt_rx, |
| 2123 | &msm_cpudai_bt_tx, |
| 2124 | &msm_cpudai_fm_rx, |
| 2125 | &msm_cpudai_fm_tx, |
| 2126 | &msm_cpudai_auxpcm_rx, |
| 2127 | &msm_cpudai_auxpcm_tx, |
| 2128 | &msm_cpu_fe, |
| 2129 | &msm_stub_codec, |
| 2130 | &msm_kgsl_3d0, |
| 2131 | #ifdef CONFIG_MSM_KGSL_2D |
| 2132 | &msm_kgsl_2d0, |
| 2133 | &msm_kgsl_2d1, |
| 2134 | #endif |
| 2135 | #ifdef CONFIG_MSM_GEMINI |
| 2136 | &msm8960_gemini_device, |
| 2137 | #endif |
| 2138 | &msm_voice, |
| 2139 | &msm_voip, |
| 2140 | &msm_lpa_pcm, |
| 2141 | &msm_cpudai_afe_01_rx, |
| 2142 | &msm_cpudai_afe_01_tx, |
| 2143 | &msm_cpudai_afe_02_rx, |
| 2144 | &msm_cpudai_afe_02_tx, |
| 2145 | &msm_pcm_afe, |
| 2146 | &msm_pcm_hostless, |
| 2147 | &msm_bus_apps_fabric, |
| 2148 | &msm_bus_sys_fabric, |
| 2149 | &msm_bus_mm_fabric, |
| 2150 | &msm_bus_sys_fpb, |
| 2151 | &msm_bus_cpss_fpb, |
| 2152 | &msm_tsens_device, |
| 2153 | }; |
| 2154 | |
| 2155 | static void __init msm8930_i2c_init(void) |
| 2156 | { |
| 2157 | msm8960_device_qup_i2c_gsbi4.dev.platform_data = |
| 2158 | &msm8960_i2c_qup_gsbi4_pdata; |
| 2159 | |
| 2160 | msm8960_device_qup_i2c_gsbi3.dev.platform_data = |
| 2161 | &msm8960_i2c_qup_gsbi3_pdata; |
| 2162 | |
| 2163 | msm8960_device_qup_i2c_gsbi10.dev.platform_data = |
| 2164 | &msm8960_i2c_qup_gsbi10_pdata; |
| 2165 | |
| 2166 | msm8960_device_qup_i2c_gsbi12.dev.platform_data = |
| 2167 | &msm8960_i2c_qup_gsbi12_pdata; |
| 2168 | } |
| 2169 | |
| 2170 | static void __init msm8930_gfx_init(void) |
| 2171 | { |
| 2172 | uint32_t soc_platform_version = socinfo_get_version(); |
| 2173 | if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) { |
| 2174 | struct kgsl_device_platform_data *kgsl_3d0_pdata = |
| 2175 | msm_kgsl_3d0.dev.platform_data; |
| 2176 | kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000; |
| 2177 | kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000; |
| 2178 | } |
| 2179 | } |
| 2180 | |
| 2181 | static struct msm_cpuidle_state msm_cstates[] __initdata = { |
| 2182 | {0, 0, "C0", "WFI", |
| 2183 | MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT}, |
| 2184 | |
| 2185 | {0, 1, "C1", "STANDALONE_POWER_COLLAPSE", |
| 2186 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE}, |
| 2187 | |
| 2188 | {0, 2, "C2", "POWER_COLLAPSE", |
| 2189 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE}, |
| 2190 | |
| 2191 | {1, 0, "C0", "WFI", |
| 2192 | MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT}, |
| 2193 | |
| 2194 | {1, 1, "C1", "STANDALONE_POWER_COLLAPSE", |
| 2195 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE}, |
| 2196 | }; |
| 2197 | |
| 2198 | static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = { |
| 2199 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = { |
| 2200 | .idle_supported = 1, |
| 2201 | .suspend_supported = 1, |
| 2202 | .idle_enabled = 0, |
| 2203 | .suspend_enabled = 0, |
| 2204 | }, |
| 2205 | |
| 2206 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = { |
| 2207 | .idle_supported = 1, |
| 2208 | .suspend_supported = 1, |
| 2209 | .idle_enabled = 0, |
| 2210 | .suspend_enabled = 0, |
| 2211 | }, |
| 2212 | |
| 2213 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = { |
| 2214 | .idle_supported = 1, |
| 2215 | .suspend_supported = 1, |
| 2216 | .idle_enabled = 1, |
| 2217 | .suspend_enabled = 1, |
| 2218 | }, |
| 2219 | |
| 2220 | [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = { |
| 2221 | .idle_supported = 0, |
| 2222 | .suspend_supported = 1, |
| 2223 | .idle_enabled = 0, |
| 2224 | .suspend_enabled = 0, |
| 2225 | }, |
| 2226 | |
| 2227 | [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = { |
| 2228 | .idle_supported = 1, |
| 2229 | .suspend_supported = 1, |
| 2230 | .idle_enabled = 0, |
| 2231 | .suspend_enabled = 0, |
| 2232 | }, |
| 2233 | |
| 2234 | [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = { |
| 2235 | .idle_supported = 1, |
| 2236 | .suspend_supported = 0, |
| 2237 | .idle_enabled = 1, |
| 2238 | .suspend_enabled = 0, |
| 2239 | }, |
| 2240 | }; |
| 2241 | |
| 2242 | static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = { |
| 2243 | { |
| 2244 | MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT, |
| 2245 | MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE), |
| 2246 | true, |
| 2247 | 100, 8000, 100000, 1, |
| 2248 | }, |
| 2249 | |
| 2250 | { |
| 2251 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE, |
| 2252 | MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE), |
| 2253 | true, |
| 2254 | 2000, 6000, 60100000, 3000, |
| 2255 | }, |
| 2256 | |
| 2257 | { |
| 2258 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 2259 | MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE), |
| 2260 | false, |
| 2261 | 4200, 5000, 60350000, 3500, |
| 2262 | }, |
| 2263 | |
| 2264 | { |
| 2265 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 2266 | MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE), |
| 2267 | false, |
| 2268 | 6300, 4500, 65350000, 4800, |
| 2269 | }, |
| 2270 | { |
| 2271 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 2272 | MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH), |
| 2273 | false, |
| 2274 | 7000, 3500, 66600000, 5150, |
| 2275 | }, |
| 2276 | |
| 2277 | { |
| 2278 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 2279 | MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE), |
| 2280 | false, |
| 2281 | 11700, 2500, 67850000, 5500, |
| 2282 | }, |
| 2283 | |
| 2284 | { |
| 2285 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 2286 | MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE), |
| 2287 | false, |
| 2288 | 13800, 2000, 71850000, 6800, |
| 2289 | }, |
| 2290 | |
| 2291 | { |
| 2292 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 2293 | MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH), |
| 2294 | false, |
| 2295 | 29700, 500, 75850000, 8800, |
| 2296 | }, |
| 2297 | |
| 2298 | { |
| 2299 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 2300 | MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW), |
| 2301 | false, |
| 2302 | 29700, 0, 76350000, 9800, |
| 2303 | }, |
| 2304 | }; |
| 2305 | |
| 2306 | #ifdef CONFIG_I2C |
| 2307 | #define I2C_SURF 1 |
| 2308 | #define I2C_FFA (1 << 1) |
| 2309 | #define I2C_RUMI (1 << 2) |
| 2310 | #define I2C_SIM (1 << 3) |
| 2311 | #define I2C_FLUID (1 << 4) |
| 2312 | #define I2C_LIQUID (1 << 5) |
| 2313 | |
| 2314 | struct i2c_registry { |
| 2315 | u8 machs; |
| 2316 | int bus; |
| 2317 | struct i2c_board_info *info; |
| 2318 | int len; |
| 2319 | }; |
| 2320 | |
| 2321 | #ifdef CONFIG_MSM_CAMERA |
| 2322 | static struct i2c_board_info msm_camera_boardinfo[] __initdata = { |
| 2323 | #ifdef CONFIG_IMX074 |
| 2324 | { |
| 2325 | I2C_BOARD_INFO("imx074", 0x1A), |
| 2326 | }, |
| 2327 | #endif |
| 2328 | #ifdef CONFIG_OV2720 |
| 2329 | { |
| 2330 | I2C_BOARD_INFO("ov2720", 0x6C), |
| 2331 | }, |
| 2332 | #endif |
| 2333 | #ifdef CONFIG_MSM_CAMERA_FLASH_SC628A |
| 2334 | { |
| 2335 | I2C_BOARD_INFO("sc628a", 0x6E), |
| 2336 | }, |
| 2337 | #endif |
| 2338 | }; |
| 2339 | #endif |
| 2340 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2341 | static void __init msm8930_init_hsic(void) |
| 2342 | { |
| 2343 | #ifdef CONFIG_USB_EHCI_MSM_HSIC |
| 2344 | uint32_t version = socinfo_get_version(); |
| 2345 | |
| 2346 | pr_info("%s: version:%d mtp:%d\n", __func__, |
| 2347 | SOCINFO_VERSION_MAJOR(version), |
| 2348 | machine_is_msm8930_mtp()); |
| 2349 | |
| 2350 | if ((SOCINFO_VERSION_MAJOR(version) == 1) || |
| 2351 | machine_is_msm8930_mtp() || |
| 2352 | machine_is_msm8930_fluid()) |
| 2353 | return; |
| 2354 | |
| 2355 | msm_gpiomux_install(msm8960_hsic_configs, |
| 2356 | ARRAY_SIZE(msm8960_hsic_configs)); |
| 2357 | |
| 2358 | platform_device_register(&msm_device_hsic_host); |
| 2359 | #endif |
| 2360 | } |
| 2361 | |
| 2362 | |
| 2363 | #ifdef CONFIG_ISL9519_CHARGER |
| 2364 | static struct isl_platform_data isl_data __initdata = { |
| 2365 | .valid_n_gpio = 0, /* Not required when notify-by-pmic */ |
| 2366 | .chg_detection_config = NULL, /* Not required when notify-by-pmic */ |
| 2367 | .max_system_voltage = 4200, |
| 2368 | .min_system_voltage = 3200, |
| 2369 | .chgcurrent = 1000, /* 1900, */ |
| 2370 | .term_current = 400, /* Need fine tuning */ |
| 2371 | .input_current = 2048, |
| 2372 | }; |
| 2373 | |
| 2374 | static struct i2c_board_info isl_charger_i2c_info[] __initdata = { |
| 2375 | { |
| 2376 | I2C_BOARD_INFO("isl9519q", 0x9), |
| 2377 | .irq = 0, /* Not required when notify-by-pmic */ |
| 2378 | .platform_data = &isl_data, |
| 2379 | }, |
| 2380 | }; |
| 2381 | #endif /* CONFIG_ISL9519_CHARGER */ |
| 2382 | |
| 2383 | static struct i2c_registry msm8960_i2c_devices[] __initdata = { |
| 2384 | #ifdef CONFIG_MSM_CAMERA |
| 2385 | { |
| 2386 | I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI, |
| 2387 | MSM_8930_GSBI4_QUP_I2C_BUS_ID, |
| 2388 | msm_camera_boardinfo, |
| 2389 | ARRAY_SIZE(msm_camera_boardinfo), |
| 2390 | }, |
| 2391 | #endif |
| 2392 | #ifdef CONFIG_ISL9519_CHARGER |
| 2393 | { |
| 2394 | I2C_LIQUID, |
| 2395 | MSM_8930_GSBI10_QUP_I2C_BUS_ID, |
| 2396 | isl_charger_i2c_info, |
| 2397 | ARRAY_SIZE(isl_charger_i2c_info), |
| 2398 | }, |
| 2399 | #endif /* CONFIG_ISL9519_CHARGER */ |
| 2400 | { |
| 2401 | I2C_SURF | I2C_FFA | I2C_FLUID, |
| 2402 | MSM_8930_GSBI3_QUP_I2C_BUS_ID, |
| 2403 | cyttsp_info, |
| 2404 | ARRAY_SIZE(cyttsp_info), |
| 2405 | }, |
| 2406 | { |
| 2407 | I2C_LIQUID, |
| 2408 | MSM_8930_GSBI3_QUP_I2C_BUS_ID, |
| 2409 | mxt_device_info, |
| 2410 | ARRAY_SIZE(mxt_device_info), |
| 2411 | }, |
| 2412 | { |
| 2413 | I2C_LIQUID, |
| 2414 | MSM_8930_GSBI10_QUP_I2C_BUS_ID, |
| 2415 | msm_isa1200_board_info, |
| 2416 | ARRAY_SIZE(msm_isa1200_board_info), |
| 2417 | }, |
| 2418 | }; |
| 2419 | #endif /* CONFIG_I2C */ |
| 2420 | |
| 2421 | static void __init register_i2c_devices(void) |
| 2422 | { |
| 2423 | #ifdef CONFIG_I2C |
| 2424 | u8 mach_mask = 0; |
| 2425 | int i; |
| 2426 | |
| 2427 | /* Build the matching 'supported_machs' bitmask */ |
Stepan Moskovchenko | 8768eff | 2011-12-01 18:55:07 -0800 | [diff] [blame] | 2428 | if (machine_is_msm8930_cdp() || machine_is_msm8627_cdp()) |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2429 | mach_mask = I2C_SURF; |
| 2430 | else if (machine_is_msm8930_fluid()) |
| 2431 | mach_mask = I2C_FLUID; |
Stepan Moskovchenko | 8768eff | 2011-12-01 18:55:07 -0800 | [diff] [blame] | 2432 | else if (machine_is_msm8930_mtp() || machine_is_msm8627_mtp()) |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2433 | mach_mask = I2C_FFA; |
| 2434 | else |
| 2435 | pr_err("unmatched machine ID in register_i2c_devices\n"); |
| 2436 | |
| 2437 | /* Run the array and install devices as appropriate */ |
| 2438 | for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) { |
| 2439 | if (msm8960_i2c_devices[i].machs & mach_mask) |
| 2440 | i2c_register_board_info(msm8960_i2c_devices[i].bus, |
| 2441 | msm8960_i2c_devices[i].info, |
| 2442 | msm8960_i2c_devices[i].len); |
| 2443 | } |
| 2444 | #endif |
| 2445 | } |
| 2446 | |
| 2447 | static void __init msm8930_cdp_init(void) |
| 2448 | { |
| 2449 | if (meminfo_init(SYS_MEMORY, SZ_256M) < 0) |
| 2450 | pr_err("meminfo_init() failed!\n"); |
| 2451 | |
| 2452 | BUG_ON(msm_rpm_init(&msm_rpm_data)); |
| 2453 | BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels, |
| 2454 | ARRAY_SIZE(msm_rpmrs_levels))); |
| 2455 | |
| 2456 | regulator_suppress_info_printing(); |
| 2457 | if (msm_xo_init()) |
| 2458 | pr_err("Failed to initialize XO votes\n"); |
| 2459 | platform_device_register(&msm8960_device_rpm_regulator); |
| 2460 | msm_clock_init(&msm8960_clock_init_data); |
| 2461 | msm8960_device_otg.dev.platform_data = &msm_otg_pdata; |
| 2462 | msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata; |
| 2463 | gpiomux_init(); |
| 2464 | msm8960_device_qup_spi_gsbi1.dev.platform_data = |
| 2465 | &msm8960_qup_spi_gsbi1_pdata; |
| 2466 | spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); |
| 2467 | |
| 2468 | msm8930_init_pmic(); |
| 2469 | msm8930_i2c_init(); |
| 2470 | msm8930_gfx_init(); |
| 2471 | msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data)); |
| 2472 | msm_spm_l2_init(msm_spm_l2_data); |
| 2473 | msm8930_init_buses(); |
| 2474 | platform_add_devices(msm_footswitch_devices, |
| 2475 | msm_num_footswitch_devices); |
| 2476 | platform_add_devices(common_devices, ARRAY_SIZE(common_devices)); |
| 2477 | msm8930_pm8921_gpio_mpp_init(); |
| 2478 | platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices)); |
| 2479 | msm8930_init_hsic(); |
| 2480 | msm8930_init_cam(); |
| 2481 | msm8930_init_mmc(); |
| 2482 | acpuclk_init(&acpuclk_8960_soc_data); |
| 2483 | register_i2c_devices(); |
| 2484 | msm8930_init_fb(); |
| 2485 | slim_register_board_info(msm_slim_devices, |
| 2486 | ARRAY_SIZE(msm_slim_devices)); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2487 | msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data)); |
| 2488 | msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ); |
| 2489 | msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates), |
| 2490 | msm_pm_data); |
| 2491 | change_memory_power = &msm8930_change_memory_power; |
| 2492 | BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL)); |
| 2493 | |
| 2494 | if (PLATFORM_IS_CHARM25()) |
| 2495 | platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices)); |
| 2496 | } |
| 2497 | |
| 2498 | MACHINE_START(MSM8930_CDP, "QCT MSM8930 CDP") |
| 2499 | .map_io = msm8930_map_io, |
| 2500 | .reserve = msm8930_reserve, |
| 2501 | .init_irq = msm8930_init_irq, |
| 2502 | .timer = &msm_timer, |
| 2503 | .init_machine = msm8930_cdp_init, |
| 2504 | .init_early = msm8930_allocate_memory_regions, |
| 2505 | .init_very_early = msm8930_early_memory, |
| 2506 | MACHINE_END |
| 2507 | |
| 2508 | MACHINE_START(MSM8930_MTP, "QCT MSM8930 MTP") |
| 2509 | .map_io = msm8930_map_io, |
| 2510 | .reserve = msm8930_reserve, |
| 2511 | .init_irq = msm8930_init_irq, |
| 2512 | .timer = &msm_timer, |
| 2513 | .init_machine = msm8930_cdp_init, |
| 2514 | .init_early = msm8930_allocate_memory_regions, |
| 2515 | .init_very_early = msm8930_early_memory, |
| 2516 | MACHINE_END |
| 2517 | |
| 2518 | MACHINE_START(MSM8930_FLUID, "QCT MSM8930 FLUID") |
| 2519 | .map_io = msm8930_map_io, |
| 2520 | .reserve = msm8930_reserve, |
| 2521 | .init_irq = msm8930_init_irq, |
| 2522 | .timer = &msm_timer, |
| 2523 | .init_machine = msm8930_cdp_init, |
| 2524 | .init_early = msm8930_allocate_memory_regions, |
| 2525 | .init_very_early = msm8930_early_memory, |
| 2526 | MACHINE_END |
Stepan Moskovchenko | 8768eff | 2011-12-01 18:55:07 -0800 | [diff] [blame] | 2527 | |
| 2528 | MACHINE_START(MSM8627_CDP, "QCT MSM8627 CDP") |
| 2529 | .map_io = msm8930_map_io, |
| 2530 | .reserve = msm8930_reserve, |
| 2531 | .init_irq = msm8930_init_irq, |
| 2532 | .timer = &msm_timer, |
| 2533 | .init_machine = msm8930_cdp_init, |
| 2534 | .init_early = msm8930_allocate_memory_regions, |
| 2535 | .init_very_early = msm8930_early_memory, |
| 2536 | MACHINE_END |
| 2537 | |
| 2538 | MACHINE_START(MSM8627_MTP, "QCT MSM8627 MTP") |
| 2539 | .map_io = msm8930_map_io, |
| 2540 | .reserve = msm8930_reserve, |
| 2541 | .init_irq = msm8930_init_irq, |
| 2542 | .timer = &msm_timer, |
| 2543 | .init_machine = msm8930_cdp_init, |
| 2544 | .init_early = msm8930_allocate_memory_regions, |
| 2545 | .init_very_early = msm8930_early_memory, |
| 2546 | MACHINE_END |