From: David Brownell Date: Tue, 26 Jul 2005 12:36:18 +0000 (-0700) Subject: [PATCH] ARM: OMAP: make Mistral support explicit X-Git-Tag: v2.6.13-omap1~55 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=99ae51578807861fcaa131f605d819ff42d2dfe1;p=linux-2.6-omap-h63xx.git [PATCH] ARM: OMAP: make Mistral support explicit This starts packaging support for the Mistral board and its devices separately from OSK framebuffer support, and supports the "wakeup" button (SW1) on that board. This involved some mux fixes, both for the MicroWire stuff (!) and for MPUIO2. There's still a lot more to be done ... currently the board-specific setup for the LCD, keypad, touchscreen, and so forth is scattered throughout several drivers, rather than gathered in one place where it's more naturally updated to match board revisions (or replaced for folk using different UI boards). Signed-off-by: David Brownell Signed-off-by: Tony Lindgren --- diff --git a/arch/arm/mach-omap1/Kconfig b/arch/arm/mach-omap1/Kconfig index e09dba6cbd3..76a10d36dc4 100644 --- a/arch/arm/mach-omap1/Kconfig +++ b/arch/arm/mach-omap1/Kconfig @@ -47,6 +47,14 @@ config MACH_OMAP_OSK TI OMAP 5912 OSK (OMAP Starter Kit) board support. Say Y here if you have such a board. +config OMAP_OSK_MISTRAL + bool "Mistral QVGA board Support" + depends on MACH_OMAP_OSK + help + The OSK supports an optional add-on board with a Quarter-VGA + touchscreen, PDA-ish buttons, a resume button, bicolor LED, + and camera connector. Say Y here if you have this board. + config MACH_OMAP_PERSEUS2 bool "TI Perseus2" depends on ARCH_OMAP1 && ARCH_OMAP730 diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c index 722ff95c041..56634f1bdab 100644 --- a/arch/arm/mach-omap1/board-osk.c +++ b/arch/arm/mach-omap1/board-osk.c @@ -29,6 +29,8 @@ #include #include #include +#include + #include #include @@ -189,6 +191,54 @@ static struct omap_board_config_kernel osk_config[] = { { OMAP_TAG_USB, &osk_usb_config }, }; +#ifdef CONFIG_OMAP_OSK_MISTRAL + +#ifdef CONFIG_PM +static irqreturn_t +osk_mistral_wake_interrupt(int irq, void *ignored, struct pt_regs *regs) +{ + return IRQ_HANDLED; +} +#endif + +static void __init osk_mistral_init(void) +{ + /* FIXME here's where to feed in framebuffer, touchpad, and + * keyboard setup ... not in the drivers for those devices! + * + * NOTE: we could actually tell if there's a Mistral board + * attached, e.g. by trying to read something from the ads7846. + * But this is too early for that... + */ + + /* the sideways button (SW1) is for use as a "wakeup" button */ + omap_cfg_reg(N15_1610_MPUIO2); + if (omap_request_gpio(OMAP_MPUIO(2)) == 0) { + int ret = 0; + omap_set_gpio_direction(OMAP_MPUIO(2), 1); + set_irq_type(OMAP_GPIO_IRQ(OMAP_MPUIO(2)), IRQT_RISING); +#ifdef CONFIG_PM + /* share the IRQ in case someone wants to use the + * button for more than wakeup from system sleep. + */ + ret = request_irq(OMAP_GPIO_IRQ(OMAP_MPUIO(2)), + &osk_mistral_wake_interrupt, + SA_SHIRQ, "mistral_wakeup", + &osk_mistral_wake_interrupt); + if (ret != 0) { + omap_free_gpio(OMAP_MPUIO(2)); + printk(KERN_ERR "OSK+Mistral: no wakeup irq, %d?\n", + ret); + } else + enable_irq_wake(OMAP_GPIO_IRQ(OMAP_MPUIO(2))); +#endif + } else + printk(KERN_ERR "OSK+Mistral: wakeup button is awol\n"); +} +#else +static void __init osk_mistral_init(void) { } +#endif + static void __init osk_init(void) { osk_flash_resource.end = osk_flash_resource.start = omap_cs3_phys(); @@ -197,6 +247,8 @@ static void __init osk_init(void) omap_board_config = osk_config; omap_board_config_size = ARRAY_SIZE(osk_config); USB_TRANSCEIVER_CTRL_REG |= (3 << 1); + + osk_mistral_init(); } static void __init osk_map_io(void) diff --git a/arch/arm/mach-omap1/leds-osk.c b/arch/arm/mach-omap1/leds-osk.c index 4a0e8b9d4fc..5be1a396d17 100644 --- a/arch/arm/mach-omap1/leds-osk.c +++ b/arch/arm/mach-omap1/leds-osk.c @@ -64,7 +64,7 @@ static void tps_work(void *unused) static DECLARE_WORK(work, tps_work, NULL); -#ifdef CONFIG_FB_OMAP +#ifdef CONFIG_OMAP_OSK_MISTRAL /* For now, all system indicators require the Mistral board, since that * LED can be manipulated without a task context. This LED is either red, @@ -127,7 +127,7 @@ void osk_leds_event(led_event_t evt) hw_led_state = 0; break; -#ifdef CONFIG_FB_OMAP +#ifdef CONFIG_OMAP_OSK_MISTRAL case led_timer: hw_led_state ^= TIMER_LED; @@ -144,7 +144,7 @@ void osk_leds_event(led_event_t evt) mistral_setled(); break; -#endif /* CONFIG_FB_OMAP */ +#endif /* CONFIG_OMAP_OSK_MISTRAL */ /* "green" == tps LED1 (leftmost, normally power-good) * works only with DC adapter, not on battery power! diff --git a/arch/arm/mach-omap1/leds.c b/arch/arm/mach-omap1/leds.c index 967bf2df060..694d8d990c3 100644 --- a/arch/arm/mach-omap1/leds.c +++ b/arch/arm/mach-omap1/leds.c @@ -34,7 +34,10 @@ omap_leds_init(void) if (machine_is_omap_h2() || machine_is_omap_h3() || machine_is_omap_perseus2() - || machine_is_omap_osk()) { +#ifdef CONFIG_OMAP_OSK_MISTRAL + || machine_is_omap_osk() +#endif + ) { /* LED1/LED2 pins can be used as GPIO (as done here), or by * the LPG (works even in deep sleep!), to drive a bicolor diff --git a/drivers/input/touchscreen/omap/ts_osk.c b/drivers/input/touchscreen/omap/ts_osk.c index ab4b1c71368..45b4eb9a378 100644 --- a/drivers/input/touchscreen/omap/ts_osk.c +++ b/drivers/input/touchscreen/omap/ts_osk.c @@ -83,6 +83,7 @@ static int osk_ts_penup(void) static int __init osk_ts_probe(struct omap_ts_t *ts) { +#ifdef CONFIG_OMAP_OSK_MISTRAL if (!machine_is_omap_osk()) return -ENODEV; @@ -99,8 +100,16 @@ static int __init osk_ts_probe(struct omap_ts_t *ts) UWIRE_WRITE_RISING_EDGE | UWIRE_CS_ACTIVE_LOW | UWIRE_FREQ_DIV_2); - + + /* FIXME verify there's really a Mistral board: + * see if the AD7846 chip responds. + */ + + /* NOTE: no VREF; must ignore the temp, VBAT, and AUX sensors */ return 0; +#else + return -ENODEV; +#endif } static void osk_ts_read(u16 *data) diff --git a/drivers/ssi/omap-uwire.c b/drivers/ssi/omap-uwire.c index b9e182a2b5e..61b3ca16257 100644 --- a/drivers/ssi/omap-uwire.c +++ b/drivers/ssi/omap-uwire.c @@ -200,11 +200,18 @@ static int __init omap_uwire_init(void) uwire_idx_shift = 2; uwire_write_reg(UWIRE_SR3, 1); - if (machine_is_omap_h2() || machine_is_omap_osk()) { + if (machine_is_omap_h2()) { /* defaults: W21 SDO, U18 SDI, V19 SCL */ omap_cfg_reg(N14_1610_UWIRE_CS0); omap_cfg_reg(N15_1610_UWIRE_CS1); } + if (machine_is_omap_osk()) { + /* this is the standard expansion connector usage, with + * the other chipselect pins for MPUIO2 and MPUIO4. + */ + omap_cfg_reg(N14_1610_UWIRE_CS0); + omap_cfg_reg(P15_1610_UWIRE_CS3); + } if (machine_is_omap_perseus2()) { /* configure pins: MPU_UW_nSCS1, MPU_UW_SDO, MPU_UW_SCLK */ int val = omap_readl(OMAP730_IO_CONF_9) & ~0x00EEE000; diff --git a/include/asm-arm/arch-omap/mux.h b/include/asm-arm/arch-omap/mux.h index 10dea4df901..1b1ad410534 100644 --- a/include/asm-arm/arch-omap/mux.h +++ b/include/asm-arm/arch-omap/mux.h @@ -185,6 +185,7 @@ typedef enum { /* MPUIO */ MPUIO2, + N15_1610_MPUIO2, MPUIO4, MPUIO5, T20_1610_MPUIO5, @@ -252,7 +253,7 @@ typedef enum { U18_1610_UWIRE_SDI, W21_1610_UWIRE_SDO, N14_1610_UWIRE_CS0, - P15_1610_UWIRE_CS0, + P15_1610_UWIRE_CS3, N15_1610_UWIRE_CS1, /* OMAP-1610 Flash */ @@ -413,7 +414,8 @@ MUX_CFG("N21_1710_GPIO14", 6, 9, 0, 1, 1, 1, 1, 1, 1) MUX_CFG("W15_1710_GPIO40", 9, 27, 7, 2, 5, 1, 2, 1, 1) /* MPUIO */ -MUX_CFG("MPUIO2", 7, 18, 0, 1, 1, 1, NA, 0, 1) +MUX_CFG("MPUIO2", 7, 18, 0, 1, 14, 1, NA, 0, 1) +MUX_CFG("N15_1610_MPUIO2", 7, 18, 0, 1, 14, 1, 1, 0, 1) MUX_CFG("MPUIO4", 7, 15, 0, 1, 13, 1, NA, 0, 1) MUX_CFG("MPUIO5", 7, 12, 0, 1, 12, 1, NA, 0, 1)