ramips: improve netis WF-2881 support
authorSungbo Eo <mans0n@gorani.run>
Wed, 2 Oct 2019 13:01:11 +0000 (22:01 +0900)
committerAdrian Schmutzler <freifunk@adrianschmutzler.de>
Tue, 5 Nov 2019 23:27:55 +0000 (00:27 +0100)
This patch does the following:

1. remove u-boot-env partition
   Stock bootloader saves env variables at 0x80000 in flash,
   and there is nothing stored at 0x30000.
   By merging the partition "u-boot-env" with "u-boot",
   the partition table becomes the same as used in stock firmware:
   00000000-00080000: "Bootloader"
   00080000-00100000: "Config"
   00100000-00140000: "Factory"
   00140000-07f80000: "Kernel"

2. fix LAN/WAN MAC addresses and provide label MAC address
   Ethernet MAC addresses are stored in factory partition at:
   0xe000: LAN (label_mac)
   0xe006: WAN (label_mac+1)

3. fix LAN port order
   WF-2881 LAN ports are in reverse order of switch ports.

4. fix WiFi LEDs
   mt76 led nodes are added to make WiFi LEDs work.
   On top of this, mt76 node names are changed to more generic ones,
   and compatible strings are also added.

5. fix pinmux groups
   uart3 and uart2 pins are used as button and led, but jtag pins are not.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
target/linux/ramips/dts/mt7621_netis_wf-2881.dts
target/linux/ramips/mt7621/base-files/etc/board.d/02_network

index 50f9592e2c7d1d29119d2ebb8fd1a4636b62ba72..1f16174cf89122f853b7a3fdfa9c94e481753c1b 100644 (file)
@@ -14,6 +14,7 @@
                led-failsafe = &led_wps;
                led-running = &led_wps;
                led-upgrade = &led_wps;
+               label-mac-device = &ethernet;
        };
 
        chosen {
 
                partition@0 {
                        label = "u-boot";
-                       reg = <0x0 0x30000>;
-                       read-only;
-               };
-
-               partition@30000 {
-                       label = "u-boot-env";
-                       reg = <0x30000 0x1000>;
+                       reg = <0x0 0x80000>;
                        read-only;
                };
 
@@ -82,7 +77,7 @@
                partition@140000 {
                        compatible = "denx,uimage";
                        label = "firmware";
-                       reg = <0x140000 0x7E40000>;
+                       reg = <0x140000 0x7e40000>;
                };
        };
 };
 };
 
 &pcie0 {
-       mt76@0,0 {
+       wifi@0,0 {
+               compatible = "mediatek,mt76";
                reg = <0x0000 0 0 0 0>;
                mediatek,mtd-eeprom = <&factory 0x8000>;
                ieee80211-freq-limit = <5000000 6000000>;
+
+               led {
+                       led-sources = <2>;
+                       led-active-low;
+               };
        };
 };
 
 &pcie1 {
-       mt76@0,0 {
+       wifi@0,0 {
+               compatible = "mediatek,mt76";
                reg = <0x0000 0 0 0 0>;
                mediatek,mtd-eeprom = <&factory 0x0000>;
                ieee80211-freq-limit = <2400000 2500000>;
+
+               led {
+                       led-sources = <2>;
+                       led-active-low;
+               };
        };
 };
 
 &ethernet {
-       mtd-mac-address = <&factory 0xe006>;
+       mtd-mac-address = <&factory 0xe000>;
 };
 
 &pinctrl {
        state_default: pinctrl0 {
                gpio {
-                       ralink,group = "uart3", "jtag";
+                       ralink,group = "uart3", "uart2";
                        ralink,function = "gpio";
                };
        };
index 11cf27e0928088752228361e1767f2df1b39d6d2..6a0d06577b4cecb60be2b230d7a8f706aee4e856 100755 (executable)
@@ -18,7 +18,6 @@ ramips_setup_interfaces()
        mediatek,mt7621-eval-board|\
        mqmaker,witi|\
        mtc,wr1201|\
-       netis,wf-2881|\
        phicomm,k2p|\
        planex,vr500|\
        samknows,whitebox-v8|\
@@ -113,7 +112,8 @@ ramips_setup_interfaces()
        netgear,r6260|\
        netgear,r6350|\
        netgear,r6850|\
-       netgear,wndr3700-v5)
+       netgear,wndr3700-v5|\
+       netis,wf-2881)
                ucidef_add_switch "switch0" \
                        "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan" "6@eth0"
                ;;
@@ -150,6 +150,7 @@ ramips_setup_macs()
        elecom,wrc-1900gst|\
        elecom,wrc-2533gst|\
        lenovo,newifi-d1|\
+       netis,wf-2881|\
        phicomm,k2p|\
        planex,vr500|\
        samknows,whitebox-v8|\