X-Git-Url: http://ftp.safe.ca/?a=blobdiff_plain;f=arch%2Farm%2Fmach-pxa%2Fpalmt5.c;h=d902a813aae398273c5b1e118b162128f55552f6;hb=424264b7b220e8eee165dc3080ae48692af73dec;hp=d7f81068c6136ee7562d12f15fd38508f06956b5;hpb=efb12cd20ace78aca03304f356f9c9c0c9ca3f66;p=safe%2Fjmp%2Flinux-2.6 diff --git a/arch/arm/mach-pxa/palmt5.c b/arch/arm/mach-pxa/palmt5.c index d7f8106..d902a81 100644 --- a/arch/arm/mach-pxa/palmt5.c +++ b/arch/arm/mach-pxa/palmt5.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -64,6 +65,7 @@ static unsigned long palmt5_pin_config[] __initdata = { GPIO29_AC97_SDATA_IN_0, GPIO30_AC97_SDATA_OUT, GPIO31_AC97_SYNC, + GPIO89_AC97_SYSCLK, GPIO95_AC97_nRESET, /* IrDA */ @@ -85,30 +87,15 @@ static unsigned long palmt5_pin_config[] __initdata = { GPIO105_KP_MKOUT_2, /* LCD */ - GPIO58_LCD_LDD_0, - GPIO59_LCD_LDD_1, - GPIO60_LCD_LDD_2, - GPIO61_LCD_LDD_3, - GPIO62_LCD_LDD_4, - GPIO63_LCD_LDD_5, - GPIO64_LCD_LDD_6, - GPIO65_LCD_LDD_7, - GPIO66_LCD_LDD_8, - GPIO67_LCD_LDD_9, - GPIO68_LCD_LDD_10, - GPIO69_LCD_LDD_11, - GPIO70_LCD_LDD_12, - GPIO71_LCD_LDD_13, - GPIO72_LCD_LDD_14, - GPIO73_LCD_LDD_15, - GPIO74_LCD_FCLK, - GPIO75_LCD_LCLK, - GPIO76_LCD_PCLK, - GPIO77_LCD_BIAS, + GPIOxx_LCD_TFT_16BPP, /* PWM */ GPIO16_PWM0_OUT, + /* FFUART */ + GPIO34_FFUART_RXD, + GPIO39_FFUART_TXD, + /* MISC */ GPIO10_GPIO, /* hotsync button */ GPIO90_GPIO, /* power detect */ @@ -118,83 +105,12 @@ static unsigned long palmt5_pin_config[] __initdata = { /****************************************************************************** * SD/MMC card controller ******************************************************************************/ -static int palmt5_mci_init(struct device *dev, irq_handler_t palmt5_detect_int, - void *data) -{ - int err = 0; - - /* Setup an interrupt for detecting card insert/remove events */ - err = gpio_request(GPIO_NR_PALMT5_SD_DETECT_N, "SD IRQ"); - if (err) - goto err; - err = gpio_direction_input(GPIO_NR_PALMT5_SD_DETECT_N); - if (err) - goto err2; - err = request_irq(gpio_to_irq(GPIO_NR_PALMT5_SD_DETECT_N), - palmt5_detect_int, IRQF_DISABLED | IRQF_SAMPLE_RANDOM | - IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, - "SD/MMC card detect", data); - if (err) { - printk(KERN_ERR "%s: cannot request SD/MMC card detect IRQ\n", - __func__); - goto err2; - } - - err = gpio_request(GPIO_NR_PALMT5_SD_POWER, "SD_POWER"); - if (err) - goto err3; - err = gpio_direction_output(GPIO_NR_PALMT5_SD_POWER, 0); - if (err) - goto err4; - - err = gpio_request(GPIO_NR_PALMT5_SD_READONLY, "SD_READONLY"); - if (err) - goto err4; - err = gpio_direction_input(GPIO_NR_PALMT5_SD_READONLY); - if (err) - goto err5; - - printk(KERN_DEBUG "%s: irq registered\n", __func__); - - return 0; - -err5: - gpio_free(GPIO_NR_PALMT5_SD_READONLY); -err4: - gpio_free(GPIO_NR_PALMT5_SD_POWER); -err3: - free_irq(gpio_to_irq(GPIO_NR_PALMT5_SD_DETECT_N), data); -err2: - gpio_free(GPIO_NR_PALMT5_SD_DETECT_N); -err: - return err; -} - -static void palmt5_mci_exit(struct device *dev, void *data) -{ - gpio_free(GPIO_NR_PALMT5_SD_READONLY); - gpio_free(GPIO_NR_PALMT5_SD_POWER); - free_irq(IRQ_GPIO_PALMT5_SD_DETECT_N, data); - gpio_free(GPIO_NR_PALMT5_SD_DETECT_N); -} - -static void palmt5_mci_power(struct device *dev, unsigned int vdd) -{ - struct pxamci_platform_data *p_d = dev->platform_data; - gpio_set_value(GPIO_NR_PALMT5_SD_POWER, p_d->ocr_mask & (1 << vdd)); -} - -static int palmt5_mci_get_ro(struct device *dev) -{ - return gpio_get_value(GPIO_NR_PALMT5_SD_READONLY); -} - static struct pxamci_platform_data palmt5_mci_platform_data = { - .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, - .setpower = palmt5_mci_power, - .get_ro = palmt5_mci_get_ro, - .init = palmt5_mci_init, - .exit = palmt5_mci_exit, + .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, + .gpio_card_detect = GPIO_NR_PALMT5_SD_DETECT_N, + .gpio_card_ro = GPIO_NR_PALMT5_SD_READONLY, + .gpio_power = GPIO_NR_PALMT5_SD_POWER, + .detect_delay = 20, }; /****************************************************************************** @@ -274,7 +190,7 @@ err: return ret; } -static int palmt5_backlight_notify(int brightness) +static int palmt5_backlight_notify(struct device *dev, int brightness) { gpio_set_value(GPIO_NR_PALMT5_BL_POWER, brightness); gpio_set_value(GPIO_NR_PALMT5_LCD_POWER, brightness); @@ -308,45 +224,26 @@ static struct platform_device palmt5_backlight = { /****************************************************************************** * IrDA ******************************************************************************/ -static int palmt5_irda_startup(struct device *dev) -{ - int err; - err = gpio_request(GPIO_NR_PALMT5_IR_DISABLE, "IR DISABLE"); - if (err) - goto err; - err = gpio_direction_output(GPIO_NR_PALMT5_IR_DISABLE, 1); - if (err) - gpio_free(GPIO_NR_PALMT5_IR_DISABLE); -err: - return err; -} - -static void palmt5_irda_shutdown(struct device *dev) -{ - gpio_free(GPIO_NR_PALMT5_IR_DISABLE); -} - -static void palmt5_irda_transceiver_mode(struct device *dev, int mode) -{ - gpio_set_value(GPIO_NR_PALMT5_IR_DISABLE, mode & IR_OFF); - pxa2xx_transceiver_mode(dev, mode); -} - static struct pxaficp_platform_data palmt5_ficp_platform_data = { - .startup = palmt5_irda_startup, - .shutdown = palmt5_irda_shutdown, - .transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF, - .transceiver_mode = palmt5_irda_transceiver_mode, + .gpio_pwdown = GPIO_NR_PALMT5_IR_DISABLE, + .transceiver_cap = IR_SIRMODE | IR_OFF, }; /****************************************************************************** * UDC ******************************************************************************/ -static struct pxa2xx_udc_mach_info palmt5_udc_info __initdata = { +static struct gpio_vbus_mach_info palmt5_udc_info = { .gpio_vbus = GPIO_NR_PALMT5_USB_DETECT_N, .gpio_vbus_inverted = 1, .gpio_pullup = GPIO_NR_PALMT5_USB_PULLUP, - .gpio_pullup_inverted = 0, +}; + +static struct platform_device palmt5_gpio_vbus = { + .name = "gpio-vbus", + .id = -1, + .dev = { + .platform_data = &palmt5_udc_info, + }, }; /****************************************************************************** @@ -420,10 +317,22 @@ static struct wm97xx_batt_info wm97xx_batt_pdata = { /****************************************************************************** * aSoC audio ******************************************************************************/ -static struct palm27x_asoc_info palm27x_asoc_pdata = { +static struct palm27x_asoc_info palmt5_asoc_pdata = { .jack_gpio = GPIO_NR_PALMT5_EARPHONE_DETECT, }; +static pxa2xx_audio_ops_t palmt5_ac97_pdata = { + .reset_gpio = 95, +}; + +static struct platform_device palmt5_asoc = { + .name = "palm27x-asoc", + .id = -1, + .dev = { + .platform_data = &palmt5_asoc_pdata, + }, +}; + /****************************************************************************** * Framebuffer ******************************************************************************/ @@ -453,30 +362,18 @@ static struct pxafb_mach_info palmt5_lcd_screen = { /****************************************************************************** * Power management - standby ******************************************************************************/ -#ifdef CONFIG_PM -static u32 *addr __initdata; -static u32 resume[3] __initdata = { - 0xe3a00101, /* mov r0, #0x40000000 */ - 0xe380060f, /* orr r0, r0, #0x00f00000 */ - 0xe590f008, /* ldr pc, [r0, #0x08] */ -}; - -static int __init palmt5_pm_init(void) +static void __init palmt5_pm_init(void) { - int i; - - /* this is where the bootloader jumps */ - addr = phys_to_virt(PALMT5_STR_BASE); - - for (i = 0; i < 3; i++) - addr[i] = resume[i]; - - return 0; + static u32 resume[] = { + 0xe3a00101, /* mov r0, #0x40000000 */ + 0xe380060f, /* orr r0, r0, #0x00f00000 */ + 0xe590f008, /* ldr pc, [r0, #0x08] */ + }; + + /* copy the bootloader */ + memcpy(phys_to_virt(PALMT5_STR_BASE), resume, sizeof(resume)); } -device_initcall(palmt5_pm_init); -#endif - /****************************************************************************** * Machine init ******************************************************************************/ @@ -486,6 +383,8 @@ static struct platform_device *devices[] __initdata = { #endif &palmt5_backlight, &power_supply, + &palmt5_asoc, + &palmt5_gpio_vbus, }; /* setup udc GPIOs initial state */ @@ -501,15 +400,19 @@ static void __init palmt5_init(void) { pxa2xx_mfp_config(ARRAY_AND_SIZE(palmt5_pin_config)); + pxa_set_ffuart_info(NULL); + pxa_set_btuart_info(NULL); + pxa_set_stuart_info(NULL); + + palmt5_pm_init(); set_pxa_fb_info(&palmt5_lcd_screen); pxa_set_mci_info(&palmt5_mci_platform_data); palmt5_udc_init(); - pxa_set_udc_info(&palmt5_udc_info); - pxa_set_ac97_info(NULL); + pxa_set_ac97_info(&palmt5_ac97_pdata); pxa_set_ficp_info(&palmt5_ficp_platform_data); pxa_set_keypad_info(&palmt5_keypad_platform_data); wm97xx_bat_set_pdata(&wm97xx_batt_pdata); - palm27x_asoc_set_pdata(&palm27x_asoc_pdata); + platform_add_devices(devices, ARRAY_SIZE(devices)); }