--- board-htcdiamond.c 2009-01-21 10:59:41.000000000 +0100 +++ board-htcraphael.c 2009-01-21 12:27:30.000000000 +0100 @@ -1,4 +1,4 @@ -/* linux/arch/arm/mach-msm/board-htcdiamond.c +/* linux/arch/arm/mach-msm/board-htcraphael.c * * Copyright (C) 2007 Google, Inc. * Author: Brian Swetland , @@ -74,20 +74,24 @@ static int halibut_ffa; module_param_named(ffa, halibut_ffa, int, S_IRUGO | S_IWUSR | S_IWGRP); -void htcraphael_init_keypad(void); +void htcraphael_device_specific_fixes(void); +extern void htcraphael_init_keypad(void); extern int msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat); static struct resource raphael_keypad_resources[] = { { - .start = MSM_GPIO_TO_INT(27), - .end = MSM_GPIO_TO_INT(27), + .start = MSM_GPIO_TO_INT(27), /* Modified in htcraphael_device_specific_fixes() */ + .end = MSM_GPIO_TO_INT(27), /* Modified in htcraphael_device_specific_fixes() */ .flags = IORESOURCE_IRQ, }, }; static struct microp_keypad_platform_data raphael_keypad_data = { - .clamshell = { .gpio = 39, .irq = MSM_GPIO_TO_INT(39), }, - .backlight_gpio = 86, + .clamshell = { + .gpio = 39, /* Modified in htcraphael_device_specific_fixes() */ + .irq = MSM_GPIO_TO_INT(39), /* Modified in htcraphael_device_specific_fixes() */ + }, + .backlight_gpio = 86, /* Modified in htcraphael_device_specific_fixes() */ }; static struct platform_device raphael_keypad_device = { @@ -179,6 +183,10 @@ // LED & Backlight controller I2C_BOARD_INFO("microp-klt", 0x66), }, + { + // Keyboard controller + I2C_BOARD_INFO("microp-ksc", 0x67), + }, { I2C_BOARD_INFO("mt9t013", 0x6c>>1), /* .irq = TROUT_GPIO_TO_INT(TROUT_GPIO_CAM_BTN_STEP1_N), */ @@ -256,22 +264,32 @@ &msm_device_i2c, }; -/* - * All halibut slots are the same(ish) - */ +static unsigned int raphael_sdcc_slot_status(struct device *dev) +{ + /* + * For the Raphael we check the GPIO that indicates whether an + * SD card is present or not. + */ + unsigned int status; + status = (unsigned int) gpio_get_value(23); + return !status; +} -static unsigned int halibut_sdcc_slot_status(struct device *dev) +static unsigned int raphael_cdma_sdcc_slot_status(struct device *dev) { /* - * The Diamond has a MoviNAND using mmc interface connected - * to SDC2. It is hardwired, thus we always return 1. + * For the Raphael we check the GPIO that indicates whether an + * SD card is present or not. */ - return 1; + unsigned int status; + status = (unsigned int) gpio_get_value(38); + return !status; } static struct mmc_platform_data halibut_sdcc_data = { .ocr_mask = MMC_VDD_28_29, - .status = halibut_sdcc_slot_status, + .status = raphael_cdma_sdcc_slot_status, /* Modified in htcraphael_device_specific_fixes() */ + .status_irq = MSM_GPIO_TO_INT(38), /* card detect sd - Modified in htcraphael_device_specific_fixes() */ }; extern struct sys_timer msm_timer; @@ -307,19 +325,22 @@ if (rc) printk(KERN_ERR "%s: vreg enable failed (%d)\n", __func__, rc); - // Configure the SD card detect gpio irq to only trigger on rising and falling - gpio_configure(38, IRQF_TRIGGER_NONE | IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING); - - // Diamond's MoviNAND can be found on SDC2 - msm_add_sdcc(3, &halibut_sdcc_data); + // Raphael's SD controller can be found on SDC2 for GSM and SDC3 for CDMA version + if (machine_is_htcraphael()) { + gpio_configure(23, IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING); + msm_add_sdcc(2, &halibut_sdcc_data); + } + else if (machine_is_htcraphael_cdma()) { + gpio_configure(38, IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING); + msm_add_sdcc(3, &halibut_sdcc_data); + } } static void __init halibut_init(void) { -#if defined(CONFIG_MSM_SERIAL_DEBUGGER) - msm_serial_debug_init(MSM_UART1_PHYS, INT_UART1, - "uart1_clk", 1); -#endif + // Fix data in arrays depending on GSM/CDMA version + htcraphael_device_specific_fixes(); + msm_acpu_clock_init(&halibut_clock_data); msm_proc_comm_wince_init(); @@ -330,6 +351,7 @@ platform_add_devices(devices, ARRAY_SIZE(devices)); i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices)); halibut_init_mmc(); + htcraphael_init_keypad(); /* TODO: detect vbus and correctly notify USB about its presence * For now we just declare that VBUS is present at boot and USB @@ -374,7 +396,29 @@ } #endif -MACHINE_START(HTCDIAMOND, "HTC Diamond GSM phone (aka HTC Touch Diamond)") +void htcraphael_device_specific_fixes(void) +{ + if (machine_is_htcraphael()) { + raphael_keypad_resources[0].start = MSM_GPIO_TO_INT(27); + raphael_keypad_resources[0].end = MSM_GPIO_TO_INT(27); + raphael_keypad_data.clamshell.gpio = 38; + raphael_keypad_data.clamshell.irq = MSM_GPIO_TO_INT(38); + raphael_keypad_data.backlight_gpio = 86; + halibut_sdcc_data.status = raphael_sdcc_slot_status; + halibut_sdcc_data.status_irq = MSM_GPIO_TO_INT(23); + } + if (machine_is_htcraphael_cdma()) { + raphael_keypad_resources[0].start = MSM_GPIO_TO_INT(27); + raphael_keypad_resources[0].end = MSM_GPIO_TO_INT(27); + raphael_keypad_data.clamshell.gpio = 39; + raphael_keypad_data.clamshell.irq = MSM_GPIO_TO_INT(39); + raphael_keypad_data.backlight_gpio = 86; + halibut_sdcc_data.status = raphael_cdma_sdcc_slot_status; + halibut_sdcc_data.status_irq = MSM_GPIO_TO_INT(38); + } +} + +MACHINE_START(HTCRAPHAEL, "HTC Raphael GSM phone (aka HTC Touch Pro)") // .fixup = htcraphael_fixup, .boot_params = 0x10000100, .map_io = halibut_map_io, @@ -383,7 +427,7 @@ .timer = &msm_timer, MACHINE_END -MACHINE_START(HTCDIAMOND_CDMA, "HTC Diamond CDMA phone (aka HTC Touch Diamond)") +MACHINE_START(HTCRAPHAEL_CDMA, "HTC Raphael CDMA phone (aka HTC Touch Pro)") // .fixup = htcraphael_fixup, .boot_params = 0x10000100, .map_io = halibut_map_io,