[LEDE-DEV] [PATCH v2] ar71xx: add initial support for RB953GS-5HnT-RP

Gui Iribarren gui at altermundi.net
Mon Jan 9 05:36:18 PST 2017


Add board support, no userspace files yet.

Tested over TFTP, ethernet is not yet working
(the 3 switch ports report link status, but eth0 is not the switch)
Both miniPCIe slots are confirmed working, including their status LEDs
Not tested: reset button, USB port, SFP cages, AR9558 radio.

Signed-off-by: Gui Iribarren <gui at altermundi.net>
---
Changelog v2:
 * enable serial console during LEDE boot on board "953gs"

Regarding the ethernet ports, it looks like the SGMII/RGMII interfaces
are connected differently than in the AP135 reference board, so
while the switch is working, it does not communicate with the CPU

 target/linux/ar71xx/config-4.4                     |   1 +
 .../ar71xx/files/arch/mips/ath79/Kconfig.openwrt   |  12 +++
 target/linux/ar71xx/files/arch/mips/ath79/Makefile |   1 +
 .../ar71xx/files/arch/mips/ath79/mach-rb953.c      | 114 +++++++++++++++++++++
 .../linux/ar71xx/files/arch/mips/ath79/machtypes.h |   1 +
 target/linux/ar71xx/mikrotik/config-default        |   1 +
 .../701-MIPS-ath79-add-routerboard-detection.patch |  11 +-
 7 files changed, 137 insertions(+), 4 deletions(-)
 create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-rb953.c

diff --git a/target/linux/ar71xx/config-4.4 b/target/linux/ar71xx/config-4.4
index 4b2f736..5a64cce 100644
--- a/target/linux/ar71xx/config-4.4
+++ b/target/linux/ar71xx/config-4.4
@@ -144,6 +144,7 @@ CONFIG_ATH79_MACH_R6100=y
 # CONFIG_ATH79_MACH_RB91X is not set
 # CONFIG_ATH79_MACH_RB922 is not set
 # CONFIG_ATH79_MACH_RB95X is not set
+# CONFIG_ATH79_MACH_RB953GS is not set
 # CONFIG_ATH79_MACH_RBSXTLITE is not set
 CONFIG_ATH79_MACH_RE450=y
 CONFIG_ATH79_MACH_RW2458N=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
index 21d6b51..00f2d33 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
@@ -869,6 +869,18 @@ config ATH79_MACH_RB95X
        select ATH79_DEV_USB
        select ATH79_ROUTERBOOT
 
+config ATH79_MACH_RB953GS
+	bool "MikroTik RouterBOARD 953GS support"
+	select SOC_QCA955X
+	select ATH79_DEV_ETH
+	select ATH79_DEV_GPIO_BUTTONS
+	select ATH79_DEV_LEDS_GPIO
+	select ATH79_DEV_NFC
+	select ATH79_DEV_SPI
+	select ATH79_DEV_USB
+	select ATH79_DEV_WMAC
+	select ATH79_ROUTERBOOT
+
 config ATH79_MACH_RB2011
 	bool "MikroTik RouterBOARD 2011 support"
 	select SOC_AR934X
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Makefile b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
index 6384c06..d7cf8e4 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Makefile
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
@@ -148,6 +148,7 @@ obj-$(CONFIG_ATH79_MACH_RB750)			+= mach-rb750.o
 obj-$(CONFIG_ATH79_MACH_RB91X)			+= mach-rb91x.o
 obj-$(CONFIG_ATH79_MACH_RB922)			+= mach-rb922.o
 obj-$(CONFIG_ATH79_MACH_RB95X)			+= mach-rb95x.o
