diff mbox

[OpenWrt-Devel,ar71xx] Help with Ubiquiti Rocket M5 XW support patch

Message ID CAPH4JEL20sfxLHAzL46nquFVqV=FKXWfNPZ+AMFKj5Lj3yT1Xg@mail.gmail.com
State Superseded, archived
Headers show

Commit Message

Roger Pueyo Centelles April 15, 2015, 9:31 a.m. UTC
Hi,

I've been working on supporting the new XW version of Ubiquiti's Rocket M5
devices. The hardware is very similar to the NanoStation [Loco] M5 XW, so
the images for these devices work on the Rocket *except* for the Ethernet
interface. I posted some information about the device in the forum
<https://forum.openwrt.org/viewtopic.php?id=56830> [1].

So far I've been able to make the Ethernet port work (see attached patch
<http://pastebin.com/aZTgZtzB> [2]) *but* I need to specify the port speed
ther as 100 Mbps FD. If I don't, the driver is not loaded.

Any ideas on how to proceed?

Thanks!

Roger

[1] https://forum.openwrt.org/viewtopic.php?id=56830
[2] http://pastebin.com/aZTgZtzB

Comments

Alexander 'lynxis' Couzens April 15, 2015, 10:15 p.m. UTC | #1
Hi Roger,

how many ethernet ports does this product has? 1 or 2?
Ubiquity add a switch chip to it's new nanostation m (xw).

I would say this product has only one port.
Can you try this init please?

static void __init ubnt_rocket_m_xw_setup(void)
{
  ubnt_xw_init();

  ath79_register_mdio(0, ~BIT(4));
  ath79_eth0_data.phy_mask = BIT(4);
  ath79_register_eth(0);
}

Best Regards,
lynxis
Roger Pueyo Centelles April 16, 2015, 8:32 a.m. UTC | #2
Hi lynxis,

Just one port, but without switch.

The init is correct now and the Ethernet port works. I was using the wrong
mask, I thought it would be BIT(2) but I was wrong.

I'll be submitting the patch in a while. Thank you very much!

Roger

2015-04-16 0:15 GMT+02:00 Alexander Couzens <lynxis@fe80.eu>:

> Hi Roger,
>
> how many ethernet ports does this product has? 1 or 2?
> Ubiquity add a switch chip to it's new nanostation m (xw).
>
> I would say this product has only one port.
> Can you try this init please?
>
> static void __init ubnt_rocket_m_xw_setup(void)
> {
>   ubnt_xw_init();
>
>   ath79_register_mdio(0, ~BIT(4));
>   ath79_eth0_data.phy_mask = BIT(4);
>   ath79_register_eth(0);
> }
>
> Best Regards,
> lynxis
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>
>
diff mbox

Patch

From 56e0fd19d8976e11fd4bd1a0b0e8d962cedf4d4c Mon Sep 17 00:00:00 2001
From: Roger Pueyo Centelles <roger.pueyo@guifi.net>
Date: Wed, 15 Apr 2015 11:19:28 +0200
Subject: [PATCH] [RFC] [ar71xx] Add support for Ubiquiti Rocket M5 XW

---
 target/linux/ar71xx/base-files/etc/diag.sh         |  2 +-
 .../ar71xx/base-files/etc/uci-defaults/01_leds     |  1 +
 .../ar71xx/base-files/etc/uci-defaults/02_network  |  1 +
 target/linux/ar71xx/base-files/lib/ar71xx.sh       |  3 ++
 .../ar71xx/base-files/lib/upgrade/platform.sh      |  1 +
 .../linux/ar71xx/files/arch/mips/ath79/mach-ubnt.c |  1 +
 target/linux/ar71xx/image/Makefile                 |  3 +-
 .../610-MIPS-ath79-openwrt-machines.patch          |  3 +-
 ...3-MIPS-ath79-add-ubnt-rocket-m-xw-support.patch | 56 ++++++++++++++++++++++
 9 files changed, 68 insertions(+), 3 deletions(-)
 create mode 100644 target/linux/ar71xx/patches-3.18/903-MIPS-ath79-add-ubnt-rocket-m-xw-support.patch

diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
index 52a73ee..f4f5190 100644
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -34,7 +34,7 @@  get_status_led() {
 	aw-nr580)
 		status_led="aw-nr580:green:ready"
 		;;
-	bullet-m | rocket-m | nano-m | nanostation-m | nanostation-m-xw | loco-m-xw)
+	bullet-m | rocket-m | rocket-m-xw | nano-m | nanostation-m | nanostation-m-xw | loco-m-xw)
 		status_led="ubnt:green:link4"
 		;;
 	bxu2000n-2-a1)
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
index 787523a..0a9a285 100644
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
@@ -38,6 +38,7 @@  ap113)
 bullet-m | \
 nanostation-m | \
 rocket-m | \
