ar71xx: correct button type for TL-MR3020 mode slider
[openwrt/staging/yousong.git] / target / linux / ar71xx / files / arch / mips / ath79 / mach-tl-mr3020.c
index 9732d5cd567a891e15cc9ee1ccbe3c1e6ade1615..e3b4087effa913ec5ee815c913f0ba8657d630ea 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/gpio.h>
 
 #include <asm/mach-ath79/ath79.h>
+#include <asm/mach-ath79/ar71xx_regs.h>
 
 #include "dev-eth.h"
 #include "dev-gpio-buttons.h"
@@ -78,7 +79,7 @@ static struct gpio_keys_button tl_mr3020_gpio_keys[] __initdata = {
        },
        {
                .desc           = "sw1",
-               .type           = EV_KEY,
+               .type           = EV_SW,
                .code           = BTN_0,
                .debounce_interval = TL_MR3020_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = TL_MR3020_GPIO_BTN_SW1,
@@ -86,7 +87,7 @@ static struct gpio_keys_button tl_mr3020_gpio_keys[] __initdata = {
        },
        {
                .desc           = "sw2",
-               .type           = EV_KEY,
+               .type           = EV_SW,
                .code           = BTN_1,
                .debounce_interval = TL_MR3020_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = TL_MR3020_GPIO_BTN_SW2,
@@ -99,6 +100,9 @@ static void __init tl_mr3020_setup(void)
        u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
        u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
 
+       /* disable PHY_SWAP and PHY_ADDR_SWAP bits */
+       ath79_setup_ar933x_phy4_switch(false, false);
+
        ath79_register_m25p80(&tl_mr3020_flash_data);
        ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_mr3020_leds_gpio),
                                 tl_mr3020_leds_gpio);
@@ -106,8 +110,9 @@ static void __init tl_mr3020_setup(void)
                                        ARRAY_SIZE(tl_mr3020_gpio_keys),
                                        tl_mr3020_gpio_keys);
 
-       gpio_request(TL_MR3020_GPIO_USB_POWER, "USB power");
-       gpio_direction_output(TL_MR3020_GPIO_USB_POWER, 1);
+       gpio_request_one(TL_MR3020_GPIO_USB_POWER,
+                        GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
+                        "USB power");
        ath79_register_usb();
 
        ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);