+obj-$(CONFIG_ATH79_MACH_RB953GS)		+= mach-rb953.o
 obj-$(CONFIG_ATH79_MACH_RBSXTLITE)		+= mach-rbsxtlite.o
 obj-$(CONFIG_ATH79_MACH_RE450)			+= mach-re450.o
 obj-$(CONFIG_ATH79_MACH_RW2458N)		+= mach-rw2458n.o
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb953.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb953.c
new file mode 100644
index 0000000..bb81cf1
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb953.c
@@ -0,0 +1,114 @@
+/*
+ *  MikroTik RouterBOARD 953GS-5HnT-RP support
+ *
+ *  Copyright (C) 2016 Gui Iribarren <gui at altermundi.net>
+ *
+ * Based on the Qualcomm Atheros AP135/RB953 reference board support code
+ *   Copyright (c) 2012 Qualcomm Atheros
+ *
+ *  This program is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License version 2 as published
+ *  by the Free Software Foundation.
+ */
+
+#include <linux/platform_device.h>
+#include <linux/ar8216_platform.h>
+
+#include <asm/mach-ath79/ar71xx_regs.h>
+
+#include "common.h"
+#include "pci.h"
+#include "dev-ap9x-pci.h"
+#include "dev-eth.h"
+#include "dev-m25p80.h"
+#include "dev-nfc.h"
+#include "dev-usb.h"
+#include "dev-wmac.h"
+#include "machtypes.h"
+
+#define RB953_MAC0_OFFSET		0
+#define RB953_MAC1_OFFSET		6
+#define RB953_WMAC_CALDATA_OFFSET	0x1000
+#define RB953_PCIE_CALDATA_OFFSET	0x5000
+
+static struct ar8327_pad_cfg rb953gs_ar8327_pad0_cfg;
+static struct ar8327_pad_cfg rb953gs_ar8327_pad6_cfg;
+
+static struct ar8327_platform_data rb953gs_ar8327_data = {
+	.pad0_cfg = &rb953gs_ar8327_pad0_cfg,
+	.pad6_cfg = &rb953gs_ar8327_pad6_cfg,
+	.port0_cfg = {
+		.force_link = 1,
+		.speed = AR8327_PORT_SPEED_1000,
+		.duplex = 1,
+		.txpause = 1,
+		.rxpause = 1,
+	},
+	.port6_cfg = {
+		.force_link = 1,
+		.speed = AR8327_PORT_SPEED_1000,
+		.duplex = 1,
+		.txpause = 1,
+		.rxpause = 1,
+	},
+};
+
+static struct mdio_board_info rb953gs_mdio0_info[] = {
+	{
+		.bus_id = "ag71xx-mdio.0",
+		.phy_addr = 0,
+		.platform_data = &rb953gs_ar8327_data,
+	},
+};
+
+static void __init rb953gs_setup(void)
+{
+	u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
+
+	/* GMAC0 of the AR8327 switch is connected to GMAC1 via SGMII */
+	rb953gs_ar8327_pad0_cfg.mode = AR8327_PAD_MAC_SGMII;
+	rb953gs_ar8327_pad0_cfg.sgmii_delay_en = true;
+
+	/* GMAC6 of the AR8327 switch is connected to GMAC0 via RGMII */
+	rb953gs_ar8327_pad6_cfg.mode = AR8327_PAD_MAC_RGMII;
+	rb953gs_ar8327_pad6_cfg.txclk_delay_en = true;
+	rb953gs_ar8327_pad6_cfg.rxclk_delay_en = true;
+	rb953gs_ar8327_pad6_cfg.txclk_delay_sel = AR8327_CLK_DELAY_SEL1;
+	rb953gs_ar8327_pad6_cfg.rxclk_delay_sel = AR8327_CLK_DELAY_SEL2;
+
+	ath79_eth0_pll_data.pll_1000 = 0x56000000;
+	ath79_eth1_pll_data.pll_1000 = 0x03000101;
+
+	ath79_register_m25p80(NULL);
+
+	ath79_register_usb();
+	ath79_register_nfc();
+
+	ath79_register_wmac(art + RB953_WMAC_CALDATA_OFFSET, NULL);
+
+	ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN);
+
+	ath79_register_mdio(0, 0x0);
+	ath79_init_mac(ath79_eth0_data.mac_addr, art + RB953_MAC0_OFFSET, 0);
+
+	mdiobus_register_board_info(rb953gs_mdio0_info,
+				    ARRAY_SIZE(rb953gs_mdio0_info));
+
+	/* GMAC0 is connected to the RMGII interface */
+	ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
+	ath79_eth0_data.phy_mask = BIT(0);
+	ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
+
+	ath79_register_eth(0);
+
+	/* GMAC1 is connected tot eh SGMII interface */
+	ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII;
+	ath79_eth1_data.speed = SPEED_1000;
+	ath79_eth1_data.duplex = DUPLEX_FULL;
+
+	ath79_register_eth(1);
+
+	ath79_register_pci();
+}
+
+MIPS_MACHINE(ATH79_MACH_RB_953GS, "953gs", "MikroTik RouterBOARD 953GS-5HnT-RP", rb953gs_setup);
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
index 9402185..d8c6373 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
+++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
@@ -164,6 +164,7 @@ enum ath79_mach_type {
 	ATH79_MACH_RB_922GS,			/* Mikrotik RouterBOARD 911/922GS boards */
 	ATH79_MACH_RB_951G,			/* Mikrotik RouterBOARD 951G */
 	ATH79_MACH_RB_951U,			/* Mikrotik RouterBOARD 951Ui-2HnD */
+	ATH79_MACH_RB_953GS,			/* Mikrotik RouterBOARD 953GS-5HnT-RP */
 	ATH79_MACH_RB_SXTLITE2ND,		/* Mikrotik RouterBOARD SXT Lite 2nD */
 	ATH79_MACH_RB_SXTLITE5ND,		/* Mikrotik RouterBOARD SXT Lite 5nD */
 	ATH79_MACH_RE450,			/* TP-LINK RE450 */
diff --git a/target/linux/ar71xx/mikrotik/config-default b/target/linux/ar71xx/mikrotik/config-default
index e33e741..1f01c33 100644
--- a/target/linux/ar71xx/mikrotik/config-default
+++ b/target/linux/ar71xx/mikrotik/config-default
@@ -67,6 +67,7 @@ CONFIG_ATH79_MACH_RB750=y
 CONFIG_ATH79_MACH_RB91X=y
 CONFIG_ATH79_MACH_RB922=y
 CONFIG_ATH79_MACH_RB95X=y
+CONFIG_ATH79_MACH_RB953GS=y
 CONFIG_ATH79_MACH_RBSXTLITE=y
 # CONFIG_ATH79_MACH_RE450 is not set
 # CONFIG_ATH79_MACH_RW2458N is not set
diff --git a/target/linux/ar71xx/patches-4.4/701-MIPS-ath79-add-routerboard-detection.patch b/target/linux/ar71xx/patches-4.4/701-MIPS-ath79-add-routerboard-detection.patch
index 77bf38c..c031858 100644
--- a/target/linux/ar71xx/patches-4.4/701-MIPS-ath79-add-routerboard-detection.patch
+++ b/target/linux/ar71xx/patches-4.4/701-MIPS-ath79-add-routerboard-detection.patch
@@ -1,6 +1,8 @@
---- a/arch/mips/ath79/prom.c
-+++ b/arch/mips/ath79/prom.c
-@@ -136,6 +136,16 @@ void __init prom_init(void)
+Index: linux-4.4.40/arch/mips/ath79/prom.c
+===================================================================
+--- linux-4.4.40.orig/arch/mips/ath79/prom.c
++++ linux-4.4.40/arch/mips/ath79/prom.c
+@@ -136,6 +136,17 @@ void __init prom_init(void)
  		initrd_end = initrd_start + fw_getenvl("initrd_size");
  	}
  #endif
@@ -12,7 +14,8 @@
 +	    strstr(arcs_cmdline, "board=951G") ||
 +	    strstr(arcs_cmdline, "board=2011L") ||
 +	    strstr(arcs_cmdline, "board=711Gr100") ||
-+	    strstr(arcs_cmdline, "board=922gs"))
++	    strstr(arcs_cmdline, "board=922gs") ||
++	    strstr(arcs_cmdline, "board=953gs"))
 +		ath79_prom_append_cmdline("console", "ttyS0,115200");
  }
  
-- 
2.1.4



More information about the Lede-dev mailing list