X-Git-Url: http://git.openwrt.org/?a=blobdiff_plain;f=target%2Flinux%2Far71xx%2Ffiles%2Farch%2Fmips%2Far71xx%2Fmach-rb-4xx.c;h=7193849f3572ef1565cb60c07b0fdea0189187b4;hb=b63a7c8640cab901370a644fa4709fb519d8acc9;hp=7504c349a6a9ec074b836bc8baf0ed00a93d7647;hpb=f529a3742043a23da4f715c3664d5a822b1f970c;p=openwrt%2Fstaging%2Fmkresin.git diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-rb-4xx.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-rb-4xx.c index 7504c349a6..7193849f35 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-rb-4xx.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-rb-4xx.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include @@ -23,8 +23,11 @@ #include #define RB4XX_GPIO_USER_LED 4 +#define RB4XX_GPIO_RESET_SWITCH 7 -static struct gpio_led rb4xx_leds_gpio[] = { +#define RB4XX_BUTTONS_POLL_INTERVAL 20 + +static struct gpio_led rb4xx_leds_gpio[] __initdata = { { .name = "rb4xx:yellow:user", .gpio = RB4XX_GPIO_USER_LED, @@ -32,16 +35,14 @@ static struct gpio_led rb4xx_leds_gpio[] = { }, }; -static struct gpio_led_platform_data rb4xx_leds_gpio_data = { - .leds = rb4xx_leds_gpio, - .num_leds = ARRAY_SIZE(rb4xx_leds_gpio), -}; - -static struct platform_device rb4xx_leds_gpio_device = { - .name = "leds-gpio", - .id = -1, - .dev = { - .platform_data = &rb4xx_leds_gpio_data, +static struct gpio_button rb4xx_gpio_buttons[] __initdata = { + { + .desc = "reset_switch", + .type = EV_KEY, + .code = BTN_0, + .threshold = 5, + .gpio = RB4XX_GPIO_RESET_SWITCH, + .active_low = 1, } }; @@ -153,9 +154,16 @@ static void __init rb411_setup(void) { rb4xx_add_device_spi(); + ar71xx_add_device_mdio(0xfffffffe); ar71xx_add_device_eth(0, PHY_INTERFACE_MODE_MII, 0x00000001); - platform_device_register(&rb4xx_leds_gpio_device); + ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(rb4xx_leds_gpio), + rb4xx_leds_gpio); + + ar71xx_add_device_gpio_buttons(-1, RB4XX_BUTTONS_POLL_INTERVAL, + ARRAY_SIZE(rb4xx_gpio_buttons), + rb4xx_gpio_buttons); + platform_device_register(&rb4xx_nand_device); ar71xx_pci_init(ARRAY_SIZE(rb4xx_pci_irqs), rb4xx_pci_irqs); @@ -167,10 +175,17 @@ static void __init rb433_setup(void) { rb433_add_device_spi(); - ar71xx_add_device_eth(0, PHY_INTERFACE_MODE_MII, 0x00000001); - ar71xx_add_device_eth(1, PHY_INTERFACE_MODE_RMII, 0xffffffff); + ar71xx_add_device_mdio(0xffffffec); + ar71xx_add_device_eth(1, PHY_INTERFACE_MODE_RMII, 0x00000010); + ar71xx_add_device_eth(0, PHY_INTERFACE_MODE_MII, 0x00000003); + + ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(rb4xx_leds_gpio), + rb4xx_leds_gpio); + + ar71xx_add_device_gpio_buttons(-1, RB4XX_BUTTONS_POLL_INTERVAL, + ARRAY_SIZE(rb4xx_gpio_buttons), + rb4xx_gpio_buttons); - platform_device_register(&rb4xx_leds_gpio_device); platform_device_register(&rb4xx_nand_device); ar71xx_pci_init(ARRAY_SIZE(rb4xx_pci_irqs), rb4xx_pci_irqs); @@ -182,10 +197,17 @@ static void __init rb450_setup(void) { rb4xx_add_device_spi(); - ar71xx_add_device_eth(0, PHY_INTERFACE_MODE_MII, 0x00000001); - ar71xx_add_device_eth(1, PHY_INTERFACE_MODE_RMII, 0xffffffff); + ar71xx_add_device_mdio(0xffffffe0); + ar71xx_add_device_eth(1, PHY_INTERFACE_MODE_RMII, 0x00000010); + ar71xx_add_device_eth(0, PHY_INTERFACE_MODE_MII, 0x0000000f); + + ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(rb4xx_leds_gpio), + rb4xx_leds_gpio); + + ar71xx_add_device_gpio_buttons(-1, RB4XX_BUTTONS_POLL_INTERVAL, + ARRAY_SIZE(rb4xx_gpio_buttons), + rb4xx_gpio_buttons); - platform_device_register(&rb4xx_leds_gpio_device); platform_device_register(&rb4xx_nand_device); }