1 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
2 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
4 #include <linux/init.h>
5 #include <linux/kernel.h>
6 #include <linux/string.h>
7 +#include <linux/gpio_keys.h>
8 +#include <linux/input.h>
9 #include <asm/addrspace.h>
10 #include <bcm63xx_board.h>
11 #include <bcm63xx_cpu.h>
14 #define HCS_OFFSET_128K 0x20000
16 +#define BCM963XX_KEYS_POLL_INTERVAL 20
17 +#define BCM963XX_KEYS_DEBOUNCE_INTERVAL (BCM963XX_KEYS_POLL_INTERVAL * 3)
22 @@ -367,6 +372,16 @@ static struct board_info __initdata boar
32 + .code = KEY_RESTART,
33 + .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
38 static struct board_info __initdata board_96348gw = {
39 @@ -425,6 +440,16 @@ static struct board_info __initdata boar
49 + .code = KEY_RESTART,
50 + .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
55 static struct board_info __initdata board_FAST2404 = {
56 --- a/arch/mips/bcm63xx/boards/board_common.c
57 +++ b/arch/mips/bcm63xx/boards/board_common.c
59 #include <linux/string.h>
60 #include <linux/platform_device.h>
61 #include <linux/ssb/ssb.h>
62 +#include <linux/gpio_keys.h>
63 #include <asm/addrspace.h>
64 #include <bcm63xx_board.h>
65 #include <bcm63xx_cpu.h>
70 +#define BCM963XX_KEYS_POLL_INTERVAL 20
72 static struct board_info board;
75 @@ -151,11 +154,23 @@ static struct platform_device bcm63xx_gp
76 .dev.platform_data = &bcm63xx_led_data,
79 +static struct gpio_keys_platform_data bcm63xx_gpio_keys_data = {
80 + .poll_interval = BCM963XX_KEYS_POLL_INTERVAL,
83 +static struct platform_device bcm63xx_gpio_keys_device = {
84 + .name = "gpio-keys-polled",
86 + .dev.platform_data = &bcm63xx_gpio_keys_data,
90 * third stage init callback, register all board devices.
92 int __init board_register_devices(void)
94 + int button_count = 0;
97 bcm63xx_uart_register(0);
99 @@ -217,5 +232,16 @@ int __init board_register_devices(void)
100 gpio_request_one(board.ephy_reset_gpio,
101 board.ephy_reset_gpio_flags, "ephy-reset");
103 + /* count number of BUTTONs defined by this device */
104 + while (button_count < ARRAY_SIZE(board.buttons) && board.buttons[button_count].desc)
107 + if (button_count) {
108 + bcm63xx_gpio_keys_data.nbuttons = button_count;
109 + bcm63xx_gpio_keys_data.buttons = board.buttons;
111 + platform_device_register(&bcm63xx_gpio_keys_device);
116 --- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
117 +++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
120 #include <linux/types.h>
121 #include <linux/gpio.h>
122 +#include <linux/gpio_keys.h>
123 #include <linux/leds.h>
124 #include <bcm63xx_dev_enet.h>
125 #include <bcm63xx_dev_usb_usbd.h>
126 @@ -48,6 +49,9 @@ struct board_info {
128 struct gpio_led leds[5];
131 + struct gpio_keys_button buttons[4];
133 /* External PHY reset GPIO */
134 unsigned int ephy_reset_gpio;