Commit 99ae5157 authored by David Brownell's avatar David Brownell Committed by Tony Lindgren

[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: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 585dd0ec
...@@ -47,6 +47,14 @@ config MACH_OMAP_OSK ...@@ -47,6 +47,14 @@ config MACH_OMAP_OSK
TI OMAP 5912 OSK (OMAP Starter Kit) board support. Say Y here TI OMAP 5912 OSK (OMAP Starter Kit) board support. Say Y here
if you have such a board. 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 config MACH_OMAP_PERSEUS2
bool "TI Perseus2" bool "TI Perseus2"
depends on ARCH_OMAP1 && ARCH_OMAP730 depends on ARCH_OMAP1 && ARCH_OMAP730
......
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/interrupt.h>
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h> #include <linux/mtd/partitions.h>
...@@ -189,6 +191,54 @@ static struct omap_board_config_kernel osk_config[] = { ...@@ -189,6 +191,54 @@ static struct omap_board_config_kernel osk_config[] = {
{ OMAP_TAG_USB, &osk_usb_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) static void __init osk_init(void)
{ {
osk_flash_resource.end = osk_flash_resource.start = omap_cs3_phys(); osk_flash_resource.end = osk_flash_resource.start = omap_cs3_phys();
...@@ -197,6 +247,8 @@ static void __init osk_init(void) ...@@ -197,6 +247,8 @@ static void __init osk_init(void)
omap_board_config = osk_config; omap_board_config = osk_config;
omap_board_config_size = ARRAY_SIZE(osk_config); omap_board_config_size = ARRAY_SIZE(osk_config);
USB_TRANSCEIVER_CTRL_REG |= (3 << 1); USB_TRANSCEIVER_CTRL_REG |= (3 << 1);
osk_mistral_init();
} }
static void __init osk_map_io(void) static void __init osk_map_io(void)
......
...@@ -64,7 +64,7 @@ static void tps_work(void *unused) ...@@ -64,7 +64,7 @@ static void tps_work(void *unused)
static DECLARE_WORK(work, tps_work, NULL); 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 /* For now, all system indicators require the Mistral board, since that
* LED can be manipulated without a task context. This LED is either red, * 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) ...@@ -127,7 +127,7 @@ void osk_leds_event(led_event_t evt)
hw_led_state = 0; hw_led_state = 0;
break; break;
#ifdef CONFIG_FB_OMAP #ifdef CONFIG_OMAP_OSK_MISTRAL
case led_timer: case led_timer:
hw_led_state ^= TIMER_LED; hw_led_state ^= TIMER_LED;
...@@ -144,7 +144,7 @@ void osk_leds_event(led_event_t evt) ...@@ -144,7 +144,7 @@ void osk_leds_event(led_event_t evt)
mistral_setled(); mistral_setled();
break; break;
#endif /* CONFIG_FB_OMAP */ #endif /* CONFIG_OMAP_OSK_MISTRAL */
/* "green" == tps LED1 (leftmost, normally power-good) /* "green" == tps LED1 (leftmost, normally power-good)
* works only with DC adapter, not on battery power! * works only with DC adapter, not on battery power!
......
...@@ -34,7 +34,10 @@ omap_leds_init(void) ...@@ -34,7 +34,10 @@ omap_leds_init(void)
if (machine_is_omap_h2() if (machine_is_omap_h2()
|| machine_is_omap_h3() || machine_is_omap_h3()
|| machine_is_omap_perseus2() || 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 /* LED1/LED2 pins can be used as GPIO (as done here), or by
* the LPG (works even in deep sleep!), to drive a bicolor * the LPG (works even in deep sleep!), to drive a bicolor
......
...@@ -83,6 +83,7 @@ static int osk_ts_penup(void) ...@@ -83,6 +83,7 @@ static int osk_ts_penup(void)
static int __init osk_ts_probe(struct omap_ts_t *ts) static int __init osk_ts_probe(struct omap_ts_t *ts)
{ {
#ifdef CONFIG_OMAP_OSK_MISTRAL
if (!machine_is_omap_osk()) if (!machine_is_omap_osk())
return -ENODEV; return -ENODEV;
...@@ -100,7 +101,15 @@ static int __init osk_ts_probe(struct omap_ts_t *ts) ...@@ -100,7 +101,15 @@ static int __init osk_ts_probe(struct omap_ts_t *ts)
UWIRE_CS_ACTIVE_LOW | UWIRE_CS_ACTIVE_LOW |
UWIRE_FREQ_DIV_2); 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; return 0;
#else
return -ENODEV;
#endif
} }
static void osk_ts_read(u16 *data) static void osk_ts_read(u16 *data)
......
...@@ -200,11 +200,18 @@ static int __init omap_uwire_init(void) ...@@ -200,11 +200,18 @@ static int __init omap_uwire_init(void)
uwire_idx_shift = 2; uwire_idx_shift = 2;
uwire_write_reg(UWIRE_SR3, 1); 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 */ /* defaults: W21 SDO, U18 SDI, V19 SCL */
omap_cfg_reg(N14_1610_UWIRE_CS0); omap_cfg_reg(N14_1610_UWIRE_CS0);
omap_cfg_reg(N15_1610_UWIRE_CS1); 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()) { if (machine_is_omap_perseus2()) {
/* configure pins: MPU_UW_nSCS1, MPU_UW_SDO, MPU_UW_SCLK */ /* configure pins: MPU_UW_nSCS1, MPU_UW_SDO, MPU_UW_SCLK */
int val = omap_readl(OMAP730_IO_CONF_9) & ~0x00EEE000; int val = omap_readl(OMAP730_IO_CONF_9) & ~0x00EEE000;
......
...@@ -185,6 +185,7 @@ typedef enum { ...@@ -185,6 +185,7 @@ typedef enum {
/* MPUIO */ /* MPUIO */
MPUIO2, MPUIO2,
N15_1610_MPUIO2,
MPUIO4, MPUIO4,
MPUIO5, MPUIO5,
T20_1610_MPUIO5, T20_1610_MPUIO5,
...@@ -252,7 +253,7 @@ typedef enum { ...@@ -252,7 +253,7 @@ typedef enum {
U18_1610_UWIRE_SDI, U18_1610_UWIRE_SDI,
W21_1610_UWIRE_SDO, W21_1610_UWIRE_SDO,
N14_1610_UWIRE_CS0, N14_1610_UWIRE_CS0,
P15_1610_UWIRE_CS0, P15_1610_UWIRE_CS3,
N15_1610_UWIRE_CS1, N15_1610_UWIRE_CS1,
/* OMAP-1610 Flash */ /* OMAP-1610 Flash */
...@@ -413,7 +414,8 @@ MUX_CFG("N21_1710_GPIO14", 6, 9, 0, 1, 1, 1, 1, 1, 1) ...@@ -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) MUX_CFG("W15_1710_GPIO40", 9, 27, 7, 2, 5, 1, 2, 1, 1)
/* MPUIO */ /* 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("MPUIO4", 7, 15, 0, 1, 13, 1, NA, 0, 1)
MUX_CFG("MPUIO5", 7, 12, 0, 1, 12, 1, NA, 0, 1) MUX_CFG("MPUIO5", 7, 12, 0, 1, 12, 1, NA, 0, 1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment