[ar71xx] ap81: register GPIO buttons
[openwrt/svn-archive/archive.git] / target / linux / ar71xx / files / arch / mips / ar71xx / mach-ap81.c
index 01504a7d9b3598a0948ea295299708f35d389c04..5a48dffa4d1d7c6e0ca6c239fe99cd9367164730 100644 (file)
@@ -9,13 +9,58 @@
  *  by the Free Software Foundation.
  */
 
+#include <linux/input.h>
+
 #include <asm/mips_machine.h>
 #include <asm/mach-ar71xx/ar71xx.h>
 
 #include "devices.h"
 
+#define AP81_GPIO_BTN_SW4      12
+#define AP81_GPIO_BTN_SW1      21
+
+#define AP81_BUTTONS_POLL_INTERVAL     20
+
+static struct gpio_button ap81_gpio_buttons[] __initdata = {
+       {
+               .desc           = "sw1",
+               .type           = EV_KEY,
+               .code           = BTN_0,
+               .threshold      = 5,
+               .gpio           = AP81_GPIO_BTN_SW1,
+               .active_low     = 1,
+       } , {
+               .desc           = "sw4",
+               .type           = EV_KEY,
+               .code           = BTN_1,
+               .threshold      = 5,
+               .gpio           = AP81_GPIO_BTN_SW4,
+               .active_low     = 1,
+       }
+};
+
 static void __init ap81_setup(void)
 {
+       ar71xx_add_device_mdio(0x0);
+
+       ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
+       ar71xx_eth0_data.phy_mask = 0xf;
+       ar71xx_eth0_data.speed = SPEED_100;
+       ar71xx_eth0_data.duplex = DUPLEX_FULL;
+       ar71xx_eth0_data.has_ar8216 = 1;
+
+       ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
+       ar71xx_eth1_data.phy_mask = 0x10;
+
+       ar71xx_add_device_eth(0);
+       ar71xx_add_device_eth(1);
+
+       ar71xx_add_device_usb();
+
+       ar71xx_add_device_gpio_buttons(-1, AP81_BUTTONS_POLL_INTERVAL,
+                                       ARRAY_SIZE(ap81_gpio_buttons),
+                                       ap81_gpio_buttons);
+
        ar91xx_add_device_wmac();
 }