diff options
Diffstat (limited to 'arch/arm/mach-msm/board-halibut.c')
-rw-r--r-- | arch/arm/mach-msm/board-halibut.c | 704 |
1 files changed, 697 insertions, 7 deletions
diff --git a/arch/arm/mach-msm/board-halibut.c b/arch/arm/mach-msm/board-halibut.c index e61967dde9a1..abb123aab8e2 100644 --- a/arch/arm/mach-msm/board-halibut.c +++ b/arch/arm/mach-msm/board-halibut.c @@ -1,6 +1,7 @@ /* linux/arch/arm/mach-msm/board-halibut.c * * Copyright (C) 2007 Google, Inc. + * Copyright (c) 2008-2009, Code Aurora Forum. All rights reserved. * Author: Brian Swetland <swetland@google.com> * * This software is licensed under the terms of the GNU General Public @@ -13,33 +14,64 @@ * GNU General Public License for more details. * */ - #include <linux/kernel.h> #include <linux/init.h> #include <linux/platform_device.h> #include <linux/input.h> #include <linux/io.h> #include <linux/delay.h> +#include <linux/bootmem.h> +#include <linux/i2c.h> +#include <linux/android_pmem.h> +#include <linux/mtd/nand.h> +#include <linux/mtd/partitions.h> #include <mach/hardware.h> +#include <mach/irqs.h> #include <asm/mach-types.h> #include <asm/mach/arch.h> #include <asm/mach/map.h> #include <asm/mach/flash.h> +#include <asm/setup.h> +#include <mach/mmc.h> +#include <mach/vreg.h> +#include <mach/mpp.h> +#include <mach/gpio.h> #include <mach/irqs.h> #include <mach/board.h> #include <mach/msm_iomap.h> - -#include <linux/mtd/nand.h> -#include <linux/mtd/partitions.h> +#include <mach/msm_serial_hs.h> +#include <mach/msm_hsusb.h> +#include <mach/vreg.h> +#include <mach/msm_rpcrouter.h> +#include <mach/memory.h> +#include <mach/camera.h> #include "devices.h" +#include "socinfo.h" +#include "clock.h" +#include "msm-keypad-devices.h" +#include "pm.h" + +#ifdef CONFIG_MSM_STACKED_MEMORY +#define MSM_SMI_BASE 0x100000 +#define MSM_SMI_SIZE 0x800000 + +#define MSM_PMEM_GPU0_BASE MSM_SMI_BASE +#define MSM_PMEM_GPU0_SIZE 0x800000 +#endif + +#define MSM_PMEM_MDP_SIZE 0x800000 +#define MSM_PMEM_CAMERA_SIZE 0xa00000 +#define MSM_PMEM_ADSP_SIZE 0x800000 +#define MSM_PMEM_GPU1_SIZE 0x800000 +#define MSM_FB_SIZE 0x200000 static struct resource smc91x_resources[] = { [0] = { .start = 0x9C004300, - .end = 0x9C004400, + .end = 0x9C0043ff, .flags = IORESOURCE_MEM, }, [1] = { @@ -49,6 +81,132 @@ static struct resource smc91x_resources[] = { }, }; +#ifdef CONFIG_USB_FUNCTION +static struct usb_mass_storage_platform_data usb_mass_storage_pdata = { + .nluns = 0x02, + .buf_size = 16384, + .vendor = "GOOGLE", + .product = "Mass storage", + .release = 0xffff, +}; + +static struct platform_device mass_storage_device = { + .name = "usb_mass_storage", + .id = -1, + .dev = { + .platform_data = &usb_mass_storage_pdata, + }, +}; +#endif + +#ifdef CONFIG_USB_ANDROID +static struct android_usb_platform_data android_usb_pdata = { + .vendor_id = 0x05C6, + .product_id = 0xF000, + .adb_product_id = 0x9015, + .version = 0x0100, + .product_name = "Qualcomm HSUSB Device", + .manufacturer_name = "Qualcomm Incorporated", + .nluns = 1, +}; + +static struct platform_device android_usb_device = { + .name = "android_usb", + .id = -1, + .dev = { + .platform_data = &android_usb_pdata, + }, +}; +#endif + +#ifdef CONFIG_USB_FUNCTION +static void hsusb_gpio_init(void) +{ + if (gpio_request(111, "ulpi_data_0")) + pr_err("failed to request gpio ulpi_data_0\n"); + if (gpio_request(112, "ulpi_data_1")) + pr_err("failed to request gpio ulpi_data_1\n"); + if (gpio_request(113, "ulpi_data_2")) + pr_err("failed to request gpio ulpi_data_2\n"); + if (gpio_request(114, "ulpi_data_3")) + pr_err("failed to request gpio ulpi_data_3\n"); + if (gpio_request(115, "ulpi_data_4")) + pr_err("failed to request gpio ulpi_data_4\n"); + if (gpio_request(116, "ulpi_data_5")) + pr_err("failed to request gpio ulpi_data_5\n"); + if (gpio_request(117, "ulpi_data_6")) + pr_err("failed to request gpio ulpi_data_6\n"); + if (gpio_request(118, "ulpi_data_7")) + pr_err("failed to request gpio ulpi_data_7\n"); + if (gpio_request(119, "ulpi_dir")) + pr_err("failed to request gpio ulpi_dir\n"); + if (gpio_request(120, "ulpi_next")) + pr_err("failed to request gpio ulpi_next\n"); + if (gpio_request(121, "ulpi_stop")) + pr_err("failed to request gpio ulpi_stop\n"); +} + +static unsigned usb_gpio_lpm_config[] = { + GPIO_CFG(111, 1, GPIO_INPUT, GPIO_NO_PULL, GPIO_2MA), /* DATA 0 */ + GPIO_CFG(112, 1, GPIO_INPUT, GPIO_NO_PULL, GPIO_2MA), /* DATA 1 */ + GPIO_CFG(113, 1, GPIO_INPUT, GPIO_NO_PULL, GPIO_2MA), /* DATA 2 */ + GPIO_CFG(114, 1, GPIO_INPUT, GPIO_NO_PULL, GPIO_2MA), /* DATA 3 */ + GPIO_CFG(115, 1, GPIO_INPUT, GPIO_NO_PULL, GPIO_2MA), /* DATA 4 */ + GPIO_CFG(116, 1, GPIO_INPUT, GPIO_NO_PULL, GPIO_2MA), /* DATA 5 */ + GPIO_CFG(117, 1, GPIO_INPUT, GPIO_NO_PULL, GPIO_2MA), /* DATA 6 */ + GPIO_CFG(118, 1, GPIO_INPUT, GPIO_NO_PULL, GPIO_2MA), /* DATA 7 */ + GPIO_CFG(119, 1, GPIO_INPUT, GPIO_NO_PULL, GPIO_2MA), /* DIR */ + GPIO_CFG(120, 1, GPIO_INPUT, GPIO_NO_PULL, GPIO_2MA), /* NEXT */ + GPIO_CFG(121, 1, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_2MA), /* STOP */ +}; + +static unsigned usb_gpio_lpm_unconfig[] = { + GPIO_CFG(111, 1, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DATA 0 */ + GPIO_CFG(112, 1, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DATA 1 */ + GPIO_CFG(113, 1, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DATA 2 */ + GPIO_CFG(114, 1, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DATA 3 */ + GPIO_CFG(115, 1, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DATA 4 */ + GPIO_CFG(116, 1, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DATA 5 */ + GPIO_CFG(117, 1, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DATA 6 */ + GPIO_CFG(118, 1, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DATA 7 */ + GPIO_CFG(119, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DIR */ + GPIO_CFG(120, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* NEXT */ + GPIO_CFG(121, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_2MA), /* STOP */ +}; + +static int usb_config_gpio(int config) +{ + int pin, rc; + + if (config) { + for (pin = 0; pin < ARRAY_SIZE(usb_gpio_lpm_config); pin++) { + rc = gpio_tlmm_config(usb_gpio_lpm_config[pin], + GPIO_ENABLE); + if (rc) { + printk(KERN_ERR + "%s: gpio_tlmm_config(%#x)=%d\n", + __func__, usb_gpio_lpm_config[pin], rc); + return -EIO; + } + } + } else { + for (pin = 0; pin < ARRAY_SIZE(usb_gpio_lpm_unconfig); pin++) { + rc = gpio_tlmm_config(usb_gpio_lpm_unconfig[pin], + GPIO_ENABLE); + if (rc) { + printk(KERN_ERR + "%s: gpio_tlmm_config(%#x)=%d\n", + __func__, usb_gpio_lpm_config[pin], rc); + return -EIO; + } + } + } + + return 0; +} +#endif + + static struct platform_device smc91x_device = { .name = "smc91x", .id = 0, @@ -57,33 +215,565 @@ static struct platform_device smc91x_device = { }; static struct platform_device *devices[] __initdata = { +#if !defined(CONFIG_MSM_SERIAL_DEBUGGER) &msm_device_uart3, +#endif + &msm_device_uart_dm1, &msm_device_smd, + &msm_device_dmov, &msm_device_nand, - &msm_device_hsusb, &msm_device_i2c, &smc91x_device, + &msm_device_tssc, + &android_pmem_camera_device, + &android_pmem_device, + &android_pmem_adsp_device, +#ifdef CONFIG_MSM_STACKED_MEMORY + &android_pmem_gpu0_device, +#endif + &android_pmem_gpu1_device, + &msm_device_hsusb_otg, + &msm_device_hsusb_host, +#if defined(CONFIG_USB_FUNCTION) || defined(CONFIG_USB_ANDROID) + &msm_device_hsusb_peripheral, +#endif +#ifdef CONFIG_USB_FUNCTION + &mass_storage_device, +#endif +#ifdef CONFIG_USB_ANDROID + &android_usb_device, +#endif + +#ifdef CONFIG_BT + &msm_bt_power_device, +#endif + &halibut_snd, + &msm_bluesleep_device, + &msm_fb_device, + &mddi_toshiba_device, + &mddi_sharp_device, }; extern struct sys_timer msm_timer; +static struct i2c_board_info i2c_devices[] = { + { + I2C_BOARD_INFO("mt9d112", 0x78 >> 1), + }, + { + I2C_BOARD_INFO("s5k3e2fx", 0x20 >> 1), + }, + { + I2C_BOARD_INFO("mt9p012", 0x6C >> 1), + }, + { + I2C_BOARD_INFO("mt9t013", 0x6C), + }, +}; + +static uint32_t camera_off_gpio_table[] = { + /* parallel CAMERA interfaces */ + GPIO_CFG(0, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT0 */ + GPIO_CFG(1, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT1 */ + GPIO_CFG(2, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT2 */ + GPIO_CFG(3, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT3 */ + GPIO_CFG(4, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT4 */ + GPIO_CFG(5, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT5 */ + GPIO_CFG(6, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT6 */ + GPIO_CFG(7, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT7 */ + GPIO_CFG(8, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT8 */ + GPIO_CFG(9, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT9 */ + GPIO_CFG(10, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT10 */ + GPIO_CFG(11, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT11 */ + GPIO_CFG(12, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* PCLK */ + GPIO_CFG(13, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* HSYNC_IN */ + GPIO_CFG(14, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* VSYNC_IN */ + GPIO_CFG(15, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_2MA), /* MCLK */ +}; + +static uint32_t camera_on_gpio_table[] = { + /* parallel CAMERA interfaces */ + GPIO_CFG(0, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT0 */ + GPIO_CFG(1, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT1 */ + GPIO_CFG(2, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT2 */ + GPIO_CFG(3, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT3 */ + GPIO_CFG(4, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT4 */ + GPIO_CFG(5, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT5 */ + GPIO_CFG(6, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT6 */ + GPIO_CFG(7, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT7 */ + GPIO_CFG(8, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT8 */ + GPIO_CFG(9, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT9 */ + GPIO_CFG(10, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT10 */ + GPIO_CFG(11, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT11 */ + GPIO_CFG(12, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_16MA), /* PCLK */ + GPIO_CFG(13, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* HSYNC_IN */ + GPIO_CFG(14, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* VSYNC_IN */ + GPIO_CFG(15, 1, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_16MA), /* MCLK */ +}; + +static void config_gpio_table(uint32_t *table, int len) +{ + int n, rc; + for (n = 0; n < len; n++) { + rc = gpio_tlmm_config(table[n], GPIO_ENABLE); + if (rc) { + printk(KERN_ERR "%s: gpio_tlmm_config(%#x)=%d\n", + __func__, table[n], rc); + break; + } + } +} + +static void config_camera_on_gpios(void) +{ + config_gpio_table(camera_on_gpio_table, + ARRAY_SIZE(camera_on_gpio_table)); +} + +static void config_camera_off_gpios(void) +{ + config_gpio_table(camera_off_gpio_table, + ARRAY_SIZE(camera_off_gpio_table)); +} + +#define MSM_PROBE_INIT(name) name##_probe_init +static struct msm_camera_sensor_info msm_camera_sensor[] = { + { + .sensor_reset = 89, + .sensor_pwd = 85, + .vcm_pwd = 0, + .sensor_name = "mt9d112", + .flash_type = MSM_CAMERA_FLASH_NONE, +#ifdef CONFIG_MSM_CAMERA + .sensor_probe = MSM_PROBE_INIT(mt9d112), +#endif + }, + { + .sensor_reset = 89, + .sensor_pwd = 85, + .vcm_pwd = 0, + .sensor_name = "s5k3e2fx", + .flash_type = MSM_CAMERA_FLASH_NONE, +#ifdef CONFIG_MSM_CAMERA + .sensor_probe = MSM_PROBE_INIT(s5k3e2fx), +#endif + }, + { + .sensor_reset = 89, + .sensor_pwd = 85, + .vcm_pwd = 88, + .sensor_name = "mt9p012", + .flash_type = MSM_CAMERA_FLASH_LED, +#ifdef CONFIG_MSM_CAMERA + .sensor_probe = MSM_PROBE_INIT(mt9p012), +#endif + }, + { + .sensor_reset = 89, + .sensor_pwd = 85, + .vcm_pwd = 0, + .sensor_name = "mt9t013", + .flash_type = MSM_CAMERA_FLASH_NONE, +#ifdef CONFIG_MSM_CAMERA + .sensor_probe = MSM_PROBE_INIT(mt9t013), +#endif + }, +}; +#undef MSM_PROBE_INIT + +static struct msm_camera_device_platform_data msm_camera_device_data = { + .camera_gpio_on = config_camera_on_gpios, + .camera_gpio_off = config_camera_off_gpios, + .snum = ARRAY_SIZE(msm_camera_sensor), + .sinfo = &msm_camera_sensor[0], + .ioext.mdcphy = MSM_MDC_PHYS, + .ioext.mdcsz = MSM_MDC_SIZE, + .ioext.appphy = MSM_CLK_CTL_PHYS, + .ioext.appsz = MSM_CLK_CTL_SIZE, +}; + +static void __init msm_camera_add_device(void) +{ + msm_camera_register_device(NULL, 0, &msm_camera_device_data); + config_camera_off_gpios(); +} + static void __init halibut_init_irq(void) { msm_init_irq(); } +static struct msm_acpu_clock_platform_data halibut_clock_data = { + .acpu_switch_time_us = 50, + .max_speed_delta_khz = 256000, + .vdd_switch_time_us = 62, + .power_collapse_khz = 19200000, + .wait_for_irq_khz = 128000000, + .max_axi_khz = 128000, +}; + +void msm_serial_debug_init(unsigned int base, int irq, + struct device *clk_device, int signal_irq); +static void sdcc_gpio_init(void) +{ +#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION + int rc = 0; + if (gpio_request(49, "sdc1_status_irq")) + pr_err("failed to request gpio sdc1_status_irq\n"); + rc = gpio_tlmm_config(GPIO_CFG(49, 0, GPIO_INPUT, GPIO_PULL_UP, + GPIO_2MA), GPIO_ENABLE); + if (rc) + printk(KERN_ERR "%s: Failed to configure GPIO %d\n", + __func__, rc); +#endif + /* SDC1 GPIOs */ +#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT + if (gpio_request(51, "sdc1_data_3")) + pr_err("failed to request gpio sdc1_data_3\n"); + if (gpio_request(52, "sdc1_data_2")) + pr_err("failed to request gpio sdc1_data_2\n"); + if (gpio_request(53, "sdc1_data_1")) + pr_err("failed to request gpio sdc1_data_1\n"); + if (gpio_request(54, "sdc1_data_0")) + pr_err("failed to request gpio sdc1_data_0\n"); + if (gpio_request(55, "sdc1_cmd")) + pr_err("failed to request gpio sdc1_cmd\n"); + if (gpio_request(56, "sdc1_clk")) + pr_err("failed to request gpio sdc1_clk\n"); +#endif + + if (machine_is_msm7201a_ffa()) + return; + + /* SDC2 GPIOs */ +#ifdef CONFIG_MMC_MSM_SDC2_SUPPORT + if (gpio_request(62, "sdc2_clk")) + pr_err("failed to request gpio sdc2_clk\n"); + if (gpio_request(63, "sdc2_cmd")) + pr_err("failed to request gpio sdc2_cmd\n"); + if (gpio_request(64, "sdc2_data_3")) + pr_err("failed to request gpio sdc2_data_3\n"); + if (gpio_request(65, "sdc2_data_2")) + pr_err("failed to request gpio sdc2_data_2\n"); + if (gpio_request(66, "sdc2_data_1")) + pr_err("failed to request gpio sdc2_data_1\n"); + if (gpio_request(67, "sdc2_data_0")) + pr_err("failed to request gpio sdc2_data_0\n"); +#endif + + /* SDC4 GPIOs */ +#ifdef CONFIG_MMC_MSM_SDC4_SUPPORT + if (gpio_request(19, "sdc4_data_3")) + pr_err("failed to request gpio sdc4_data_3\n"); + if (gpio_request(20, "sdc4_data_2")) + pr_err("failed to request gpio sdc4_data_2\n"); + if (gpio_request(21, "sdc4_data_1")) + pr_err("failed to request gpio sdc4_data_1\n"); + if (gpio_request(107, "sdc4_cmd")) + pr_err("failed to request gpio sdc4_cmd\n"); + if (gpio_request(108, "sdc4_data_0")) + pr_err("failed to request gpio sdc4_data_0\n"); + if (gpio_request(109, "sdc4_clk")) + pr_err("failed to request gpio sdc4_clk\n"); +#endif +} + +static unsigned sdcc_cfg_data[][6] = { + /* SDC1 configs */ + { + GPIO_CFG(51, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), + GPIO_CFG(52, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), + GPIO_CFG(53, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), + GPIO_CFG(54, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), + GPIO_CFG(55, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), + GPIO_CFG(56, 1, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_8MA), + }, + /* SDC2 configs */ + { + GPIO_CFG(62, 2, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_8MA), + GPIO_CFG(63, 2, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), + GPIO_CFG(64, 2, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), + GPIO_CFG(65, 2, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), + GPIO_CFG(66, 2, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), + GPIO_CFG(67, 2, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), + }, + { + /* SDC3 configs */ + }, + /* SDC4 configs */ + { + GPIO_CFG(19, 3, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), + GPIO_CFG(20, 3, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), + GPIO_CFG(21, 3, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), + GPIO_CFG(107, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), + GPIO_CFG(108, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), + GPIO_CFG(109, 1, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_8MA), + } +}; + +static unsigned long vreg_sts, gpio_sts; +static struct mpp *mpp_mmc; +static struct vreg *vreg_mmc; + +static void msm_sdcc_setup_gpio(int dev_id, unsigned int enable) +{ + int i, rc; + + if (!(test_bit(dev_id, &gpio_sts)^enable)) + return; + + if (enable) + set_bit(dev_id, &gpio_sts); + else + clear_bit(dev_id, &gpio_sts); + + for (i = 0; i < ARRAY_SIZE(sdcc_cfg_data[dev_id - 1]); i++) { + rc = gpio_tlmm_config(sdcc_cfg_data[dev_id - 1][i], + enable ? GPIO_ENABLE : GPIO_DISABLE); + if (rc) { + printk(KERN_ERR "%s: gpio_tlmm_config(%#x)=%d\n", + __func__, sdcc_cfg_data[dev_id - 1][i], rc); + } + } +} + +static uint32_t msm_sdcc_setup_power(struct device *dv, unsigned int vdd) +{ + int rc = 0; + struct platform_device *pdev; + + pdev = container_of(dv, struct platform_device, dev); + msm_sdcc_setup_gpio(pdev->id, !!vdd); + + if (vdd == 0) { + if (!vreg_sts) + return 0; + + clear_bit(pdev->id, &vreg_sts); + + if (!vreg_sts) { + if (machine_is_msm7201a_ffa()) + rc = mpp_config_digital_out(mpp_mmc, + MPP_CFG(MPP_DLOGIC_LVL_MSMP, + MPP_DLOGIC_OUT_CTRL_LOW)); + else + rc = vreg_disable(vreg_mmc); + if (rc) + printk(KERN_ERR "%s: return val: %d \n", + __func__, rc); + } + return 0; + } + + if (!vreg_sts) { + if (machine_is_msm7201a_ffa()) + rc = mpp_config_digital_out(mpp_mmc, + MPP_CFG(MPP_DLOGIC_LVL_MSMP, + MPP_DLOGIC_OUT_CTRL_HIGH)); + else { + rc = vreg_set_level(vreg_mmc, 2850); + if (!rc) + rc = vreg_enable(vreg_mmc); + } + if (rc) + printk(KERN_ERR "%s: return val: %d \n", + __func__, rc); + } + set_bit(pdev->id, &vreg_sts); + return 0; +} + +#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION +static unsigned int halibut_sdcc_slot_status(struct device *dev) +{ + return (unsinged int) gpio_get_value(49); +} +#endif + +static struct mmc_platform_data halibut_sdcc_data = { + .ocr_mask = MMC_VDD_28_29, + .translate_vdd = msm_sdcc_setup_power, +#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION + .status = halibut_sdcc_slot_status, + .status_irq = MSM_GPIO_TO_INT(49), + .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, +#endif +}; + +static void __init halibut_init_mmc(void) +{ + if (machine_is_msm7201a_ffa()) { + mpp_mmc = mpp_get(NULL, "mpp3"); + if (!mpp_mmc) { + printk(KERN_ERR "%s: mpp get failed (%ld)\n", + __func__, PTR_ERR(vreg_mmc)); + return; + } + } else { + vreg_mmc = vreg_get(NULL, "mmc"); + if (IS_ERR(vreg_mmc)) { + printk(KERN_ERR "%s: vreg get failed (%ld)\n", + __func__, PTR_ERR(vreg_mmc)); + return; + } + } + + sdcc_gpio_init(); +#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT + msm_add_sdcc(1, &halibut_sdcc_data); +#endif + + if (machine_is_msm7201a_surf()) { +#ifdef CONFIG_MMC_MSM_SDC2_SUPPORT + msm_add_sdcc(2, &halibut_sdcc_data); +#endif +#ifdef CONFIG_MMC_MSM_SDC4_SUPPORT + msm_add_sdcc(4, &halibut_sdcc_data); +#endif + } +} + +static struct msm_panel_common_pdata mdp_pdata = { + .gpio = 97, +}; + +static void __init msm_fb_add_devices(void) +{ + msm_fb_register_device("mdp", &mdp_pdata); + msm_fb_register_device("ebi2", 0); + msm_fb_register_device("pmdh", &mddi_pdata); + msm_fb_register_device("emdh", 0); + msm_fb_register_device("tvenc", &tvenc_pdata); +} + +static struct msm_i2c_platform_data msm_i2c_pdata = { + .clk_freq = 100000, +}; + +static void __init msm_device_i2c_init(void) +{ + msm_device_i2c.dev.platform_data = &msm_i2c_pdata; +} + +static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR] = { + [MSM_PM_SLEEP_MODE_POWER_COLLAPSE].latency = 16000, + [MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN].latency = 12000, + [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].latency = 2000, +}; + static void __init halibut_init(void) { + if (socinfo_init() < 0) + BUG(); + + if (machine_is_msm7201a_ffa()) { + smc91x_resources[0].start = 0x98000300; + smc91x_resources[0].end = 0x980003ff; + smc91x_resources[1].start = MSM_GPIO_TO_INT(85); + smc91x_resources[1].end = MSM_GPIO_TO_INT(85); + } + + /* All 7x01 2.0 based boards are expected to have RAM chips capable + * of 160 MHz. */ + if (cpu_is_msm7x01() + && SOCINFO_VERSION_MAJOR(socinfo_get_version()) == 2) + halibut_clock_data.max_axi_khz = 160000; + + msm_acpu_clock_init(&halibut_clock_data); + +#if defined(CONFIG_MSM_SERIAL_DEBUGGER) + msm_serial_debug_init(MSM_UART3_PHYS, INT_UART3, + &msm_device_uart3.dev, 1); +#endif + msm_hsusb_pdata.soc_version = socinfo_get_version(); + msm_acpu_clock_init(&halibut_clock_data); + msm_device_hsusb_peripheral.dev.platform_data = &msm_hsusb_pdata, + msm_device_hsusb_host.dev.platform_data = &msm_hsusb_pdata, platform_add_devices(devices, ARRAY_SIZE(devices)); + halibut_init_mmc(); + msm_pm_set_platform_data(msm_pm_data); +} + +static void __init msm_halibut_allocate_memory_regions(void) +{ + void *addr; + unsigned long size; + + size = MSM_PMEM_MDP_SIZE; + addr = alloc_bootmem(size); + android_pmem_pdata.start = __pa(addr); + android_pmem_pdata.size = size; + printk(KERN_INFO "allocating %lu bytes at %p (%lx physical)" + "for pmem\n", size, addr, __pa(addr)); + + size = MSM_PMEM_CAMERA_SIZE; + addr = alloc_bootmem(size); + android_pmem_camera_pdata.start = __pa(addr); + android_pmem_camera_pdata.size = size; + printk(KERN_INFO "allocating %lu bytes at %p (%lx physical)" + "for camera pmem\n", size, addr, __pa(addr)); + + size = MSM_PMEM_ADSP_SIZE; + addr = alloc_bootmem(size); + android_pmem_adsp_pdata.start = __pa(addr); + android_pmem_adsp_pdata.size = size; + printk(KERN_INFO "allocating %lu bytes at %p (%lx physical)" + "for adsp pmem\n", size, addr, __pa(addr)); + + size = MSM_PMEM_GPU1_SIZE; + addr = alloc_bootmem_aligned(size, 0x100000); + android_pmem_gpu1_pdata.start = __pa(addr); + android_pmem_gpu1_pdata.size = size; + printk(KERN_INFO "allocating %lu bytes at %p (%lx physical)" + "for gpu1 pmem\n", size, addr, __pa(addr)); + + size = MSM_FB_SIZE; + addr = alloc_bootmem(size); + msm_fb_resources[0].start = __pa(addr); + msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1; + printk(KERN_INFO "allocating %lu bytes at %p (%lx physical) for fb\n", + size, addr, __pa(addr)); + } static void __init halibut_map_io(void) { + msm_shared_ram_phys = 0x01F00000; + msm_map_common_io(); - msm_clock_init(); + msm_clock_init(msm_clocks_7x01a, msm_num_clocks_7x01a); + msm_halibut_allocate_memory_regions(); } MACHINE_START(HALIBUT, "Halibut Board (QCT SURF7200A)") +#ifdef CONFIG_MSM_DEBUG_UART + .phys_io = MSM_DEBUG_UART_PHYS, + .io_pg_offst = ((MSM_DEBUG_UART_BASE) >> 18) & 0xfffc, +#endif + .boot_params = 0x10000100, + .map_io = halibut_map_io, + .init_irq = halibut_init_irq, + .init_machine = halibut_init, + .timer = &msm_timer, +MACHINE_END + +MACHINE_START(MSM7201A_FFA, "QCT FFA7201A Board") +#ifdef CONFIG_MSM_DEBUG_UART + .phys_io = MSM_DEBUG_UART_PHYS, + .io_pg_offst = ((MSM_DEBUG_UART_BASE) >> 18) & 0xfffc, +#endif + .boot_params = 0x10000100, + .map_io = halibut_map_io, + .init_irq = halibut_init_irq, + .init_machine = halibut_init, + .timer = &msm_timer, +MACHINE_END + +MACHINE_START(MSM7201A_SURF, "QCT SURF7201A Board") +#ifdef CONFIG_MSM_DEBUG_UART + .phys_io = MSM_DEBUG_UART_PHYS, + .io_pg_offst = ((MSM_DEBUG_UART_BASE) >> 18) & 0xfffc, +#endif .boot_params = 0x10000100, .map_io = halibut_map_io, .init_irq = halibut_init_irq, |