gluon/patches/openwrt/0016-ramips-add-support-for-Netgear-R6120.patch

272 lines
6.9 KiB
Diff

From: Ludwig Thomeczek <ledesrc@wxorx.net>
Date: Tue, 12 Jun 2018 21:17:23 +0200
Subject: ramips: add support for Netgear R6120
This patch adds support for the Netgear R6120, aka Netgear AC1200.
Specification:
- SoC: MediaTek MT7628 (580 MHz)
- Flash: 16 MiB
- RAM: 64 MiB
- Wireless: 2.4Ghz(builtin) and 5Ghz (MT7612E)
- LAN speed: 10/100
- LAN ports: 4
- WAN speed: 10/100
- WAN ports: 1
- Serial baud rate of Bootloader and factory firmware: 57600
To flash use nmrpflash with the provided factory.img.
Flashing via webinterface will not work, for now.
Signed-off-by: Ludwig Thomeczek <ledesrc@wxorx.net>
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 19386b9e139a25fd1ac29cd9a66b738b5b092cdf..4203773b4fa3ec771f07b7a8c414a416a0da0f20 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -301,6 +301,11 @@ mzk-ex750np)
na930)
set_usb_led "$boardname:blue:status"
;;
+netgear,r6120)
+ ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch0" "0x0f"
+ ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch0" "0x10"
+ ucidef_set_led_wlan "wlan2g" "WiFi 2.4GHz" "$boardname:green:wlan2g" "phy0tpt"
+ ;;
newifi-d1)
set_usb_led "$boardname:red:status"
;;
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 1c6cc6b0af745b43b81bbfffc9b5462c1b88defc..9424c7ddfd64f9149a24ff91e63b71990265d211 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -301,6 +301,10 @@ ramips_setup_interfaces()
"0:lan" "1:lan" "2:lan" "3:lan" "6t@eth0"
ucidef_set_interface_wan "usb0"
;;
+ netgear,r6120)
+ ucidef_add_switch "switch0" \
+ "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan" "6@eth0"
+ ;;
mzk-dp150n|\
vocore-8M|\
vocore-16M)
diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh
index 6d021b6def2f1fe7b71a67f36749c440f3bad1d4..097cc6df569518f64dbfd641eeccc1a4b1b37a2b 100644
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -38,6 +38,7 @@ get_status_led() {
mzk-w300nh2|\
nbg-419n|\
nbg-419n2|\
+ netgear,r6120|\
pwh2004|\
r6220|\
tplink,c20-v4|\
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 8055853508fc850a1826166c7e0cbdf443df27cb..7213b22d0c2734488bd96bc34e921f08649b8c2f 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -129,6 +129,7 @@ platform_check_image() {
psr-680w|\
px-4885-4M|\
px-4885-8M|\
+ netgear,r6120|\
rb750gr3|\
re6500|\
rp-n53|\
diff --git a/target/linux/ramips/dts/R6120.dts b/target/linux/ramips/dts/R6120.dts
new file mode 100644
index 0000000000000000000000000000000000000000..a0df0072379a7d8f974ec8025483410d5f9f1da1
--- /dev/null
+++ b/target/linux/ramips/dts/R6120.dts
@@ -0,0 +1,142 @@
+/dts-v1/;
+
+#include "mt7628an.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+ compatible = "netgear,r6120", "mediatek,mt7628an-soc";
+ model = "Netgear R6120";
+
+ memory@0 {
+ device_type = "memory";
+ reg = <0x0 0x4000000>;
+ };
+
+ gpio-keys-polled {
+ compatible = "gpio-keys-polled";
+ poll-interval = <20>;
+
+ reset {
+ label = "reset";
+ gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
+ linux,code = <KEY_RESTART>;
+ };
+ };
+
+ gpio-leds {
+ compatible = "gpio-leds";
+
+ lan {
+ label = "r6120:green:lan";
+ gpios = <&gpio1 12 GPIO_ACTIVE_LOW>;
+ };
+
+ led_power: power {
+ label = "r6120:green:power";
+ gpios = <&gpio1 11 GPIO_ACTIVE_LOW>;
+ };
+
+ wlan {
+ label = "r6120:green:wlan2g";
+ gpios = <&gpio1 10 GPIO_ACTIVE_LOW>;
+ };
+
+ wlan_orange {
+ label = "r6120:orange:wlan2g";
+ gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
+ };
+
+ wan {
+ label = "r6120:green:wan";
+ gpios = <&gpio1 8 GPIO_ACTIVE_LOW>;
+ };
+
+ wan_orange {
+ label = "r6120:orange:wan";
+ gpios = <&gpio1 7 GPIO_ACTIVE_LOW>;
+ };
+ };
+};
+
+&pinctrl {
+ state_default: pinctrl0 {
+ gpio {
+ ralink,group = "p0led_an", "p1led_an", "p2led_an",
+ "p3led_an", "p4led_an", "wdt", "wled_an";
+ ralink,function = "gpio";
+ };
+ };
+};
+
+&spi0 {
+ status = "okay";
+
+ flash@0 {
+ compatible = "jedec,spi-nor";
+ reg = <0>;
+ spi-max-frequency = <10000000>;
+ m25p,chunked-io = <32>;
+
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition@0 {
+ label = "u-boot";
+ reg = <0x0 0x40000>;
+ read-only;
+ };
+
+ factory: partition@40000 {
+ label = "factory";
+ reg = <0x40000 0x20000>;
+ read-only;
+ };
+
+ partition@60000 {
+ label = "nvram";
+ reg = <0x60000 0x30000>;
+ read-only;
+ };
+
+ partition@90000 {
+ label = "firmware";
+ reg = <0x90000 0xf60000>;
+ };
+
+ partition@ff0000 {
+ label = "reserved";
+ reg = <0xff0000 0x10000>;
+ read-only;
+ };
+ };
+ };
+};
+
+&wmac {
+ status = "okay";
+ mtd-mac-address = <&factory 0x4>;
+ mediatek,mtd-eeprom = <&factory 0x0>;
+};
+
+&ethernet {
+ mtd-mac-address = <&factory 0x4>;
+};
+
+&pcie {
+ status = "okay";
+
+ pcie-bridge {
+ mt76@0,0 {
+ reg = <0x0000 0 0 0 0>;
+ device_type = "pci";
+ mediatek,mtd-eeprom = <&factory 0x8000>;
+ ieee80211-freq-limit = <5000000 6000000>;
+ mtd-mac-address = <&factory 0x4>;
+ mtd-mac-address-increment = <(2)>;
+ };
+ };
+};
diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk
index 34bd662f3a9490bdb0fd125af5ffa8a0f77c5f16..bc282666d8c1a4b6ce5beabe2b492331fb48a23a 100644
--- a/target/linux/ramips/image/mt76x8.mk
+++ b/target/linux/ramips/image/mt76x8.mk
@@ -2,6 +2,17 @@
# MT76x8 Profiles
#
+DEVICE_VARS += SERCOMM_KERNEL_OFFSET SERCOMM_HWID SERCOMM_HWVER SERCOMM_SWVER
+
+define Build/mksercommfw
+ $(STAGING_DIR_HOST)/bin/mksercommfw \
+ $@ \
+ $(SERCOMM_KERNEL_OFFSET) \
+ $(SERCOMM_HWID) \
+ $(SERCOMM_HWVER) \
+ $(SERCOMM_SWVER)
+endef
+
define Device/tplink
TPLINK_FLASHLAYOUT :=
TPLINK_HWID :=
@@ -90,6 +101,23 @@ define Device/mt7628
endef
TARGET_DEVICES += mt7628
+define Device/netgear_r6120
+ DTS := R6120
+ BLOCKSIZE := 64k
+ IMAGE_SIZE := $(ralink_default_fw_size_16M)
+ DEVICE_TITLE := Netgear R6120
+ DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci
+ SERCOMM_KERNEL_OFFSET := 90000
+ SERCOMM_HWID := CGQ
+ SERCOMM_HWVER := A001
+ SERCOMM_SWVER := 0040
+ IMAGES += factory.img
+ IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE)| append-rootfs | pad-rootfs
+ IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | check-size $$$$(IMAGE_SIZE)
+ IMAGE/factory.img := $$(IMAGE/default) | mksercommfw
+endef
+TARGET_DEVICES += netgear_r6120
+
define Device/omega2
DTS := OMEGA2
IMAGE_SIZE := $(ralink_default_fw_size_16M)