2 * Ubiquiti Networks XM (rev 1.0) board support
4 * Copyright (C) 2011 René Bolldorf <xsecute@googlemail.com>
6 * Derived from: mach-pb44.c
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/init.h>
14 #include <linux/pci.h>
15 #include <linux/platform_device.h>
16 #include <linux/ath9k_platform.h>
17 #include <linux/etherdevice.h>
18 #include <linux/ar8216_platform.h>
20 #include <asm/mach-ath79/ath79.h>
21 #include <asm/mach-ath79/irq.h>
22 #include <asm/mach-ath79/ar71xx_regs.h>
24 #include <linux/platform_data/phy-at803x.h>
27 #include "dev-ap9x-pci.h"
29 #include "dev-gpio-buttons.h"
30 #include "dev-leds-gpio.h"
31 #include "dev-m25p80.h"
34 #include "machtypes.h"
36 #define UBNT_XM_GPIO_LED_L1 0
37 #define UBNT_XM_GPIO_LED_L2 1
38 #define UBNT_XM_GPIO_LED_L3 11
39 #define UBNT_XM_GPIO_LED_L4 7
41 #define UBNT_XM_GPIO_BTN_RESET 12
43 #define UBNT_XM_KEYS_POLL_INTERVAL 20
44 #define UBNT_XM_KEYS_DEBOUNCE_INTERVAL (3 * UBNT_XM_KEYS_POLL_INTERVAL)
46 #define UBNT_XM_EEPROM_ADDR 0x1fff1000
48 static struct gpio_led ubnt_xm_leds_gpio
[] __initdata
= {
50 .name
= "ubnt:red:link1",
51 .gpio
= UBNT_XM_GPIO_LED_L1
,
54 .name
= "ubnt:orange:link2",
55 .gpio
= UBNT_XM_GPIO_LED_L2
,
58 .name
= "ubnt:green:link3",
59 .gpio
= UBNT_XM_GPIO_LED_L3
,
62 .name
= "ubnt:green:link4",
63 .gpio
= UBNT_XM_GPIO_LED_L4
,
68 static struct gpio_keys_button ubnt_xm_gpio_keys
[] __initdata
= {
73 .debounce_interval
= UBNT_XM_KEYS_DEBOUNCE_INTERVAL
,
74 .gpio
= UBNT_XM_GPIO_BTN_RESET
,
79 #define UBNT_M_WAN_PHYMASK BIT(4)
81 static void __init
ubnt_xm_init(void)
83 u8
*eeprom
= (u8
*) KSEG1ADDR(UBNT_XM_EEPROM_ADDR
);
84 u8
*mac1
= (u8
*) KSEG1ADDR(0x1fff0000);
85 u8
*mac2
= (u8
*) KSEG1ADDR(0x1fff0000 + ETH_ALEN
);
87 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_xm_leds_gpio
),
90 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL
,
91 ARRAY_SIZE(ubnt_xm_gpio_keys
),
94 ath79_register_m25p80(NULL
);
95 ap91_pci_init(eeprom
, NULL
);
97 ath79_register_mdio(0, ~UBNT_M_WAN_PHYMASK
);
98 ath79_init_mac(ath79_eth0_data
.mac_addr
, mac1
, 0);
99 ath79_init_mac(ath79_eth1_data
.mac_addr
, mac2
, 0);
100 ath79_register_eth(0);
103 MIPS_MACHINE(ATH79_MACH_UBNT_XM
,
105 "Ubiquiti Networks XM (rev 1.0) board",
108 MIPS_MACHINE(ATH79_MACH_UBNT_BULLET_M
, "UBNT-BM", "Ubiquiti Bullet M",
111 static void __init
ubnt_rocket_m_setup(void)
114 ath79_register_usb();
117 MIPS_MACHINE(ATH79_MACH_UBNT_ROCKET_M
, "UBNT-RM", "Ubiquiti Rocket M",
118 ubnt_rocket_m_setup
);
120 static void __init
ubnt_nano_m_setup(void)
123 ath79_register_eth(1);
126 MIPS_MACHINE(ATH79_MACH_UBNT_NANO_M
, "UBNT-NM", "Ubiquiti Nanostation M",
129 static struct gpio_led ubnt_airrouter_leds_gpio
[] __initdata
= {
131 .name
= "ubnt:green:globe",
135 .name
= "ubnt:green:power",
138 .default_state
= LEDS_GPIO_DEFSTATE_ON
,
142 static void __init
ubnt_airrouter_setup(void)
144 u8
*mac1
= (u8
*) KSEG1ADDR(0x1fff0000);
145 u8
*ee
= (u8
*) KSEG1ADDR(0x1fff1000);
147 ath79_register_m25p80(NULL
);
148 ath79_register_mdio(0, ~UBNT_M_WAN_PHYMASK
);
150 ath79_init_mac(ath79_eth0_data
.mac_addr
, mac1
, 0);
151 ath79_init_local_mac(ath79_eth1_data
.mac_addr
, mac1
);
153 ath79_register_eth(1);
154 ath79_register_eth(0);
155 ath79_register_usb();
157 ap91_pci_init(ee
, NULL
);
158 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_airrouter_leds_gpio
),
159 ubnt_airrouter_leds_gpio
);
161 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL
,
162 ARRAY_SIZE(ubnt_xm_gpio_keys
),
166 MIPS_MACHINE(ATH79_MACH_UBNT_AIRROUTER
, "UBNT-AR", "Ubiquiti AirRouter",
167 ubnt_airrouter_setup
);
169 static struct gpio_led ubnt_unifi_leds_gpio
[] __initdata
= {
171 .name
= "ubnt:orange:dome",
175 .name
= "ubnt:green:dome",
181 static struct gpio_led ubnt_unifi_outdoor_leds_gpio
[] __initdata
= {
183 .name
= "ubnt:orange:front",
187 .name
= "ubnt:green:front",
193 static struct gpio_led ubnt_unifi_outdoor_plus_leds_gpio
[] __initdata
= {
195 .name
= "ubnt:white:front",
199 .name
= "ubnt:blue:front",
206 static void __init
ubnt_unifi_setup(void)
208 u8
*mac
= (u8
*) KSEG1ADDR(0x1fff0000);
209 u8
*ee
= (u8
*) KSEG1ADDR(0x1fff1000);
211 ath79_register_m25p80(NULL
);
213 ath79_register_mdio(0, ~UBNT_M_WAN_PHYMASK
);
215 ath79_init_mac(ath79_eth0_data
.mac_addr
, mac
, 0);
216 ath79_register_eth(0);
218 ap91_pci_init(ee
, NULL
);
220 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifi_leds_gpio
),
221 ubnt_unifi_leds_gpio
);
223 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL
,
224 ARRAY_SIZE(ubnt_xm_gpio_keys
),
228 MIPS_MACHINE(ATH79_MACH_UBNT_UNIFI
, "UBNT-UF", "Ubiquiti UniFi",
232 #define UBNT_UNIFIOD_PRI_PHYMASK BIT(4)
233 #define UBNT_UNIFIOD_2ND_PHYMASK (BIT(0) | BIT(1) | BIT(2) | BIT(3))
235 static void __init
ubnt_unifi_outdoor_setup(void)
237 u8
*mac1
= (u8
*) KSEG1ADDR(0x1fff0000);
238 u8
*mac2
= (u8
*) KSEG1ADDR(0x1fff0000 + ETH_ALEN
);
239 u8
*ee
= (u8
*) KSEG1ADDR(0x1fff1000);
241 ath79_register_m25p80(NULL
);
243 ath79_register_mdio(0, ~(UBNT_UNIFIOD_PRI_PHYMASK
|
244 UBNT_UNIFIOD_2ND_PHYMASK
));
246 ath79_init_mac(ath79_eth0_data
.mac_addr
, mac1
, 0);
247 ath79_init_mac(ath79_eth1_data
.mac_addr
, mac2
, 0);
248 ath79_register_eth(0);
249 ath79_register_eth(1);
251 ap91_pci_init(ee
, NULL
);
253 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifi_outdoor_leds_gpio
),
254 ubnt_unifi_outdoor_leds_gpio
);
256 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL
,
257 ARRAY_SIZE(ubnt_xm_gpio_keys
),
261 MIPS_MACHINE(ATH79_MACH_UBNT_UNIFI_OUTDOOR
, "UBNT-U20",
262 "Ubiquiti UniFiAP Outdoor",
263 ubnt_unifi_outdoor_setup
);
266 static void __init
ubnt_unifi_outdoor_plus_setup(void)
268 u8
*mac1
= (u8
*) KSEG1ADDR(0x1fff0000);
269 u8
*mac2
= (u8
*) KSEG1ADDR(0x1fff0000 + ETH_ALEN
);
270 u8
*ee
= (u8
*) KSEG1ADDR(0x1fff1000);
272 ath79_register_m25p80(NULL
);
274 ath79_register_mdio(0, ~(UBNT_UNIFIOD_PRI_PHYMASK
|
275 UBNT_UNIFIOD_2ND_PHYMASK
));
277 ath79_init_mac(ath79_eth0_data
.mac_addr
, mac1
, 0);
278 ath79_init_mac(ath79_eth1_data
.mac_addr
, mac2
, 0);
279 ath79_register_eth(0);
280 ath79_register_eth(1);
282 ap9x_pci_get_wmac_data(0)->ubnt_hsr
= true;
283 ap91_pci_init(ee
, NULL
);
285 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifi_outdoor_plus_leds_gpio
),
286 ubnt_unifi_outdoor_plus_leds_gpio
);
288 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL
,
289 ARRAY_SIZE(ubnt_xm_gpio_keys
),
293 MIPS_MACHINE(ATH79_MACH_UBNT_UNIFI_OUTDOOR_PLUS
, "UBNT-UOP",
294 "Ubiquiti UniFiAP Outdoor+",
295 ubnt_unifi_outdoor_plus_setup
);
298 static struct gpio_led ubnt_uap_pro_gpio_leds
[] __initdata
= {
300 .name
= "ubnt:white:dome",
303 .name
= "ubnt:blue:dome",
308 static struct gpio_keys_button uap_pro_gpio_keys
[] __initdata
= {
313 .debounce_interval
= UBNT_XM_KEYS_DEBOUNCE_INTERVAL
,
319 static struct ar8327_pad_cfg uap_pro_ar8327_pad0_cfg
= {
320 .mode
= AR8327_PAD_MAC_RGMII
,
321 .txclk_delay_en
= true,
322 .rxclk_delay_en
= true,
323 .txclk_delay_sel
= AR8327_CLK_DELAY_SEL1
,
324 .rxclk_delay_sel
= AR8327_CLK_DELAY_SEL2
,
327 static struct ar8327_platform_data uap_pro_ar8327_data
= {
328 .pad0_cfg
= &uap_pro_ar8327_pad0_cfg
,
331 .speed
= AR8327_PORT_SPEED_1000
,
338 static struct mdio_board_info uap_pro_mdio0_info
[] = {
340 .bus_id
= "ag71xx-mdio.0",
342 .platform_data
= &uap_pro_ar8327_data
,
346 #define UAP_PRO_MAC0_OFFSET 0x0000
347 #define UAP_PRO_MAC1_OFFSET 0x0006
348 #define UAP_PRO_WMAC_CALDATA_OFFSET 0x1000
349 #define UAP_PRO_PCI_CALDATA_OFFSET 0x5000
351 static void __init
ubnt_uap_pro_setup(void)
353 u8
*eeprom
= (u8
*) KSEG1ADDR(0x1fff0000);
355 ath79_register_m25p80(NULL
);
357 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_uap_pro_gpio_leds
),
358 ubnt_uap_pro_gpio_leds
);
359 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL
,
360 ARRAY_SIZE(uap_pro_gpio_keys
),
363 ath79_register_wmac(eeprom
+ UAP_PRO_WMAC_CALDATA_OFFSET
, NULL
);
364 ap91_pci_init(eeprom
+ UAP_PRO_PCI_CALDATA_OFFSET
, NULL
);
366 ath79_register_mdio(0, 0x0);
367 mdiobus_register_board_info(uap_pro_mdio0_info
,
368 ARRAY_SIZE(uap_pro_mdio0_info
));
370 ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0
);
371 ath79_init_mac(ath79_eth0_data
.mac_addr
,
372 eeprom
+ UAP_PRO_MAC0_OFFSET
, 0);
374 /* GMAC0 is connected to an AR8327 switch */
375 ath79_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_RGMII
;
376 ath79_eth0_data
.phy_mask
= BIT(0);
377 ath79_eth0_data
.mii_bus_dev
= &ath79_mdio0_device
.dev
;
378 ath79_eth0_pll_data
.pll_1000
= 0x06000000;
379 ath79_register_eth(0);
382 MIPS_MACHINE(ATH79_MACH_UBNT_UAP_PRO
, "UAP-PRO", "Ubiquiti UniFi AP Pro",
385 #define UBNT_XW_GPIO_LED_L1 11
386 #define UBNT_XW_GPIO_LED_L2 16
387 #define UBNT_XW_GPIO_LED_L3 13
388 #define UBNT_XW_GPIO_LED_L4 14
390 static struct gpio_led ubnt_xw_leds_gpio
[] __initdata
= {
392 .name
= "ubnt:red:link1",
393 .gpio
= UBNT_XW_GPIO_LED_L1
,
396 .name
= "ubnt:orange:link2",
397 .gpio
= UBNT_XW_GPIO_LED_L2
,
400 .name
= "ubnt:green:link3",
401 .gpio
= UBNT_XW_GPIO_LED_L3
,
404 .name
= "ubnt:green:link4",
405 .gpio
= UBNT_XW_GPIO_LED_L4
,
410 #define UBNT_ROCKET_TI_GPIO_LED_L1 16
411 #define UBNT_ROCKET_TI_GPIO_LED_L2 17
412 #define UBNT_ROCKET_TI_GPIO_LED_L3 18
413 #define UBNT_ROCKET_TI_GPIO_LED_L4 19
414 #define UBNT_ROCKET_TI_GPIO_LED_L5 20
415 #define UBNT_ROCKET_TI_GPIO_LED_L6 21
416 static struct gpio_led ubnt_rocket_ti_leds_gpio
[] __initdata
= {
418 .name
= "ubnt:green:link1",
419 .gpio
= UBNT_ROCKET_TI_GPIO_LED_L1
,
422 .name
= "ubnt:green:link2",
423 .gpio
= UBNT_ROCKET_TI_GPIO_LED_L2
,
426 .name
= "ubnt:green:link3",
427 .gpio
= UBNT_ROCKET_TI_GPIO_LED_L3
,
430 .name
= "ubnt:green:link4",
431 .gpio
= UBNT_ROCKET_TI_GPIO_LED_L4
,
434 .name
= "ubnt:green:link5",
435 .gpio
= UBNT_ROCKET_TI_GPIO_LED_L5
,
438 .name
= "ubnt:green:link6",
439 .gpio
= UBNT_ROCKET_TI_GPIO_LED_L6
,
444 static void __init
ubnt_xw_init(void)
446 u8
*eeprom
= (u8
*) KSEG1ADDR(0x1fff0000);
448 ath79_register_m25p80(NULL
);
450 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_xw_leds_gpio
),
452 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL
,
453 ARRAY_SIZE(ubnt_xm_gpio_keys
),
456 ath79_register_wmac(eeprom
+ UAP_PRO_WMAC_CALDATA_OFFSET
, NULL
);
457 ap91_pci_init(eeprom
+ UAP_PRO_PCI_CALDATA_OFFSET
, NULL
);
460 ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_MII_GMAC0
| AR934X_ETH_CFG_MII_GMAC0_SLAVE
);
461 ath79_init_mac(ath79_eth0_data
.mac_addr
,
462 eeprom
+ UAP_PRO_MAC0_OFFSET
, 0);
464 ath79_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_MII
;
465 ath79_eth0_data
.mii_bus_dev
= &ath79_mdio0_device
.dev
;
468 static void __init
ubnt_nano_m_xw_setup(void)
472 /* GMAC0 is connected to an AR8326 switch */
473 ath79_register_mdio(0, ~(BIT(0) | BIT(1) | BIT(5)));
474 ath79_eth0_data
.phy_mask
= (BIT(0) | BIT(1) | BIT(5));
475 ath79_eth0_data
.speed
= SPEED_100
;
476 ath79_eth0_data
.duplex
= DUPLEX_FULL
;
477 ath79_register_eth(0);
480 static void __init
ubnt_loco_m_xw_setup(void)
484 ath79_register_mdio(0, ~BIT(1));
485 ath79_eth0_data
.phy_mask
= BIT(1);
486 ath79_register_eth(0);
489 static void __init
ubnt_rocket_m_xw_setup(void)
491 u8
*eeprom
= (u8
*) KSEG1ADDR(0x1fff0000);
493 ath79_register_m25p80(NULL
);
495 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_xw_leds_gpio
),
497 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL
,
498 ARRAY_SIZE(ubnt_xm_gpio_keys
),
501 ath79_register_wmac(eeprom
+ UAP_PRO_WMAC_CALDATA_OFFSET
, NULL
);
502 ap91_pci_init(eeprom
+ UAP_PRO_PCI_CALDATA_OFFSET
, NULL
);
504 ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0
);
505 ath79_init_mac(ath79_eth0_data
.mac_addr
,
506 eeprom
+ UAP_PRO_MAC0_OFFSET
, 0);
508 ath79_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_RGMII
;
509 ath79_eth0_data
.mii_bus_dev
= &ath79_mdio0_device
.dev
;
511 ath79_register_mdio(0, ~BIT(4));
512 ath79_eth0_data
.phy_mask
= BIT(4);
513 ath79_eth0_pll_data
.pll_1000
= 0x06000000;
514 ath79_register_eth(0);
517 static struct at803x_platform_data ubnt_rocket_m_ti_at803_data
= {
518 .disable_smarteee
= 1,
519 .enable_rgmii_rx_delay
= 1,
520 .enable_rgmii_tx_delay
= 1,
522 static struct mdio_board_info ubnt_rocket_m_ti_mdio_info
[] = {
524 .bus_id
= "ag71xx-mdio.0",
526 .platform_data
= &ubnt_rocket_m_ti_at803_data
,
530 static void __init
ubnt_rocket_m_ti_setup(void)
532 u8
*eeprom
= (u8
*) KSEG1ADDR(0x1fff0000);
534 ath79_register_m25p80(NULL
);
536 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_rocket_ti_leds_gpio
),
537 ubnt_rocket_ti_leds_gpio
);
538 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL
,
539 ARRAY_SIZE(ubnt_xm_gpio_keys
),
542 ap91_pci_init(eeprom
+ 0x1000, NULL
);
544 ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0
);
545 ath79_setup_ar934x_eth_rx_delay(3, 3);
546 ath79_init_mac(ath79_eth0_data
.mac_addr
,
547 eeprom
+ UAP_PRO_MAC0_OFFSET
, 0);
548 ath79_init_mac(ath79_eth1_data
.mac_addr
,
549 eeprom
+ UAP_PRO_MAC1_OFFSET
, 0);
551 ath79_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_RGMII
;
552 ath79_eth0_data
.mii_bus_dev
= &ath79_mdio0_device
.dev
;
553 ath79_eth1_data
.phy_if_mode
= PHY_INTERFACE_MODE_GMII
;
554 ath79_eth1_data
.mii_bus_dev
= &ath79_mdio1_device
.dev
;
556 mdiobus_register_board_info(ubnt_rocket_m_ti_mdio_info
,
557 ARRAY_SIZE(ubnt_rocket_m_ti_mdio_info
));
558 ath79_register_mdio(0, 0x0);
561 ath79_eth0_data
.phy_mask
= BIT(4);
562 /* read out from vendor */
563 ath79_eth0_pll_data
.pll_1000
= 0x2000000;
564 ath79_eth0_pll_data
.pll_10
= 0x1313;
565 ath79_register_eth(0);
567 ath79_register_mdio(1, 0x0);
568 ath79_eth1_data
.phy_mask
= BIT(3);
569 ath79_register_eth(1);
573 MIPS_MACHINE(ATH79_MACH_UBNT_NANO_M_XW
, "UBNT-NM-XW", "Ubiquiti Nanostation M XW",
574 ubnt_nano_m_xw_setup
);
576 MIPS_MACHINE(ATH79_MACH_UBNT_LOCO_M_XW
, "UBNT-LOCO-XW", "Ubiquiti Loco M XW",
577 ubnt_loco_m_xw_setup
);
579 MIPS_MACHINE(ATH79_MACH_UBNT_ROCKET_M_XW
, "UBNT-RM-XW", "Ubiquiti Rocket M XW",
580 ubnt_rocket_m_xw_setup
);
582 MIPS_MACHINE(ATH79_MACH_UBNT_ROCKET_M_TI
, "UBNT-RM-TI", "Ubiquiti Rocket M TI",
583 ubnt_rocket_m_ti_setup
);
585 static struct gpio_led ubnt_airgateway_gpio_leds
[] __initdata
= {
587 .name
= "ubnt:blue:wlan",
590 .name
= "ubnt:white:status",
595 static struct gpio_keys_button airgateway_gpio_keys
[] __initdata
= {
600 .debounce_interval
= UBNT_XM_KEYS_DEBOUNCE_INTERVAL
,
606 static void __init
ubnt_airgateway_setup(void)
609 u8
*mac0
= (u8
*) KSEG1ADDR(0x1fff0000);
610 u8
*mac1
= (u8
*) KSEG1ADDR(0x1fff0000 + ETH_ALEN
);
611 u8
*ee
= (u8
*) KSEG1ADDR(0x1fff1000);
614 ath79_gpio_function_disable(AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN
|
615 AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN
|
616 AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN
|
617 AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN
|
618 AR933X_GPIO_FUNC_ETH_SWITCH_LED4_EN
);
620 t
= ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP
);
621 t
|= AR933X_BOOTSTRAP_MDIO_GPIO_EN
;
622 ath79_reset_wr(AR933X_RESET_REG_BOOTSTRAP
, t
);
624 ath79_register_m25p80(NULL
);
625 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_airgateway_gpio_leds
),
626 ubnt_airgateway_gpio_leds
);
628 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL
,
629 ARRAY_SIZE(airgateway_gpio_keys
),
630 airgateway_gpio_keys
);
632 ath79_init_mac(ath79_eth1_data
.mac_addr
, mac0
, 0);
633 ath79_init_mac(ath79_eth0_data
.mac_addr
, mac1
, 0);
635 ath79_register_mdio(0, 0x0);
637 ath79_register_eth(1);
638 ath79_register_eth(0);
640 ath79_register_wmac(ee
, NULL
);
643 MIPS_MACHINE(ATH79_MACH_UBNT_AIRGW
, "UBNT-AGW", "Ubiquiti AirGateway",
644 ubnt_airgateway_setup
);
646 static struct gpio_led ubnt_airgateway_pro_gpio_leds
[] __initdata
= {
648 .name
= "ubnt:blue:wlan",
651 .name
= "ubnt:white:status",
657 static struct gpio_keys_button airgateway_pro_gpio_keys
[] __initdata
= {
662 .debounce_interval
= UBNT_XM_KEYS_DEBOUNCE_INTERVAL
,
668 static void __init
ubnt_airgateway_pro_setup(void)
670 u8
*eeprom
= (u8
*) KSEG1ADDR(0x1fff0000);
671 u8
*mac0
= (u8
*) KSEG1ADDR(0x1fff0000);
673 ath79_register_m25p80(NULL
);
674 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_airgateway_pro_gpio_leds
),
675 ubnt_airgateway_pro_gpio_leds
);
677 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL
,
678 ARRAY_SIZE(airgateway_pro_gpio_keys
),
679 airgateway_pro_gpio_keys
);
681 ath79_register_wmac(eeprom
+ UAP_PRO_WMAC_CALDATA_OFFSET
, NULL
);
682 ap91_pci_init(eeprom
+ UAP_PRO_PCI_CALDATA_OFFSET
, NULL
);
685 ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_ONLY_MODE
);
687 ath79_register_mdio(1, 0x0);
689 /* GMAC0 is left unused in this configuration */
691 /* GMAC1 is connected to MAC0 on the internal switch */
692 /* The PoE/WAN port connects to port 5 on the internal switch */
693 /* The LAN port connects to port 4 on the internal switch */
694 ath79_init_mac(ath79_eth1_data
.mac_addr
, mac0
, 0);
695 ath79_eth1_data
.phy_if_mode
= PHY_INTERFACE_MODE_GMII
;
696 ath79_register_eth(1);
700 MIPS_MACHINE(ATH79_MACH_UBNT_AIRGWP
, "UBNT-AGWP", "Ubiquiti AirGateway Pro",
701 ubnt_airgateway_pro_setup
);