[source] ar71xx: add support for RB750UPr2
LEDE Commits
lede-commits at lists.infradead.org
Wed Feb 15 02:29:10 PST 2017
nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/19f42663d294cfd00770e7c6a9048772e074789d
commit 19f42663d294cfd00770e7c6a9048772e074789d
Author: Thibaut VARENE <hacks at slashdirt.org>
AuthorDate: Thu Feb 9 22:50:08 2017 +0100
ar71xx: add support for RB750UPr2
This patch adds support for the MikroTik RouterBOARD hEX PoE lite
https://routerboard.com/RB750UPr2
Specifications:
- SoC: Qualcomm QCA9531 (650MHz)
- RAM: 64MB
- Storage: 16MB NOR SPI flash
- Ethernet: 5x100M (1 PoE in, 1 PoE out)
- USB: Type A
This ethernet router is based on the same platform as the wireless router hAP.
Signed-off-by: Thibaut VARENE <hacks at slashdirt.org>
---
target/linux/ar71xx/base-files/etc/board.d/01_leds | 8 +++
.../linux/ar71xx/base-files/etc/board.d/02_network | 1 +
.../ar71xx/base-files/etc/board.d/03_gpio_switches | 1 +
target/linux/ar71xx/base-files/etc/diag.sh | 1 +
target/linux/ar71xx/base-files/lib/ar71xx.sh | 3 +
.../ar71xx/base-files/lib/upgrade/platform.sh | 3 +
.../ar71xx/files/arch/mips/ath79/Kconfig.openwrt | 1 +
.../ar71xx/files/arch/mips/ath79/mach-rbspi.c | 68 ++++++++++++++++------
.../linux/ar71xx/files/arch/mips/ath79/machtypes.h | 1 +
9 files changed, 68 insertions(+), 19 deletions(-)
diff --git a/target/linux/ar71xx/base-files/etc/board.d/01_leds b/target/linux/ar71xx/base-files/etc/board.d/01_leds
index 403715c..c2129ea 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/01_leds
+++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds
@@ -222,6 +222,14 @@ rb-750)
ucidef_set_led_switch "port4" "port4" "rb750:green:port4" "switch0" "0x04"
ucidef_set_led_switch "port5" "port5" "rb750:green:port5" "switch0" "0x02"
;;
+rb-750up-r2)
+ ucidef_set_led_timer "user" "USER" "rb:green:user" "1000" "1000"
+ ucidef_set_led_netdev "port1" "port1" "rb:green:port1" "eth0"
+ ucidef_set_led_switch "port2" "port2" "rb:green:port2" "switch0" "0x10"
+ ucidef_set_led_switch "port3" "port2" "rb:green:port3" "switch0" "0x08"
+ ucidef_set_led_switch "port4" "port3" "rb:green:port4" "switch0" "0x04"
+ ucidef_set_led_switch "port5" "port5" "rb:green:port5" "switch0" "0x02"
+ ;;
rb-941-2nd)
ucidef_set_led_timer "user" "USR/ACT" "rb:green:user" "1000" "1000"
;;
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 721c01c..4f7ddac 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/02_network
+++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
@@ -136,6 +136,7 @@ ar71xx_setup_interfaces()
om2p-hsv4|\
pb42|\
pb44|\
+ rb-750up-r2|\
rb-951ui-2hnd|\
rb-951ui-2nd|\
routerstation|\
diff --git a/target/linux/ar71xx/base-files/etc/board.d/03_gpio_switches b/target/linux/ar71xx/base-files/etc/board.d/03_gpio_switches
index e76c9be..4bb319c 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/03_gpio_switches
+++ b/target/linux/ar71xx/base-files/etc/board.d/03_gpio_switches
@@ -27,6 +27,7 @@ rb-912uag-2hpnd|\
rb-912uag-5hpnd)
ucidef_add_gpio_switch "usb_power_switch" "USB Power Switch" "52" "1"
;;
+rb-750up-r2|\
rb-951ui-2nd)
ucidef_add_gpio_switch "usb_power_switch" "USB Power Switch" "45" "1"
ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "14"
diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
index 5f52389..3a75e10 100644
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -293,6 +293,7 @@ get_status_led() {
rb-750)
status_led="rb750:green:act"
;;
+ rb-750up-r2|\
rb-911g-2hpnd|\
rb-911g-5hpacd|\
rb-911g-5hpnd|\
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index a798398..f4e5441 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -838,6 +838,9 @@ ar71xx_board_detect() {
*"RouterBOARD 750GL")
name="rb-750gl"
;;
+ *"RouterBOARD 750UP r2")
+ name="rb-750up-r2"
+ ;;
*"RouterBOARD 751")
name="rb-751"
;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index b18e87e..1105254 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -343,6 +343,7 @@ platform_check_image() {
ls-sr71|\
pb42|\
pb44|\
+ rb-750up-r2|\
rb-941-2nd|\
rb-951ui-2nd|\
rb-mapl-2nd|\
@@ -617,6 +618,7 @@ platform_pre_upgrade() {
local board=$(ar71xx_board_name)
case "$board" in
+ rb-750up-r2|\
rb-941-2nd|\
rb-951ui-2nd|\
rb-mapl-2nd)
@@ -655,6 +657,7 @@ platform_do_upgrade() {
local board=$(ar71xx_board_name)
case "$board" in
+ rb-750up-r2|\
rb-941-2nd|\
rb-951ui-2nd|\
rb-mapl-2nd)
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
index ef22aea..3f43471 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
@@ -929,6 +929,7 @@ config ATH79_MACH_RBSPI
MikroTik RouterBOARD mAP lite
MikroTik RouterBOARD hAP lite
MikroTik RouterBOARD hAP
+ MikroTik RouterBOARD hEX PoE lite
config ATH79_MACH_RBSXTLITE
bool "MikroTik RouterBOARD SXT Lite"
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-rbspi.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-rbspi.c
index 8f8a4f5..81659ef 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-rbspi.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-rbspi.c
@@ -4,6 +4,7 @@
* - MikroTik RouterBOARD mAP L-2nD
* - MikroTik RouterBOARD 941L-2nD
* - MikroTik RouterBOARD 951Ui-2nD
+ * - MikroTik RouterBOARD 750UP r2
*
* Copyright (C) 2017 Thibaut VARENE <varenet at parisc-linux.org>
*
@@ -45,6 +46,7 @@
#define RBSPI_HAS_WLAN BIT(1)
#define RBSPI_HAS_WAN4 BIT(2) /* has WAN port on PHY4 */
#define RBSPI_HAS_SSR BIT(3) /* has an SSR on SPI bus 0 */
+#define RBSPI_HAS_POE BIT(4)
#define RB_ROUTERBOOT_OFFSET 0x0000
#define RB_BIOS_SIZE 0x1000
@@ -419,6 +421,37 @@ static void __init rbhapl_setup(void)
}
/*
+ * The hAP, hEX lite and hEX PoE lite share the same platform
+ */
+static void __init rbspi_952_750r2_setup(u32 flags)
+{
+ if (flags & RBSPI_HAS_SSR)
+ rbspi_spi_cs_gpios[1] = RB952_GPIO_SSR_CS;
+
+ rbspi_peripherals_setup(flags);
+
+ /* GMAC1 is HW MAC + 1, WLAN MAC IS HW MAC + 5 */
+ rbspi_network_setup(flags, 1, 5);
+
+ if (flags & RBSPI_HAS_USB)
+ gpio_request_one(RB952_GPIO_USB_POWER,
+ GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
+ "USB power");
+
+ if (flags & RBSPI_HAS_POE)
+ gpio_request_one(RB952_GPIO_POE_POWER,
+ GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
+ "POE power");
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(rb952_leds), rb952_leds);
+
+ /* These devices have a single reset button as gpio 16 */
+ ath79_register_gpio_keys_polled(-1, RBSPI_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(rbspi_gpio_keys_reset16),
+ rbspi_gpio_keys_reset16);
+}
+
+/*
* Init the hAP hardware.
* The 951Ui-2nD (hAP) has 5 ethernet ports, with ports 2-5 being assigned
* to LAN on the casing, and port 1 being assigned to "internet" (WAN).
@@ -430,34 +463,31 @@ static void __init rbhapl_setup(void)
static void __init rb952_setup(void)
{
u32 flags = RBSPI_HAS_WLAN | RBSPI_HAS_WAN4 | RBSPI_HAS_USB |
- RBSPI_HAS_SSR;
+ RBSPI_HAS_SSR | RBSPI_HAS_POE;
if (rbspi_platform_setup())
return;
- rbspi_spi_cs_gpios[1] = RB952_GPIO_SSR_CS;
-
- rbspi_peripherals_setup(flags);
-
- /* GMAC1 is HW MAC + 1, WLAN MAC IS HW MAC + 5 */
- rbspi_network_setup(flags, 1, 5);
-
- gpio_request_one(RB952_GPIO_USB_POWER,
- GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
- "USB power");
+ rbspi_952_750r2_setup(flags);
+}
- gpio_request_one(RB952_GPIO_POE_POWER,
- GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
- "POE power");
+/*
+ * Init the hEX PoE lite hardware.
+ * The 750UP r2 (hEX PoE lite) is nearly identical to the hAP, only without
+ * WLAN.
+ */
+static void __init rb750upr2_setup(void)
+{
+ u32 flags = RBSPI_HAS_WAN4 | RBSPI_HAS_USB |
+ RBSPI_HAS_SSR | RBSPI_HAS_POE;
- ath79_register_leds_gpio(-1, ARRAY_SIZE(rb952_leds), rb952_leds);
+ if (rbspi_platform_setup())
+ return;
- /* hAP has a single reset button as gpio 16 */
- ath79_register_gpio_keys_polled(-1, RBSPI_KEYS_POLL_INTERVAL,
- ARRAY_SIZE(rbspi_gpio_keys_reset16),
- rbspi_gpio_keys_reset16);
+ rbspi_952_750r2_setup(flags);
}
MIPS_MACHINE_NONAME(ATH79_MACH_RB_MAPL, "map-hb", rbmapl_setup);
MIPS_MACHINE_NONAME(ATH79_MACH_RB_941, "H951L", rbhapl_setup);
MIPS_MACHINE_NONAME(ATH79_MACH_RB_952, "952-hb", rb952_setup);
+MIPS_MACHINE_NONAME(ATH79_MACH_RB_750UPR2, "750-hb", rb750upr2_setup);
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
index 2df4eda..a8fc07a 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
+++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
@@ -167,6 +167,7 @@ enum ath79_mach_type {
ATH79_MACH_RB_711GR100, /* Mikrotik RouterBOARD 911/912 boards */
ATH79_MACH_RB_750, /* MikroTik RouterBOARD 750 */
ATH79_MACH_RB_750G_R3, /* MikroTik RouterBOARD 750GL */
+ ATH79_MACH_RB_750UPR2, /* MikroTik RouterBOARD 750UP r2 */
ATH79_MACH_RB_751, /* MikroTik RouterBOARD 751 */
ATH79_MACH_RB_751G, /* Mikrotik RouterBOARD 751G */
ATH79_MACH_RB_922GS, /* Mikrotik RouterBOARD 911/922GS boards */
More information about the lede-commits
mailing list