[ARM] pxa: add simple gpio debug LEDs support for zylonite
authorEric Miao <eric.miao@marvell.com>
Tue, 17 Jun 2008 11:03:54 +0000 (19:03 +0800)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Wed, 9 Jul 2008 20:38:33 +0000 (21:38 +0100)
Signed-off-by: Eric Miao <eric.miao@marvell.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mach-pxa/zylonite.c
arch/arm/mach-pxa/zylonite_pxa300.c
arch/arm/mach-pxa/zylonite_pxa320.c
include/asm-arm/arch-pxa/zylonite.h

index 13ab2985a026915934ac7c902ccc4c0791239ce1..4a4711d36e73e6580929cf93ab33875c5faa6676 100644 (file)
@@ -38,6 +38,8 @@
 struct platform_mmc_slot zylonite_mmc_slot[MAX_SLOTS];
 
 int gpio_eth_irq;
+int gpio_debug_led1;
+int gpio_debug_led2;
 
 int wm9713_irq;
 
@@ -64,6 +66,42 @@ static struct platform_device smc91x_device = {
        .resource       = smc91x_resources,
 };
 
+#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
+static struct gpio_led zylonite_debug_leds[] = {
+       [0] = {
+               .name                   = "zylonite:yellow:1",
+               .default_trigger        = "heartbeat",
+       },
+       [1] = {
+               .name                   = "zylonite:yellow:2",
+               .default_trigger        = "default-on",
+       },
+};
+
+static struct gpio_led_platform_data zylonite_debug_leds_info = {
+       .leds           = zylonite_debug_leds,
+       .num_leds       = ARRAY_SIZE(zylonite_debug_leds),
+};
+
+static struct platform_device zylonite_device_leds = {
+       .name           = "leds-gpio",
+       .id             = -1,
+       .dev            = {
+               .platform_data = &zylonite_debug_leds_info,
+       }
+};
+
+static void __init zylonite_init_leds(void)
+{
+       zylonite_debug_leds[0].gpio = gpio_debug_led1;
+       zylonite_debug_leds[1].gpio = gpio_debug_led2;
+
+       platform_device_register(&zylonite_device_leds);
+}
+#else
+static inline void zylonite_init_leds(void) {}
+#endif
+
 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
 static struct platform_pwm_backlight_data zylonite_backlight_data = {
        .pwm_id         = 3,
@@ -395,6 +433,7 @@ static void __init zylonite_init(void)
        zylonite_init_mmc();
        zylonite_init_keypad();
        zylonite_init_nand();
+       zylonite_init_leds();
 }
 
 MACHINE_START(ZYLONITE, "PXA3xx Platform Development Kit (aka Zylonite)")
index 75bf61f1f1c30a743afe7ad34ddd27b83db57a92..b28d46e081d34e0d1a326e18ed4e74c74aed1882 100644 (file)
@@ -264,4 +264,8 @@ void __init zylonite_pxa300_init(void)
                zylonite_mmc_slot[2].gpio_cd = EXT_GPIO(30);
                zylonite_mmc_slot[2].gpio_wp = EXT_GPIO(31);
        }
+
+       /* GPIOs for Debug LEDs */
+       gpio_debug_led1 = EXT_GPIO(25);
+       gpio_debug_led2 = EXT_GPIO(26);
 }
index 2b4fc34919ac3d59c54ef9b6be2fcb9d7f3c0f4d..2b7fba7a29211b0fcfa77af0db8ea26b1484ea4d 100644 (file)
@@ -116,6 +116,10 @@ static mfp_cfg_t mfp_cfg[] __initdata = {
        GPIO27_MMC2_DAT3,
        GPIO28_MMC2_CLK,
        GPIO29_MMC2_CMD,
+
+       /* Debug LEDs */
+       GPIO1_2_GPIO | MFP_LPM_DRIVE_HIGH,
+       GPIO4_2_GPIO | MFP_LPM_DRIVE_HIGH,
 };
 
 #define NUM_LCD_DETECT_PINS    7
@@ -189,6 +193,8 @@ void __init zylonite_pxa320_init(void)
 
                /* GPIO pin assignment */
                gpio_eth_irq    = mfp_to_gpio(MFP_PIN_GPIO9);
+               gpio_debug_led1 = mfp_to_gpio(MFP_PIN_GPIO1_2);
+               gpio_debug_led2 = mfp_to_gpio(MFP_PIN_GPIO4_2);
 
                /* MMC card detect & write protect for controller 0 */
                zylonite_mmc_slot[0].gpio_cd  = mfp_to_gpio(MFP_PIN_GPIO1);
index de577de8d18c9dc5994c75a77408e789cd14329d..0d35ca04731e485fa655c5dccd087c59fd58fb0d 100644 (file)
@@ -16,6 +16,8 @@ struct platform_mmc_slot {
 extern struct platform_mmc_slot zylonite_mmc_slot[];
 
 extern int gpio_eth_irq;
+extern int gpio_debug_led1;
+extern int gpio_debug_led2;
 
 extern int wm9713_irq;