brcm47xx: update flash drivers
[openwrt.git] / target / linux / brcm63xx / patches-3.3 / 100-reset_buttons.patch
1 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
2 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
3 @@ -15,6 +15,8 @@
4  #include <linux/mtd/partitions.h>
5  #include <linux/mtd/physmap.h>
6  #include <linux/ssb/ssb.h>
7 +#include <linux/gpio_buttons.h>
8 +#include <linux/input.h>
9  #include <asm/addrspace.h>
10  #include <bcm63xx_board.h>
11  #include <bcm63xx_cpu.h>
12 @@ -296,6 +298,16 @@ static struct board_info __initdata boar
13                         .active_low     = 1,
14                 },
15         },
16 +       .buttons = {
17 +               {
18 +                       .desc           = "reset",
19 +                       .gpio           = 33,
20 +                       .active_low     = 1,
21 +                       .type           = EV_KEY,
22 +                       .code           = KEY_RESTART,
23 +                       .threshold      = 3,
24 +               },
25 +       },
26  };
27  
28  static struct board_info __initdata board_96348gw = {
29 @@ -354,6 +366,16 @@ static struct board_info __initdata boar
30                         .active_low     = 1,
31                 },
32         },
33 +       .buttons = {
34 +               {
35 +                       .desc           = "reset",
36 +                       .gpio           = 36,
37 +                       .active_low     = 1,
38 +                       .type           = EV_KEY,
39 +                       .code           = KEY_RESTART,
40 +                       .threshold      = 3,
41 +               },
42 +       },
43  };
44  
45  static struct board_info __initdata board_FAST2404 = {
46 @@ -852,12 +874,23 @@ static struct platform_device bcm63xx_gp
47         .dev.platform_data      = &bcm63xx_led_data,
48  };
49  
50 +static struct gpio_buttons_platform_data bcm63xx_gpio_buttons_data = {
51 +       .poll_interval  = 20,
52 +};
53 +
54 +static struct platform_device bcm63xx_gpio_buttons_device = {
55 +       .name           = "gpio-buttons",
56 +       .id             = 0,
57 +       .dev.platform_data = &bcm63xx_gpio_buttons_data,
58 +};
59 +
60  /*
61   * third stage init callback, register all board devices.
62   */
63  int __init board_register_devices(void)
64  {
65         u32 val;
66 +       int button_count = 0;
67  
68         if (board.has_uart0)
69                 bcm63xx_uart_register(0);
70 @@ -912,5 +945,16 @@ int __init board_register_devices(void)
71  
72         platform_device_register(&bcm63xx_gpio_leds);
73  
74 +       /* count number of BUTTONs defined by this device */
75 +       while (button_count < ARRAY_SIZE(board.buttons) && board.buttons[button_count].desc)
76 +               button_count++;
77 +
78 +       if (button_count) {
79 +               bcm63xx_gpio_buttons_data.nbuttons = button_count;
80 +               bcm63xx_gpio_buttons_data.buttons = board.buttons;
81 +
82 +               platform_device_register(&bcm63xx_gpio_buttons_device);
83 +       }
84 +
85         return 0;
86  }
87 --- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
88 +++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
89 @@ -3,6 +3,7 @@
90  
91  #include <linux/types.h>
92  #include <linux/gpio.h>
93 +#include <linux/gpio_buttons.h>
94  #include <linux/leds.h>
95  #include <bcm63xx_dev_enet.h>
96  #include <bcm63xx_dev_dsp.h>
97 @@ -57,6 +58,9 @@ struct board_info {
98  
99         /* GPIO LEDs */
100         struct gpio_led leds[5];
101 +
102 +       /* Buttons */
103 +       struct gpio_button buttons[4];
104  };
105  
106  #endif /* ! BOARD_BCM963XX_H_ */