+rocket-m-xw | \
 nanostation-m-xw | \
 loco-m-xw)
 	ucidef_set_led_rssi "rssilow" "RSSILOW" "ubnt:red:link1" "wlan0" "1" "100" "0" "13"
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
index 9789834..af7930a 100644
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
@@ -318,6 +318,7 @@  rb-912uag-2hpnd |\
 rb-912uag-5hpnd |\
 rb-sxt2n |\
 rb-sxt5n |\
+rocket-m-xw |\
 tl-mr10u |\
 tl-mr11u |\
 tl-mr12u |\
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index b3dbcf5..c6aa81e 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -621,6 +621,9 @@  ar71xx_board_detect() {
 	*"Rocket M")
 		name="rocket-m"
 		;;
+	*"Rocket M XW")
+		name="rocket-m-xw"
+		;;
 	*RouterStation)
 		name="routerstation"
 		;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 0cbee1d..d349133 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -224,6 +224,7 @@  platform_check_image() {
 	loco-m-xw | \
 	nanostation-m | \
 	rocket-m | \
+	rocket-m-xw | \
 	nanostation-m-xw | \
 	rw2458n | \
 	wndap360 | \
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt.c
index e49ac23..a7bb7e7 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt.c
@@ -10,6 +10,7 @@ 
  *  by the Free Software Foundation.
  */

+#include <linux/platform_data/phy-at803x.h>
 #include <asm/mach-ath79/ath79.h>

 #include "dev-eth.h"
diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
index 8766756..b35bd56 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -1523,6 +1523,7 @@  $(eval $(call SingleProfile,UBNTXM,64kraw,UBNTUNIFI,ubnt-unifi,UBNT-UF,ttyS0,115
 $(eval $(call SingleProfile,UBNTXM,64kraw,UBNTUNIFIOUTDOOR,ubnt-unifi-outdoor,UBNT-U20,ttyS0,115200,XM,BZ,ar7240))
 $(eval $(call SingleProfile,UBNTXM,64kraw,UBNTNANOMXW,ubnt-nano-m-xw,UBNT-NM-XW,ttyS0,115200,XM,XW,ar934x))
 $(eval $(call SingleProfile,UBNTXM,64kraw,UBNTLOCOXW,ubnt-loco-m-xw,UBNT-LOCO-XW,ttyS0,115200,XM,XW,ar934x))
+$(eval $(call SingleProfile,UBNTXM,64kraw,UBNTROCKETMXW,ubnt-rocket-m-xw,UBNT-RM-XW,ttyS0,115200,XM,XW,ar934x))
 $(eval $(call SingleProfile,UBNTXM,64kraw,UBNTAIRGW,ubnt-air-gateway,UBNT-AGW,ttyATH0,115200,XM,AirGW,ar933x))

 $(eval $(call SingleProfile,WHRHPG300N,64kraw,WHRG301N,whr-g301n,WHR-G301N,ttyS0,115200,$$(whrhpg300n_mtdlayout),WHR-G301N))
@@ -1573,7 +1574,7 @@  $(eval $(call MultiProfile,TLWR941,TLWR941NV2 TLWR941NV3 TLWR941NV4 TLWR941NV5 T
 $(eval $(call MultiProfile,TLWR1043,TLWR1043V1 TLWR1043V2))
 $(eval $(call MultiProfile,TLWDR4300,TLWDR3500V1 TLWDR3600V1 TLWDR4300V1 TLWDR4300V1IL TLWDR4310V1 MW4530RV1))
 $(eval $(call MultiProfile,TUBE2H,TUBE2H8M TUBE2H16M))
-$(eval $(call MultiProfile,UBNT,UBNTAIRROUTER UBNTRS UBNTRSPRO UBNTLSSR71 UBNTBULLETM UBNTROCKETM UBNTNANOM UBNTNANOMXW UBNTLOCOXW UBNTUNIFI UBNTUNIFIOUTDOOR UBNTUNIFIOUTDOORPLUS UAPPRO UBNTAIRGW))
+$(eval $(call MultiProfile,UBNT,UBNTAIRROUTER UBNTRS UBNTRSPRO UBNTLSSR71 UBNTBULLETM UBNTROCKETM UBNTNANOM UBNTNANOMXW UBNTLOCOXW UBNTROCKETMXW UBNTUNIFI UBNTUNIFIOUTDOOR UBNTUNIFIOUTDOORPLUS UAPPRO UBNTAIRGW))
 $(eval $(call MultiProfile,WNR612V2,REALWNR612V2 N150R))
 $(eval $(call MultiProfile,WNR1000V2,REALWNR1000V2 WNR1000V2_VC))
 $(eval $(call MultiProfile,WP543,WP543_2M WP543_4M WP543_8M WP543_16M))
diff --git a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
index 2aca064..8612f1d 100644
--- a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
+++ b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
@@ -1,6 +1,6 @@ 
 --- a/arch/mips/ath79/machtypes.h
 +++ b/arch/mips/ath79/machtypes.h
-@@ -16,22 +16,190 @@
+@@ -16,22 +16,191 @@

  enum ath79_mach_type {
  	ATH79_MACH_GENERIC = 0,
@@ -154,6 +154,7 @@ 
  	ATH79_MACH_UBNT_NANO_M, 	/* Ubiquiti NanoStation M */
 +	ATH79_MACH_UBNT_NANO_M_XW, 	/* Ubiquiti NanoStation M XW */
  	ATH79_MACH_UBNT_ROCKET_M,	/* Ubiquiti Rocket M */
++       ATH79_MACH_UBNT_ROCKET_M_XW,    /* Ubiquiti Rocket M XW*/
 +	ATH79_MACH_UBNT_RSPRO,		/* Ubiquiti RouterStation Pro */
 +	ATH79_MACH_UBNT_RS,		/* Ubiquiti RouterStation */
  	ATH79_MACH_UBNT_UAP_PRO,	/* Ubiquiti UniFi AP Pro */
diff --git a/target/linux/ar71xx/patches-3.18/903-MIPS-ath79-add-ubnt-rocket-m-xw-support.patch b/target/linux/ar71xx/patches-3.18/903-MIPS-ath79-add-ubnt-rocket-m-xw-support.patch
new file mode 100644
index 0000000..96aa25f
--- /dev/null
+++ b/target/linux/ar71xx/patches-3.18/903-MIPS-ath79-add-ubnt-rocket-m-xw-support.patch
@@ -0,0 +1,56 @@ 
+--- a/arch/mips/ath79/mach-ubnt-xm.c
++++ b/arch/mips/ath79/mach-ubnt-xm.c
+@@ -16,6 +16,7 @@
+ #include <linux/ath9k_platform.h>
+ #include <linux/etherdevice.h>
+ #include <linux/ar8216_platform.h>
++#include <linux/platform_data/phy-at803x.h>
+
+ #include <asm/mach-ath79/ath79.h>
+ #include <asm/mach-ath79/irq.h>
+@@ -449,12 +450,45 @@
+ 	ath79_register_eth(0);
+ }
+
++static void __init ubnt_rocket_m_xw_setup(void)
++{
++	u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000);
++
++	ath79_register_m25p80(NULL);
++
++	ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_xw_leds_gpio),
++				 ubnt_xw_leds_gpio);
++	ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL,
++                                        ARRAY_SIZE(ubnt_xm_gpio_keys),
++                                        ubnt_xm_gpio_keys);
++
++	ath79_register_wmac(eeprom + UAP_PRO_WMAC_CALDATA_OFFSET, NULL);
++	ap91_pci_init(eeprom + UAP_PRO_PCI_CALDATA_OFFSET, NULL);
++
++	ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0);
++	ath79_init_mac(ath79_eth0_data.mac_addr,
++		       eeprom + UAP_PRO_MAC0_OFFSET, 0);
++
++	ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
++	ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
++	ath79_eth0_data.speed = SPEED_100;
++	ath79_eth0_data.duplex = DUPLEX_FULL;
++
++
++
++
++	ath79_register_eth(0);
++}
++
+ MIPS_MACHINE(ATH79_MACH_UBNT_NANO_M_XW, "UBNT-NM-XW", "Ubiquiti Nanostation M XW",
+ 	     ubnt_nano_m_xw_setup);
+
+ MIPS_MACHINE(ATH79_MACH_UBNT_LOCO_M_XW, "UBNT-LOCO-XW", "Ubiquiti Loco M XW",
+ 	     ubnt_loco_m_xw_setup);
+
++MIPS_MACHINE(ATH79_MACH_UBNT_ROCKET_M_XW, "UBNT-RM-XW", "Ubiquiti Rocket M XW",
++	     ubnt_rocket_m_xw_setup);
++
+ static struct gpio_led ubnt_airgateway_gpio_leds[] __initdata = {
+ 	{
+ 		.name	   = "ubnt:blue:wlan",
--
2.1.4