[OpenWrt-Devel] Current status of support for RB953GS-5HnT-RP
Alexander Rumyankov
alex at rumyankovs.com
Mon Oct 29 07:38:23 EDT 2018
Hi David,
Please see the patch against openwrt-18.06.
You can compile and upgrade the device using common Mikrotik procedure
(boot from initframs image and use sysupgrade).
SFPs and PCI1 need some more work.
Gui, thanks for your initial code, I've just made ethernet and nand (copy
paste from rb922) working.
diff --git a/target/linux/ar71xx/base-files/etc/board.d/02_network
b/target/linux/ar71xx/base-files/etc/board.d/02_network
index 87b8dba..f06dacf 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/02_network
+++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
@@ -207,6 +207,7 @@ ar71xx_setup_interfaces()
rb-750gl|\
rb-751g|\
rb-951g-2hnd|\
+ rb-953gs-5hnt|\
rb-962uigs-5hact2hnt|\
wlr8100|\
wzr-hp-g450h)
diff --git a/target/linux/ar71xx/base-files/etc/diag.sh
b/target/linux/ar71xx/base-files/etc/diag.sh
index 4eb2abb..a7b3c9a 100644
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -374,6 +374,7 @@ get_status_led() {
rb-941-2nd|\
rb-951ui-2nd|\
rb-952ui-5ac2nd|\
+ rb-953gs-5hnt|\
rb-962uigs-5hact2hnt|\
rb-lhg-5nd|\
rb-map-2nd|\
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh
b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 3af2eee..00a919b 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -1082,6 +1082,9 @@ ar71xx_board_detect() {
*"RouterBOARD 952Ui-5ac2nD")
name="rb-952ui-5ac2nd"
;;
+ *"RouterBOARD 953GS-5HnT")
+ name="rb-953gs-5hnt"
+ ;;
*"RouterBOARD 962UiGS-5HacT2HnT")
name="rb-962uigs-5hact2hnt"
;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
old mode 100755
new mode 100644
index ca1270b..61b5707
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -556,6 +556,7 @@ platform_check_image() {
rb-921gs-5hpacd-r2|\
rb-951g-2hnd|\
rb-951ui-2hnd|\
+ rb-953gs-5hnt|\
rb-2011l|\
rb-2011il|\
rb-2011ils|\
@@ -858,6 +859,7 @@ platform_do_upgrade() {
rb-921gs-5hpacd-r2|\
rb-951g-2hnd|\
rb-951ui-2hnd|\
+ rb-953gs-5hnt|\
rb-2011il|\
rb-2011ils|\
rb-2011l|\
diff --git a/target/linux/ar71xx/config-4.9 b/target/linux/ar71xx/config-4.9
index 8aa0b41..eccb3ac 100644
--- a/target/linux/ar71xx/config-4.9
+++ b/target/linux/ar71xx/config-4.9
@@ -175,6 +175,7 @@ CONFIG_ATH79=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_RBSPI is not set
# CONFIG_ATH79_MACH_RBSXTLITE is not set
# CONFIG_ATH79_MACH_RE355 is not set
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
index e7655b3..40474f7 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
@@ -1127,6 +1127,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 8800a7d..b874317 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Makefile
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
@@ -187,6 +187,7 @@ obj-$(CONFIG_ATH79_MACH_RB91X) += mach-rb91x.o
obj-$(CONFIG_ATH79_MACH_RB922) += mach-rb922.o
obj-$(CONFIG_ATH79_MACH_RB941) += mach-rb941.o
obj-$(CONFIG_ATH79_MACH_RB95X) += mach-rb95x.o
+obj-$(CONFIG_ATH79_MACH_RB953GS) += mach-rb953.o
obj-$(CONFIG_ATH79_MACH_RBSPI) += mach-rbspi.o
obj-$(CONFIG_ATH79_MACH_RBSXTLITE) += mach-rbsxtlite.o
obj-$(CONFIG_ATH79_MACH_RE355) += mach-re450.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..4f03c72
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb953.c
@@ -0,0 +1,321 @@
+/*
+ * MikroTik RouterBOARD 953GS support
+ *
+ * Copyright (C) 2018 Alexander Rumyankov <alex at rumyankovs.com>
+ * Copyright (C) 2015 Gabor Juhos <juhosg at openwrt.org>
+ *
+ * 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/phy.h>
+#include <linux/delay.h>
+#include <linux/platform_device.h>
+#include <linux/ath9k_platform.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/nand.h>
+#include <linux/mtd/partitions.h>
+#include <linux/spi/spi.h>
+#include <linux/spi/flash.h>
+#include <linux/routerboot.h>
+#include <linux/gpio.h>
+#include <linux/ar8216_platform.h>
+#include <linux/platform_data/phy-at803x.h>
+#include <linux/version.h>
+
+#include <asm/prom.h>
+#include <asm/mach-ath79/ath79.h>
+#include <asm/mach-ath79/ar71xx_regs.h>
+
+#include "common.h"
+#include "dev-gpio-buttons.h"
+#include "dev-eth.h"
+#include "dev-leds-gpio.h"
+#include "dev-m25p80.h"
+#include "dev-nfc.h"
+#include "dev-usb.h"
+#include "dev-spi.h"
+#include "dev-wmac.h"
+#include "machtypes.h"
+#include "pci.h"
+#include "routerboot.h"
+
+#define RB953GS_GPIO_NAND_NCE 23
+#define RB953GS_WMAC_CALDATA_OFFSET 0x1000
+
+#define RB_ROUTERBOOT_OFFSET 0x0000
+#define RB_ROUTERBOOT_MIN_SIZE 0xb000
+#define RB_HARD_CFG_SIZE 0x1000
+#define RB_BIOS_OFFSET 0xd000
+#define RB_BIOS_SIZE 0x1000
+#define RB_SOFT_CFG_OFFSET 0xf000
+#define RB_SOFT_CFG_SIZE 0x1000
+
+static struct mtd_partition rb953gs_spi_partitions[] = {
+ {
+ .name = "routerboot",
+ .offset = RB_ROUTERBOOT_OFFSET,
+ .mask_flags = MTD_WRITEABLE,
+ }, {
+ .name = "hard_config",
+ .size = RB_HARD_CFG_SIZE,
+ .mask_flags = MTD_WRITEABLE,
+ }, {
+ .name = "bios",
+ .offset = RB_BIOS_OFFSET,
+ .size = RB_BIOS_SIZE,
+ .mask_flags = MTD_WRITEABLE,
+ }, {
+ .name = "soft_config",
+ .size = RB_SOFT_CFG_SIZE,
+ }
+};
+
+static struct flash_platform_data rb953gs_spi_flash_data = {
+ .parts = rb953gs_spi_partitions,
+ .nr_parts = ARRAY_SIZE(rb953gs_spi_partitions),
+};
+
+static void __init rb953gs_init_partitions(const struct rb_info *info)
+{
+ rb953gs_spi_partitions[0].size = info->hard_cfg_offs;
+ rb953gs_spi_partitions[1].offset = info->hard_cfg_offs;
+ rb953gs_spi_partitions[3].offset = info->soft_cfg_offs;
+}
+
+static const struct ar8327_led_info rb953gs_leds_ar8327[] = {
+ AR8327_LED_INFO(PHY0_0, HW, "rb:green:port1"),
+ AR8327_LED_INFO(PHY1_0, HW, "rb:green:port2"),
+ AR8327_LED_INFO(PHY2_0, HW, "rb:green:port3"),
+ AR8327_LED_INFO(PHY3_0, HW, "rb:green:port4"),
+ AR8327_LED_INFO(PHY4_0, HW, "rb:green:port5"),
+};
+
+static struct ar8327_pad_cfg rb953gs_ar8327_pad0_cfg = {
+ .mode = AR8327_PAD_MAC_RGMII,
+ .txclk_delay_en = true,
+ .rxclk_delay_en = true,
+ .txclk_delay_sel = AR8327_CLK_DELAY_SEL1,
+ .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2,
+ .mac06_exchange_dis = true,
+};
+
+static struct ar8327_pad_cfg rb953gs_ar8327_pad6_cfg = {
+ /* Use SGMII interface for GMAC6 of the AR8337 switch */
+ .mode = AR8327_PAD_MAC_SGMII,
+ .rxclk_delay_en = true,
+ .rxclk_delay_sel = AR8327_CLK_DELAY_SEL0,
+};
+
+static struct ar8327_led_cfg rb953gs_ar8327_led_cfg = {
+ .led_ctrl0 = 0xc737c737,
+ .led_ctrl1 = 0x00000000,
+ .led_ctrl2 = 0x00000000,
+ .led_ctrl3 = 0x0030c300,
+ .open_drain = false,
+};
+
+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,
+ },
+ .led_cfg = &rb953gs_ar8327_led_cfg,
+ .num_leds = ARRAY_SIZE(rb953gs_leds_ar8327),
+ .leds = rb953gs_leds_ar8327,
+};
+
+static struct mdio_board_info rb953gs_mdio0_info[] = {
+ {
+ .bus_id = "ag71xx-mdio.0",
+ .phy_addr = 0,
+ .platform_data = &rb953gs_ar8327_data,
+ },
+};
+
+static void rb953gs_nand_select_chip(int chip_no)
+{
+ switch (chip_no) {
+ case 0:
+ gpio_set_value(RB953GS_GPIO_NAND_NCE, 0);
+ break;
+ default:
+ gpio_set_value(RB953GS_GPIO_NAND_NCE, 1);
+ break;
+ }
+ ndelay(500);
+}
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0)
+static struct nand_ecclayout rb953gs_nand_ecclayout = {
+ .eccbytes = 6,
+ .eccpos = { 8, 9, 10, 13, 14, 15 },
+ .oobavail = 9,
+ .oobfree = { { 0, 4 }, { 6, 2 }, { 11, 2 }, { 4, 1 } }
+};
+
+#else
+
+static int rb953gs_ooblayout_ecc(struct mtd_info *mtd, int section,
+ struct mtd_oob_region *oobregion)
+{
+ switch (section) {
+ case 0:
+ oobregion->offset = 8;
+ oobregion->length = 3;
+ return 0;
+ case 1:
+ oobregion->offset = 13;
+ oobregion->length = 3;
+ return 0;
+ default:
+ return -ERANGE;
+ }
+}
+
+static int rb953gs_ooblayout_free(struct mtd_info *mtd, int section,
+ struct mtd_oob_region *oobregion)
+{
+ switch (section) {
+ case 0:
+ oobregion->offset = 0;
+ oobregion->length = 4;
+ return 0;
+ case 1:
+ oobregion->offset = 4;
+ oobregion->length = 1;
+ return 0;
+ case 2:
+ oobregion->offset = 6;
+ oobregion->length = 2;
+ return 0;
+ case 3:
+ oobregion->offset = 11;
+ oobregion->length = 2;
+ return 0;
+ default:
+ return -ERANGE;
+ }
+}
+
+static const struct mtd_ooblayout_ops rb953gs_nand_ecclayout_ops = {
+ .ecc = rb953gs_ooblayout_ecc,
+ .free = rb953gs_ooblayout_free,
+};
+#endif /* < 4.6 */
+
+static int rb953gs_nand_scan_fixup(struct mtd_info *mtd)
+{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0)
+ struct nand_chip *chip = mtd->priv;
+#else
+ struct nand_chip *chip = mtd_to_nand(mtd);
+#endif /* < 4.6.0 */
+
+ if (mtd->writesize == 512) {
+ /*
+ * Use the OLD Yaffs-1 OOB layout, otherwise RouterBoot
+ * will not be able to find the kernel that we load.
+ */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0)
+ chip->ecc.layout = &rb953gs_nand_ecclayout;
+#else
+ mtd_set_ooblayout(mtd, &rb953gs_nand_ecclayout_ops);
+#endif
+ }
+
+ chip->options = NAND_NO_SUBPAGE_WRITE;
+
+ return 0;
+}
+
+static struct mtd_partition rb953gs_nand_partitions[] = {
+ {
+ .name = "booter",
+ .offset = 0,
+ .size = (256 * 1024),
+ .mask_flags = MTD_WRITEABLE,
+ },
+ {
+ .name = "kernel",
+ .offset = (256 * 1024),
+ .size = (4 * 1024 * 1024) - (256 * 1024),
+ },
+ {
+ .name = "ubi",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = MTDPART_SIZ_FULL,
+ },
+};
+
+static void __init rb953gs_nand_init(void)
+{
+ gpio_request_one(RB953GS_GPIO_NAND_NCE, GPIOF_OUT_INIT_HIGH, "NAND nCE");
+
+ ath79_nfc_set_scan_fixup(rb953gs_nand_scan_fixup);
+ ath79_nfc_set_parts(rb953gs_nand_partitions,
+ ARRAY_SIZE(rb953gs_nand_partitions));
+ ath79_nfc_set_select_chip(rb953gs_nand_select_chip);
+ ath79_nfc_set_swap_dma(true);
+ ath79_register_nfc();
+}
+
+static void __init rb953gs_setup(void)
+{
+ const struct rb_info *info;
+ char *art_buf;
+ u8 wlan_mac[ETH_ALEN];
+
+
+ info = rb_init_info((void *) KSEG1ADDR(0x1f000000), 0x10000);
+ if (!info)
+ return;
+
+ art_buf = rb_get_wlan_data();
+ if (art_buf == NULL)
+ return;
+
+ rb953gs_init_partitions(info);
+
+ ath79_register_m25p80(&rb953gs_spi_flash_data);
+
+ rb953gs_nand_init();
+
+ ath79_register_mdio(0, 0x0);
+
+ mdiobus_register_board_info(rb953gs_mdio0_info,
+ ARRAY_SIZE(rb953gs_mdio0_info));
+
+ ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN);
+
+ ath79_eth0_pll_data.pll_1000 = 0x82000101;
+ ath79_eth0_pll_data.pll_100 = 0x80000101;
+ ath79_eth0_pll_data.pll_10 = 0x80001313;
+
+ ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0);
+ 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);
+
+ ath79_init_mac(wlan_mac, ath79_mac_base, 5);
+ ath79_register_wmac(art_buf + 0x1000, wlan_mac);
+
+ ath79_register_pci();
+ ath79_register_usb();
+}
+
+MIPS_MACHINE(ATH79_MACH_RB_953GS, "953gs", "MikroTik RouterBOARD
953GS-5HnT", 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 390ec0b..189529d 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
+++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
@@ -217,6 +217,7 @@ enum ath79_mach_type {
ATH79_MACH_RB_951G, /* Mikrotik RouterBOARD 951G */
ATH79_MACH_RB_951U, /* Mikrotik RouterBOARD 951Ui-2HnD */
ATH79_MACH_RB_952, /* MikroTik RouterBOARD 951Ui-2nD / 952Ui-5ac2nD */
+ ATH79_MACH_RB_953GS, /* Mikrotik RouterBOARD 953GS-5HnT-RP */
ATH79_MACH_RB_962, /* MikroTik RouterBOARD 962UiGS-5HacT2HnT */
ATH79_MACH_RB_CAP, /* Mikrotik RouterBOARD cAP2nD */
ATH79_MACH_RB_LHG5, /* Mikrotik RouterBOARD LHG5 */
diff --git a/target/linux/ar71xx/image/mikrotik.mk
b/target/linux/ar71xx/image/mikrotik.mk
index dc0066d..a2d3465 100644
--- a/target/linux/ar71xx/image/mikrotik.mk
+++ b/target/linux/ar71xx/image/mikrotik.mk
@@ -29,7 +29,7 @@ define Device/nand-large-ac
DEVICE_TITLE := MikroTik RouterBoard (>= 128 MB NAND, 802.11ac)
DEVICE_PACKAGES += kmod-ath10k ath10k-firmware-qca988x
KERNEL := kernel-bin | kernel2minor -s 2048 -e -c
- SUPPORTED_DEVICES := rb-921gs-5hpacd-r2
+ SUPPORTED_DEVICES := rb-921gs-5hpacd-r2 rb-953gs-5hnt
endef
TARGET_DEVICES += nand-large-ac
diff --git a/target/linux/ar71xx/mikrotik/config-default
b/target/linux/ar71xx/mikrotik/config-default
index e324e4c..7cc4602 100644
--- a/target/linux/ar71xx/mikrotik/config-default
+++ b/target/linux/ar71xx/mikrotik/config-default
@@ -13,6 +13,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_RBSPI=y
CONFIG_ATH79_MACH_RBSXTLITE=y
CONFIG_ATH79_PCI_ATH9K_FIXUP=y
--
2.8.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20181029/fb63f399/attachment.htm>
-------------- next part --------------
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list