| /* Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
| * |
| * This program is free software; you can redistribute it and/or modify |
| * it under the terms of the GNU General Public License version 2 and |
| * only version 2 as published by the Free Software Foundation. |
| * |
| * This program is distributed in the hope that it will be useful, |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| * GNU General Public License for more details. |
| * |
| */ |
| #include <linux/kernel.h> |
| #include <linux/platform_device.h> |
| #include <linux/i2c.h> |
| #include <linux/msm_ssbi.h> |
| #include <asm/mach-types.h> |
| #include <asm/mach/arch.h> |
| #include <asm/mach/mmc.h> |
| #include <mach/board.h> |
| #include <mach/msm_iomap.h> |
| #include <mach/gpio.h> |
| #include <mach/gpiomux.h> |
| #include <mach/msm_spi.h> |
| #include <linux/usb/android.h> |
| #include <linux/usb/msm_hsusb.h> |
| #include <linux/mfd/pm8xxx/pm8xxx-adc.h> |
| #include <linux/leds.h> |
| #include <linux/leds-pm8xxx.h> |
| #include <mach/msm_bus_board.h> |
| #include "timer.h" |
| #include "devices.h" |
| #include "board-9615.h" |
| #include "cpuidle.h" |
| #include "pm.h" |
| #include "acpuclock.h" |
| |
| static struct pm8xxx_adc_amux pm8018_adc_channels_data[] = { |
| {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1, |
| ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1, |
| ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1, |
| ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2, |
| ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM}, |
| {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV2, |
| ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1, |
| ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM}, |
| {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1, |
| ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1, |
| ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| {"pa_therm0", ADC_MPP_1_AMUX3, CHAN_PATH_SCALING1, AMUX_RSV1, |
| ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM}, |
| }; |
| |
| static struct pm8xxx_adc_properties pm8018_adc_data = { |
| .adc_vdd_reference = 1800, /* milli-voltage for this adc */ |
| .bitresolution = 15, |
| .bipolar = 0, |
| }; |
| |
| static struct pm8xxx_adc_platform_data pm8018_adc_pdata = { |
| .adc_channel = pm8018_adc_channels_data, |
| .adc_num_board_channel = ARRAY_SIZE(pm8018_adc_channels_data), |
| .adc_prop = &pm8018_adc_data, |
| }; |
| |
| static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = { |
| .irq_base = PM8018_IRQ_BASE, |
| .devirq = MSM_GPIO_TO_INT(87), |
| .irq_trigger_flag = IRQF_TRIGGER_LOW, |
| }; |
| |
| static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = { |
| .gpio_base = PM8018_GPIO_PM_TO_SYS(1), |
| }; |
| |
| static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = { |
| .mpp_base = PM8018_MPP_PM_TO_SYS(1), |
| }; |
| |
| static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = { |
| .rtc_write_enable = false, |
| .rtc_alarm_powerup = false, |
| }; |
| |
| static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = { |
| .pull_up = 1, |
| .kpd_trigger_delay_us = 970, |
| .wakeup = 1, |
| }; |
| |
| static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = { |
| .priority = 0, |
| }; |
| |
| #define PM8018_LED_KB_MAX_CURRENT 20 /* I = 20mA */ |
| #define PM8XXX_LED_PWM_PERIOD_US 1000 |
| |
| /** |
| * PM8XXX_PWM_CHANNEL_NONE shall be used when LED shall not be |
| * driven using PWM feature. |
| */ |
| #define PM8XXX_PWM_CHANNEL_NONE -1 |
| |
| static struct led_info pm8018_led_info[] = { |
| [0] = { |
| .name = "led:kb", |
| }, |
| }; |
| |
| static struct led_platform_data pm8018_led_core_pdata = { |
| .num_leds = ARRAY_SIZE(pm8018_led_info), |
| .leds = pm8018_led_info, |
| }; |
| |
| static struct pm8xxx_led_config pm8018_led_configs[] = { |
| [0] = { |
| .id = PM8XXX_ID_LED_KB_LIGHT, |
| .mode = PM8XXX_LED_MODE_PWM3, |
| .max_current = PM8018_LED_KB_MAX_CURRENT, |
| .pwm_channel = 2, |
| .pwm_period_us = PM8XXX_LED_PWM_PERIOD_US, |
| }, |
| }; |
| |
| static struct pm8xxx_led_platform_data pm8xxx_leds_pdata = { |
| .led_core = &pm8018_led_core_pdata, |
| .configs = pm8018_led_configs, |
| .num_configs = ARRAY_SIZE(pm8018_led_configs), |
| }; |
| |
| static struct pm8018_platform_data pm8018_platform_data __devinitdata = { |
| .irq_pdata = &pm8xxx_irq_pdata, |
| .gpio_pdata = &pm8xxx_gpio_pdata, |
| .mpp_pdata = &pm8xxx_mpp_pdata, |
| .rtc_pdata = &pm8xxx_rtc_pdata, |
| .pwrkey_pdata = &pm8xxx_pwrkey_pdata, |
| .misc_pdata = &pm8xxx_misc_pdata, |
| .regulator_pdatas = msm_pm8018_regulator_pdata, |
| .adc_pdata = &pm8018_adc_pdata, |
| .leds_pdata = &pm8xxx_leds_pdata, |
| }; |
| |
| static struct msm_ssbi_platform_data msm9615_ssbi_pm8018_pdata __devinitdata = { |
| .controller_type = MSM_SBI_CTRL_PMIC_ARBITER, |
| .slave = { |
| .name = PM8018_CORE_DEV_NAME, |
| .platform_data = &pm8018_platform_data, |
| }, |
| }; |
| |
| static struct platform_device msm9615_device_rpm_regulator __devinitdata = { |
| .name = "rpm-regulator", |
| .id = -1, |
| .dev = { |
| .platform_data = &msm_rpm_regulator_9615_pdata, |
| }, |
| }; |
| |
| static struct platform_device msm9615_device_ext_2p95v_vreg = { |
| .name = GPIO_REGULATOR_DEV_NAME, |
| .id = 18, |
| .dev = { |
| .platform_data = |
| &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_2P95V], |
| }, |
| }; |
| |
| static struct gpiomux_setting ps_hold = { |
| .func = GPIOMUX_FUNC_1, |
| .drv = GPIOMUX_DRV_8MA, |
| .pull = GPIOMUX_PULL_NONE, |
| }; |
| |
| static struct gpiomux_setting gsbi4 = { |
| .func = GPIOMUX_FUNC_1, |
| .drv = GPIOMUX_DRV_8MA, |
| .pull = GPIOMUX_PULL_NONE, |
| }; |
| |
| static struct gpiomux_setting gsbi5 = { |
| .func = GPIOMUX_FUNC_1, |
| .drv = GPIOMUX_DRV_8MA, |
| .pull = GPIOMUX_PULL_NONE, |
| }; |
| |
| static struct gpiomux_setting gsbi3 = { |
| .func = GPIOMUX_FUNC_1, |
| .drv = GPIOMUX_DRV_8MA, |
| .pull = GPIOMUX_PULL_NONE, |
| }; |
| |
| static struct gpiomux_setting gsbi3_cs1_config = { |
| .func = GPIOMUX_FUNC_4, |
| .drv = GPIOMUX_DRV_8MA, |
| .pull = GPIOMUX_PULL_NONE, |
| }; |
| |
| struct msm_gpiomux_config msm9615_ps_hold_config[] __initdata = { |
| { |
| .gpio = 83, |
| .settings = { |
| [GPIOMUX_SUSPENDED] = &ps_hold, |
| }, |
| }, |
| }; |
| |
| struct msm_gpiomux_config msm9615_gsbi_configs[] __initdata = { |
| { |
| .gpio = 8, /* GSBI3 QUP SPI_CLK */ |
| .settings = { |
| [GPIOMUX_SUSPENDED] = &gsbi3, |
| }, |
| }, |
| { |
| .gpio = 9, /* GSBI3 QUP SPI_CS_N */ |
| .settings = { |
| [GPIOMUX_SUSPENDED] = &gsbi3, |
| }, |
| }, |
| { |
| .gpio = 10, /* GSBI3 QUP SPI_DATA_MISO */ |
| .settings = { |
| [GPIOMUX_SUSPENDED] = &gsbi3, |
| }, |
| }, |
| { |
| .gpio = 11, /* GSBI3 QUP SPI_DATA_MOSI */ |
| .settings = { |
| [GPIOMUX_SUSPENDED] = &gsbi3, |
| }, |
| }, |
| { |
| .gpio = 12, /* GSBI4 UART */ |
| .settings = { |
| [GPIOMUX_SUSPENDED] = &gsbi4, |
| }, |
| }, |
| { |
| .gpio = 13, /* GSBI4 UART */ |
| .settings = { |
| [GPIOMUX_SUSPENDED] = &gsbi4, |
| }, |
| }, |
| { |
| .gpio = 14, /* GSBI4 UART */ |
| .settings = { |
| [GPIOMUX_SUSPENDED] = &gsbi4, |
| }, |
| }, |
| { |
| .gpio = 15, /* GSBI4 UART */ |
| .settings = { |
| [GPIOMUX_SUSPENDED] = &gsbi4, |
| }, |
| }, |
| { |
| .gpio = 16, /* GSBI5 I2C QUP SCL */ |
| .settings = { |
| [GPIOMUX_SUSPENDED] = &gsbi5, |
| }, |
| }, |
| { |
| .gpio = 17, /* GSBI5 I2C QUP SDA */ |
| .settings = { |
| [GPIOMUX_SUSPENDED] = &gsbi5, |
| }, |
| }, |
| { |
| /* GPIO 19 can be used for I2C/UART on GSBI5 */ |
| .gpio = 19, /* GSBI3 QUP SPI_CS_1 */ |
| .settings = { |
| [GPIOMUX_SUSPENDED] = &gsbi3_cs1_config, |
| }, |
| }, |
| }; |
| |
| #if (defined(CONFIG_MMC_MSM_SDC1_SUPPORT)\ |
| || defined(CONFIG_MMC_MSM_SDC2_SUPPORT)) |
| |
| #define GPIO_SDC1_HW_DET 80 |
| #define GPIO_SDC2_DAT1_WAKEUP 26 |
| |
| /* MDM9x15 has 2 SDCC controllers */ |
| enum sdcc_controllers { |
| SDCC1, |
| SDCC2, |
| MAX_SDCC_CONTROLLER |
| }; |
| |
| #ifdef CONFIG_MMC_MSM_SDC1_SUPPORT |
| /* All SDCC controllers requires VDD/VCC voltage */ |
| static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = { |
| /* SDCC1 : External card slot connected */ |
| [SDCC1] = { |
| .name = "sdc_vdd", |
| /* |
| * This is a gpio-regulator and does not support |
| * regulator_set_voltage and regulator_set_optimum_mode |
| */ |
| .high_vol_level = 2950000, |
| .low_vol_level = 2950000, |
| .hpm_uA = 600000, /* 600mA */ |
| } |
| }; |
| |
| /* All SDCC controllers may require voting for VDD PAD voltage */ |
| static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = { |
| /* SDCC1 : External card slot connected */ |
| [SDCC1] = { |
| .name = "sdc_vddp", |
| .high_vol_level = 2950000, |
| .low_vol_level = 1850000, |
| .always_on = true, |
| .lpm_sup = true, |
| /* Max. Active current required is 16 mA */ |
| .hpm_uA = 16000, |
| /* |
| * Sleep current required is ~300 uA. But min. vote can be |
| * in terms of mA (min. 1 mA). So let's vote for 2 mA |
| * during sleep. |
| */ |
| .lpm_uA = 2000, |
| } |
| }; |
| |
| static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = { |
| /* SDCC1 : External card slot connected */ |
| [SDCC1] = { |
| .vdd_data = &mmc_vdd_reg_data[SDCC1], |
| .vddp_data = &mmc_vddp_reg_data[SDCC1], |
| } |
| }; |
| |
| /* SDC1 pad data */ |
| static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = { |
| {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA}, |
| {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA}, |
| {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA} |
| }; |
| |
| static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = { |
| {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA}, |
| {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA}, |
| {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA} |
| }; |
| |
| static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = { |
| {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL}, |
| {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP}, |
| {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP} |
| }; |
| |
| static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = { |
| {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL}, |
| {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN}, |
| {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN} |
| }; |
| |
| static struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = { |
| [SDCC1] = { |
| .on = sdc1_pad_pull_on_cfg, |
| .off = sdc1_pad_pull_off_cfg, |
| .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg) |
| }, |
| }; |
| |
| static struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = { |
| [SDCC1] = { |
| .on = sdc1_pad_drv_on_cfg, |
| .off = sdc1_pad_drv_off_cfg, |
| .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg) |
| }, |
| }; |
| |
| static struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = { |
| [SDCC1] = { |
| .pull = &mmc_pad_pull_data[SDCC1], |
| .drv = &mmc_pad_drv_data[SDCC1] |
| }, |
| }; |
| #endif |
| |
| #ifdef CONFIG_MMC_MSM_SDC2_SUPPORT |
| static struct gpiomux_setting sdcc2_clk_actv_cfg = { |
| .func = GPIOMUX_FUNC_1, |
| .drv = GPIOMUX_DRV_16MA, |
| .pull = GPIOMUX_PULL_NONE, |
| }; |
| |
| static struct gpiomux_setting sdcc2_cmd_data_0_3_actv_cfg = { |
| .func = GPIOMUX_FUNC_1, |
| .drv = GPIOMUX_DRV_8MA, |
| .pull = GPIOMUX_PULL_UP, |
| }; |
| |
| static struct gpiomux_setting sdcc2_suspend_cfg = { |
| .func = GPIOMUX_FUNC_1, |
| .drv = GPIOMUX_DRV_2MA, |
| .pull = GPIOMUX_PULL_DOWN, |
| }; |
| |
| static struct msm_gpiomux_config msm9615_sdcc2_configs[] __initdata = { |
| { |
| /* SDC2_DATA_0 */ |
| .gpio = 25, |
| .settings = { |
| [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg, |
| [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg, |
| }, |
| }, |
| { |
| /* SDC2_DATA_1 */ |
| .gpio = 26, |
| .settings = { |
| [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg, |
| [GPIOMUX_SUSPENDED] = &sdcc2_cmd_data_0_3_actv_cfg, |
| }, |
| }, |
| { |
| /* SDC2_DATA_2 */ |
| .gpio = 27, |
| .settings = { |
| [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg, |
| [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg, |
| }, |
| }, |
| { |
| /* SDC2_DATA_3 */ |
| .gpio = 28, |
| .settings = { |
| [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg, |
| [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg, |
| }, |
| }, |
| { |
| /* SDC2_CMD */ |
| .gpio = 29, |
| .settings = { |
| [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg, |
| [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg, |
| }, |
| }, |
| { |
| /* SDC2_CLK */ |
| .gpio = 30, |
| .settings = { |
| [GPIOMUX_ACTIVE] = &sdcc2_clk_actv_cfg, |
| [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg, |
| }, |
| }, |
| }; |
| |
| static struct msm_mmc_gpio sdc2_gpio_cfg[] = { |
| {25, "sdc2_dat_0"}, |
| {26, "sdc2_dat_1"}, |
| {27, "sdc2_dat_2"}, |
| {28, "sdc2_dat_3"}, |
| {29, "sdc2_cmd"}, |
| {30, "sdc2_clk"}, |
| }; |
| |
| static struct msm_mmc_gpio_data mmc_gpio_data[MAX_SDCC_CONTROLLER] = { |
| [SDCC2] = { |
| .gpio = sdc2_gpio_cfg, |
| .size = ARRAY_SIZE(sdc2_gpio_cfg), |
| }, |
| }; |
| #else |
| static struct msm_gpiomux_config msm9615_sdcc2_configs[0]; |
| #endif |
| |
| static struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = { |
| #ifdef CONFIG_MMC_MSM_SDC1_SUPPORT |
| [SDCC1] = { |
| .is_gpio = 0, |
| .pad_data = &mmc_pad_data[SDCC1], |
| }, |
| #endif |
| #ifdef CONFIG_MMC_MSM_SDC2_SUPPORT |
| [SDCC2] = { |
| .is_gpio = 1, |
| .gpio_data = &mmc_gpio_data[SDCC2], |
| }, |
| #endif |
| }; |
| |
| #ifdef CONFIG_MMC_MSM_SDC1_SUPPORT |
| static unsigned int sdc1_sup_clk_rates[] = { |
| 400000, 24000000, 48000000 |
| }; |
| |
| static struct mmc_platform_data sdc1_data = { |
| .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29, |
| .mmc_bus_width = MMC_CAP_4_BIT_DATA, |
| .sup_clk_table = sdc1_sup_clk_rates, |
| .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates), |
| .pclk_src_dfab = true, |
| .vreg_data = &mmc_slot_vreg_data[SDCC1], |
| .pin_data = &mmc_slot_pin_data[SDCC1], |
| #ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION |
| .status_gpio = GPIO_SDC1_HW_DET, |
| .status_irq = MSM_GPIO_TO_INT(GPIO_SDC1_HW_DET), |
| .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, |
| #endif |
| .xpc_cap = 1, |
| .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 | |
| MMC_CAP_MAX_CURRENT_400) |
| }; |
| static struct mmc_platform_data *msm9615_sdc1_pdata = &sdc1_data; |
| #else |
| static struct mmc_platform_data *msm9615_sdc1_pdata; |
| #endif |
| |
| #ifdef CONFIG_MMC_MSM_SDC2_SUPPORT |
| static unsigned int sdc2_sup_clk_rates[] = { |
| 400000, 24000000, 48000000 |
| }; |
| |
| static struct mmc_platform_data sdc2_data = { |
| .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29, |
| .mmc_bus_width = MMC_CAP_4_BIT_DATA, |
| .sup_clk_table = sdc2_sup_clk_rates, |
| .sup_clk_cnt = ARRAY_SIZE(sdc2_sup_clk_rates), |
| .pclk_src_dfab = 1, |
| .pin_data = &mmc_slot_pin_data[SDCC2], |
| #ifdef CONFIG_MMC_MSM_SDIO_SUPPORT |
| .sdiowakeup_irq = MSM_GPIO_TO_INT(GPIO_SDC2_DAT1_WAKEUP), |
| #endif |
| }; |
| static struct mmc_platform_data *msm9615_sdc2_pdata = &sdc2_data; |
| #else |
| static struct mmc_platform_data *msm9615_sdc2_pdata; |
| #endif |
| |
| static void __init msm9615_init_mmc(void) |
| { |
| if (msm9615_sdc1_pdata) { |
| /* SDC1: External card slot for SD/MMC cards */ |
| msm_add_sdcc(1, msm9615_sdc1_pdata); |
| } |
| |
| if (msm9615_sdc2_pdata) { |
| msm_gpiomux_install(msm9615_sdcc2_configs, |
| ARRAY_SIZE(msm9615_sdcc2_configs)); |
| |
| /* SDC2: External card slot used for WLAN */ |
| msm_add_sdcc(2, msm9615_sdc2_pdata); |
| } |
| } |
| #else |
| static void __init msm9615_init_mmc(void) { } |
| #endif |
| static struct msm_cpuidle_state msm_cstates[] __initdata = { |
| {0, 0, "C0", "WFI", |
| MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT}, |
| |
| {0, 1, "C1", "STANDALONE_POWER_COLLAPSE", |
| MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE}, |
| |
| {0, 2, "C2", "POWER_COLLAPSE", |
| MSM_PM_SLEEP_MODE_POWER_COLLAPSE}, |
| }; |
| static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR] = { |
| [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = { |
| .idle_supported = 1, |
| .suspend_supported = 1, |
| .idle_enabled = 0, |
| .suspend_enabled = 0, |
| }, |
| [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = { |
| .idle_supported = 1, |
| .suspend_supported = 1, |
| .idle_enabled = 0, |
| .suspend_enabled = 0, |
| }, |
| [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = { |
| .idle_supported = 1, |
| .suspend_supported = 1, |
| .idle_enabled = 1, |
| .suspend_enabled = 1, |
| }, |
| }; |
| |
| static int __init gpiomux_init(void) |
| { |
| int rc; |
| |
| rc = msm_gpiomux_init(NR_GPIO_IRQS); |
| if (rc) { |
| pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc); |
| return rc; |
| } |
| msm_gpiomux_install(msm9615_gsbi_configs, |
| ARRAY_SIZE(msm9615_gsbi_configs)); |
| |
| msm_gpiomux_install(msm9615_ps_hold_config, |
| ARRAY_SIZE(msm9615_ps_hold_config)); |
| return 0; |
| } |
| |
| static void __init msm9615_init_buses(void) |
| { |
| #ifdef CONFIG_MSM_BUS_SCALING |
| msm_bus_rpm_set_mt_mask(); |
| msm_bus_9615_sys_fabric_pdata.rpm_enabled = 1; |
| msm_bus_9615_sys_fabric.dev.platform_data = |
| &msm_bus_9615_sys_fabric_pdata; |
| msm_bus_def_fab.dev.platform_data = &msm_bus_9615_def_fab_pdata; |
| #endif |
| } |
| |
| static struct msm_spi_platform_data msm9615_qup_spi_gsbi3_pdata = { |
| .max_clock_speed = 24000000, |
| }; |
| |
| static struct msm_i2c_platform_data msm9615_i2c_qup_gsbi5_pdata = { |
| .clk_freq = 100000, |
| .src_clk_rate = 24000000, |
| }; |
| |
| #define USB_5V_EN 3 |
| #define PM_USB_5V_EN PM8018_GPIO_PM_TO_SYS(USB_5V_EN) |
| |
| static void msm_hsusb_vbus_power(bool on) |
| { |
| int rc; |
| static bool vbus_is_on; |
| struct pm_gpio usb_vbus = { |
| .direction = PM_GPIO_DIR_OUT, |
| .pull = PM_GPIO_PULL_NO, |
| .output_buffer = PM_GPIO_OUT_BUF_CMOS, |
| .output_value = 0, |
| .vin_sel = 2, |
| .out_strength = PM_GPIO_STRENGTH_HIGH, |
| .function = PM_GPIO_FUNC_NORMAL, |
| .inv_int_pol = 0, |
| }; |
| |
| if (vbus_is_on == on) |
| return; |
| |
| if (on) { |
| rc = pm8xxx_gpio_config(PM_USB_5V_EN, &usb_vbus); |
| if (rc) { |
| pr_err("failed to config usb_5v_en gpio\n"); |
| return; |
| } |
| |
| rc = gpio_request(PM_USB_5V_EN, |
| "usb_5v_en"); |
| if (rc < 0) { |
| pr_err("failed to request usb_5v_en gpio\n"); |
| return; |
| } |
| |
| rc = gpio_direction_output(PM_USB_5V_EN, 1); |
| if (rc) { |
| pr_err("%s: unable to set_direction for gpio [%d]\n", |
| __func__, PM_USB_5V_EN); |
| goto free_usb_5v_en; |
| } |
| |
| vbus_is_on = true; |
| return; |
| } |
| gpio_set_value(PM_USB_5V_EN, 0); |
| free_usb_5v_en: |
| gpio_free(PM_USB_5V_EN); |
| vbus_is_on = false; |
| } |
| |
| static struct msm_otg_platform_data msm_otg_pdata = { |
| .mode = USB_OTG, |
| .otg_control = OTG_PHY_CONTROL, |
| .phy_type = SNPS_28NM_INTEGRATED_PHY, |
| .pclk_src_name = "dfab_usb_hs_clk", |
| .vbus_power = msm_hsusb_vbus_power, |
| }; |
| |
| static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum) |
| { |
| return 0; |
| } |
| |
| static struct android_usb_platform_data android_usb_pdata = { |
| .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num, |
| }; |
| |
| static struct platform_device android_usb_device = { |
| .name = "android_usb", |
| .id = -1, |
| .dev = { |
| .platform_data = &android_usb_pdata, |
| }, |
| }; |
| |
| static struct platform_device msm_wlan_ar6000_pm_device = { |
| .name = "wlan_ar6000_pm_dev", |
| .id = -1, |
| }; |
| |
| static int __init msm9615_init_ar6000pm(void) |
| { |
| return platform_device_register(&msm_wlan_ar6000_pm_device); |
| } |
| |
| static struct platform_device *common_devices[] = { |
| &msm9615_device_dmov, |
| &msm_device_smd, |
| &msm_device_otg, |
| &msm_device_gadget_peripheral, |
| &msm_device_hsusb_host, |
| &android_usb_device, |
| &msm9615_device_uart_gsbi4, |
| &msm9615_device_ext_2p95v_vreg, |
| &msm9615_device_ssbi_pmic1, |
| &msm9615_device_qup_i2c_gsbi5, |
| &msm9615_device_qup_spi_gsbi3, |
| &msm_device_sps, |
| &msm9615_device_tsens, |
| &msm_device_nand, |
| &msm_device_bam_dmux, |
| &msm_rpm_device, |
| #ifdef CONFIG_HW_RANDOM_MSM |
| &msm_device_rng, |
| #endif |
| |
| #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) |
| &msm9615_qcrypto_device, |
| #endif |
| |
| #if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
| &msm9615_qcedev_device, |
| #endif |
| &msm9615_device_watchdog, |
| &msm_bus_9615_sys_fabric, |
| &msm_bus_def_fab, |
| }; |
| |
| static void __init msm9615_i2c_init(void) |
| { |
| msm9615_device_qup_i2c_gsbi5.dev.platform_data = |
| &msm9615_i2c_qup_gsbi5_pdata; |
| } |
| |
| static void __init msm9615_common_init(void) |
| { |
| msm9615_device_init(); |
| gpiomux_init(); |
| msm9615_i2c_init(); |
| regulator_suppress_info_printing(); |
| platform_device_register(&msm9615_device_rpm_regulator); |
| msm_clock_init(&msm9615_clock_init_data); |
| msm9615_init_buses(); |
| msm9615_device_qup_spi_gsbi3.dev.platform_data = |
| &msm9615_qup_spi_gsbi3_pdata; |
| msm9615_device_ssbi_pmic1.dev.platform_data = |
| &msm9615_ssbi_pm8018_pdata; |
| pm8018_platform_data.num_regulators = msm_pm8018_regulator_pdata_len; |
| |
| msm_device_otg.dev.platform_data = &msm_otg_pdata; |
| platform_add_devices(common_devices, ARRAY_SIZE(common_devices)); |
| |
| acpuclk_init(&acpuclk_9615_soc_data); |
| |
| /* Ensure ar6000pm device is registered before MMC/SDC */ |
| msm9615_init_ar6000pm(); |
| |
| msm9615_init_mmc(); |
| msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data)); |
| msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ); |
| msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates), |
| msm_pm_data); |
| } |
| |
| static void __init msm9615_cdp_init(void) |
| { |
| msm9615_common_init(); |
| } |
| |
| static void __init msm9615_mtp_init(void) |
| { |
| msm9615_common_init(); |
| } |
| |
| MACHINE_START(MSM9615_CDP, "QCT MSM9615 CDP") |
| .map_io = msm9615_map_io, |
| .init_irq = msm9615_init_irq, |
| .timer = &msm_timer, |
| .init_machine = msm9615_cdp_init, |
| MACHINE_END |
| |
| MACHINE_START(MSM9615_MTP, "QCT MSM9615 MTP") |
| .map_io = msm9615_map_io, |
| .init_irq = msm9615_init_irq, |
| .timer = &msm_timer, |
| .init_machine = msm9615_mtp_init, |
| MACHINE_END |