]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/arm/mach-at91/board-csb337.c
Merge git://git.infradead.org/~dedekind/ubi-2.6
[linux-2.6-omap-h63xx.git] / arch / arm / mach-at91 / board-csb337.c
index dde089922e3bda6afaad9efed6335d38efe7c172..26fea4dcc3a013edbd14f41c58c88b3b8b098e2d 100644 (file)
 #include <linux/mm.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
-#include <linux/i2c.h>
 #include <linux/spi/spi.h>
 #include <linux/mtd/physmap.h>
+#include <linux/input.h>
+#include <linux/gpio_keys.h>
 
 #include <asm/hardware.h>
 #include <asm/setup.h>
 #include "generic.h"
 
 
-/*
- * Serial port configuration.
- *    0 .. 3 = USART0 .. USART3
- *    4      = DBGU
- */
-static struct at91_uart_config __initdata csb337_uart_config = {
-       .console_tty    = 0,                            /* ttyS0 */
-       .nr_tty         = 2,
-       .tty_map        = { 4, 1, -1, -1, -1 }          /* ttyS0, ..., ttyS4 */
-};
-
 static void __init csb337_map_io(void)
 {
        /* Initialize processor: 3.6864 MHz crystal */
@@ -61,8 +51,11 @@ static void __init csb337_map_io(void)
        /* Setup the LEDs */
        at91_init_leds(AT91_PIN_PB0, AT91_PIN_PB1);
 
-       /* Setup the serial ports and console */
-       at91_init_serial(&csb337_uart_config);
+       /* DBGU on ttyS0 */
+       at91_register_uart(0, 0, 0);
+
+       /* make console=ttyS0 the default */
+       at91_set_serial_console(0);
 }
 
 static void __init csb337_init_irq(void)
@@ -85,12 +78,12 @@ static struct at91_udc_data __initdata csb337_udc_data = {
 };
 
 static struct i2c_board_info __initdata csb337_i2c_devices[] = {
-       { I2C_BOARD_INFO("rtc-ds1307", 0x68),
-         .type = "ds1307",
+       {
+               I2C_BOARD_INFO("rtc-ds1307", 0x68),
+               .type   = "ds1307",
        },
 };
 
-
 static struct at91_cf_data __initdata csb337_cf_data = {
        /*
         * connector P4 on the CSB 337 mates to
@@ -157,6 +150,85 @@ static struct platform_device csb_flash = {
        .num_resources  = ARRAY_SIZE(csb_flash_resources),
 };
 
+/*
+ * GPIO Buttons (on CSB300)
+ */
+#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
+static struct gpio_keys_button csb300_buttons[] = {
+       {
+               .gpio           = AT91_PIN_PB29,
+               .code           = BTN_0,
+               .desc           = "sw0",
+               .active_low     = 1,
+               .wakeup         = 1,
+       },
+       {
+               .gpio           = AT91_PIN_PB28,
+               .code           = BTN_1,
+               .desc           = "sw1",
+               .active_low     = 1,
+               .wakeup         = 1,
+       },
+       {
+               .gpio           = AT91_PIN_PA21,
+               .code           = BTN_2,
+               .desc           = "sw2",
+               .active_low     = 1,
+               .wakeup         = 1,
+       }
+};
+
+static struct gpio_keys_platform_data csb300_button_data = {
+       .buttons        = csb300_buttons,
+       .nbuttons       = ARRAY_SIZE(csb300_buttons),
+};
+
+static struct platform_device csb300_button_device = {
+       .name           = "gpio-keys",
+       .id             = -1,
+       .num_resources  = 0,
+       .dev            = {
+               .platform_data  = &csb300_button_data,
+       }
+};
+
+static void __init csb300_add_device_buttons(void)
+{
+       at91_set_gpio_input(AT91_PIN_PB29, 0);  /* sw0 */
+       at91_set_deglitch(AT91_PIN_PB29, 1);
+       at91_set_gpio_input(AT91_PIN_PB28, 0);  /* sw1 */
+       at91_set_deglitch(AT91_PIN_PB28, 1);
+       at91_set_gpio_input(AT91_PIN_PA21, 0);  /* sw2 */
+       at91_set_deglitch(AT91_PIN_PA21, 1);
+
+       platform_device_register(&csb300_button_device);
+}
+#else
+static void __init csb300_add_device_buttons(void) {}
+#endif
+
+static struct gpio_led csb_leds[] = {
+       {       /* "led0", yellow */
+               .name                   = "led0",
+               .gpio                   = AT91_PIN_PB2,
+               .active_low             = 1,
+               .default_trigger        = "heartbeat",
+       },
+       {       /* "led1", green */
+               .name                   = "led1",
+               .gpio                   = AT91_PIN_PB1,
+               .active_low             = 1,
+               .default_trigger        = "mmc0",
+       },
+       {       /* "led2", yellow */
+               .name                   = "led2",
+               .gpio                   = AT91_PIN_PB0,
+               .active_low             = 1,
+               .default_trigger        = "ide-disk",
+       },
+};
+
+
 static void __init csb337_board_init(void)
 {
        /* Serial */
@@ -168,9 +240,7 @@ static void __init csb337_board_init(void)
        /* USB Device */
        at91_add_device_udc(&csb337_udc_data);
        /* I2C */
-       at91_add_device_i2c();
-       i2c_register_board_info(0, csb337_i2c_devices,
-                       ARRAY_SIZE(csb337_i2c_devices));
+       at91_add_device_i2c(csb337_i2c_devices, ARRAY_SIZE(csb337_i2c_devices));
        /* Compact Flash */
        at91_set_gpio_input(AT91_PIN_PB22, 1);          /* IOIS16 */
        at91_add_device_cf(&csb337_cf_data);
@@ -180,6 +250,10 @@ static void __init csb337_board_init(void)
        at91_add_device_mmc(0, &csb337_mmc_data);
        /* NOR flash */
        platform_device_register(&csb_flash);
+       /* LEDs */
+       at91_gpio_leds(csb_leds, ARRAY_SIZE(csb_leds));
+       /* Switches on CSB300 */
+       csb300_add_device_buttons();
 }
 
 MACHINE_START(CSB337, "Cogent CSB337")