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/gpio.h>
16 #include <linux/platform_device.h>
17 #include <linux/ath9k_platform.h>
18 #include <linux/etherdevice.h>
19 #include <linux/ar8216_platform.h>
20 #include <linux/platform_data/phy-at803x.h>
22 #include <asm/mach-ath79/ath79.h>
23 #include <asm/mach-ath79/irq.h>
24 #include <asm/mach-ath79/ar71xx_regs.h>
26 #include <linux/platform_data/phy-at803x.h>
29 #include "dev-ap9x-pci.h"
31 #include "dev-gpio-buttons.h"
32 #include "dev-leds-gpio.h"
33 #include "dev-m25p80.h"
36 #include "machtypes.h"
38 #define UBNT_XM_GPIO_LED_L1 0
39 #define UBNT_XM_GPIO_LED_L2 1
40 #define UBNT_XM_GPIO_LED_L3 11
41 #define UBNT_XM_GPIO_LED_L4 7
43 #define UBNT_XM_GPIO_BTN_RESET 12
45 #define UBNT_XM_KEYS_POLL_INTERVAL 20
46 #define UBNT_XM_KEYS_DEBOUNCE_INTERVAL (3 * UBNT_XM_KEYS_POLL_INTERVAL)
48 #define UBNT_XM_EEPROM_ADDR 0x1fff1000
50 static struct gpio_led ubnt_xm_leds_gpio
[] __initdata
= {
52 .name
= "ubnt:red:link1",
53 .gpio
= UBNT_XM_GPIO_LED_L1
,
56 .name
= "ubnt:orange:link2",
57 .gpio
= UBNT_XM_GPIO_LED_L2
,
60 .name
= "ubnt:green:link3",
61 .gpio
= UBNT_XM_GPIO_LED_L3
,
64 .name
= "ubnt:green:link4",
65 .gpio
= UBNT_XM_GPIO_LED_L4
,
70 static struct gpio_keys_button ubnt_xm_gpio_keys
[] __initdata
= {
75 .debounce_interval
= UBNT_XM_KEYS_DEBOUNCE_INTERVAL
,
76 .gpio
= UBNT_XM_GPIO_BTN_RESET
,
81 #define UBNT_M_WAN_PHYMASK BIT(4)
83 static void __init
ubnt_xm_init(void)
85 u8
*eeprom
= (u8
*) KSEG1ADDR(UBNT_XM_EEPROM_ADDR
);
86 u8
*mac1
= (u8
*) KSEG1ADDR(0x1fff0000);
87 u8
*mac2
= (u8
*) KSEG1ADDR(0x1fff0000 + ETH_ALEN
);
89 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_xm_leds_gpio
),
92 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL
,
93 ARRAY_SIZE(ubnt_xm_gpio_keys
),
96 ath79_register_m25p80(NULL
);
97 ap91_pci_init(eeprom
, NULL
);
99 ath79_register_mdio(0, ~UBNT_M_WAN_PHYMASK
);
100 ath79_init_mac(ath79_eth0_data
.mac_addr
, mac1
, 0);
101 ath79_init_mac(ath79_eth1_data
.mac_addr
, mac2
, 0);
102 ath79_register_eth(0);
105 MIPS_MACHINE(ATH79_MACH_UBNT_XM
,
107 "Ubiquiti Networks XM (rev 1.0) board",
110 MIPS_MACHINE(ATH79_MACH_UBNT_BULLET_M
, "UBNT-BM", "Ubiquiti Bullet M",
113 static void __init
ubnt_rocket_m_setup(void)
116 ath79_register_usb();
119 MIPS_MACHINE(ATH79_MACH_UBNT_ROCKET_M
, "UBNT-RM", "Ubiquiti Rocket M",
120 ubnt_rocket_m_setup
);
122 static void __init
ubnt_nano_m_setup(void)
125 ath79_register_eth(1);
128 MIPS_MACHINE(ATH79_MACH_UBNT_NANO_M
, "UBNT-NM", "Ubiquiti Nanostation M",
131 static struct gpio_led ubnt_airrouter_leds_gpio
[] __initdata
= {
133 .name
= "ubnt:green:globe",
137 .name
= "ubnt:green:power",
140 .default_state
= LEDS_GPIO_DEFSTATE_ON
,
144 static void __init
ubnt_airrouter_setup(void)
146 u8
*mac1
= (u8
*) KSEG1ADDR(0x1fff0000);
147 u8
*ee
= (u8
*) KSEG1ADDR(0x1fff1000);
149 ath79_register_m25p80(NULL
);
150 ath79_register_mdio(0, ~UBNT_M_WAN_PHYMASK
);
152 ath79_init_mac(ath79_eth0_data
.mac_addr
, mac1
, 0);
153 ath79_init_local_mac(ath79_eth1_data
.mac_addr
, mac1
);
155 ath79_register_eth(1);
156 ath79_register_eth(0);
157 ath79_register_usb();
159 ap91_pci_init(ee
, NULL
);
160 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_airrouter_leds_gpio
),
161 ubnt_airrouter_leds_gpio
);
163 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL
,
164 ARRAY_SIZE(ubnt_xm_gpio_keys
),
168 MIPS_MACHINE(ATH79_MACH_UBNT_AIRROUTER
, "UBNT-AR", "Ubiquiti AirRouter",
169 ubnt_airrouter_setup
);
171 static struct gpio_led ubnt_unifi_leds_gpio
[] __initdata
= {
173 .name
= "ubnt:orange:dome",
177 .name
= "ubnt:green:dome",
183 static struct gpio_led ubnt_unifi_outdoor_leds_gpio
[] __initdata
= {
185 .name
= "ubnt:orange:front",
189 .name
= "ubnt:green:front",
195 static struct gpio_led ubnt_unifi_outdoor_plus_leds_gpio
[] __initdata
= {
197 .name
= "ubnt:white:front",
201 .name
= "ubnt:blue:front",
208 static void __init
ubnt_unifi_setup(void)
210 u8
*mac
= (u8
*) KSEG1ADDR(0x1fff0000);
211 u8
*ee
= (u8
*) KSEG1ADDR(0x1fff1000);
213 ath79_register_m25p80(NULL
);
215 ath79_register_mdio(0, ~UBNT_M_WAN_PHYMASK
);
217 ath79_init_mac(ath79_eth0_data
.mac_addr
, mac
, 0);
218 ath79_register_eth(0);
220 ap91_pci_init(ee
, NULL
);
222 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifi_leds_gpio
),
223 ubnt_unifi_leds_gpio
);
225 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL
,
226 ARRAY_SIZE(ubnt_xm_gpio_keys
),
230 MIPS_MACHINE(ATH79_MACH_UBNT_UNIFI
, "UBNT-UF", "Ubiquiti UniFi",
234 #define UBNT_UNIFIOD_PRI_PHYMASK BIT(4)
235 #define UBNT_UNIFIOD_2ND_PHYMASK (BIT(0) | BIT(1) | BIT(2) | BIT(3))
237 static void __init
ubnt_unifi_outdoor_setup(void)
239 u8
*mac1
= (u8
*) KSEG1ADDR(0x1fff0000);
240 u8
*mac2
= (u8
*) KSEG1ADDR(0x1fff0000 + ETH_ALEN
);
241 u8
*ee
= (u8
*) KSEG1ADDR(0x1fff1000);
243 ath79_register_m25p80(NULL
);
245 ath79_register_mdio(0, ~(UBNT_UNIFIOD_PRI_PHYMASK
|
246 UBNT_UNIFIOD_2ND_PHYMASK
));
248 ath79_init_mac(ath79_eth0_data
.mac_addr
, mac1
, 0);
249 ath79_init_mac(ath79_eth1_data
.mac_addr
, mac2
, 0);
250 ath79_register_eth(0);
251 ath79_register_eth(1);
253 ap91_pci_init(ee
, NULL
);
255 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifi_outdoor_leds_gpio
),
256 ubnt_unifi_outdoor_leds_gpio
);
258 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL
,
259 ARRAY_SIZE(ubnt_xm_gpio_keys
),
263 MIPS_MACHINE(ATH79_MACH_UBNT_UNIFI_OUTDOOR
, "UBNT-U20",
264 "Ubiquiti UniFiAP Outdoor",
265 ubnt_unifi_outdoor_setup
);
268 static void __init
ubnt_unifi_outdoor_plus_setup(void)
270 u8
*mac1
= (u8
*) KSEG1ADDR(0x1fff0000);
271 u8
*mac2
= (u8
*) KSEG1ADDR(0x1fff0000 + ETH_ALEN
);
272 u8
*ee
= (u8
*) KSEG1ADDR(0x1fff1000);
274 ath79_register_m25p80(NULL
);
276 ath79_register_mdio(0, ~(UBNT_UNIFIOD_PRI_PHYMASK
|
277 UBNT_UNIFIOD_2ND_PHYMASK
));
279 ath79_init_mac(ath79_eth0_data
.mac_addr
, mac1
, 0);
280 ath79_init_mac(ath79_eth1_data
.mac_addr
, mac2
, 0);
281 ath79_register_eth(0);
282 ath79_register_eth(1);
284 ap9x_pci_get_wmac_data(0)->ubnt_hsr
= true;
285 ap91_pci_init(ee
, NULL
);
287 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifi_outdoor_plus_leds_gpio
),
288 ubnt_unifi_outdoor_plus_leds_gpio
);
290 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL
,
291 ARRAY_SIZE(ubnt_xm_gpio_keys
),
295 MIPS_MACHINE(ATH79_MACH_UBNT_UNIFI_OUTDOOR_PLUS
, "UBNT-UOP",
296 "Ubiquiti UniFiAP Outdoor+",
297 ubnt_unifi_outdoor_plus_setup
);
300 static struct gpio_led ubnt_uap_pro_gpio_leds
[] __initdata
= {
302 .name
= "ubnt:white:dome",
305 .name
= "ubnt:blue:dome",
310 static struct gpio_keys_button uap_pro_gpio_keys
[] __initdata
= {
315 .debounce_interval
= UBNT_XM_KEYS_DEBOUNCE_INTERVAL
,
321 static struct ar8327_pad_cfg uap_pro_ar8327_pad0_cfg
= {
322 .mode
= AR8327_PAD_MAC_RGMII
,
323 .txclk_delay_en
= true,
324 .rxclk_delay_en
= true,
325 .txclk_delay_sel
= AR8327_CLK_DELAY_SEL1
,
326 .rxclk_delay_sel
= AR8327_CLK_DELAY_SEL2
,
329 static struct ar8327_platform_data uap_pro_ar8327_data
= {
330 .pad0_cfg
= &uap_pro_ar8327_pad0_cfg
,
333 .speed
= AR8327_PORT_SPEED_1000
,
340 static struct mdio_board_info uap_pro_mdio0_info
[] = {
342 .bus_id
= "ag71xx-mdio.0",
344 .platform_data
= &uap_pro_ar8327_data
,
348 #define UAP_PRO_MAC0_OFFSET 0x0000
349 #define UAP_PRO_MAC1_OFFSET 0x0006
350 #define UAP_PRO_WMAC_CALDATA_OFFSET 0x1000
351 #define UAP_PRO_PCI_CALDATA_OFFSET 0x5000
353 static void __init
ubnt_uap_pro_setup(void)
355 u8
*eeprom
= (u8
*) KSEG1ADDR(0x1fff0000);
357 ath79_register_m25p80(NULL
);
359 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_uap_pro_gpio_leds
),
360 ubnt_uap_pro_gpio_leds
);
361 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL
,
362 ARRAY_SIZE(uap_pro_gpio_keys
),
365 ath79_register_wmac(eeprom
+ UAP_PRO_WMAC_CALDATA_OFFSET
, NULL
);
366 ap91_pci_init(eeprom
+ UAP_PRO_PCI_CALDATA_OFFSET
, NULL
);
368 ath79_register_mdio(0, 0x0);
369 mdiobus_register_board_info(uap_pro_mdio0_info
,
370 ARRAY_SIZE(uap_pro_mdio0_info
));
372 ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0
);
373 ath79_init_mac(ath79_eth0_data
.mac_addr
,
374 eeprom
+ UAP_PRO_MAC0_OFFSET
, 0);
376 /* GMAC0 is connected to an AR8327 switch */
377 ath79_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_RGMII
;
378 ath79_eth0_data
.phy_mask
= BIT(0);
379 ath79_eth0_data
.mii_bus_dev
= &ath79_mdio0_device
.dev
;
380 ath79_eth0_pll_data
.pll_1000
= 0x06000000;
381 ath79_register_eth(0);
384 MIPS_MACHINE(ATH79_MACH_UBNT_UAP_PRO
, "UAP-PRO", "Ubiquiti UniFi AP Pro",
387 #define UBNT_XW_GPIO_LED_L1 11
388 #define UBNT_XW_GPIO_LED_L2 16
389 #define UBNT_XW_GPIO_LED_L3 13
390 #define UBNT_XW_GPIO_LED_L4 14
392 static struct gpio_led ubnt_xw_leds_gpio
[] __initdata
= {
394 .name
= "ubnt:red:link1",
395 .gpio
= UBNT_XW_GPIO_LED_L1
,
398 .name
= "ubnt:orange:link2",
399 .gpio
= UBNT_XW_GPIO_LED_L2
,
402 .name
= "ubnt:green:link3",
403 .gpio
= UBNT_XW_GPIO_LED_L3
,
406 .name
= "ubnt:green:link4",
407 .gpio
= UBNT_XW_GPIO_LED_L4
,
412 #define UBNT_ROCKET_TI_GPIO_LED_L1 16
413 #define UBNT_ROCKET_TI_GPIO_LED_L2 17
414 #define UBNT_ROCKET_TI_GPIO_LED_L3 18
415 #define UBNT_ROCKET_TI_GPIO_LED_L4 19
416 #define UBNT_ROCKET_TI_GPIO_LED_L5 20
417 #define UBNT_ROCKET_TI_GPIO_LED_L6 21
418 static struct gpio_led ubnt_rocket_ti_leds_gpio
[] __initdata
= {
420 .name
= "ubnt:green:link1",
421 .gpio
= UBNT_ROCKET_TI_GPIO_LED_L1
,
424 .name
= "ubnt:green:link2",
425 .gpio
= UBNT_ROCKET_TI_GPIO_LED_L2
,
428 .name
= "ubnt:green:link3",
429 .gpio
= UBNT_ROCKET_TI_GPIO_LED_L3
,
432 .name
= "ubnt:green:link4",
433 .gpio
= UBNT_ROCKET_TI_GPIO_LED_L4
,
436 .name
= "ubnt:green:link5",
437 .gpio
= UBNT_ROCKET_TI_GPIO_LED_L5
,
440 .name
= "ubnt:green:link6",
441 .gpio
= UBNT_ROCKET_TI_GPIO_LED_L6
,
446 static void __init
ubnt_xw_init(void)
448 u8
*eeprom
= (u8
*) KSEG1ADDR(0x1fff0000);
450 ath79_register_m25p80(NULL
);
452 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_xw_leds_gpio
),
454 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL
,
455 ARRAY_SIZE(ubnt_xm_gpio_keys
),
458 ath79_register_wmac(eeprom
+ UAP_PRO_WMAC_CALDATA_OFFSET
, NULL
);
459 ap91_pci_init(eeprom
+ UAP_PRO_PCI_CALDATA_OFFSET
, NULL
);
462 ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_MII_GMAC0
| AR934X_ETH_CFG_MII_GMAC0_SLAVE
);
463 ath79_init_mac(ath79_eth0_data
.mac_addr
,
464 eeprom
+ UAP_PRO_MAC0_OFFSET
, 0);
466 ath79_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_MII
;
467 ath79_eth0_data
.mii_bus_dev
= &ath79_mdio0_device
.dev
;
470 static void __init
ubnt_nano_m_xw_setup(void)
474 /* GMAC0 is connected to an AR8326 switch */
475 ath79_register_mdio(0, ~(BIT(0) | BIT(1) | BIT(5)));
476 ath79_eth0_data
.phy_mask
= (BIT(0) | BIT(1) | BIT(5));
477 ath79_eth0_data
.speed
= SPEED_100
;
478 ath79_eth0_data
.duplex
= DUPLEX_FULL
;
479 ath79_register_eth(0);
482 static struct at803x_platform_data ubnt_loco_m_xw_at803x_data
= {
487 static struct mdio_board_info ubnt_loco_m_xw_mdio_info
[] = {
489 .bus_id
= "ag71xx-mdio.0",
491 .platform_data
= &ubnt_loco_m_xw_at803x_data
,
495 static void __init
ubnt_loco_m_xw_setup(void)
499 mdiobus_register_board_info(ubnt_loco_m_xw_mdio_info
,
500 ARRAY_SIZE(ubnt_loco_m_xw_mdio_info
));
502 ath79_register_mdio(0, ~BIT(1));
503 ath79_eth0_data
.phy_mask
= BIT(1);
504 ath79_register_eth(0);
507 #define UBNT_LBE_M5_GPIO_LED_LAN 13
508 #define UBNT_LBE_M5_GPIO_LED_WLAN 14
509 #define UBNT_LBE_M5_GPIO_LED_SYS 16
511 static struct gpio_led ubnt_lbe_m5_leds_gpio
[] __initdata
= {
513 .name
= "ubnt:green:lan",
514 .gpio
= UBNT_LBE_M5_GPIO_LED_LAN
,
517 .name
= "ubnt:green:wlan",
518 .gpio
= UBNT_LBE_M5_GPIO_LED_WLAN
,
521 .name
= "ubnt:green:sys",
522 .gpio
= UBNT_LBE_M5_GPIO_LED_SYS
,
527 static void __init
ubnt_lbe_m5_setup(void)
529 u8
*eeprom
= (u8
*) KSEG1ADDR(0x1fff0000);
531 ath79_register_m25p80(NULL
);
533 ath79_register_wmac(eeprom
+ UAP_PRO_WMAC_CALDATA_OFFSET
, NULL
);
534 ap91_pci_init(eeprom
+ UAP_PRO_PCI_CALDATA_OFFSET
, NULL
);
536 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_lbe_m5_leds_gpio
),
537 ubnt_lbe_m5_leds_gpio
);
538 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL
,
539 ARRAY_SIZE(ubnt_xm_gpio_keys
),
542 ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_MII_GMAC0
|
543 AR934X_ETH_CFG_MII_GMAC0_SLAVE
);
544 ath79_init_mac(ath79_eth0_data
.mac_addr
,
545 eeprom
+ UAP_PRO_MAC0_OFFSET
, 0);
547 ath79_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_MII
;
548 ath79_eth0_data
.mii_bus_dev
= &ath79_mdio0_device
.dev
;
550 gpio_request_one(0, GPIOF_OUT_INIT_LOW
| GPIOF_ACTIVE_LOW
|
551 GPIOF_EXPORT_DIR_FIXED
, "SPI nWP");
553 mdiobus_register_board_info(ubnt_loco_m_xw_mdio_info
,
554 ARRAY_SIZE(ubnt_loco_m_xw_mdio_info
));
556 ath79_register_mdio(0, ~BIT(1));
557 ath79_eth0_data
.phy_mask
= BIT(1);
558 ath79_register_eth(0);
561 static void __init
ubnt_rocket_m_xw_setup(void)
563 u8
*eeprom
= (u8
*) KSEG1ADDR(0x1fff0000);
565 ath79_register_m25p80(NULL
);
567 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_xw_leds_gpio
),
569 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL
,
570 ARRAY_SIZE(ubnt_xm_gpio_keys
),
573 ath79_register_wmac(eeprom
+ UAP_PRO_WMAC_CALDATA_OFFSET
, NULL
);
574 ap91_pci_init(eeprom
+ UAP_PRO_PCI_CALDATA_OFFSET
, NULL
);
576 ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0
);
577 ath79_init_mac(ath79_eth0_data
.mac_addr
,
578 eeprom
+ UAP_PRO_MAC0_OFFSET
, 0);
580 ath79_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_RGMII
;
581 ath79_eth0_data
.mii_bus_dev
= &ath79_mdio0_device
.dev
;
583 ath79_register_mdio(0, ~BIT(4));
584 ath79_eth0_data
.phy_mask
= BIT(4);
585 ath79_eth0_pll_data
.pll_1000
= 0x06000000;
586 ath79_register_eth(0);
589 static struct at803x_platform_data ubnt_rocket_m_ti_at803_data
= {
590 .disable_smarteee
= 1,
591 .enable_rgmii_rx_delay
= 1,
592 .enable_rgmii_tx_delay
= 1,
594 static struct mdio_board_info ubnt_rocket_m_ti_mdio_info
[] = {
596 .bus_id
= "ag71xx-mdio.0",
598 .platform_data
= &ubnt_rocket_m_ti_at803_data
,
602 static void __init
ubnt_rocket_m_ti_setup(void)
604 u8
*eeprom
= (u8
*) KSEG1ADDR(0x1fff0000);
606 ath79_register_m25p80(NULL
);
608 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_rocket_ti_leds_gpio
),
609 ubnt_rocket_ti_leds_gpio
);
610 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL
,
611 ARRAY_SIZE(ubnt_xm_gpio_keys
),
614 ap91_pci_init(eeprom
+ 0x1000, NULL
);
616 ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0
);
617 ath79_setup_ar934x_eth_rx_delay(3, 3);
618 ath79_init_mac(ath79_eth0_data
.mac_addr
,
619 eeprom
+ UAP_PRO_MAC0_OFFSET
, 0);
620 ath79_init_mac(ath79_eth1_data
.mac_addr
,
621 eeprom
+ UAP_PRO_MAC1_OFFSET
, 0);
623 ath79_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_RGMII
;
624 ath79_eth0_data
.mii_bus_dev
= &ath79_mdio0_device
.dev
;
625 ath79_eth1_data
.phy_if_mode
= PHY_INTERFACE_MODE_GMII
;
626 ath79_eth1_data
.mii_bus_dev
= &ath79_mdio1_device
.dev
;
628 mdiobus_register_board_info(ubnt_rocket_m_ti_mdio_info
,
629 ARRAY_SIZE(ubnt_rocket_m_ti_mdio_info
));
630 ath79_register_mdio(0, 0x0);
633 ath79_eth0_data
.phy_mask
= BIT(4);
634 /* read out from vendor */
635 ath79_eth0_pll_data
.pll_1000
= 0x2000000;
636 ath79_eth0_pll_data
.pll_10
= 0x1313;
637 ath79_register_eth(0);
639 ath79_register_mdio(1, 0x0);
640 ath79_eth1_data
.phy_mask
= BIT(3);
641 ath79_register_eth(1);
645 MIPS_MACHINE(ATH79_MACH_UBNT_NANO_M_XW
, "UBNT-NM-XW", "Ubiquiti Nanostation M XW",
646 ubnt_nano_m_xw_setup
);
648 MIPS_MACHINE(ATH79_MACH_UBNT_LBE_M5
, "UBNT-LBE-M5", "Ubiquiti Litebeam M5",
651 MIPS_MACHINE(ATH79_MACH_UBNT_LOCO_M_XW
, "UBNT-LOCO-XW", "Ubiquiti Loco M XW",
652 ubnt_loco_m_xw_setup
);
654 MIPS_MACHINE(ATH79_MACH_UBNT_ROCKET_M_XW
, "UBNT-RM-XW", "Ubiquiti Rocket M XW",
655 ubnt_rocket_m_xw_setup
);
657 MIPS_MACHINE(ATH79_MACH_UBNT_ROCKET_M_TI
, "UBNT-RM-TI", "Ubiquiti Rocket M TI",
658 ubnt_rocket_m_ti_setup
);
660 static struct gpio_led ubnt_airgateway_gpio_leds
[] __initdata
= {
662 .name
= "ubnt:blue:wlan",
665 .name
= "ubnt:white:status",
670 static struct gpio_keys_button airgateway_gpio_keys
[] __initdata
= {
675 .debounce_interval
= UBNT_XM_KEYS_DEBOUNCE_INTERVAL
,
681 static void __init
ubnt_airgateway_setup(void)
684 u8
*mac0
= (u8
*) KSEG1ADDR(0x1fff0000);
685 u8
*mac1
= (u8
*) KSEG1ADDR(0x1fff0000 + ETH_ALEN
);
686 u8
*ee
= (u8
*) KSEG1ADDR(0x1fff1000);
689 ath79_gpio_function_disable(AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN
|
690 AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN
|
691 AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN
|
692 AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN
|
693 AR933X_GPIO_FUNC_ETH_SWITCH_LED4_EN
);
695 t
= ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP
);
696 t
|= AR933X_BOOTSTRAP_MDIO_GPIO_EN
;
697 ath79_reset_wr(AR933X_RESET_REG_BOOTSTRAP
, t
);
699 ath79_register_m25p80(NULL
);
700 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_airgateway_gpio_leds
),
701 ubnt_airgateway_gpio_leds
);
703 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL
,
704 ARRAY_SIZE(airgateway_gpio_keys
),
705 airgateway_gpio_keys
);
707 ath79_init_mac(ath79_eth1_data
.mac_addr
, mac0
, 0);
708 ath79_init_mac(ath79_eth0_data
.mac_addr
, mac1
, 0);
710 ath79_register_mdio(0, 0x0);
712 ath79_register_eth(1);
713 ath79_register_eth(0);
715 ath79_register_wmac(ee
, NULL
);
718 MIPS_MACHINE(ATH79_MACH_UBNT_AIRGW
, "UBNT-AGW", "Ubiquiti AirGateway",
719 ubnt_airgateway_setup
);
721 static struct gpio_led ubnt_airgateway_pro_gpio_leds
[] __initdata
= {
723 .name
= "ubnt:blue:wlan",
726 .name
= "ubnt:white:status",
732 static struct gpio_keys_button airgateway_pro_gpio_keys
[] __initdata
= {
737 .debounce_interval
= UBNT_XM_KEYS_DEBOUNCE_INTERVAL
,
743 static void __init
ubnt_airgateway_pro_setup(void)
745 u8
*eeprom
= (u8
*) KSEG1ADDR(0x1fff0000);
746 u8
*mac0
= (u8
*) KSEG1ADDR(0x1fff0000);
748 ath79_register_m25p80(NULL
);
749 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_airgateway_pro_gpio_leds
),
750 ubnt_airgateway_pro_gpio_leds
);
752 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL
,
753 ARRAY_SIZE(airgateway_pro_gpio_keys
),
754 airgateway_pro_gpio_keys
);
756 ath79_register_wmac(eeprom
+ UAP_PRO_WMAC_CALDATA_OFFSET
, NULL
);
757 ap91_pci_init(eeprom
+ UAP_PRO_PCI_CALDATA_OFFSET
, NULL
);
760 ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_ONLY_MODE
);
762 ath79_register_mdio(1, 0x0);
764 /* GMAC0 is left unused in this configuration */
766 /* GMAC1 is connected to MAC0 on the internal switch */
767 /* The PoE/WAN port connects to port 5 on the internal switch */
768 /* The LAN port connects to port 4 on the internal switch */
769 ath79_init_mac(ath79_eth1_data
.mac_addr
, mac0
, 0);
770 ath79_eth1_data
.phy_if_mode
= PHY_INTERFACE_MODE_GMII
;
771 ath79_register_eth(1);
775 MIPS_MACHINE(ATH79_MACH_UBNT_AIRGWP
, "UBNT-AGWP", "Ubiquiti AirGateway Pro",
776 ubnt_airgateway_pro_setup
);