diff options
author | juhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2009-03-14 12:24:11 +0000 |
---|---|---|
committer | juhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2009-03-14 12:24:11 +0000 |
commit | ea9ae3e500f29361398e5adada0552a45ea1f96b (patch) | |
tree | 2f45608cece35ca529750bc415d4e60fdecc8d50 /target/linux/ar71xx/files/arch | |
parent | 0d46c9374dc814790790b0954b75db852a397037 (diff) |
[ar71xx] simplify setup code for Ubiquiti boards
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@14872 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ar71xx/files/arch')
-rw-r--r-- | target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c index f05d8cbdd7..c6ca6fdf33 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c @@ -59,7 +59,7 @@ static struct gpio_led ubnt_rs_leds_gpio[] __initdata = { } }; -static struct gpio_button ubnt_rs_gpio_buttons[] __initdata = { +static struct gpio_button ubnt_gpio_buttons[] __initdata = { { .desc = "sw4", .type = EV_KEY, @@ -70,13 +70,24 @@ static struct gpio_button ubnt_rs_gpio_buttons[] __initdata = { } }; +static void __init ubnt_generic_setup(void) +{ + ar71xx_add_device_spi(NULL, ubnt_spi_info, + ARRAY_SIZE(ubnt_spi_info)); + + ar71xx_add_device_gpio_buttons(-1, UBNT_BUTTONS_POLL_INTERVAL, + ARRAY_SIZE(ubnt_gpio_buttons), + ubnt_gpio_buttons); + + ar71xx_pci_init(ARRAY_SIZE(ubnt_pci_irqs), ubnt_pci_irqs); +} + #define UBNT_RS_WAN_PHYMASK (1 << 20) #define UBNT_RS_LAN_PHYMASK ((1 << 16) | (1 << 17) | (1 << 18) | (1 << 19)) static void __init ubnt_rs_setup(void) { - ar71xx_add_device_spi(NULL, ubnt_spi_info, - ARRAY_SIZE(ubnt_spi_info)); + ubnt_generic_setup(); ar71xx_add_device_mdio(~(UBNT_RS_WAN_PHYMASK | UBNT_RS_LAN_PHYMASK)); @@ -94,26 +105,18 @@ static void __init ubnt_rs_setup(void) ar71xx_add_device_usb(); - ar71xx_pci_init(ARRAY_SIZE(ubnt_pci_irqs), ubnt_pci_irqs); - ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(ubnt_rs_leds_gpio), ubnt_rs_leds_gpio); - ar71xx_add_device_gpio_buttons(-1, UBNT_BUTTONS_POLL_INTERVAL, - ARRAY_SIZE(ubnt_rs_gpio_buttons), - ubnt_rs_gpio_buttons); } MIPS_MACHINE(AR71XX_MACH_UBNT_RS, "Ubiquiti RouterStation", ubnt_rs_setup); static void __init ubnt_rspro_setup(void) { - ar71xx_add_device_spi(NULL, ubnt_spi_info, - ARRAY_SIZE(ubnt_spi_info)); + ubnt_generic_setup(); ar71xx_add_device_usb(); - - ar71xx_pci_init(ARRAY_SIZE(ubnt_pci_irqs), ubnt_pci_irqs); } MIPS_MACHINE(AR71XX_MACH_UBNT_RSPRO, "Ubiquiti RouterStation Pro", @@ -121,9 +124,7 @@ MIPS_MACHINE(AR71XX_MACH_UBNT_RSPRO, "Ubiquiti RouterStation Pro", static void __init ubnt_lsx_setup(void) { - ar71xx_add_device_spi(NULL, ubnt_spi_info, - ARRAY_SIZE(ubnt_spi_info)); - + ubnt_generic_setup(); } MIPS_MACHINE(AR71XX_MACH_UBNT_LSX, "Ubiquiti LSX", ubnt_lsx_setup); @@ -132,8 +133,7 @@ MIPS_MACHINE(AR71XX_MACH_UBNT_LSX, "Ubiquiti LSX", ubnt_lsx_setup); static void __init ubnt_lssr71_setup(void) { - ar71xx_add_device_spi(NULL, ubnt_spi_info, - ARRAY_SIZE(ubnt_spi_info)); + ubnt_generic_setup(); ar71xx_add_device_mdio(~UBNT_LSSR71_PHY_MASK); @@ -141,8 +141,6 @@ static void __init ubnt_lssr71_setup(void) ar71xx_eth0_data.phy_mask = UBNT_LSSR71_PHY_MASK; ar71xx_add_device_eth(0); - - ar71xx_pci_init(ARRAY_SIZE(ubnt_pci_irqs), ubnt_pci_irqs); } MIPS_MACHINE(AR71XX_MACH_UBNT_LSSR71, "Ubiquiti LS-SR71", ubnt_lssr71_setup); |