From: David Yang Date: Tue, 8 Jun 2021 16:53:27 +0000 (+0800) Subject: ramips: add support for Netgear PR2000 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=b00a02aaa0fff867acfe02229f39bc47158f0874;p=openwrt%2Fstaging%2Fneocturne.git ramips: add support for Netgear PR2000 This patch adds support for Netgear PR2000, sold as "Travel Router and Range Extender". Specifications: -------------- * SoC: Mediatek MT7620N * RAM: 64MB DDR2 * Flash: 16MB SPI NOR flash (Macronix MX25L12805D) * WiFi 2.4GHz: builtin * Ethernet: builtin * LED: Power, Internet, WiFi, USB * Buttons: Reset (GPIO 1/2) * UART: Serial console (57600 8n1) * USB: 1 x USB2 SPECIAL NOTES: ------------- Problem: WiFi is super weak, but SSID beacons seems to be right. Solve: Change 36h in factory partition (namely 0xf60036) to be 0x0. Explain: Clearly Netgear have different ideas on how EEPROM is used. Bit 2 of 36h indicates the presence of External LNA for 11g (2.4 GHz) band, which seems to be incorrectly set by Netgear (originally 0x04). Lifting it solves the problem of weak RX signal. Installation: ------------ There are two possible ways to install the firmware. Flashing via web interface of original firmware is not tested due to a broken firmware. 1) Open the shell and use a UART2USB convert to gain TTY access (TP7: RXD, TP9: TXD, TP10: GND). Please notice you have to remove resistance R54 next to TP7 otherwise you won't be able to input anything. 2) Use well-known Netgear debug switch. Access http://192.168.168.1/setup.cgi?todo=debug to start telnet service (username: root, password: ). Please back up firmware if you want to go back to the original. After you can control the device, flash the firmware as usual. Here are some hints for that. Option 1 (via nmrpflash): 1) Download nmrpflash from https://github.com/jclehner/nmrpflash 2) Use *-factory.img and flash: nmrpflash -L nmrpflash -i net* -f 3) Turn off then turn on the device, wait it finishing flash. Option 2 (replacing u-boot via breed): 1) Download breed-mt7620-reset1.bin from https://breed.hackpascal.net/ 2) Setup HTTP server on your computer, for example: python3 -m http.server You can skip this step if your breed is already accessible from HTTP, since the original wget does not support HTTPS. 3) Connect to the route and flash breed: cd /tmp wget http:///breed-mt7620-reset1.bin dd if=breed-mt7620-reset1.bin of=/dev/mtdblock0 bs=64k 4) Reboot. Hold reset key or press any key in TTY to enter breed. 5) Access breed web interface (http://192.168.1.1/). Choose memory layout to be 0x40000 and flash new firmware. Remark: ------ As a "Range Extender", it has a switch to switch between Wired mode (GPIO 21 low) and Wireless mode (GPIO 20 low), which is not implemented in this patch. However, the router will be turned off when it switches to the middle, which makes this switch much less useful. MAC addresses: ------------- The OEM firmware uses one single MAC for all interfaces, located at 0xf700b0. Signed-off-by: David Yang --- diff --git a/target/linux/ramips/dts/mt7620n_netgear_pr2000.dts b/target/linux/ramips/dts/mt7620n_netgear_pr2000.dts new file mode 100644 index 0000000000..6b4dde5432 --- /dev/null +++ b/target/linux/ramips/dts/mt7620n_netgear_pr2000.dts @@ -0,0 +1,191 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7620n.dtsi" + +#include +#include + +/ { + compatible = "netgear,pr2000", "ralink,mt7620n-soc"; + model = "Netgear PR2000"; + + aliases { + label-mac-device = ðernet; + }; + + leds { + compatible = "gpio-leds"; + + internet { + label = "green:internet"; + gpios = <&gpio3 0 GPIO_ACTIVE_LOW>; + }; + + wifi { + label = "green:wifi"; + gpios = <&gpio2 4 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + usb { + label = "green:usb"; + gpios = <&gpio0 0 GPIO_ACTIVE_LOW>; + trigger-sources = <&ohci_port1>, <&ehci_port1>; + linux,default-trigger = "usbport"; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wireless { + label = "wireless"; + gpios = <&gpio0 20 GPIO_ACTIVE_LOW>; + linux,code = ; + linux,input-type = ; + }; + + wired { + label = "wired"; + gpios = <&gpio0 21 GPIO_ACTIVE_LOW>; + linux,code = ; + linux,input-type = ; + }; + }; +}; + +&gpio2 { + status = "okay"; +}; + +&gpio3 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <50000000>; + m25p,fast-read; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + }; + + /* sercomm header for kernel starts at 0x3ffba + * can be safely ignored since not used by OpenWRT + */ + + partition@40000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x40000 0xf20000>; + }; + + factory: partition@f60000 { + label = "factory"; + reg = <0xf60000 0x10000>; + read-only; + }; + + board_data: partition@f70000 { + label = "board_data"; + reg = <0xf70000 0x10000>; + read-only; + }; + + partition@f80000 { + label = "POT"; + reg = <0xf80000 0x10000>; + read-only; + }; + + partition@f90000 { + label = "Traffic Meter"; + reg = <0xf90000 0x10000>; + read-only; + }; + + partition@fa0000 { + label = "Traffic Meter2"; + reg = <0xfa0000 0x10000>; + read-only; + }; + + partition@fb0000 { + label = "nvram"; + reg = <0xfb0000 0x10000>; + }; + + partition@fc0000 { + label = "DPF"; + reg = <0xfc0000 0x10000>; + read-only; + }; + + partition@fd0000 { + label = "ralink_nvram"; + reg = <0xfd0000 0x10000>; + read-only; + }; + + partition@fe0000 { + label = "reserved1"; + reg = <0xfe0000 0x10000>; + read-only; + }; + + partition@ff0000 { + label = "reserved2"; + reg = <0xff0000 0x10000>; + read-only; + }; + }; + }; +}; + +ðernet { + mtd-mac-address = <&board_data 0xb0>; + mediatek,portmap = "wllll"; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0x0>; + mtd-mac-address = <&board_data 0xb0>; +}; + +&state_default { + default { + groups = "ephy", "wled", "pa", "i2c"; + function = "gpio"; + }; +}; diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk index d2a2c90460..b3551fa6cb 100644 --- a/target/linux/ramips/image/mt7620.mk +++ b/target/linux/ramips/image/mt7620.mk @@ -802,6 +802,21 @@ define Device/netgear_jwnr2010-v5 endef TARGET_DEVICES += netgear_jwnr2010-v5 +define Device/netgear_pr2000 + $(Device/netgear_sercomm_nor) + SOC := mt7620n + BLOCKSIZE := 4k + IMAGE_SIZE := 15488k + DEVICE_MODEL := PR2000 + DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci + SERCOMM_HWNAME := PR2000 + SERCOMM_HWID := AQ7 + SERCOMM_HWVER := A001 + SERCOMM_SWVER := 0x0000 + SERCOMM_PAD := 640k +endef +TARGET_DEVICES += netgear_pr2000 + define Device/netgear_wn3000rp-v3 SOC := mt7620a IMAGE_SIZE := 7872k diff --git a/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds index 1293c34cbf..889818c631 100644 --- a/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds @@ -177,6 +177,9 @@ netgear,jwnr2010-v5) ucidef_set_led_switch "lan4" "lan4" "green:lan4" "switch0" "0x01" ucidef_set_led_switch "wan" "wan" "green:wan" "switch0" "0x10" ;; +netgear,pr2000) + ucidef_set_led_switch "internet" "internet" "green:internet" "switch0" "0x01" + ;; phicomm,psg1208) ucidef_set_led_netdev "wifi_led" "wifi" "white:wlan2g" "wlan0" ;; diff --git a/target/linux/ramips/mt7620/base-files/etc/board.d/02_network b/target/linux/ramips/mt7620/base-files/etc/board.d/02_network index f7bc41669f..7b1766766b 100644 --- a/target/linux/ramips/mt7620/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7620/base-files/etc/board.d/02_network @@ -202,6 +202,7 @@ ramips_setup_interfaces() ucidef_add_switch "switch1" \ "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0" ;; + netgear,pr2000|\ nexx,wt3020-4m|\ nexx,wt3020-8m) ucidef_add_switch "switch0" \