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>
19 #include <linux/platform_data/phy-at803x.h>
21 #include <asm/mach-ath79/ath79.h>
22 #include <asm/mach-ath79/irq.h>
23 #include <asm/mach-ath79/ar71xx_regs.h>
25 #include <linux/platform_data/phy-at803x.h>
28 #include "dev-ap9x-pci.h"
30 #include "dev-gpio-buttons.h"
31 #include "dev-leds-gpio.h"
32 #include "dev-m25p80.h"
35 #include "machtypes.h"
37 #define UBNT_XM_GPIO_LED_L1 0
38 #define UBNT_XM_GPIO_LED_L2 1
39 #define UBNT_XM_GPIO_LED_L3 11
40 #define UBNT_XM_GPIO_LED_L4 7
42 #define UBNT_XM_GPIO_BTN_RESET 12
44 #define UBNT_XM_KEYS_POLL_INTERVAL 20
45 #define UBNT_XM_KEYS_DEBOUNCE_INTERVAL (3 * UBNT_XM_KEYS_POLL_INTERVAL)
47 #define UBNT_XM_EEPROM_ADDR 0x1fff1000
49 static struct gpio_led ubnt_xm_leds_gpio
[] __initdata
= {
51 .name
= "ubnt:red:link1",
52 .gpio
= UBNT_XM_GPIO_LED_L1
,
55 .name
= "ubnt:orange:link2",
56 .gpio
= UBNT_XM_GPIO_LED_L2
,
59 .name
= "ubnt:green:link3",
60 .gpio
= UBNT_XM_GPIO_LED_L3
,
63 .name
= "ubnt:green:link4",
64 .gpio
= UBNT_XM_GPIO_LED_L4
,
69 static struct gpio_keys_button ubnt_xm_gpio_keys
[] __initdata
= {
74 .debounce_interval
= UBNT_XM_KEYS_DEBOUNCE_INTERVAL
,
75 .gpio
= UBNT_XM_GPIO_BTN_RESET
,
80 #define UBNT_M_WAN_PHYMASK BIT(4)
82 static void __init
ubnt_xm_init(void)
84 u8
*eeprom
= (u8
*) KSEG1ADDR(UBNT_XM_EEPROM_ADDR
);
85 u8
*mac1
= (u8
*) KSEG1ADDR(0x1fff0000);
86 u8
*mac2
= (u8
*) KSEG1ADDR(0x1fff0000 + ETH_ALEN
);
88 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_xm_leds_gpio
),
91 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL
,
92 ARRAY_SIZE(ubnt_xm_gpio_keys
),
95 ath79_register_m25p80(NULL
);
96 ap91_pci_init(eeprom
, NULL
);
98 ath79_register_mdio(0, ~UBNT_M_WAN_PHYMASK
);
99 ath79_init_mac(ath79_eth0_data
.mac_addr
, mac1
, 0);
100 ath79_init_mac(ath79_eth1_data
.mac_addr
, mac2
, 0);
101 ath79_register_eth(0);
104 MIPS_MACHINE(ATH79_MACH_UBNT_XM
,
106 "Ubiquiti Networks XM (rev 1.0) board",
109 MIPS_MACHINE(ATH79_MACH_UBNT_BULLET_M
, "UBNT-BM", "Ubiquiti Bullet M",
112 static void __init
ubnt_rocket_m_setup(void)
115 ath79_register_usb();
118 MIPS_MACHINE(ATH79_MACH_UBNT_ROCKET_M
, "UBNT-RM", "Ubiquiti Rocket M",
119 ubnt_rocket_m_setup
);
121 static void __init
ubnt_nano_m_setup(void)
124 ath79_register_eth(1);
127 MIPS_MACHINE(ATH79_MACH_UBNT_NANO_M
, "UBNT-NM", "Ubiquiti Nanostation M",
130 static struct gpio_led ubnt_airrouter_leds_gpio
[] __initdata
= {
132 .name
= "ubnt:green:globe",
136 .name
= "ubnt:green:power",
139 .default_state
= LEDS_GPIO_DEFSTATE_ON
,
143 static void __init
ubnt_airrouter_setup(void)
145 u8
*mac1
= (u8
*) KSEG1ADDR(0x1fff0000);
146 u8
*ee
= (u8
*) KSEG1ADDR(0x1fff1000);
148 ath79_register_m25p80(NULL
);
149 ath79_register_mdio(0, ~UBNT_M_WAN_PHYMASK
);
151 ath79_init_mac(ath79_eth0_data
.mac_addr
, mac1
, 0);
152 ath79_init_local_mac(ath79_eth1_data
.mac_addr
, mac1
);
154 ath79_register_eth(1);
155 ath79_register_eth(0);
156 ath79_register_usb();
158 ap91_pci_init(ee
, NULL
);
159 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_airrouter_leds_gpio
),
160 ubnt_airrouter_leds_gpio
);
162 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL
,
163 ARRAY_SIZE(ubnt_xm_gpio_keys
),
167 MIPS_MACHINE(ATH79_MACH_UBNT_AIRROUTER
, "UBNT-AR", "Ubiquiti AirRouter",
168 ubnt_airrouter_setup
);
170 static struct gpio_led ubnt_unifi_leds_gpio
[] __initdata
= {
172 .name
= "ubnt:orange:dome",
176 .name
= "ubnt:green:dome",
182 static struct gpio_led ubnt_unifi_outdoor_leds_gpio
[] __initdata
= {
184 .name
= "ubnt:orange:front",
188 .name
= "ubnt:green:front",
194 static struct gpio_led ubnt_unifi_outdoor_plus_leds_gpio
[] __initdata
= {
196 .name
= "ubnt:white:front",
200 .name
= "ubnt:blue:front",
207 static void __init
ubnt_unifi_setup(void)
209 u8
*mac
= (u8
*) KSEG1ADDR(0x1fff0000);
210 u8
*ee
= (u8
*) KSEG1ADDR(0x1fff1000);
212 ath79_register_m25p80(NULL
);
214 ath79_register_mdio(0, ~UBNT_M_WAN_PHYMASK
);
216 ath79_init_mac(ath79_eth0_data
.mac_addr
, mac
, 0);
217 ath79_register_eth(0);
219 ap91_pci_init(ee
, NULL
);
221 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifi_leds_gpio
),
222 ubnt_unifi_leds_gpio
);
224 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL
,
225 ARRAY_SIZE(ubnt_xm_gpio_keys
),
229 MIPS_MACHINE(ATH79_MACH_UBNT_UNIFI
, "UBNT-UF", "Ubiquiti UniFi",
233 #define UBNT_UNIFIOD_PRI_PHYMASK BIT(4)
234 #define UBNT_UNIFIOD_2ND_PHYMASK (BIT(0) | BIT(1) | BIT(2) | BIT(3))
236 static void __init
ubnt_unifi_outdoor_setup(void)
238 u8
*mac1
= (u8
*) KSEG1ADDR(0x1fff0000);
239 u8
*mac2
= (u8
*) KSEG1ADDR(0x1fff0000 + ETH_ALEN
);
240 u8
*ee
= (u8
*) KSEG1ADDR(0x1fff1000);
242 ath79_register_m25p80(NULL
);
244 ath79_register_mdio(0, ~(UBNT_UNIFIOD_PRI_PHYMASK
|
245 UBNT_UNIFIOD_2ND_PHYMASK
));
247 ath79_init_mac(ath79_eth0_data
.mac_addr
, mac1
, 0);
248 ath79_init_mac(ath79_eth1_data
.mac_addr
, mac2
, 0);
249 ath79_register_eth(0);
250 ath79_register_eth(1);
252 ap91_pci_init(ee
, NULL
);
254 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifi_outdoor_leds_gpio
),
255 ubnt_unifi_outdoor_leds_gpio
);
257 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL
,
258 ARRAY_SIZE(ubnt_xm_gpio_keys
),
262 MIPS_MACHINE(ATH79_MACH_UBNT_UNIFI_OUTDOOR
, "UBNT-U20",
263 "Ubiquiti UniFiAP Outdoor",
264 ubnt_unifi_outdoor_setup
);
267 static void __init
ubnt_unifi_outdoor_plus_setup(void)
269 u8
*mac1
= (u8
*) KSEG1ADDR(0x1fff0000);
270 u8
*mac2
= (u8
*) KSEG1ADDR(0x1fff0000 + ETH_ALEN
);
271 u8
*ee
= (u8
*) KSEG1ADDR(0x1fff1000);
273 ath79_register_m25p80(NULL
);
275 ath79_register_mdio(0, ~(UBNT_UNIFIOD_PRI_PHYMASK
|
276 UBNT_UNIFIOD_2ND_PHYMASK
));
278 ath79_init_mac(ath79_eth0_data
.mac_addr
, mac1
, 0);
279 ath79_init_mac(ath79_eth1_data
.mac_addr
, mac2
, 0);
280 ath79_register_eth(0);
281 ath79_register_eth(1);
283 ap9x_pci_get_wmac_data(0)->ubnt_hsr
= true;
284 ap91_pci_init(ee
, NULL
);
286 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifi_outdoor_plus_leds_gpio
),
287 ubnt_unifi_outdoor_plus_leds_gpio
);
289 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL
,
290 ARRAY_SIZE(ubnt_xm_gpio_keys
),
294 MIPS_MACHINE(ATH79_MACH_UBNT_UNIFI_OUTDOOR_PLUS
, "UBNT-UOP",
295 "Ubiquiti UniFiAP Outdoor+",
296 ubnt_unifi_outdoor_plus_setup
);
299 static struct gpio_led ubnt_uap_pro_gpio_leds
[] __initdata
= {
301 .name
= "ubnt:white:dome",
304 .name
= "ubnt:blue:dome",
309 static struct gpio_keys_button uap_pro_gpio_keys
[] __initdata
= {
314 .debounce_interval
= UBNT_XM_KEYS_DEBOUNCE_INTERVAL
,
320 static struct ar8327_pad_cfg uap_pro_ar8327_pad0_cfg
= {
321 .mode
= AR8327_PAD_MAC_RGMII
,
322 .txclk_delay_en
= true,
323 .rxclk_delay_en
= true,
324 .txclk_delay_sel
= AR8327_CLK_DELAY_SEL1
,
325 .rxclk_delay_sel
= AR8327_CLK_DELAY_SEL2
,
328 static struct ar8327_platform_data uap_pro_ar8327_data
= {
329 .pad0_cfg
= &uap_pro_ar8327_pad0_cfg
,
332 .speed
= AR8327_PORT_SPEED_1000
,
339 static struct mdio_board_info uap_pro_mdio0_info
[] = {
341 .bus_id
= "ag71xx-mdio.0",
343 .platform_data
= &uap_pro_ar8327_data
,
347 #define UAP_PRO_MAC0_OFFSET 0x0000
348 #define UAP_PRO_MAC1_OFFSET 0x0006
349 #define UAP_PRO_WMAC_CALDATA_OFFSET 0x1000
350 #define UAP_PRO_PCI_CALDATA_OFFSET 0x5000
352 static void __init
ubnt_uap_pro_setup(void)
354 u8
*eeprom
= (u8
*) KSEG1ADDR(0x1fff0000);
356 ath79_register_m25p80(NULL
);
358 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_uap_pro_gpio_leds
),
359 ubnt_uap_pro_gpio_leds
);
360 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL
,
361 ARRAY_SIZE(uap_pro_gpio_keys
),
364 ath79_register_wmac(eeprom
+ UAP_PRO_WMAC_CALDATA_OFFSET
, NULL
);
365 ap91_pci_init(eeprom
+ UAP_PRO_PCI_CALDATA_OFFSET
, NULL
);
367 ath79_register_mdio(0, 0x0);
368 mdiobus_register_board_info(uap_pro_mdio0_info
,
369 ARRAY_SIZE(uap_pro_mdio0_info
));
371 ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0
);
372 ath79_init_mac(ath79_eth0_data
.mac_addr
,
373 eeprom
+ UAP_PRO_MAC0_OFFSET
, 0);
375 /* GMAC0 is connected to an AR8327 switch */
376 ath79_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_RGMII
;
377 ath79_eth0_data
.phy_mask
= BIT(0);
378 ath79_eth0_data
.mii_bus_dev
= &ath79_mdio0_device
.dev
;
379 ath79_eth0_pll_data
.pll_1000
= 0x06000000;
380 ath79_register_eth(0);
383 MIPS_MACHINE(ATH79_MACH_UBNT_UAP_PRO
, "UAP-PRO", "Ubiquiti UniFi AP Pro",
386 #define UBNT_XW_GPIO_LED_L1 11
387 #define UBNT_XW_GPIO_LED_L2 16
388 #define UBNT_XW_GPIO_LED_L3 13
389 #define UBNT_XW_GPIO_LED_L4 14
391 static struct gpio_led ubnt_xw_leds_gpio
[] __initdata
= {
393 .name
= "ubnt:red:link1",
394 .gpio
= UBNT_XW_GPIO_LED_L1
,
397 .name
= "ubnt:orange:link2",
398 .gpio
= UBNT_XW_GPIO_LED_L2
,
401 .name
= "ubnt:green:link3",
402 .gpio
= UBNT_XW_GPIO_LED_L3
,
405 .name
= "ubnt:green:link4",
406 .gpio
= UBNT_XW_GPIO_LED_L4
,
411 #define UBNT_ROCKET_TI_GPIO_LED_L1 16
412 #define UBNT_ROCKET_TI_GPIO_LED_L2 17
413 #define UBNT_ROCKET_TI_GPIO_LED_L3 18
414 #define UBNT_ROCKET_TI_GPIO_LED_L4 19
415 #define UBNT_ROCKET_TI_GPIO_LED_L5 20
416 #define UBNT_ROCKET_TI_GPIO_LED_L6 21
417 static struct gpio_led ubnt_rocket_ti_leds_gpio
[] __initdata
= {
419 .name
= "ubnt:green:link1",
420 .gpio
= UBNT_ROCKET_TI_GPIO_LED_L1
,
423 .name
= "ubnt:green:link2",
424 .gpio
= UBNT_ROCKET_TI_GPIO_LED_L2
,
427 .name
= "ubnt:green:link3",
428 .gpio
= UBNT_ROCKET_TI_GPIO_LED_L3
,
431 .name
= "ubnt:green:link4",
432 .gpio
= UBNT_ROCKET_TI_GPIO_LED_L4
,
435 .name
= "ubnt:green:link5",
436 .gpio
= UBNT_ROCKET_TI_GPIO_LED_L5
,
439 .name
= "ubnt:green:link6",
440 .gpio
= UBNT_ROCKET_TI_GPIO_LED_L6
,
445 static void __init
ubnt_xw_init(void)
447 u8
*eeprom
= (u8
*) KSEG1ADDR(0x1fff0000);
449 ath79_register_m25p80(NULL
);
451 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_xw_leds_gpio
),
453 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL
,
454 ARRAY_SIZE(ubnt_xm_gpio_keys
),
457 ath79_register_wmac(eeprom
+ UAP_PRO_WMAC_CALDATA_OFFSET
, NULL
);
458 ap91_pci_init(eeprom
+ UAP_PRO_PCI_CALDATA_OFFSET
, NULL
);
461 ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_MII_GMAC0
| AR934X_ETH_CFG_MII_GMAC0_SLAVE
);
462 ath79_init_mac(ath79_eth0_data
.mac_addr
,
463 eeprom
+ UAP_PRO_MAC0_OFFSET
, 0);
465 ath79_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_MII
;
466 ath79_eth0_data
.mii_bus_dev
= &ath79_mdio0_device
.dev
;
469 static void __init
ubnt_nano_m_xw_setup(void)
473 /* GMAC0 is connected to an AR8326 switch */
474 ath79_register_mdio(0, ~(BIT(0) | BIT(1) | BIT(5)));
475 ath79_eth0_data
.phy_mask
= (BIT(0) | BIT(1) | BIT(5));
476 ath79_eth0_data
.speed
= SPEED_100
;
477 ath79_eth0_data
.duplex
= DUPLEX_FULL
;
478 ath79_register_eth(0);
481 static struct at803x_platform_data ubnt_loco_m_xw_at803x_data
= {
486 static struct mdio_board_info ubnt_loco_m_xw_mdio_info
[] = {
488 .bus_id
= "ag71xx-mdio.0",
490 .platform_data
= &ubnt_loco_m_xw_at803x_data
,
494 static void __init
ubnt_loco_m_xw_setup(void)
498 mdiobus_register_board_info(ubnt_loco_m_xw_mdio_info
,
499 ARRAY_SIZE(ubnt_loco_m_xw_mdio_info
));
501 ath79_register_mdio(0, ~BIT(1));
502 ath79_eth0_data
.phy_mask
= BIT(1);
503 ath79_register_eth(0);
506 static void __init
ubnt_rocket_m_xw_setup(void)
508 u8
*eeprom
= (u8
*) KSEG1ADDR(0x1fff0000);
510 ath79_register_m25p80(NULL
);
512 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_xw_leds_gpio
),
514 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL
,
515 ARRAY_SIZE(ubnt_xm_gpio_keys
),
518 ath79_register_wmac(eeprom
+ UAP_PRO_WMAC_CALDATA_OFFSET
, NULL
);
519 ap91_pci_init(eeprom
+ UAP_PRO_PCI_CALDATA_OFFSET
, NULL
);
521 ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0
);
522 ath79_init_mac(ath79_eth0_data
.mac_addr
,
523 eeprom
+ UAP_PRO_MAC0_OFFSET
, 0);
525 ath79_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_RGMII
;
526 ath79_eth0_data
.mii_bus_dev
= &ath79_mdio0_device
.dev
;
528 ath79_register_mdio(0, ~BIT(4));
529 ath79_eth0_data
.phy_mask
= BIT(4);
530 ath79_eth0_pll_data
.pll_1000
= 0x06000000;
531 ath79_register_eth(0);
534 static struct at803x_platform_data ubnt_rocket_m_ti_at803_data
= {
535 .disable_smarteee
= 1,
536 .enable_rgmii_rx_delay
= 1,
537 .enable_rgmii_tx_delay
= 1,
539 static struct mdio_board_info ubnt_rocket_m_ti_mdio_info
[] = {
541 .bus_id
= "ag71xx-mdio.0",
543 .platform_data
= &ubnt_rocket_m_ti_at803_data
,
547 static void __init
ubnt_rocket_m_ti_setup(void)
549 u8
*eeprom
= (u8
*) KSEG1ADDR(0x1fff0000);
551 ath79_register_m25p80(NULL
);
553 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_rocket_ti_leds_gpio
),
554 ubnt_rocket_ti_leds_gpio
);
555 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL
,
556 ARRAY_SIZE(ubnt_xm_gpio_keys
),
559 ap91_pci_init(eeprom
+ 0x1000, NULL
);
561 ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0
);
562 ath79_setup_ar934x_eth_rx_delay(3, 3);
563 ath79_init_mac(ath79_eth0_data
.mac_addr
,
564 eeprom
+ UAP_PRO_MAC0_OFFSET
, 0);
565 ath79_init_mac(ath79_eth1_data
.mac_addr
,
566 eeprom
+ UAP_PRO_MAC1_OFFSET
, 0);
568 ath79_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_RGMII
;
569 ath79_eth0_data
.mii_bus_dev
= &ath79_mdio0_device
.dev
;
570 ath79_eth1_data
.phy_if_mode
= PHY_INTERFACE_MODE_GMII
;
571 ath79_eth1_data
.mii_bus_dev
= &ath79_mdio1_device
.dev
;
573 mdiobus_register_board_info(ubnt_rocket_m_ti_mdio_info
,
574 ARRAY_SIZE(ubnt_rocket_m_ti_mdio_info
));
575 ath79_register_mdio(0, 0x0);
578 ath79_eth0_data
.phy_mask
= BIT(4);
579 /* read out from vendor */
580 ath79_eth0_pll_data
.pll_1000
= 0x2000000;
581 ath79_eth0_pll_data
.pll_10
= 0x1313;
582 ath79_register_eth(0);
584 ath79_register_mdio(1, 0x0);
585 ath79_eth1_data
.phy_mask
= BIT(3);
586 ath79_register_eth(1);
590 MIPS_MACHINE(ATH79_MACH_UBNT_NANO_M_XW
, "UBNT-NM-XW", "Ubiquiti Nanostation M XW",
591 ubnt_nano_m_xw_setup
);
593 MIPS_MACHINE(ATH79_MACH_UBNT_LOCO_M_XW
, "UBNT-LOCO-XW", "Ubiquiti Loco M XW",
594 ubnt_loco_m_xw_setup
);
596 MIPS_MACHINE(ATH79_MACH_UBNT_ROCKET_M_XW
, "UBNT-RM-XW", "Ubiquiti Rocket M XW",
597 ubnt_rocket_m_xw_setup
);
599 MIPS_MACHINE(ATH79_MACH_UBNT_ROCKET_M_TI
, "UBNT-RM-TI", "Ubiquiti Rocket M TI",
600 ubnt_rocket_m_ti_setup
);
602 static struct gpio_led ubnt_airgateway_gpio_leds
[] __initdata
= {
604 .name
= "ubnt:blue:wlan",
607 .name
= "ubnt:white:status",
612 static struct gpio_keys_button airgateway_gpio_keys
[] __initdata
= {
617 .debounce_interval
= UBNT_XM_KEYS_DEBOUNCE_INTERVAL
,
623 static void __init
ubnt_airgateway_setup(void)
626 u8
*mac0
= (u8
*) KSEG1ADDR(0x1fff0000);
627 u8
*mac1
= (u8
*) KSEG1ADDR(0x1fff0000 + ETH_ALEN
);
628 u8
*ee
= (u8
*) KSEG1ADDR(0x1fff1000);
631 ath79_gpio_function_disable(AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN
|
632 AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN
|
633 AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN
|
634 AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN
|
635 AR933X_GPIO_FUNC_ETH_SWITCH_LED4_EN
);
637 t
= ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP
);
638 t
|= AR933X_BOOTSTRAP_MDIO_GPIO_EN
;
639 ath79_reset_wr(AR933X_RESET_REG_BOOTSTRAP
, t
);
641 ath79_register_m25p80(NULL
);
642 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_airgateway_gpio_leds
),
643 ubnt_airgateway_gpio_leds
);
645 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL
,
646 ARRAY_SIZE(airgateway_gpio_keys
),
647 airgateway_gpio_keys
);
649 ath79_init_mac(ath79_eth1_data
.mac_addr
, mac0
, 0);
650 ath79_init_mac(ath79_eth0_data
.mac_addr
, mac1
, 0);
652 ath79_register_mdio(0, 0x0);
654 ath79_register_eth(1);
655 ath79_register_eth(0);
657 ath79_register_wmac(ee
, NULL
);
660 MIPS_MACHINE(ATH79_MACH_UBNT_AIRGW
, "UBNT-AGW", "Ubiquiti AirGateway",
661 ubnt_airgateway_setup
);
663 static struct gpio_led ubnt_airgateway_pro_gpio_leds
[] __initdata
= {
665 .name
= "ubnt:blue:wlan",
668 .name
= "ubnt:white:status",
674 static struct gpio_keys_button airgateway_pro_gpio_keys
[] __initdata
= {
679 .debounce_interval
= UBNT_XM_KEYS_DEBOUNCE_INTERVAL
,
685 static void __init
ubnt_airgateway_pro_setup(void)
687 u8
*eeprom
= (u8
*) KSEG1ADDR(0x1fff0000);
688 u8
*mac0
= (u8
*) KSEG1ADDR(0x1fff0000);
690 ath79_register_m25p80(NULL
);
691 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_airgateway_pro_gpio_leds
),
692 ubnt_airgateway_pro_gpio_leds
);
694 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL
,
695 ARRAY_SIZE(airgateway_pro_gpio_keys
),
696 airgateway_pro_gpio_keys
);
698 ath79_register_wmac(eeprom
+ UAP_PRO_WMAC_CALDATA_OFFSET
, NULL
);
699 ap91_pci_init(eeprom
+ UAP_PRO_PCI_CALDATA_OFFSET
, NULL
);
702 ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_ONLY_MODE
);
704 ath79_register_mdio(1, 0x0);
706 /* GMAC0 is left unused in this configuration */
708 /* GMAC1 is connected to MAC0 on the internal switch */
709 /* The PoE/WAN port connects to port 5 on the internal switch */
710 /* The LAN port connects to port 4 on the internal switch */
711 ath79_init_mac(ath79_eth1_data
.mac_addr
, mac0
, 0);
712 ath79_eth1_data
.phy_if_mode
= PHY_INTERFACE_MODE_GMII
;
713 ath79_register_eth(1);
717 MIPS_MACHINE(ATH79_MACH_UBNT_AIRGWP
, "UBNT-AGWP", "Ubiquiti AirGateway Pro",
718 ubnt_airgateway_pro_setup
);