lantiq:
[openwrt/svn-archive/archive.git] / target / linux / lantiq / files-3.1 / arch / mips / lantiq / xway / mach-arv45xx.c
index 249cc9b706321f2eadba0ca17bc81e672660dc6b..78d8b5b77e1d2a9d14ac7ab53125c6f8f78c4731 100644 (file)
@@ -26,6 +26,7 @@
 
 #include "../machtypes.h"
 #include "dev-wifi-rt2x00.h"
+#include "dev-wifi-ath5k.h"
 #include "devices.h"
 #include "dev-dwc_otg.h"
 
@@ -177,11 +178,32 @@ arv4518pw_gpio_leds[] __initdata = {
        { .name = "soc:green:fxo", .gpio = 103, .active_low = 1, .default_trigger = "default-on" },
 };
 
-static struct gpio_button
-arv4518pw_gpio_buttons[] __initdata = {
-       { .desc = "wifi", .type = EV_KEY, .code = BTN_0, .threshold = 3, .gpio = 28, .active_low = 1, },
-       { .desc = "wps", .type = EV_KEY, .code = BTN_1, .threshold = 3, .gpio = 29, .active_low = 1, },
-       { .desc = "reset", .type = EV_KEY, .code = BTN_2, .threshold = 3, .gpio = 30, .active_low = 1, },
+static struct gpio_keys_button
+arv4518pw_gpio_keys[] __initdata = {
+       {
+               .desc           = "wifi",
+               .type           = EV_KEY,
+               .code           = BTN_0,
+               .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
+               .gpio           = 28,
+               .active_low     = 1,
+       },
+       {
+               .desc           = "reset",
+               .type           = EV_KEY,
+               .code           = BTN_1,
+               .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
+               .gpio           = 30,
+               .active_low     = 1,
+       },
+       {
+               .desc           = "wps",
+               .type           = EV_KEY,
+               .code           = BTN_2,
+               .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
+               .gpio           = 29,
+               .active_low     = 1,
+       },
 };
 
 static struct gpio_led
@@ -248,11 +270,32 @@ arv752dpw22_gpio_leds[] __initdata = {
        { .name = "soc:green:eth4", .gpio = 114, .active_low = 1, .default_trigger = "default-on", },
 };
 
-static struct gpio_button
-arv752dpw22_gpio_buttons[] __initdata = {
-       { .desc = "btn0", .type = EV_KEY, .code = BTN_0, .threshold = 3, .gpio = 12, .active_low = 1, },
-       { .desc = "btn1", .type = EV_KEY, .code = BTN_1, .threshold = 3, .gpio = 13, .active_low = 1, },
-       { .desc = "btn2", .type = EV_KEY, .code = BTN_2, .threshold = 3, .gpio = 28, .active_low = 1, },
+static struct gpio_keys_button
+arv752dpw22_gpio_keys[] __initdata = {
+       {
+               .desc           = "btn0",
+               .type           = EV_KEY,
+               .code           = BTN_0,
+               .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
+               .gpio           = 12,
+               .active_low     = 1,
+       },
+       {
+               .desc           = "btn1",
+               .type           = EV_KEY,
+               .code           = BTN_1,
+               .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
+               .gpio           = 13,
+               .active_low     = 1,
+       },
+       {
+               .desc           = "btn2",
+               .type           = EV_KEY,
+               .code           = BTN_2,
+               .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
+               .gpio           = 28,
+               .active_low     = 1,
+       },
 };
 
 static struct gpio_led
@@ -265,10 +308,36 @@ arv7518pw_gpio_leds[] __initdata = {
        { .name = "soc:green:usb", .gpio = 19, .active_low = 1, },
 };
 
-static struct gpio_button
-arv7518pw_gpio_buttons[] __initdata = {
-       { .desc = "reset", .type = EV_KEY, .code = BTN_0, .threshold = 3, .gpio = 23, .active_low = 1, },
-       { .desc = "wifi", .type = EV_KEY, .code = BTN_1, .threshold = 3, .gpio = 25, .active_low = 1, },
+static struct gpio_keys_button
+arv7518pw_gpio_keys[] __initdata = {
+       {
+               .desc           = "reset",
+               .type           = EV_KEY,
+               .code           = BTN_0,
+               .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
+               .gpio           = 23,
+               .active_low     = 1,
+       },
+       {
+               .desc           = "wifi",
+               .type           = EV_KEY,
+               .code           = BTN_1,
+               .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
+               .gpio           = 25,
+               .active_low     = 1,
+       },
+};
+
+static struct gpio_keys_button
+arv7525pw_gpio_keys[] __initdata = {
+       {
+               .desc           = "restart",
+               .type           = EV_KEY,
+               .code           = BTN_0,
+               .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
+               .gpio           = 29,
+               .active_low     = 1,
+       },
 };
 
 static void
@@ -299,26 +368,19 @@ bewan_register_ethernet(void)
 }
 
 static u16 arv45xx_ath5k_eeprom_data[ATH5K_PLAT_EEP_MAX_WORDS];
-static struct ath5k_platform_data arv45xx_ath5k_platform_data;
+static u8 arv45xx_ath5k_eeprom_mac[6];
 
-/*static int arv45xx_pci_plat_dev_init(struct pci_dev *dev)
-{
-       dev->dev.platform_data = &arv45xx_ath5k_platform_data;
-       return 0;
-}
-*/
 void __init
 arv45xx_register_ath5k(void)
 {
 #define ARV45XX_BRN_ATH                0x3f0478
        int i;
-       unsigned char eeprom_mac[6];
        static u16 eeprom_data[ATH5K_PLAT_EEP_MAX_WORDS];
        u32 *p = (u32*)arv45xx_ath5k_eeprom_data;
 
-       memcpy_fromio(eeprom_mac,
+       memcpy_fromio(arv45xx_ath5k_eeprom_mac,
                (void *)KSEG1ADDR(LTQ_FLASH_START + ARV45XX_BRN_MAC), 6);
-       eeprom_mac[5]++;
+       arv45xx_ath5k_eeprom_mac[5]++;
        memcpy_fromio(arv45xx_ath5k_eeprom_data,
                (void *)KSEG1ADDR(LTQ_FLASH_START + ARV45XX_BRN_ATH), ATH5K_PLAT_EEP_MAX_WORDS);
        // swap eeprom bytes
@@ -334,9 +396,6 @@ arv45xx_register_ath5k(void)
                        p[i] |= 0x67;
                }
        }
-       arv45xx_ath5k_platform_data.eeprom_data = arv45xx_ath5k_eeprom_data;
-       arv45xx_ath5k_platform_data.macaddr = eeprom_mac;
-       //lqpci_plat_dev_init = arv45xx_pci_plat_dev_init;
 }
 
 static void __init
@@ -381,14 +440,15 @@ arv4518pw_init(void)
 
        ltq_register_gpio_ebu(ARV4518PW_EBU);
        ltq_add_device_gpio_leds(-1, ARRAY_SIZE(arv4518pw_gpio_leds), arv4518pw_gpio_leds);
-       ltq_register_gpio_buttons(arv4518pw_gpio_buttons, ARRAY_SIZE(arv4518pw_gpio_buttons));
+       ltq_register_gpio_keys_polled(-1, LTQ_KEYS_POLL_INTERVAL,
+                               ARRAY_SIZE(arv4518pw_gpio_keys), arv4518pw_gpio_keys);
        ltq_register_nor(&arv45xx_flash_data);
        ltq_pci_data.gpio = PCI_GNT2 | PCI_REQ2;
        ltq_register_pci(&ltq_pci_data);
        ltq_register_madwifi_eep(ARV4518PW_MADWIFI_ADDR);
+       ltq_register_ath5k(arv45xx_ath5k_eeprom_data, arv45xx_ath5k_eeprom_mac);
        xway_register_dwc(ARV4518PW_USB);
        arv45xx_register_ethernet();
-       arv45xx_register_ath5k();
 
        gpio_request(ARV4518PW_SWITCH_RESET, "switch");
        gpio_direction_output(ARV4518PW_SWITCH_RESET, 1);
@@ -480,18 +540,6 @@ MIPS_MACHINE(LANTIQ_MACH_ARV4525PW,
                        "ARV4525PW - Speedport W502V",
                        arv4525pw_init);
 
-static struct gpio_keys_button
-arv7525pw_gpio_keys[] __initdata = {
-       {
-               .desc           = "restart",
-               .type           = EV_KEY,
-               .code           = BTN_0,
-               .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
-               .gpio           = 29,
-               .active_low     = 1,
-       },
-};
-
 static void __init
 arv7525pw_init(void)
 {
@@ -504,9 +552,9 @@ arv7525pw_init(void)
        ltq_pci_data.irq[14] = (INT_NUM_IM3_IRL0 + 31);
        ltq_register_pci(&ltq_pci_data);
        ltq_eth_data.mii_mode = PHY_INTERFACE_MODE_MII;
-       arv45xx_register_ethernet();
        ltq_register_rt2x00("RT2860.eeprom");
        ltq_register_tapi();
+       arv45xx_register_ethernet();
 }
 
 MIPS_MACHINE(LANTIQ_MACH_ARV7525PW,
@@ -522,7 +570,8 @@ arv7518pw_init(void)
 
        ltq_register_gpio_ebu(ARV7518PW_EBU);
        ltq_add_device_gpio_leds(-1, ARRAY_SIZE(arv7518pw_gpio_leds), arv7518pw_gpio_leds);
-       ltq_register_gpio_buttons(arv7518pw_gpio_buttons, ARRAY_SIZE(arv7518pw_gpio_buttons));
+       ltq_register_gpio_keys_polled(-1, LTQ_KEYS_POLL_INTERVAL,
+                               ARRAY_SIZE(arv7518pw_gpio_keys), arv7518pw_gpio_keys);
        ltq_register_nor(&arv75xx_flash_data);
        ltq_register_pci(&ltq_pci_data);
        ltq_register_tapi();
@@ -545,7 +594,8 @@ arv752dpw22_init(void)
 
        ltq_register_gpio_ebu(ARV752DPW22_EBU);
        ltq_add_device_gpio_leds(-1, ARRAY_SIZE(arv752dpw22_gpio_leds), arv752dpw22_gpio_leds);
-       ltq_register_gpio_buttons(arv752dpw22_gpio_buttons, ARRAY_SIZE(arv752dpw22_gpio_buttons));
+       ltq_register_gpio_keys_polled(-1, LTQ_KEYS_POLL_INTERVAL,
+                               ARRAY_SIZE(arv752dpw22_gpio_keys), arv752dpw22_gpio_keys);
        ltq_register_nor(&arv75xx_flash_data);
        ltq_pci_data.irq[15] = (INT_NUM_IM3_IRL0 + 31);
        ltq_pci_data.gpio |= PCI_EXIN1 | PCI_REQ2;