diff --git a/arch/arm/mach-msm/Kconfig b/arch/arm/mach-msm/Kconfig index 803a26b4..5a464fda 100644 --- a/arch/arm/mach-msm/Kconfig +++ b/arch/arm/mach-msm/Kconfig @@ -271,6 +271,13 @@ config MACH_BRAVO help Select this to support the Bravo device +config MACH_HTCLEO + depends on ARCH_QSD8X50 + default y + bool "HTC Leo" + help + Select this to support the HTC Leo device + config MACH_PASSIONC depends on ARCH_QSD8X50 default n diff --git a/arch/arm/mach-msm/Makefile b/arch/arm/mach-msm/Makefile index 02374f65..d2f7c751 100644 --- a/arch/arm/mach-msm/Makefile +++ b/arch/arm/mach-msm/Makefile @@ -97,6 +97,8 @@ obj-$(CONFIG_MACH_BRAVOC) += board-bravoc-rfkill.o board-bravoc-audio.o obj-$(CONFIG_MACH_BRAVOC) += board-bravoc-wifi.o htc_awb_cal.o obj-$(CONFIG_MACH_BRAVOC) += board-bravoc-microp.o +obj-$(CONFIG_MACH_HTCLEO) += board-htcleo.o + # MSM7x30 boards obj-$(CONFIG_ARCH_MSM7X30) += panel-samsungwvga-tl2796a.o panel-samsungwvga-s6e63m0.o panel-sonywvga-s6d16a0x21-7x30.o obj-$(CONFIG_ARCH_MSM7X30) += htc_wifi_nvs.o htc_awb_cal.o diff --git a/arch/arm/mach-msm/board-htcleo.c b/arch/arm/mach-msm/board-htcleo.c new file mode 100644 index 00000000..f7162b13 --- /dev/null +++ b/arch/arm/mach-msm/board-htcleo.c @@ -0,0 +1,155 @@ +/* linux/arch/arm/mach-msm/board-htcleo.c + * + * Copyright (C) 2009 Google, Inc. + * Copyright (C) 2009 HTC Corporation. + * Author: Dima Zavin + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include <../../../drivers/staging/android/timed_gpio.h> + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "board-htcleo.h" +#include "devices.h" + +/* Vibrator */ +static struct timed_gpio timed_gpios[] = { + { + .name = "vibrator", + .gpio = HTCLEO_GPIO_VIBRATOR_ON, + .max_timeout = 15000, + }, +}; + +static struct timed_gpio_platform_data timed_gpio_data = { + .num_gpios = ARRAY_SIZE(timed_gpios), + .gpios = timed_gpios, +}; + +static struct platform_device htcleo_timed_gpios = { + .name = "timed-gpio", + .id = -1, + .dev = { + .platform_data = &timed_gpio_data, + }, +}; + + +static struct i2c_board_info base_i2c_devices[] = +{ +}; +static struct platform_device *devices[] __initdata = +{ + &msm_device_i2c, +}; + +static struct msm_acpu_clock_platform_data htcleo_clock_data = { + .acpu_switch_time_us = 20, + .max_speed_delta_khz = 256000, + .vdd_switch_time_us = 62, + .power_collapse_khz = 245000, + .wait_for_irq_khz = 245000, +// .wait_for_irq_khz = 19200, // TCXO +}; + +static void htcleo_reset(void) +{ + // 25 - 16 = 9 + while (1) + { + writel(readl(MSM_GPIOCFG2_BASE + 0x504) | (1 << 9), MSM_GPIOCFG2_BASE + 0x504);// owner + gpio_set_value(HTCLEO_GPIO_PS_HOLD, 0); + } +} + + + +static void do_grp_reset(void) +{ + writel(0x20000, MSM_CLK_CTL_BASE + 0x214); +} + +static void __init htcleo_init(void) +{ + volatile unsigned *bank6_in, *bank6_out; + printk("htcleo_init()\n"); + + msm_hw_reset_hook = htcleo_reset; + + do_grp_reset(); + + msm_acpu_clock_init(&htcleo_clock_data); + + platform_add_devices(devices, ARRAY_SIZE(devices)); + + i2c_register_board_info(0, base_i2c_devices, ARRAY_SIZE(base_i2c_devices)); + + platform_device_register(&htcleo_timed_gpios); + + /* Blink the camera LED shortly to show that we're alive! */ + + bank6_in = (unsigned int*)(MSM_GPIO1_BASE + 0x0864); + bank6_out = (unsigned int*)(MSM_GPIO1_BASE + 0x0814); + *bank6_out = *bank6_in ^ 0x200000; + mdelay(50); + *bank6_out = *bank6_in | 0x200000; + mdelay(200); + +} + +static void __init htcleo_fixup(struct machine_desc *desc, struct tag *tags, + char **cmdline, struct meminfo *mi) +{ + mi->nr_banks = 1; + mi->bank[0].start = MSM_EBI1_BANK0_BASE; + mi->bank[0].node = PHYS_TO_NID(MSM_EBI1_BANK0_BASE); + mi->bank[0].size = MSM_EBI1_BANK0_SIZE; +} + +static void __init htcleo_map_io(void) +{ + msm_map_common_io(); + msm_clock_init(); +} + +extern struct sys_timer msm_timer; + +MACHINE_START(HTCLEO, "htcleo") +#ifdef CONFIG_MSM_DEBUG_UART + .phys_io = MSM_DEBUG_UART_PHYS, + .io_pg_offst = ((MSM_DEBUG_UART_BASE) >> 18) & 0xfffc, +#endif + .boot_params = 0x11800100, + .fixup = htcleo_fixup, + .map_io = htcleo_map_io, + .init_irq = msm_init_irq, + .init_machine = htcleo_init, + .timer = &msm_timer, +MACHINE_END diff --git a/arch/arm/mach-msm/board-htcleo.h b/arch/arm/mach-msm/board-htcleo.h new file mode 100644 index 00000000..20aee92f --- /dev/null +++ b/arch/arm/mach-msm/board-htcleo.h @@ -0,0 +1,168 @@ +/* arch/arm/mach-msm/board-htcleo.h + * + * Copyright (C) 2009 HTC Corporation. + * Author: Haley Teng + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * 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. +*/ + +#ifndef __ARCH_ARM_MACH_MSM_BOARD_HTCLEO_H +#define __ARCH_ARM_MACH_MSM_BOARD_HTCLEO_H + +#include + +#define MSM_EBI1_BANK0_BASE 0x11800000 +//#define MSM_EBI1_BANK0_SIZE 0x1E800000 /* 488MB */ +#define MSM_EBI1_BANK0_SIZE 0x1E7C0000 /* 488MB - 0x00040000 RAM CONSOLE*/ + +/* Don't change that */ +#define MSM_SMI_BASE 0x00000000 +#define MSM_SMI_SIZE 0x04000000 + +/* Begin SMI region */ +/* First part of SMI is used for OEMSBL & AMSS */ +#define MSM_PMEM_SMI_BASE (MSM_SMI_BASE + 0x02500000) +#define MSM_PMEM_SMI_SIZE 0x01B00000 + +#define MSM_FB_BASE MSM_PMEM_SMI_BASE +#define MSM_FB_SIZE 0x00600000 + +#define MSM_GPU_PHYS_BASE (MSM_PMEM_SMI_BASE + MSM_FB_SIZE) +#define MSM_GPU_PHYS_SIZE 0x00800000 +/* #define MSM_GPU_PHYS_SIZE 0x00300000 */ + +#define MSM_PMEM_CAMERA_BASE (MSM_GPU_PHYS_BASE + MSM_GPU_PHYS_SIZE) +#define MSM_PMEM_CAMERA_SIZE 0x00C00000 + +#define MSM_PMEM_SMIPOOL_BASE (MSM_PMEM_CAMERA_BASE + MSM_PMEM_CAMERA_SIZE) +#define MSM_PMEM_SMIPOOL_SIZE (MSM_PMEM_SMI_SIZE - MSM_GPU_PHYS_SIZE - MSM_FB_SIZE - MSM_PMEM_CAMERA_SIZE) +/* End SMI region */ + +/* Begin EBI region */ +#define PMEM_KERNEL_EBI1_SIZE 0x00028000 + +#define MSM_PMEM_SF_SIZE 0x02000000 + +#define MSM_PMEM_ADSP_SIZE 0x02196000 + +/* MSM_RAM_CONSOLE uses the last 0x00040000 of EBI memory, defined in msm_iomap.h +#define MSM_RAM_CONSOLE_SIZE 0x00040000 +#define MSM_RAM_CONSOLE_BASE (MSM_EBI1_BANK0_BASE + MSM_EBI1_BANK0_SIZE - MSM_RAM_CONSOLE_SIZE) //0x2FFC0000 +*/ + +/* End EBI region */ + +#define HTCLEO_GPIO_PS_HOLD 25 + +//#define HTCLEO_GPIO_UP_INT_N 35 // We have to find the right one +#define HTCLEO_GPIO_UP_INT_N 90 +#define HTCLEO_GPIO_UP_RESET_N 91 +#define HTCLEO_GPIO_LS_EN_N 119 + +#define HTCLEO_GPIO_TP_INT_N 92 +#define HTCLEO_GPIO_TP_LS_EN 93 +#define HTCLEO_GPIO_TP_EN 160 + +#define HTCLEO_GPIO_POWER_KEY 94 +#define HTCLEO_GPIO_SDMC_CD_REV0_N 153 + +#define HTCLEO_GPIO_WIFI_SHUTDOWN_N 129 +#define HTCLEO_GPIO_WIFI_IRQ 152 + +#define HTCLEO_GPIO_VIBRATOR_ON 100 + +/* Flashlight */ +#define HTCLEO_GPIO_FLASHLIGHT_TORCH 159 +#define HTCLEO_GPIO_FLASHLIGHT_FLASH 143 + + + +#define HTCLEO_AUD_JACKHP_EN 157 +#define HTCLEO_AUD_2V5_EN 158 +#define HTCLEO_BT_PCM_OUT 68 +#define HTCLEO_BT_PCM_IN 69 +#define HTCLEO_BT_PCM_SYNC 70 +#define HTCLEO_BT_PCM_CLK 71 + +/* Headset */ +#define HTCLEO_GPIO_HDS_MIC 35 +#define HTCLEO_GPIO_HDS_DET 145 + +/* Keypad */ +#define HTCLEO_GPIO_KP_MKOUT0 33 +#define HTCLEO_GPIO_KP_MKOUT1 32 +#define HTCLEO_GPIO_KP_MKOUT2 31 +#define HTCLEO_GPIO_KP_MPIN0 42 +#define HTCLEO_GPIO_KP_MPIN1 41 +#define HTCLEO_GPIO_KP_MPIN2 40 +#define HTCLEO_GPIO_KP_LED 48 + +/* Bluetooth */ +#define HTCLEO_GPIO_BT_UART1_RTS 43 +#define HTCLEO_GPIO_BT_UART1_CTS 44 +#define HTCLEO_GPIO_BT_UART1_RX 45 +#define HTCLEO_GPIO_BT_UART1_TX 46 +#define HTCLEO_GPIO_BT_RESET_N 146 +#define HTCLEO_GPIO_BT_SHUTDOWN_N 128 +#define HTCLEO_GPIO_BT_HOST_WAKE 37 +#define HTCLEO_GPIO_BT_CHIP_WAKE 57 + +/* Compass */ +#define HTCLEO_GPIO_COMPASS_INT_N 39 +#define HTCLEO_GPIO_COMPASS_RST_N 107 +#define HTCLEO_PROJECT_NAME "htcleo" +#define HTCLEO_LAYOUTS { \ + { {-1, 0, 0}, { 0, -1, 0}, {0, 0, 1} }, \ + { { 0, -1, 0}, { 1, 0, 0}, {0, 0, -1} }, \ + { { 0, -1, 0}, { 1, 0, 0}, {0, 0, 1} }, \ + { {-1, 0, 0}, { 0, 0, -1}, {0, 1, 0} } \ +} + +/* Display */ +#define HTCLEO_GPIO_LCM_POWER 88 +#define HTCLEO_GPIO_LCM_RESET 29 +#define HTCLEO_LCD_R1 (114) +#define HTCLEO_LCD_R2 (115) +#define HTCLEO_LCD_R3 (116) +#define HTCLEO_LCD_R4 (117) +#define HTCLEO_LCD_R5 (118) +#define HTCLEO_LCD_G0 (121) +#define HTCLEO_LCD_G1 (122) +#define HTCLEO_LCD_G2 (123) +#define HTCLEO_LCD_G3 (124) +#define HTCLEO_LCD_G4 (125) +#define HTCLEO_LCD_G5 (126) +#define HTCLEO_LCD_B1 (130) +#define HTCLEO_LCD_B2 (131) +#define HTCLEO_LCD_B3 (132) +#define HTCLEO_LCD_B4 (133) +#define HTCLEO_LCD_B5 (134) +#define HTCLEO_LCD_PCLK (135) +#define HTCLEO_LCD_VSYNC (136) +#define HTCLEO_LCD_HSYNC (137) +#define HTCLEO_LCD_DE (138) + +/* Battery */ +#define HTCLEO_GPIO_BATTERY_CHARGER_ENABLE 22 +#define HTCLEO_GPIO_BATTERY_CHARGER_CURRENT 16 +#define HTCLEO_GPIO_BATTERY_OVER_CHG 147 +#define HTCLEO_GPIO_POWER_USB 109 +#define HTCLEO_GPIO_USBPHY_3V3_ENABLE 104 + +/* Touchscreen */ +#define HTCLEO_GPIO_TS_POWER 160 +#define HTCLEO_GPIO_TS_IRQ 92 +#define HTCLEO_GPIO_TS_SEL 108 + +#define HTCLEO_GPIO_LED_3V3_EN 85 + +int htcleo_pm_set_vreg(int enable, unsigned id); + +#endif /* __ARCH_ARM_MACH_MSM_BOARD_HTCLEO_H */