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 --- a/arch/mips/bcm63xx/boards/board_common.c
23 +++ b/arch/mips/bcm63xx/boards/board_common.c
25 #include <linux/string.h>
26 #include <linux/platform_device.h>
27 #include <linux/ssb/ssb.h>
28 +#include <linux/gpio_keys.h>
29 #include <asm/addrspace.h>
30 #include <bcm63xx_board.h>
31 #include <bcm63xx_cpu.h>
36 +#define BCM963XX_KEYS_POLL_INTERVAL 20
38 static struct board_info board;
41 @@ -151,11 +154,23 @@ static struct platform_device bcm63xx_gp
42 .dev.platform_data = &bcm63xx_led_data,
45 +static struct gpio_keys_platform_data bcm63xx_gpio_keys_data = {
46 + .poll_interval = BCM963XX_KEYS_POLL_INTERVAL,
49 +static struct platform_device bcm63xx_gpio_keys_device = {
50 + .name = "gpio-keys-polled",
52 + .dev.platform_data = &bcm63xx_gpio_keys_data,
56 * third stage init callback, register all board devices.
58 int __init board_register_devices(void)
60 + int button_count = 0;
63 bcm63xx_uart_register(0);
65 @@ -217,5 +232,16 @@ int __init board_register_devices(void)
66 gpio_request_one(board.ephy_reset_gpio,
67 board.ephy_reset_gpio_flags, "ephy-reset");
69 + /* count number of BUTTONs defined by this device */
70 + while (button_count < ARRAY_SIZE(board.buttons) && board.buttons[button_count].desc)
74 + bcm63xx_gpio_keys_data.nbuttons = button_count;
75 + bcm63xx_gpio_keys_data.buttons = board.buttons;
77 + platform_device_register(&bcm63xx_gpio_keys_device);
82 --- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
83 +++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
86 #include <linux/types.h>
87 #include <linux/gpio.h>
88 +#include <linux/gpio_keys.h>
89 #include <linux/leds.h>
90 #include <bcm63xx_dev_enet.h>
91 #include <bcm63xx_dev_usb_usbd.h>
92 @@ -48,6 +49,9 @@ struct board_info {
94 struct gpio_led leds[5];
97 + struct gpio_keys_button buttons[4];
99 /* External PHY reset GPIO */
100 unsigned int ephy_reset_gpio;