[LEDE-DEV] [PATCH] This patch adds support for the Netgear WN3000RPv3 N300 repeater.

2017-01-17 Thread hacks
From: Thibaut VARENE 

It uses the same trick as for the EX2700 to pass the Second Part
Magic Check from the bootloader (as described here
https://forum.openwrt.org/viewtopic.php?pid=312577#p312577 )

Specifications:
- SoC: MediaTek MT7620A (580MHz, ramips)
- RAM: 32MB
- Storage: 8MB NOR SPI flash
- Wireless: builtin MT7620A
- Ethernet: 1x100M

Stock firmware is based on OpenWRT Kamikaze snapshot. To install
LEDE, use the factory.bin image. Once LEDE is installed, subsequent
updates can use the sysupgrade.bin image.

Signed-off-by: Thibaut VARENE 
---
 target/linux/ramips/base-files/etc/board.d/01_leds |   3 +-
 .../linux/ramips/base-files/etc/board.d/02_network |   1 +
 target/linux/ramips/base-files/etc/diag.sh |   3 +-
 target/linux/ramips/base-files/lib/ramips.sh   |   3 +
 .../ramips/base-files/lib/upgrade/platform.sh  |   1 +
 target/linux/ramips/dts/WN3000RPV3.dts | 148 +
 target/linux/ramips/image/mt7620.mk|  11 ++
 7 files changed, 168 insertions(+), 2 deletions(-)
 create mode 100644 target/linux/ramips/dts/WN3000RPV3.dts

diff --git a/target/linux/ramips/base-files/etc/board.d/01_leds 
b/target/linux/ramips/base-files/etc/board.d/01_leds
index 3d3aa0a..545d6a4 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -155,7 +155,8 @@ vr500)
 dir-860l-b1)
ucidef_set_led_netdev "wan" "wan" "$board:green:net" "eth0.2"
;;
-ex2700)
+ex2700|\
+wn3000rpv3)
ucidef_set_led_default "power_r" "POWER (red)" "$board:red:power" "0"
set_wifi_led "$board:green:router"
;;
diff --git a/target/linux/ramips/base-files/etc/board.d/02_network 
b/target/linux/ramips/base-files/etc/board.d/02_network
index baf619f..4c94fba 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -58,6 +58,7 @@ ramips_setup_interfaces()
timecloud|\
w150m|\
widora-neo|\
+   wn3000rpv3|\
wnce2001|\
zbt-cpe102|\
zte-q7)
diff --git a/target/linux/ramips/base-files/etc/diag.sh 
b/target/linux/ramips/base-files/etc/diag.sh
index 5367e65..9499833 100644
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -53,7 +53,8 @@ get_status_led() {
jhr-n825r|\
mpr-a1|\
mpr-a2|\
-   mzk-ex750np)
+   mzk-ex750np|\
+   wn3000rpv3)
status_led="$board:red:power"
;;
ac1200pro|\
diff --git a/target/linux/ramips/base-files/lib/ramips.sh 
b/target/linux/ramips/base-files/lib/ramips.sh
index 6afe709..8292da1 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -553,6 +553,9 @@ ramips_board_detect() {
*"WMR-300")
name="wmr-300"
;;
+   *"WN3000RPv3")
+   name="wn3000rpv3"
+   ;;
*"WNCE2001")
name="wnce2001"
;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh 
b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 0f2510c..c6ad8ca 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -157,6 +157,7 @@ platform_check_image() {
wli-tx4-ag300n|\
wlr-6000|\
wmr-300|\
+   wn3000rpv3|\
wnce2001|\
wndr3700v5|\
wr512-3gn|\
diff --git a/target/linux/ramips/dts/WN3000RPV3.dts 
b/target/linux/ramips/dts/WN3000RPV3.dts
new file mode 100644
index 000..8dc4249
--- /dev/null
+++ b/target/linux/ramips/dts/WN3000RPV3.dts
@@ -0,0 +1,148 @@
+/dts-v1/;
+
+#include "mt7620a.dtsi"
+
+#include 
+
+/ {
+   compatible = "ralink,mt7620a-soc";
+   model = "Netgear WN3000RPv3";
+
+   chosen {
+   bootargs = "console=ttyS0,57600";
+   };
+
+   gpio-leds {
+   compatible = "gpio-leds";
+
+   power_g {
+   label = "wn3000rpv3:green:power";
+   gpios = <&gpio0 9 1>;
+   default-state = "on";
+   };
+
+   power_r {
+   label = "wn3000rpv3:red:power";
+   gpios = <&gpio0 11 1>;
+   };
+
+   client_g {
+   label = "wn3000rpv3:green:client";
+   gpios = <&gpio0 13 1>;
+   };
+
+   client_r {
+   label = "wn3000rpv3:red:client";
+   gpios = <&gpio0 10 1>;
+   };
+
+   router_g {
+   label = "wn3000rpv3:green:router";
+   gpios = <&gpio0 12 1>;
+   };
+
+   router_r {
+   label = "wn3000rpv3:red:router";
+   gpios = <&gpio0 14 1>;
+

[LEDE-DEV] [PATCH] ar71xx/ath79: mark soft_config as writeable in mach-rb941.c

2017-01-17 Thread hacks
From: Thibaut VARENE 

This is necessary for rbcfg to work.

Signed-off-by: Thibaut VARENE 
---
 target/linux/ar71xx/files/arch/mips/ath79/mach-rb941.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb941.c 
b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb941.c
index 5a8c7c0..5da950b 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb941.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb941.c
@@ -99,7 +99,6 @@ static struct mtd_partition rb941_spi_partitions[] = {
 .name = "soft_config",
 .offset = RB_SOFT_CFG_OFFSET,
 .size = RB_SOFT_CFG_SIZE,
-.mask_flags = MTD_WRITEABLE,
 }, {
 .name = "rootfs",
 .offset = RB_ROOTFS_OFFSET,
-- 
2.1.4


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH V2] ar71xx: mark soft_config mtd part as writeable for RB-941-2nD

2017-01-18 Thread hacks
From: Thibaut VARENE 

The soft_config partition must be writeable for rbcfg to be able to
enact changes to the routerboot configuration.
The read-only flag was a mistake in the initial patch. Removing it
brings mach-rb941.c in line with all other RB platforms.

Signed-off-by: Thibaut VARENE 
---
 target/linux/ar71xx/files/arch/mips/ath79/mach-rb941.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb941.c 
b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb941.c
index 5a8c7c0..5da950b 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb941.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb941.c
@@ -99,7 +99,6 @@ static struct mtd_partition rb941_spi_partitions[] = {
 .name = "soft_config",
 .offset = RB_SOFT_CFG_OFFSET,
 .size = RB_SOFT_CFG_SIZE,
-.mask_flags = MTD_WRITEABLE,
 }, {
 .name = "rootfs",
 .offset = RB_ROOTFS_OFFSET,
-- 
2.1.4


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH V2] ramips: add support for Netgear WN3000RPv3

2017-01-18 Thread hacks
From: Thibaut VARENE 

This patch adds support for the Netgear WN3000RPv3
http://www.netgear.com/support/product/wn3000rpv3.aspx

Specifications:
- SoC: MediaTek MT7620A (580MHz, ramips)
- RAM: 32MB DDR
- Storage: 8MB NOR SPI flash
- Wireless: builtin MT7620A, 2x2:2 with u.FL connectors
- Ethernet: 1x100M
- Serial: JP1 header, 57600-8N1
- Stock firmware based on OpenWRT Kamikaze

Like the EX2700, the bootloader expects a secondary image signature,
see https://forum.openwrt.org/viewtopic.php?pid=312577#p312577
This is why the same fakeroot image is used for the WN3000

Signed-off-by: Thibaut VARENE 
---
 target/linux/ramips/base-files/etc/board.d/01_leds |   3 +-
 .../linux/ramips/base-files/etc/board.d/02_network |   1 +
 target/linux/ramips/base-files/etc/diag.sh |   3 +-
 target/linux/ramips/base-files/lib/ramips.sh   |   3 +
 .../ramips/base-files/lib/upgrade/platform.sh  |   1 +
 target/linux/ramips/dts/WN3000RPV3.dts | 143 +
 target/linux/ramips/image/mt7620.mk|  11 ++
 7 files changed, 163 insertions(+), 2 deletions(-)
 create mode 100644 target/linux/ramips/dts/WN3000RPV3.dts

diff --git a/target/linux/ramips/base-files/etc/board.d/01_leds 
b/target/linux/ramips/base-files/etc/board.d/01_leds
index 3d3aa0a..545d6a4 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -155,7 +155,8 @@ vr500)
 dir-860l-b1)
ucidef_set_led_netdev "wan" "wan" "$board:green:net" "eth0.2"
;;
-ex2700)
+ex2700|\
+wn3000rpv3)
ucidef_set_led_default "power_r" "POWER (red)" "$board:red:power" "0"
set_wifi_led "$board:green:router"
;;
diff --git a/target/linux/ramips/base-files/etc/board.d/02_network 
b/target/linux/ramips/base-files/etc/board.d/02_network
index baf619f..4c94fba 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -58,6 +58,7 @@ ramips_setup_interfaces()
timecloud|\
w150m|\
widora-neo|\
+   wn3000rpv3|\
wnce2001|\
zbt-cpe102|\
zte-q7)
diff --git a/target/linux/ramips/base-files/etc/diag.sh 
b/target/linux/ramips/base-files/etc/diag.sh
index 5367e65..9499833 100644
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -53,7 +53,8 @@ get_status_led() {
jhr-n825r|\
mpr-a1|\
mpr-a2|\
-   mzk-ex750np)
+   mzk-ex750np|\
+   wn3000rpv3)
status_led="$board:red:power"
;;
ac1200pro|\
diff --git a/target/linux/ramips/base-files/lib/ramips.sh 
b/target/linux/ramips/base-files/lib/ramips.sh
index 6afe709..8292da1 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -553,6 +553,9 @@ ramips_board_detect() {
*"WMR-300")
name="wmr-300"
;;
+   *"WN3000RPv3")
+   name="wn3000rpv3"
+   ;;
*"WNCE2001")
name="wnce2001"
;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh 
b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 0f2510c..c6ad8ca 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -157,6 +157,7 @@ platform_check_image() {
wli-tx4-ag300n|\
wlr-6000|\
wmr-300|\
+   wn3000rpv3|\
wnce2001|\
wndr3700v5|\
wr512-3gn|\
diff --git a/target/linux/ramips/dts/WN3000RPV3.dts 
b/target/linux/ramips/dts/WN3000RPV3.dts
new file mode 100644
index 000..deebfd0
--- /dev/null
+++ b/target/linux/ramips/dts/WN3000RPV3.dts
@@ -0,0 +1,143 @@
+/* This file is released into the public domain */
+
+/dts-v1/;
+
+#include "mt7620a.dtsi"
+
+#include 
+#include 
+
+/ {
+   compatible = "ralink,mt7620a-soc";
+   model = "Netgear WN3000RPv3";
+
+   chosen {
+   bootargs = "console=ttyS0,57600";
+   };
+
+   gpio-leds {
+   compatible = "gpio-leds";
+
+   power_g {
+   label = "wn3000rpv3:green:power";
+   gpios = <&gpio0 9 GPIO_ACTIVE_LOW>;
+   default-state = "on";
+   };
+
+   power_r {
+   label = "wn3000rpv3:red:power";
+   gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
+   };
+
+   client_g {
+   label = "wn3000rpv3:green:client";
+   gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
+   };
+
+   client_r {
+   label = "wn3000rpv3:red:client";
+   gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
+   };
+
+   router_g {
+   label = "wn3000rpv3:green:router";
+   gpios = <&gpio0

[LEDE-DEV] [PATCH 3/3] ar71xx: Add preliminary support for several SPI NOR MikroTik RB devices

2017-02-05 Thread hacks
From: Thibaut VARENE 

This patch adds preliminary support for the following devices
- RouterBOARD cAP
- RouterBOARD cAP lite
- RouterBOARD hAP
- RouterBOARD mAP
- RouterBOARD wAP

These devices apparently all share the same QCA953x / 16MB SPI NOR platform.

This patch will provide basic hardware initialization:
- WLAN will be initialized
- All PHYs will be connected to the internal switch and be assigned to "eth0"

It is impossible to flash LEDE directly from the RouterOS upgrade interface.
Instead, one must first boot an initramfs image and then flash LEDE (via
sysupgrade).

Thus, even by providing incomplete support, it is impossible to brick these
devices. If the image boots, the users can then log into the device and report
useful information to improve support (GPIOs, additional devices, etc).

Signed-off-by: Thibaut VARENE 
---
 target/linux/ar71xx/base-files/etc/board.d/02_network |  1 +
 target/linux/ar71xx/base-files/lib/ar71xx.sh  |  3 +++
 target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt |  5 +
 target/linux/ar71xx/files/arch/mips/ath79/mach-rbxap.c| 11 +++
 target/linux/ar71xx/files/arch/mips/ath79/machtypes.h |  5 +
 5 files changed, 25 insertions(+)

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 639ae55..7cc9e3a 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/02_network
+++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
@@ -90,6 +90,7 @@ ar71xx_setup_interfaces()
rb-911g-5hpnd|\
rb-912uag-2hpnd|\
rb-912uag-5hpnd|\
+   rb-generic|\
rb-mapl-2nd|\
rb-sxt2n|\
rb-sxt5n|\
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh 
b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 7c249c5..c448d01 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -877,6 +877,9 @@ ar71xx_board_detect() {
*"RouterBOARD SXT Lite5")
name="rb-sxt5n"
;;
+   *"RouterBOARD"*)
+   name="rb-generic"
+   ;;
*"Rocket M")
name="rocket-m"
ubnt_xm_board_detect
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt 
b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
index 1be6799..026e7a4 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
@@ -917,6 +917,11 @@ config ATH79_MACH_RBXAP
  Say 'Y' here if you want your kernel to support the
  MikroTik RouterBOARD mAP lite
  MikroTik RouterBOARD hAP lite
+ MikroTik RouterBOARD hAP (EXPERIMENTAL)
+ MikroTik RouterBOARD cAP (EXPERIMENTAL)
+ MikroTik RouterBOARD cAP lite (EXPERIMENTAL)
+ MikroTik RouterBOARD mAP (EXPERIMENTAL)
+ MikroTik RouterBOARD wAP (EXPERIMENTAL)
 
 config ATH79_MACH_RBSXTLITE
bool "MikroTik RouterBOARD SXT Lite"
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-rbxap.c 
b/target/linux/ar71xx/files/arch/mips/ath79/mach-rbxap.c
index ffdb785..62288fd 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-rbxap.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-rbxap.c
@@ -233,5 +233,16 @@ static void __init rbhapl_setup(void)
rbmapl_gpio_keys);
 }
 
+/* Provide basic initialization for "supportable" but untested hardware. */
+static void __init rbxap_generic_setup(void)
+{
+   rbxap_setup(1);
+}
+
 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", rbxap_generic_setup);
+MIPS_MACHINE_NONAME(ATH79_MACH_RB_WAP, "wap-hb", rbxap_generic_setup);
+MIPS_MACHINE_NONAME(ATH79_MACH_RB_CAPL, "cap-hb", rbxap_generic_setup);
+MIPS_MACHINE_NONAME(ATH79_MACH_RB_CAP, "cm2n", rbxap_generic_setup);
+MIPS_MACHINE_NONAME(ATH79_MACH_RB_MAP2, "map2-hb", rbxap_generic_setup);
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h 
b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
index 1e161de..58e711d 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
+++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
@@ -168,9 +168,14 @@ enum ath79_mach_type {
ATH79_MACH_RB_941,  /* MikroTik RouterBOARD 941-2nD 
*/
ATH79_MACH_RB_951G, /* Mikrotik RouterBOARD 951G */
ATH79_MACH_RB_951U, /* Mikrotik RouterBOARD 
951Ui-2HnD */
+   ATH79_MACH_RB_952,  /* Mikrotik RouterBOARD 
951Ui-2nD */
+   ATH79_MACH_RB_CAP,  /* MikroTik RouterBOARD cAP-2nD 
*/
+   ATH79_MACH_RB_CAPL, /* MikroTik RouterBOARD 
cAPL-2nD */
ATH79_MACH_RB_MAPL, /* Mikrotik RouterBOARD mAP 

[LEDE-DEV] [PATCH 1/3] ar71xx: add support for RB mAP L-2nD

2017-02-05 Thread hacks
From: Thibaut VARENE 

This patch adds support for the MikroTik RouterBOARD mAP lite
https://routerboard.com/RBmAPL-2nD

Specifications:
- SoC: Qualcomm QCA9533 (650MHz)
- RAM: 64MB
- Storage: 16MB NOR SPI flash
- Wireless: builtin QCA9533, 2x2:2
- Ethernet: 1x100M

This is another 16M SPI NOR mikrotik device. The machine file is named
mach-rbxap.c because I plan to add support for most of the other "AP"
RouterBOARD devices in subsequent patches: they share most of the hardware
and thus the same codebase.

Signed-off-by: Thibaut VARENE 
---
 target/linux/ar71xx/base-files/etc/board.d/01_leds |   5 +
 .../linux/ar71xx/base-files/etc/board.d/02_network |   1 +
 target/linux/ar71xx/base-files/etc/diag.sh |   3 +-
 target/linux/ar71xx/base-files/lib/ar71xx.sh   |   3 +
 .../ar71xx/base-files/lib/upgrade/platform.sh  |   7 +-
 target/linux/ar71xx/config-4.4 |   1 +
 .../ar71xx/files/arch/mips/ath79/Kconfig.openwrt   |  13 ++
 target/linux/ar71xx/files/arch/mips/ath79/Makefile |   1 +
 .../ar71xx/files/arch/mips/ath79/mach-rbxap.c  | 209 +
 .../linux/ar71xx/files/arch/mips/ath79/machtypes.h |   1 +
 target/linux/ar71xx/image/mikrotik.mk  |   9 +-
 target/linux/ar71xx/mikrotik/config-default|   1 +
 12 files changed, 250 insertions(+), 4 deletions(-)
 create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-rbxap.c

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 b1ecb02..c52f822 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/01_leds
+++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds
@@ -228,6 +228,11 @@ rb-2011uias-2hnd)
ucidef_set_led_switch "eth9" "ETH9" "rb:green:eth9" "switch1" "0x04"
ucidef_set_led_switch "eth10" "ETH10" "rb:green:eth10" "switch1" "0x02"
;;
+rb-mapl-2nd)
+   ucidef_set_led_default "power" "POWER" "rb:green:power" "1"
+   ucidef_set_led_netdev "lan" "LAN" "rb:green:eth" "eth0"
+   ucidef_set_led_wlan "wlan" "WLAN" "rb:green:wlan" "phy0tpt"
+   ;;
 dap-2695-a1)
ucidef_set_led_default "power" "POWER" "d-link:green:power" "1"
ucidef_set_led_default "diag" "DIAG" "d-link:red:power" "0"
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 976440e..639ae55 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/02_network
+++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
@@ -90,6 +90,7 @@ ar71xx_setup_interfaces()
rb-911g-5hpnd|\
rb-912uag-2hpnd|\
rb-912uag-5hpnd|\
+   rb-mapl-2nd|\
rb-sxt2n|\
rb-sxt5n|\
re450|\
diff --git a/target/linux/ar71xx/base-files/etc/diag.sh 
b/target/linux/ar71xx/base-files/etc/diag.sh
index edcf621..c7f377e 100644
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -289,7 +289,8 @@ get_status_led() {
rb-911g-5hpacd|\
rb-911g-5hpnd|\
rb-912uag-2hpnd|\
-   rb-912uag-5hpnd)
+   rb-912uag-5hpnd|\
+   rb-mapl-2nd)
status_led="rb:green:user"
;;
rb-951ui-2hnd | rb-941-2nd)
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh 
b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 3ca2c0d..7c249c5 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -868,6 +868,9 @@ ar71xx_board_detect() {
*"RouterBOARD 2011UiAS-2HnD")
name="rb-2011uias-2hnd"
;;
+   *"RouterBOARD mAP L-2nD")
+   name="rb-mapl-2nd"
+   ;;
*"RouterBOARD SXT Lite2")
name="rb-sxt2n"
;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh 
b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index cf2aab2..17469b9 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() {
pb42|\
pb44|\
rb-941-2nd|\
+   rb-mapl-2nd|\
routerstation-pro|\
routerstation|\
wp543|\
@@ -609,7 +610,8 @@ platform_pre_upgrade() {
local board=$(ar71xx_board_name)
 
case "$board" in
-   rb-941-2nd)
+   rb-941-2nd|\
+   rb-mapl-2nd)
;;
rb*|\
c-60|\
@@ -645,7 +647,8 @@ platform_do_upgrade() {
local board=$(ar71xx_board_name)
 
case "$board" in
-   rb-941-2nd)
+   rb-941-2nd|\
+   rb-mapl-2nd)
PLATFORM_DO_UPGRADE_COMBINED_SEPARATE_MTD=1
platform_do_upgrade_combined "$ARGV"
;;
diff --git a/target/linux/ar71xx/config-4.4 b/target/linux/ar71xx/config-4.4
index 8ba0c2a..20f1f0b 100644
--- a/target/linux/ar71xx/config-4.4
+++ b/target/linux/ar71xx/config-4.4
@@ -148,6 +148,7 @@ C

[LEDE-DEV] [PATCH 2/3] ar71xx: provide support for RB-941-2nD via mach-rbxap.c

2017-02-05 Thread hacks
From: Thibaut VARENE 

This patch implements support for the hAP lite in mach-rbxap.c
hAP lite was supported via mach-rb941.c, so this file is removed
as well as the corresponding build bits.

Signed-off-by: Thibaut VARENE 
---
 target/linux/ar71xx/config-4.4 |   1 -
 .../ar71xx/files/arch/mips/ath79/Kconfig.openwrt   |  11 +-
 .../ar71xx/files/arch/mips/ath79/mach-rb941.c  | 173 -
 .../ar71xx/files/arch/mips/ath79/mach-rbxap.c  |  28 
 target/linux/ar71xx/image/mikrotik.mk  |   9 +-
 target/linux/ar71xx/mikrotik/config-default|   1 -
 6 files changed, 30 insertions(+), 193 deletions(-)
 delete mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-rb941.c

diff --git a/target/linux/ar71xx/config-4.4 b/target/linux/ar71xx/config-4.4
index 20f1f0b..1fb1bd6 100644
--- a/target/linux/ar71xx/config-4.4
+++ b/target/linux/ar71xx/config-4.4
@@ -146,7 +146,6 @@ CONFIG_ATH79_MACH_R6100=y
 # CONFIG_ATH79_MACH_RB750 is not set
 # CONFIG_ATH79_MACH_RB91X is not set
 # CONFIG_ATH79_MACH_RB922 is not set
-# CONFIG_ATH79_MACH_RB941 is not set
 # CONFIG_ATH79_MACH_RB95X is not set
 # CONFIG_ATH79_MACH_RBXAP is not set
 # CONFIG_ATH79_MACH_RBSXTLITE 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 0378fed..1be6799 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
@@ -885,16 +885,6 @@ config ATH79_MACH_RB922
select ATH79_ROUTERBOOT
select RLE_DECOMPRESS
 
-config ATH79_MACH_RB941
-   bool "MikroTik RouterBOARD 941-2nd support"
-   select SOC_QCA953X
-   select ATH79_DEV_ETH
-   select ATH79_DEV_GPIO_BUTTONS
-   select ATH79_DEV_LEDS_GPIO
-   select ATH79_DEV_M25P80
-   select ATH79_DEV_WMAC
-   select ATH79_ROUTERBOOT
-
 config ATH79_MACH_RB95X
bool "MikroTik RouterBOARD 95X support"
select SOC_AR934X
@@ -926,6 +916,7 @@ config ATH79_MACH_RBXAP
help
  Say 'Y' here if you want your kernel to support the
  MikroTik RouterBOARD mAP lite
+ MikroTik RouterBOARD hAP lite
 
 config ATH79_MACH_RBSXTLITE
bool "MikroTik RouterBOARD SXT Lite"
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb941.c 
b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb941.c
deleted file mode 100644
index 5da950b..000
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb941.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- *  MikroTik RouterBOARD 941-2nD support
- *
- *  Copyright (C) 2016 Sergey Sergeev 
- *
- *  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 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-//#include 
-#include 
-
-#include 
-#include 
-#include 
-
-#include "common.h"
-#include "dev-ap9x-pci.h"
-#include "dev-eth.h"
-#include "dev-spi.h"
-#include "dev-gpio-buttons.h"
-#include "dev-leds-gpio.h"
-#include "dev-m25p80.h"
-//#include "dev-usb.h"
-#include "dev-wmac.h"
-#include "machtypes.h"
-#include "routerboot.h"
-
-#define RB941_GPIO_LED_ACT  14
-#define RB941_GPIO_BTN_RESET16
-
-#define RB941_KEYS_POLL_INTERVAL 20 /* msecs */
-#define RB941_KEYS_DEBOUNCE_INTERVAL (3 * RB941_KEYS_POLL_INTERVAL)
-
-#define RB_ROUTERBOOT_OFFSET0x
-#define RB_ROUTERBOOT_SIZE  0xe000
-#define RB_HARD_CFG_OFFSET  0xe000
-#define RB_HARD_CFG_SIZE0x1000
-#define RB_BIOS_OFFSET  0xf000
-#define RB_BIOS_SIZE0x1000
-#define RB_ROUTERBOOT2_OFFSET   0x1
-#define RB_ROUTERBOOT2_SIZE 0xf000
-#define RB_SOFT_CFG_OFFSET  0x1f000
-#define RB_SOFT_CFG_SIZE0x1000
-#define RB_ROOTFS_OFFSET0x2
-#define RB_ROOTFS_SIZE  0x9e
-#define RB_KERNEL_OFFSET0xa0
-#define RB_KERNEL_SIZE  MTDPART_SIZ_FULL
-
-void __init rb941_wlan_init(void)
-{
-char *art_buf;
-u8 wlan_mac[ETH_ALEN];
-
-art_buf = rb_get_wlan_data();
-if (art_buf == NULL)
-return;
-
-ath79_init_mac(wlan_mac, ath79_mac_base, 11);
-ath79_register_wmac(art_buf + 0x1000, wlan_mac);
-
-kfree(art_buf);
-}
-
-static struct mtd_partition rb941_spi_partitions[] = {
-{
-.name = "routerboot",
-.offset = RB_ROUTERBOOT_OFFSET,
-.mask_flags = MTD_WRITEABLE,
-.size = RB_ROUTERBOOT_SIZE,
-}, {
-.name = "hard_config",
-.offset = RB_HARD_CFG_OFFSET,
-.size = RB_HARD_CFG_SIZE,
-.mask_flags = MTD_WRITEABLE,
-}, {
-.name = "bios",
-.offset = RB_BIOS_OFFSET,
-.size = RB_BIOS_SIZE,
-.mask_flags = MTD_WRITEABLE,
-}, {
-.name = "routerboot2",
- 

[LEDE-DEV] [PATCH v2 2/3] ar71xx: provide support for RB-941-2nD via mach-rbxap.c

2017-02-05 Thread hacks
From: Thibaut VARENE 

This patch implements support for the hAP lite in mach-rbxap.c
hAP lite was supported via mach-rb941.c, so this file is removed
as well as the corresponding build bits.

v2 fixes WLAN MAC offset and a comment grammar issue.

Signed-off-by: Thibaut VARENE 
---
 target/linux/ar71xx/config-4.4 |   1 -
 .../ar71xx/files/arch/mips/ath79/Kconfig.openwrt   |  11 +-
 .../ar71xx/files/arch/mips/ath79/mach-rb941.c  | 173 -
 .../ar71xx/files/arch/mips/ath79/mach-rbxap.c  |  28 
 target/linux/ar71xx/image/mikrotik.mk  |   9 +-
 target/linux/ar71xx/mikrotik/config-default|   1 -
 6 files changed, 30 insertions(+), 193 deletions(-)
 delete mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-rb941.c

diff --git a/target/linux/ar71xx/config-4.4 b/target/linux/ar71xx/config-4.4
index 20f1f0b..1fb1bd6 100644
--- a/target/linux/ar71xx/config-4.4
+++ b/target/linux/ar71xx/config-4.4
@@ -146,7 +146,6 @@ CONFIG_ATH79_MACH_R6100=y
 # CONFIG_ATH79_MACH_RB750 is not set
 # CONFIG_ATH79_MACH_RB91X is not set
 # CONFIG_ATH79_MACH_RB922 is not set
-# CONFIG_ATH79_MACH_RB941 is not set
 # CONFIG_ATH79_MACH_RB95X is not set
 # CONFIG_ATH79_MACH_RBXAP is not set
 # CONFIG_ATH79_MACH_RBSXTLITE 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 0378fed..1be6799 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
@@ -885,16 +885,6 @@ config ATH79_MACH_RB922
select ATH79_ROUTERBOOT
select RLE_DECOMPRESS
 
-config ATH79_MACH_RB941
-   bool "MikroTik RouterBOARD 941-2nd support"
-   select SOC_QCA953X
-   select ATH79_DEV_ETH
-   select ATH79_DEV_GPIO_BUTTONS
-   select ATH79_DEV_LEDS_GPIO
-   select ATH79_DEV_M25P80
-   select ATH79_DEV_WMAC
-   select ATH79_ROUTERBOOT
-
 config ATH79_MACH_RB95X
bool "MikroTik RouterBOARD 95X support"
select SOC_AR934X
@@ -926,6 +916,7 @@ config ATH79_MACH_RBXAP
help
  Say 'Y' here if you want your kernel to support the
  MikroTik RouterBOARD mAP lite
+ MikroTik RouterBOARD hAP lite
 
 config ATH79_MACH_RBSXTLITE
bool "MikroTik RouterBOARD SXT Lite"
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb941.c 
b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb941.c
deleted file mode 100644
index 5da950b..000
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb941.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- *  MikroTik RouterBOARD 941-2nD support
- *
- *  Copyright (C) 2016 Sergey Sergeev 
- *
- *  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 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-//#include 
-#include 
-
-#include 
-#include 
-#include 
-
-#include "common.h"
-#include "dev-ap9x-pci.h"
-#include "dev-eth.h"
-#include "dev-spi.h"
-#include "dev-gpio-buttons.h"
-#include "dev-leds-gpio.h"
-#include "dev-m25p80.h"
-//#include "dev-usb.h"
-#include "dev-wmac.h"
-#include "machtypes.h"
-#include "routerboot.h"
-
-#define RB941_GPIO_LED_ACT  14
-#define RB941_GPIO_BTN_RESET16
-
-#define RB941_KEYS_POLL_INTERVAL 20 /* msecs */
-#define RB941_KEYS_DEBOUNCE_INTERVAL (3 * RB941_KEYS_POLL_INTERVAL)
-
-#define RB_ROUTERBOOT_OFFSET0x
-#define RB_ROUTERBOOT_SIZE  0xe000
-#define RB_HARD_CFG_OFFSET  0xe000
-#define RB_HARD_CFG_SIZE0x1000
-#define RB_BIOS_OFFSET  0xf000
-#define RB_BIOS_SIZE0x1000
-#define RB_ROUTERBOOT2_OFFSET   0x1
-#define RB_ROUTERBOOT2_SIZE 0xf000
-#define RB_SOFT_CFG_OFFSET  0x1f000
-#define RB_SOFT_CFG_SIZE0x1000
-#define RB_ROOTFS_OFFSET0x2
-#define RB_ROOTFS_SIZE  0x9e
-#define RB_KERNEL_OFFSET0xa0
-#define RB_KERNEL_SIZE  MTDPART_SIZ_FULL
-
-void __init rb941_wlan_init(void)
-{
-char *art_buf;
-u8 wlan_mac[ETH_ALEN];
-
-art_buf = rb_get_wlan_data();
-if (art_buf == NULL)
-return;
-
-ath79_init_mac(wlan_mac, ath79_mac_base, 11);
-ath79_register_wmac(art_buf + 0x1000, wlan_mac);
-
-kfree(art_buf);
-}
-
-static struct mtd_partition rb941_spi_partitions[] = {
-{
-.name = "routerboot",
-.offset = RB_ROUTERBOOT_OFFSET,
-.mask_flags = MTD_WRITEABLE,
-.size = RB_ROUTERBOOT_SIZE,
-}, {
-.name = "hard_config",
-.offset = RB_HARD_CFG_OFFSET,
-.size = RB_HARD_CFG_SIZE,
-.mask_flags = MTD_WRITEABLE,
-}, {
-.name = "bios",
-.offset = RB_BIOS_OFFSET,
-.size = RB_BIOS_SIZE,
-.mask_flags = MTD_WRIT