2 * Ubiquiti RouterStation support
4 * Copyright (C) 2008 Gabor Juhos <juhosg@openwrt.org>
5 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
6 * Copyright (C) 2008 Ubiquiti <support@ubnt.com>
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 2 as published
10 * by the Free Software Foundation.
13 #include <linux/platform_device.h>
14 #include <linux/spi/spi.h>
15 #include <linux/spi/flash.h>
16 #include <linux/input.h>
18 #include <asm/mips_machine.h>
19 #include <asm/mach-ar71xx/ar71xx.h>
20 #include <asm/mach-ar71xx/pci.h>
21 #include <asm/mach-ar71xx/platform.h>
23 #define UBNT_RS_GPIO_LED_RF 2
24 #define UBNT_RS_GPIO_SW4 8
26 #define UBNT_BUTTONS_POLL_INTERVAL 20
28 static struct spi_board_info ubnt_spi_info
[] = {
32 .max_speed_hz
= 25000000,
37 static struct ar71xx_pci_irq ubnt_pci_irqs
[] __initdata
= {
41 .irq
= AR71XX_PCI_IRQ_DEV0
,
45 .irq
= AR71XX_PCI_IRQ_DEV1
,
49 .irq
= AR71XX_PCI_IRQ_DEV2
,
53 static struct gpio_led ubnt_rs_leds_gpio
[] __initdata
= {
55 .name
= "ubnt:green:rf",
56 .gpio
= UBNT_RS_GPIO_LED_RF
,
61 static struct gpio_button ubnt_rs_gpio_buttons
[] __initdata
= {
67 .gpio
= UBNT_RS_GPIO_SW4
,
72 #define UBNT_RS_WAN_PHYMASK (1 << 20)
73 #define UBNT_RS_LAN_PHYMASK ((1 << 16) | (1 << 17) | (1 << 18) | (1 << 19))
75 static void __init
ubnt_rs_setup(void)
77 ar71xx_add_device_spi(NULL
, ubnt_spi_info
,
78 ARRAY_SIZE(ubnt_spi_info
));
80 ar71xx_add_device_mdio(~(UBNT_RS_WAN_PHYMASK
| UBNT_RS_LAN_PHYMASK
));
82 ar71xx_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_MII
;
83 ar71xx_eth0_data
.phy_mask
= UBNT_RS_WAN_PHYMASK
;
85 ar71xx_eth1_data
.phy_if_mode
= PHY_INTERFACE_MODE_RMII
;
86 ar71xx_eth1_data
.phy_mask
= UBNT_RS_LAN_PHYMASK
;
88 ar71xx_eth1_data
.speed
= SPEED_100
;
89 ar71xx_eth1_data
.duplex
= DUPLEX_FULL
;
91 ar71xx_add_device_eth(0);
92 ar71xx_add_device_eth(1);
94 ar71xx_add_device_usb();
96 ar71xx_pci_init(ARRAY_SIZE(ubnt_pci_irqs
), ubnt_pci_irqs
);
98 ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(ubnt_rs_leds_gpio
),
101 ar71xx_add_device_gpio_buttons(-1, UBNT_BUTTONS_POLL_INTERVAL
,
102 ARRAY_SIZE(ubnt_rs_gpio_buttons
),
103 ubnt_rs_gpio_buttons
);
106 MIPS_MACHINE(AR71XX_MACH_UBNT_RS
, "Ubiquiti RouterStation", ubnt_rs_setup
);
108 static void __init
ubnt_lsx_setup(void)
110 ar71xx_add_device_spi(NULL
, ubnt_spi_info
,
111 ARRAY_SIZE(ubnt_spi_info
));
115 MIPS_MACHINE(AR71XX_MACH_UBNT_LSX
, "Ubiquiti LSX", ubnt_lsx_setup
);
117 #define UBNT_LSSR71_PHY_MASK (1 << 1)
119 static void __init
ubnt_lssr71_setup(void)
121 ar71xx_add_device_spi(NULL
, ubnt_spi_info
,
122 ARRAY_SIZE(ubnt_spi_info
));
124 ar71xx_add_device_mdio(~UBNT_LSSR71_PHY_MASK
);
126 ar71xx_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_MII
;
127 ar71xx_eth0_data
.phy_mask
= UBNT_LSSR71_PHY_MASK
;
129 ar71xx_add_device_eth(0);
131 ar71xx_pci_init(ARRAY_SIZE(ubnt_pci_irqs
), ubnt_pci_irqs
);
134 MIPS_MACHINE(AR71XX_MACH_UBNT_LSSR71
, "Ubiquiti LS-SR71", ubnt_lssr71_setup
);