From fa01321b6946c8820e1d4599a6e7aefc539ac061 Mon Sep 17 00:00:00 2001
From: cshore <cshore@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Date: Thu, 28 Jan 2010 16:54:00 +0000
Subject: brcm63xx: Fix gpio-buttons and add LED and buttons for Tecom IGW6200
 and Comtrend CT-5261

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@19361 3c298f89-4303-0410-b956-a3cf2f4a3e73
---
 .../arch/mips/bcm63xx/boards/board_bcm963xx.c      | 72 +++++++++++++++++-----
 .../include/asm-mips/mach-bcm63xx/board_bcm963xx.h |  2 +-
 2 files changed, 59 insertions(+), 15 deletions(-)

diff --git a/target/linux/brcm63xx/files/arch/mips/bcm63xx/boards/board_bcm963xx.c b/target/linux/brcm63xx/files/arch/mips/bcm63xx/boards/board_bcm963xx.c
index d2ecc8486..97374f897 100644
--- a/target/linux/brcm63xx/files/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/target/linux/brcm63xx/files/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -33,6 +33,7 @@
 #include <bcm63xx_dev_usb_udc.h>
 #include <bcm63xx_dev_spi.h>
 #include <board_bcm963xx.h>
+#include <linux/input.h>
 
 #define PFX	"board_bcm963xx: "
 
@@ -295,6 +296,16 @@ static struct board_info __initdata board_96348gw_11 = {
 			.active_low	= 1,
 		},
 	},
+	.reset_buttons = {
+		{
+			.desc		= "reset",
+			.gpio		= 32,
+			.active_low	= 1,
+			.type	        = EV_KEY,
+			.code           = BTN_0,
+			.threshold      = 3,
+		},
+	},
 };
 
 static struct board_info __initdata board_96348gw = {
@@ -331,27 +342,51 @@ static struct board_info __initdata board_96348gw = {
 			.active_low	= 1,
 		},
 		{
-			.name		= "ppp",
-			.gpio		= 3,
+			.name		= "power",
+			.gpio		= 0,
 			.active_low	= 1,
+			.default_trigger = "default-on",
 		},
 		{
-			.name		= "ppp-fail",
+			.name		= "stop",
+			.gpio		= 1,
+			.active_low	= 1,
+		},
+		{
+			.name		= "line1",
 			.gpio		= 4,
 			.active_low	= 1,
 		},
 		{
-			.name		= "power",
-			.gpio		= 0,
+			.name		= "line2",
+			.gpio		= 5,
+			.active_low	= 1,
+		},
+		{	.name		= "line3",
+			.gpio		= 6,
 			.active_low	= 1,
-			.default_trigger = "default-on",
 		},
 		{
-			.name		= "stop",
-			.gpio		= 1,
+			.name		= "tel",
+			.gpio		= 7,
+			.active_low	= 1,
+		},
+		{
+			.name		= "eth",
+			.gpio		= 35,
 			.active_low	= 1,
 		},
 	},
+	.reset_buttons = {
+		{
+			.desc		= "reset",
+			.gpio		= 36,
+			.active_low	= 1,
+			.type	        = EV_KEY,
+			.code           = BTN_0,
+			.threshold      = 3,
+		},
+	},	
 };
 
 static struct board_info __initdata board_FAST2404 = {
@@ -606,7 +641,16 @@ static struct board_info __initdata board_AGPFS0 = {
 		},
 	},
 
-	.reset_btn = 37, /* sw2 */
+	.reset_buttons = {
+		{
+			.desc		= "sw2",
+			.gpio		= 37,
+			.active_low	= 1,
+			.type	        = EV_KEY,
+			.code           = BTN_0,
+			.threshold      = 3,
+		},
+	},
 	/* sw1 is connected to gpio34*/
 };
 
@@ -869,11 +913,11 @@ static struct platform_device bcm63xx_gpio_leds = {
 	.dev.platform_data	= &bcm63xx_led_data,
 };
 
-struct gpio_buttons_platform_data bcm63xx_gpio_buttons_data = {
+static struct gpio_buttons_platform_data bcm63xx_gpio_buttons_data = {
 	.poll_interval  = 20,
 };
 
-struct platform_device bcm63xx_gpio_buttons_device = {
+static struct platform_device bcm63xx_gpio_buttons_device = {
         .name           = "gpio-buttons",
         .id             = 0,
         .dev.platform_data = &bcm63xx_gpio_buttons_data,
@@ -947,9 +991,9 @@ int __init board_register_devices(void)
 
 	platform_device_register(&bcm63xx_gpio_leds);
 
-	if (board.reset_btn) {
-		bcm63xx_gpio_buttons_data.nbuttons = 1,
-		bcm63xx_gpio_buttons_data.buttons = board.reset_btn;
+	if (board.reset_buttons) {
+		bcm63xx_gpio_buttons_data.nbuttons = ARRAY_SIZE(board.reset_buttons);
+		bcm63xx_gpio_buttons_data.buttons = board.reset_buttons;
 
 		platform_device_register(&bcm63xx_gpio_buttons_device);
 	}
diff --git a/target/linux/brcm63xx/files/include/asm-mips/mach-bcm63xx/board_bcm963xx.h b/target/linux/brcm63xx/files/include/asm-mips/mach-bcm63xx/board_bcm963xx.h
index 0482c6954..e5b916036 100644
--- a/target/linux/brcm63xx/files/include/asm-mips/mach-bcm63xx/board_bcm963xx.h
+++ b/target/linux/brcm63xx/files/include/asm-mips/mach-bcm63xx/board_bcm963xx.h
@@ -58,7 +58,7 @@ struct board_info {
 	struct gpio_led leds[8];
 
 	/* Reset button */
-	unsigned int	reset_btn;
+	struct gpio_button reset_buttons[1];
 };
 
 #endif /* ! BOARD_BCM963XX_H_ */
-- 
cgit v1.2.3