ar71xx: add support for the AP121/AP121-MINI reference boards
[openwrt/openwrt.git] / target / linux / ar71xx / files / arch / mips / ar71xx / mach-zcn-1523h.c
index b65e13291f5a0c3fc277bdb1a80cdd0d00c45f00..bfbb72621f91d9bb4430fd45f5dfc876b7e75dd1 100644 (file)
@@ -34,7 +34,8 @@
 #define ZCN_1523H_5_GPIO_LED_MEDIUM    15
 #define ZCN_1523H_5_GPIO_LED_STRONG    16
 
-#define ZCN_1523H_BUTTONS_POLL_INTERVAL        20
+#define ZCN_1523H_KEYS_POLL_INTERVAL   20      /* msecs */
+#define ZCN_1523H_KEYS_DEBOUNCE_INTERVAL (3 * ZCN_1523H_KEYS_POLL_INTERVAL)
 
 #ifdef CONFIG_MTD_PARTITIONS
 static struct mtd_partition zcn_1523h_partitions[] = {
@@ -43,35 +44,35 @@ static struct mtd_partition zcn_1523h_partitions[] = {
                .offset         = 0,
                .size           = 0x040000,
                .mask_flags     = MTD_WRITEABLE,
-       } , {
+       }, {
                .name           = "u-boot-env",
                .offset         = 0x040000,
                .size           = 0x010000,
                .mask_flags     = MTD_WRITEABLE,
-       } , {
+       }, {
                .name           = "rootfs",
                .offset         = 0x050000,
                .size           = 0x610000,
-       } , {
+       }, {
                .name           = "kernel",
                .offset         = 0x660000,
                .size           = 0x170000,
-       } , {
+       }, {
                .name           = "configure",
                .offset         = 0x7d0000,
                .size           = 0x010000,
                .mask_flags     = MTD_WRITEABLE,
-       } , {
+       }, {
                .name           = "mfg",
                .offset         = 0x7e0000,
                .size           = 0x010000,
                .mask_flags     = MTD_WRITEABLE,
-       } , {
+       }, {
                .name           = "eeprom",
                .offset         = 0x7f0000,
                .size           = 0x010000,
                .mask_flags     = MTD_WRITEABLE,
-       } , {
+       }, {
                .name           = "firmware",
                .offset         = 0x050000,
                .size           = 0x780000,
@@ -81,17 +82,17 @@ static struct mtd_partition zcn_1523h_partitions[] = {
 
 static struct flash_platform_data zcn_1523h_flash_data = {
 #ifdef CONFIG_MTD_PARTITIONS
-        .parts          = zcn_1523h_partitions,
-        .nr_parts       = ARRAY_SIZE(zcn_1523h_partitions),
+       .parts          = zcn_1523h_partitions,
+       .nr_parts       = ARRAY_SIZE(zcn_1523h_partitions),
 #endif
 };
 
-static struct gpio_button zcn_1523h_gpio_buttons[] __initdata = {
+static struct gpio_keys_button zcn_1523h_gpio_keys[] __initdata = {
        {
                .desc           = "reset",
                .type           = EV_KEY,
                .code           = KEY_RESTART,
-               .threshold      = 3,
+               .debounce_interval = ZCN_1523H_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = ZCN_1523H_GPIO_BTN_RESET,
                .active_low     = 1,
        }
@@ -162,11 +163,11 @@ static void __init zcn_1523h_generic_setup(void)
        ar71xx_add_device_m25p80(&zcn_1523h_flash_data);
 
        ar71xx_add_device_leds_gpio(0, ARRAY_SIZE(zcn_1523h_leds_gpio),
-                                   zcn_1523h_leds_gpio);
+                                       zcn_1523h_leds_gpio);
 
-       ar71xx_add_device_gpio_buttons(-1, ZCN_1523H_BUTTONS_POLL_INTERVAL,
-                                       ARRAY_SIZE(zcn_1523h_gpio_buttons),
-                                       zcn_1523h_gpio_buttons);
+       ar71xx_register_gpio_keys_polled(-1, ZCN_1523H_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(zcn_1523h_gpio_keys),
+                                        zcn_1523h_gpio_keys);
 
        ap91_pci_init(ee, mac);
 
@@ -192,7 +193,7 @@ static void __init zcn_1523h_2_setup(void)
        zcn_1523h_generic_setup();
 
        ar71xx_add_device_leds_gpio(1, ARRAY_SIZE(zcn_1523h_2_leds_gpio),
-                                   zcn_1523h_2_leds_gpio);
+                                       zcn_1523h_2_leds_gpio);
 }
 
 MIPS_MACHINE(AR71XX_MACH_ZCN_1523H_2, "ZCN-1523H-2", "Zcomax ZCN-1523H-2",
@@ -203,7 +204,7 @@ static void __init zcn_1523h_5_setup(void)
        zcn_1523h_generic_setup();
 
        ar71xx_add_device_leds_gpio(1, ARRAY_SIZE(zcn_1523h_5_leds_gpio),
-                                   zcn_1523h_5_leds_gpio);
+                                       zcn_1523h_5_leds_gpio);
        ar71xx_add_device_eth(1);
 }