[OpenWrt-Devel] [PATCH] ramips: add support for netgear r6020

mail at adrianschmutzler.de mail at adrianschmutzler.de
Sat Jul 11 19:47:23 EDT 2020


> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
> On Behalf Of Evan Jobling
> Sent: Freitag, 5. Juni 2020 08:28
> To: openwrt-devel at lists.openwrt.org
> Cc: ynezz at true.cz; mail at adrianschmutzler.de
> Subject: [OpenWrt-Devel] [PATCH] ramips: add support for netgear r6020

Hi,

in the meantime, this device has been merged (based on somebody else's PR):

https://github.com/openwrt/openwrt/commit/edbc8e5512dccc2e0b6925258e34b3f21d66679c

Best

Adrian

> 
> Hi,
> 
> It seems that the older patches got put into patchwork, and assigned to Petr
> Štetiar?
> Apologies for the mess I created.
> I tried to put those patches to superseded?
> 
> Responses to feedback on my original patches, as well as the patch at the
> end.
> Additional feedback and requests for changes/tests welcome.
> 
> >Typically, frequency can be raised with substantial gains in read speed.
> 
> I can increase if required.
> Not sure how fast is reasonable/required?
> 
> At this stage I would rather not set up an oscilloscope to experiment with
> how fast I can push it?
> 
> Datasheet of flash ic is 80MHz or so?
> Not sure how fast the mt7628an can go?
> 
> >> mtd-mac-address = <&nvram 0x100b0>;
> >
> >Are these necessary, or will the address be correct if you just drop them?
> 
> It appears I need this line for the ethernet, otherwise random mac address is
> created.
> 
> >
> >Despite, can you please check whether there are addresses in factory 0x28,
> 0x2e, 0xe000, 0xe006, 0x4, 0x8004?
> >
> >Which addresses are assigned on OEM firmware (lan, wan, 2g, 5g)?
> 
> You would like me to flash the OEM firmware, look at MAC addresses?
> All the devices I have on hand are flashed to openwrt.
> I can flash latest factory firmware?
> 
> I have it set up to be same mac address on wired and wlan.
> It is the same one that is written on the device sticker.
> The bootloader uses that mac address on the lan hardware.
> 
> >> ucidef_set_led_wlan "wlan2g" "WiFi 2.4GHz"
> "$boardname:green:wlan2g" "phy0tpt"
> >
> >Please use a DTS trigger instead (for both 2g and 5g).
> 
> I don't understand.  R6120 lines look similar?
> Do I need to remove the 2g/5g lines?
> I tried to search for some documentation. I found [1], [2] ?
> 
> >The old PR has been closed quite some time ago due to inactivity. If there is
> new progress now, it would be fine to just open a new PR by the "new
> author".
> 
> Is patch via email acceptable?
> Alternatively,
> I would need to create github account, and do pull request there?
> 
> I'm assuming keeping the same thread at this stage is the best way forward?
> I understand the subject should have been something like
> "Subject: [PATCH] ramips: add support for netgear r6020"
> 
> Cheers,
> Evan.
> 
> [1] https://openwrt.org/docs/guide-user/base-system/led_configuration
> [2]
> https://www.kernel.org/doc/Documentation/devicetree/bindings/leds/leds
> -gpio.txt
> 
> From 8a2cf974be374612e8ea32d2182226d542ebbcdf Mon Sep 17 00:00:00
> 2001
> From: Evan Jobling <evan.jobling at uon.edu.au>
> Date: Sat, 30 May 2020 20:39:47 +1000
> Subject: [PATCH] ramips: add support for netgear r6020
> 
> Signed-off-by: Evan Jobling <evan.jobling at uon.edu.au>
> ---
>  .../ramips/dts/mt7628an_netgear_r6020.dts     | 144 ++++++++++++++++++
>  target/linux/ramips/image/mt76x8.mk           |  24 +++
>  .../mt76x8/base-files/etc/board.d/01_leds     |   5 +
>  .../mt76x8/base-files/etc/board.d/02_network  |   1 +
>  4 files changed, 174 insertions(+)
>  create mode 100644 target/linux/ramips/dts/mt7628an_netgear_r6020.dts
> 
> diff --git a/target/linux/ramips/dts/mt7628an_netgear_r6020.dts
> b/target/linux/ramips/dts/mt7628an_netgear_r6020.dts
> new file mode 100644
> index 0000000000..717fdde3fa
> --- /dev/null
> +++ b/target/linux/ramips/dts/mt7628an_netgear_r6020.dts
> @@ -0,0 +1,144 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT /dts-v1/;
> +
> +#include "mt7628an.dtsi"
> +
> +#include <dt-bindings/gpio/gpio.h>
> +#include <dt-bindings/input/input.h>
> +
> +/ {
> +       compatible = "netgear,r6020", "mediatek,mt7628an-soc";
> +       model = "Netgear  R6020 (AC750)";
> +
> +       aliases {
> +               led-boot = &led_power;
> +               led-failsafe = &led_power;
> +               led-running = &led_power;
> +               led-upgrade = &led_power;
> +       };
> +
> +       keys {
> +               compatible = "gpio-keys";
> +
> +               reset {
> +                       label = "reset";
> +                       gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
> +                       linux,code = <KEY_RESTART>;
> +               };
> +       };
> +
> +       leds {
> +               compatible = "gpio-leds";
> +
> +               lan {
> +                       label = "r6020:green:lan";
> +                       gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
> +               };
> +
> +               led_power: power {
> +                       label = "r6020:green:power";
> +                       gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
> +               };
> +
> +               wlan {
> +                       label = "r6020:green:wlan2g";
> +                       gpios = <&gpio 10 GPIO_ACTIVE_LOW>;
> +               };
> +
> +               wlan_orange {
> +                       label = "r6020:orange:wlan2g";
> +                       gpios = <&gpio 9 GPIO_ACTIVE_LOW>;
> +               };
> +
> +               wlan5 {
> +                       label = "r6020:green:wlan5g";
> +                       gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
> +               };
> +
> +               wlan5_orange {
> +                       label = "r6020:orange:wlan5g";
> +                       gpios = <&gpio 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 at 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 at 0 {
> +                               label = "u-boot";
> +                               reg = <0x0 0x40000>;
> +                               read-only;
> +                       };
> +
> +                       factory: partition at 40000 {
> +                               label = "factory";
> +                               reg = <0x40000 0x20000>;
> +                               read-only;
> +                       };
> +
> +                       nvram: partition at 60000 {
> +                               label = "nvram";
> +                               reg = <0x60000 0x30000>;
> +                               read-only;
> +                       };
> +
> +                       partition at 90000 {
> +                               compatible = "denx,uimage";
> +                               label = "firmware";
> +                               reg = <0x90000 0x6f0000>;
> +                       };
> +
> +                       partition at 780000 {
> +                               label = "reserved";
> +                               reg = <0x780000 0x80000>;
> +                               read-only;
> +                       };
> +               };
> +       };
> +};
> +
> +&wmac {
> +       status = "okay";
> +       mediatek,mtd-eeprom = <&factory 0x0>; };
> +
> +
> +&ethernet {
> +       mtd-mac-address = <&nvram 0x100b0>; };
> +
> +
> +&pcie {
> +       status = "okay";
> +};
> +
> +&pcie0 {
> +       wifi at 0,0 {
> +               reg = <0x0000 0 0 0 0>;
> +               mediatek,mtd-eeprom = <&factory 0x8000>;
> +               ieee80211-freq-limit = <5000000 6000000>;
> +               mtd-mac-address-increment = <(2)>;
> +       };
> +};
> diff --git a/target/linux/ramips/image/mt76x8.mk
> b/target/linux/ramips/image/mt76x8.mk
> index 16b5958ad1..2bfe71e15f 100644
> --- a/target/linux/ramips/image/mt76x8.mk
> +++ b/target/linux/ramips/image/mt76x8.mk
> @@ -189,6 +189,28 @@ define Device/mercury_mac1200r-v2  endef
> TARGET_DEVICES += mercury_mac1200r-v2
> 
> +
> +define Device/netgear_r6020
> +  BLOCKSIZE := 64k
> +  IMAGE_SIZE := 7270k
> +  DEVICE_VENDOR := NETGEAR
> +  DEVICE_MODEL :=  R6020
> +  DEVICE_PACKAGES := kmod-mt76x2 kmod-usb2 kmod-usb-ohci
> +  SERCOMM_KERNEL_OFFSET := 0x90000
> +  SERCOMM_HWID := CFR
> +  SERCOMM_HWVER := A001
> +  SERCOMM_SWVER := 0x0040
> +  IMAGES += factory.img
> +  IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE)|
> +append-rootfs | pad-rootfs
> +  IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata |
> +check-size
> +  IMAGE/factory.img := pad-extra 576k | $$(IMAGE/default) | \
> +       pad-to $$$$(BLOCKSIZE) | sercom-footer | pad-to 128 | zip R6020.bin | \
> +       sercom-seal
> +endef
> +TARGET_DEVICES += netgear_r6020
> +
> +
> +
>  define Device/netgear_r6120
>    BLOCKSIZE := 64k
>    IMAGE_SIZE := 15744k
> @@ -208,6 +230,8 @@ define Device/netgear_r6120  endef
> TARGET_DEVICES += netgear_r6120
> 
> +
> +
>  define Device/onion_omega2
>    IMAGE_SIZE := 16064k
>    DEVICE_VENDOR := Onion
> diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds
> b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds
> index 685895452a..a80c5e8ef9 100755
> --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds
> +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds
> @@ -46,6 +46,11 @@ hiwifi,hc5761a)
>  mediatek,linkit-smart-7688)
>         ucidef_set_led_wlan "wifi" "wifi" "linkit-smart-7688:orange:wifi"
> "phy0tpt"
>         ;;
> +netgear,r6020)
> +       ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch0"
> "0x0f"
> +       ucidef_set_led_wlan "wlan2g" "WiFi 2.4GHz"
> "$boardname:green:wlan2g" "phy0tpt"
> +       ucidef_set_led_wlan "wlan5g" "WiFi 5GHz"
> "$boardname:green:wlan5g" "phy1tpt"
> +       ;;
>  netgear,r6120)
>         ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch0"
> "0x0f"
>         ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch0"
> "0x10"
> diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network
> b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network
> index 398b5e88c7..816ff54a6c 100755
> --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network
> +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network
> @@ -92,6 +92,7 @@ ramips_setup_interfaces()
>                 ucidef_add_switch "switch0" \
>                         "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "0:wan" "6 at eth0"
>                 ;;
> +       netgear,r6020|\
>         netgear,r6120)
>                 ucidef_add_switch "switch0" \
>                         "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan" "6 at eth0"
> --
> 2.26.2
> 
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200712/71bf0fd6/attachment-0001.sig>


More information about the openwrt-devel mailing list