aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux
diff options
context:
space:
mode:
authorThibaut VARÈNE <hacks@slashdirt.org>2018-07-29 12:15:00 +0200
committerJohn Crispin <john@phrozen.org>2018-07-30 10:35:11 +0200
commit091e915d994ff77a2677266e9e8cc831a7091deb (patch)
treec5a269c74743919dbbb2154529f81356bf66f423 /target/linux
parent5c2419b6f82e2ec49ecac17ae17fdbdb151701c7 (diff)
downloadupstream-091e915d994ff77a2677266e9e8cc831a7091deb.tar.gz
upstream-091e915d994ff77a2677266e9e8cc831a7091deb.tar.bz2
upstream-091e915d994ff77a2677266e9e8cc831a7091deb.zip
ar71xx: improve MikroTik wAP R support
81d446b045176e3e25bb0ef74e3d060b51a0a353 introduced incomplete support for this device. This patch attempts to correct the situation based on OEM source code. LED1-3 are GSM mode on OFW (2G/3G/4G) hence unassigned here. Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org> Tested-by: David Ehrmann <ehrmann@gmail.com>
Diffstat (limited to 'target/linux')
-rwxr-xr-xtarget/linux/ar71xx/base-files/etc/board.d/01_leds3
-rw-r--r--target/linux/ar71xx/base-files/etc/diag.sh3
-rw-r--r--target/linux/ar71xx/files/arch/mips/ath79/mach-rbspi.c63
3 files changed, 67 insertions, 2 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 11299dcb92..b0f4975e5c 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/01_leds
+++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds
@@ -680,6 +680,9 @@ rb-wap-2nd)
ucidef_set_led_timer "user" "USER" "rb:green:user" "1000" "1000"
ucidef_set_led_wlan "wlan" "WLAN" "rb:green:wlan" "phy0tpt"
;;
+rb-wapr-2nd)
+ ucidef_set_led_wlan "wlan" "WLAN" "rb:green:user" "phy0tpt"
+ ;;
re355|\
re450)
ucidef_set_led_netdev "lan_data" "LAN Data" "$board:green:lan_data" "eth0" "tx rx"
diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
index efb1305aec..129df16097 100644
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -376,7 +376,8 @@ get_status_led() {
rb-lhg-5nd|\
rb-map-2nd|\
rb-mapl-2nd|\
- rb-wap-2nd)
+ rb-wap-2nd|\
+ rb-wapr-2nd)
status_led="rb:green:user"
;;
rb-951ui-2hnd)
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 4aff7df55b..cff69092c4 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-rbspi.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-rbspi.c
@@ -594,6 +594,36 @@ static struct gpio_led rb931_leds[] __initdata = {
},
};
+/* RB wAP R-2nD (wAP R) gpios*/
+#define RBWAPR_GPIO_LED_USER 14
+#define RBWAPR_GPIO_LED1 12
+#define RBWAPR_GPIO_LED2 13
+#define RBWAPR_GPIO_LED3 3
+#define RBWAPR_GPIO_PCIE_PWROFF 15
+#define RBWAPR_GPIO_CONTROL 10
+#define RBWAPR_GPIO_BTN_RESET 16
+
+static struct gpio_led rbwapr_leds[] __initdata = {
+ {
+ .name = "rb:green:user",
+ .gpio = RBWAPR_GPIO_LED_USER,
+ .active_low = 0,
+ },{
+ .name = "rb:green:led1",
+ .gpio = RBWAPR_GPIO_LED1,
+ .active_low = 1,
+ },{
+ .name = "rb:green:led2",
+ .gpio = RBWAPR_GPIO_LED2,
+ .active_low = 1,
+ },{
+ .name = "rb:green:led3",
+ .gpio = RBWAPR_GPIO_LED3,
+ .active_low = 0,
+ },
+};
+
+
static struct gen_74x164_chip_platform_data rbspi_ssr_data = {
.base = RBSPI_SSR_GPIO_BASE,
.num_registers = 1,
@@ -1170,6 +1200,37 @@ static void __init rb931_setup(void)
rb931_gpio_keys);
}
+/*
+ * Init the wAP R hardware.
+ * The wAP R-2nD has a single ethernet port and a mini PCIe slot.
+ * The OEM source shows it has usb (used over PCIe for LTE devices),
+ * and the 'control' GPIO is assumed to be an output pin not tied to an LED.
+ */
+static void __init rbwapr_setup(void)
+{
+ u32 flags = RBSPI_HAS_WLAN0 | RBSPI_HAS_USB | RBSPI_HAS_PCI;
+
+ if (!rbspi_platform_setup())
+ return;
+
+ rbspi_peripherals_setup(flags);
+
+ /* GMAC1 is HW MAC, WLAN0 MAC is HW MAC + 1 */
+ rbspi_network_setup(flags, 0, 1, 0);
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(rbwapr_leds), rbwapr_leds);
+
+ gpio_request_one(RBWAPR_GPIO_PCIE_PWROFF, GPIOF_OUT_INIT_HIGH |
+ GPIOF_ACTIVE_LOW | GPIOF_EXPORT_DIR_FIXED,
+ "PCIE power off");
+
+ gpio_request_one(RBWAPR_GPIO_CONTROL, GPIOF_OUT_INIT_LOW |
+ GPIOF_ACTIVE_LOW | GPIOF_EXPORT_DIR_FIXED,
+ "control");
+
+ rbspi_register_reset_button(RBWAPR_GPIO_BTN_RESET);
+}
+
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_911L, "911L", rb911l_setup);
@@ -1178,7 +1239,7 @@ MIPS_MACHINE_NONAME(ATH79_MACH_RB_962, "962", rb962_setup);
MIPS_MACHINE_NONAME(ATH79_MACH_RB_750UPR2, "750-hb", rb750upr2_setup);
MIPS_MACHINE_NONAME(ATH79_MACH_RB_LHG5, "lhg", rblhg_setup);
MIPS_MACHINE_NONAME(ATH79_MACH_RB_WAP, "wap-hb", rbwap_setup);
-MIPS_MACHINE_NONAME(ATH79_MACH_RB_WAPR, "wap-lte", rbwap_setup);
+MIPS_MACHINE_NONAME(ATH79_MACH_RB_WAPR, "wap-lte", rbwapr_setup);
MIPS_MACHINE_NONAME(ATH79_MACH_RB_CAP, "cap-hb", rbcap_setup);
MIPS_MACHINE_NONAME(ATH79_MACH_RB_MAP, "map2-hb", rbmap_setup);
MIPS_MACHINE_NONAME(ATH79_MACH_RB_WAPAC, "wapg-sc", rbwapgsc_setup);