]> Pileus Git - ~andy/linux/blobdiff - arch/arm/mach-omap1/board-h2.c
ARM: OMAP1: use BUG_ON where possible
[~andy/linux] / arch / arm / mach-omap1 / board-h2.c
index 44a4ab195fbc54ec0537d24328fed150216d8e3b..9d533ee7aee0d10c5ce236c0d7922c109f031834 100644 (file)
 #include <linux/i2c/tps65010.h>
 #include <linux/smc91x.h>
 #include <linux/omapfb.h>
+#include <linux/platform_data/gpio-omap.h>
+#include <linux/leds.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <plat/mux.h>
+#include <mach/mux.h>
 #include <plat/dma.h>
 #include <plat/tc.h>
-#include <plat/irda.h>
-#include <plat/keypad.h>
-#include <plat/flash.h>
+#include <mach/irda.h>
+#include <linux/platform_data/keypad-omap.h>
+#include <mach/flash.h>
 
 #include <mach/hardware.h>
 #include <mach/usb.h>
@@ -306,12 +308,39 @@ static struct platform_device h2_irda_device = {
        .resource       = h2_irda_resources,
 };
 
+static struct gpio_led h2_gpio_led_pins[] = {
+       {
+               .name           = "h2:red",
+               .default_trigger = "heartbeat",
+               .gpio           = 3,
+       },
+       {
+               .name           = "h2:green",
+               .default_trigger = "cpu0",
+               .gpio           = OMAP_MPUIO(4),
+       },
+};
+
+static struct gpio_led_platform_data h2_gpio_led_data = {
+       .leds           = h2_gpio_led_pins,
+       .num_leds       = ARRAY_SIZE(h2_gpio_led_pins),
+};
+
+static struct platform_device h2_gpio_leds = {
+       .name   = "leds-gpio",
+       .id     = -1,
+       .dev    = {
+               .platform_data = &h2_gpio_led_data,
+       },
+};
+
 static struct platform_device *h2_devices[] __initdata = {
        &h2_nor_device,
        &h2_nand_device,
        &h2_smc91x_device,
        &h2_irda_device,
        &h2_kp_device,
+       &h2_gpio_leds,
 };
 
 static void __init h2_init_smc91x(void)
@@ -382,8 +411,7 @@ static void __init h2_init(void)
 
        h2_nand_resource.end = h2_nand_resource.start = OMAP_CS2B_PHYS;
        h2_nand_resource.end += SZ_4K - 1;
-       if (gpio_request(H2_NAND_RB_GPIO_PIN, "NAND ready") < 0)
-               BUG();
+       BUG_ON(gpio_request(H2_NAND_RB_GPIO_PIN, "NAND ready") < 0);
        gpio_direction_input(H2_NAND_RB_GPIO_PIN);
 
        omap_cfg_reg(L3_1610_FLASH_CS2B_OE);
@@ -406,6 +434,10 @@ static void __init h2_init(void)
        omap_cfg_reg(E19_1610_KBR4);
        omap_cfg_reg(N19_1610_KBR5);
 
+       /* GPIO based LEDs */
+       omap_cfg_reg(P18_1610_GPIO3);
+       omap_cfg_reg(MPUIO4);
+
        h2_smc91x_resources[1].start = gpio_to_irq(0);
        h2_smc91x_resources[1].end = gpio_to_irq(0);
        platform_add_devices(h2_devices, ARRAY_SIZE(h2_devices));