From: Thibaut VARENE Date: Thu, 9 Feb 2017 21:50:08 +0000 (+0100) Subject: ar71xx: add support for RB750UPr2 X-Git-Tag: v18.06.0-rc1~3600 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=19f42663d294cfd00770e7c6a9048772e074789d;p=openwrt%2Fstaging%2Fchunkeey.git 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 --- 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 403715c002..c2129ea5f6 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 721c01c6a4..4f7ddacaca 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 e76c9be68a..4bb319c937 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 5f52389c8b..3a75e1080c 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 a79839864c..f4e54415ae 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 b18e87eec7..1105254483 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 ef22aea348..3f4347106f 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 8f8a4f5a11..81659ef503 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 * @@ -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 @@ -418,6 +420,37 @@ static void __init rbhapl_setup(void) rbspi_gpio_keys_reset16); } +/* + * 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 @@ -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 2df4eda5ca..a8fc07a1c3 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 */