Browse Source

[ARM] pxa: add simple gpio debug LEDs support for zylonite

Signed-off-by: Eric Miao <eric.miao@marvell.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Eric Miao 17 years ago
parent
commit
5c9f50e90e

+ 39 - 0
arch/arm/mach-pxa/zylonite.c

@@ -38,6 +38,8 @@
 struct platform_mmc_slot zylonite_mmc_slot[MAX_SLOTS];
 struct platform_mmc_slot zylonite_mmc_slot[MAX_SLOTS];
 
 
 int gpio_eth_irq;
 int gpio_eth_irq;
+int gpio_debug_led1;
+int gpio_debug_led2;
 
 
 int wm9713_irq;
 int wm9713_irq;
 
 
@@ -64,6 +66,42 @@ static struct platform_device smc91x_device = {
 	.resource	= smc91x_resources,
 	.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)
 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
 static struct platform_pwm_backlight_data zylonite_backlight_data = {
 static struct platform_pwm_backlight_data zylonite_backlight_data = {
 	.pwm_id		= 3,
 	.pwm_id		= 3,
@@ -395,6 +433,7 @@ static void __init zylonite_init(void)
 	zylonite_init_mmc();
 	zylonite_init_mmc();
 	zylonite_init_keypad();
 	zylonite_init_keypad();
 	zylonite_init_nand();
 	zylonite_init_nand();
+	zylonite_init_leds();
 }
 }
 
 
 MACHINE_START(ZYLONITE, "PXA3xx Platform Development Kit (aka Zylonite)")
 MACHINE_START(ZYLONITE, "PXA3xx Platform Development Kit (aka Zylonite)")

+ 4 - 0
arch/arm/mach-pxa/zylonite_pxa300.c

@@ -264,4 +264,8 @@ void __init zylonite_pxa300_init(void)
 		zylonite_mmc_slot[2].gpio_cd = EXT_GPIO(30);
 		zylonite_mmc_slot[2].gpio_cd = EXT_GPIO(30);
 		zylonite_mmc_slot[2].gpio_wp = EXT_GPIO(31);
 		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);
 }
 }

+ 6 - 0
arch/arm/mach-pxa/zylonite_pxa320.c

@@ -116,6 +116,10 @@ static mfp_cfg_t mfp_cfg[] __initdata = {
 	GPIO27_MMC2_DAT3,
 	GPIO27_MMC2_DAT3,
 	GPIO28_MMC2_CLK,
 	GPIO28_MMC2_CLK,
 	GPIO29_MMC2_CMD,
 	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
 #define NUM_LCD_DETECT_PINS	7
@@ -189,6 +193,8 @@ void __init zylonite_pxa320_init(void)
 
 
 		/* GPIO pin assignment */
 		/* GPIO pin assignment */
 		gpio_eth_irq	= mfp_to_gpio(MFP_PIN_GPIO9);
 		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 */
 		/* MMC card detect & write protect for controller 0 */
 		zylonite_mmc_slot[0].gpio_cd  = mfp_to_gpio(MFP_PIN_GPIO1);
 		zylonite_mmc_slot[0].gpio_cd  = mfp_to_gpio(MFP_PIN_GPIO1);

+ 2 - 0
include/asm-arm/arch-pxa/zylonite.h

@@ -16,6 +16,8 @@ struct platform_mmc_slot {
 extern struct platform_mmc_slot zylonite_mmc_slot[];
 extern struct platform_mmc_slot zylonite_mmc_slot[];
 
 
 extern int gpio_eth_irq;
 extern int gpio_eth_irq;
+extern int gpio_debug_led1;
+extern int gpio_debug_led2;
 
 
 extern int wm9713_irq;
 extern int wm9713_irq;