/* * linux/arch/arm/mach-pxa/balloon3.c * * Support for Balloonboard.org Balloon3 board. * * Author: Nick Bane, Wookey, Jonathan McDowell * Created: June, 2006 * Copyright: Toby Churchill Ltd * Derived from mainstone.c, by Nico Pitre * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "generic.h" #include "devices.h" /****************************************************************************** * Pin configuration ******************************************************************************/ static unsigned long balloon3_pin_config[] __initdata = { /* Select BTUART 'COM1/ttyS0' as IO option for pins 42/43/44/45 */ GPIO42_BTUART_RXD, GPIO43_BTUART_TXD, GPIO44_BTUART_CTS, GPIO45_BTUART_RTS, /* Reset, configured as GPIO wakeup source */ GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH, }; /****************************************************************************** * Compatibility: Parameter parsing ******************************************************************************/ static unsigned long balloon3_irq_enabled; static unsigned long balloon3_features_present = (1 << BALLOON3_FEATURE_OHCI) | (1 << BALLOON3_FEATURE_CF) | (1 << BALLOON3_FEATURE_AUDIO) | (1 << BALLOON3_FEATURE_TOPPOLY); int balloon3_has(enum balloon3_features feature) { return (balloon3_features_present & (1 << feature)) ? 1 : 0; } EXPORT_SYMBOL_GPL(balloon3_has); int __init parse_balloon3_features(char *arg) { if (!arg) return 0; return strict_strtoul(arg, 0, &balloon3_features_present); } early_param("balloon3_features", parse_balloon3_features); /****************************************************************************** * Compact Flash slot ******************************************************************************/ #if defined(CONFIG_PCMCIA_PXA2XX) || defined(CONFIG_PCMCIA_PXA2XX_MODULE) static unsigned long balloon3_cf_pin_config[] __initdata = { GPIO48_nPOE, GPIO49_nPWE, GPIO50_nPIOR, GPIO51_nPIOW, GPIO85_nPCE_1, GPIO54_nPCE_2, GPIO79_PSKTSEL, GPIO55_nPREG, GPIO56_nPWAIT, GPIO57_nIOIS16, }; static void __init balloon3_cf_init(void) { if (!balloon3_has(BALLOON3_FEATURE_CF)) return; pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_cf_pin_config)); } #else static inline void balloon3_cf_init(void) {} #endif /****************************************************************************** * NOR Flash ******************************************************************************/ #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) static struct mtd_partition balloon3_nor_partitions[] = { { .name = "Flash", .offset = 0x00000000, .size = MTDPART_SIZ_FULL, } }; static struct physmap_flash_data balloon3_flash_data[] = { { .width = 2, /* bankwidth in bytes */ .parts = balloon3_nor_partitions, .nr_parts = ARRAY_SIZE(balloon3_nor_partitions) } }; static struct resource balloon3_flash_resource = { .start = PXA_CS0_PHYS, .end = PXA_CS0_PHYS + SZ_64M - 1, .flags = IORESOURCE_MEM, }; static struct platform_device balloon3_flash = { .name = "physmap-flash", .id = 0, .resource = &balloon3_flash_resource, .num_resources = 1, .dev = { .platform_data = balloon3_flash_data, }, }; static void __init balloon3_nor_init(void) { platform_device_register(&balloon3_flash); } #else static inline void balloon3_nor_init(void) {} #endif /****************************************************************************** * Audio and Touchscreen ******************************************************************************/ #if defined(CONFIG_TOUCHSCREEN_UCB1400) || \ defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE) static unsigned long balloon3_ac97_pin_config[] __initdata = { GPIO28_AC97_BITCLK, GPIO29_AC97_SDATA_IN_0, GPIO30_AC97_SDATA_OUT, GPIO31_AC97_SYNC, GPIO113_AC97_nRESET, GPIO95_GPIO, }; static struct ucb1400_pdata vpac270_ucb1400_pdata = { .irq = PXA_GPIO_TO_IRQ(BALLOON3_GPIO_CODEC_IRQ), }; static struct platform_device balloon3_ucb1400_device = { .name = "ucb1400_core", .id = -1, .dev = { .platform_data = &vpac270_ucb1400_pdata, }, }; static void __init balloon3_ts_init(void) { if (!balloon3_has(BALLOON3_FEATURE_AUDIO)) return; pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_ac97_pin_config)); pxa_set_ac97_info(NULL); platform_device_register(&balloon3_ucb1400_device); } #else static inline void balloon3_ts_init(void) {} #endif /****************************************************************************** * Framebuffer ******************************************************************************/ #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) static unsigned long balloon3_lcd_pin_config[] __initdata = { GPIOxx_LCD_TFT_16BPP, GPIO99_GPIO, }; static struct pxafb_mode_info balloon3_lcd_modes[] = { { .pixclock = 38000, .xres = 480, .yres = 640, .bpp = 16, .hsync_len = 8, .left_margin = 8, .right_margin = 8, .vsync_len = 2, .upper_margin = 4, .lower_margin = 5, .sync = 0, }, }; static struct pxafb_mach_info balloon3_lcd_screen = { .modes = balloon3_lcd_modes, .num_modes = ARRAY_SIZE(balloon3_lcd_modes), .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, }; static void balloon3_backlight_power(int on) { gpio_set_value(BALLOON3_GPIO_RUN_BACKLIGHT, on);