From 624b85e646328c5f4ff271e6cf0edc5923d40c67 Mon Sep 17 00:00:00 2001 From: Felix Matouschek Date: Thu, 18 Feb 2021 23:12:01 +0100 Subject: [PATCH 01/25] ath79: add support for Devolo dLAN pro 1200+ WiFi ac This patch adds support for the Devolo dLAN pro 1200+ WiFi ac. This device is a plc wifi AC2400 router/extender with 2 Ethernet ports, has a QCA7500 PLC and uses the HomePlug AV2 standard. Other than the PLC the hardware is identical to the Devolo Magic 2 WIFI. Therefore it uses the same dts, which was moved to a dtsi to be included by both boards. This is a board that was previously included in the ar71xx tree. Hardware: SoC: AR9344 CPU: 560 MHz Flash: 16 MiB (W25Q128JVSIQ) RAM: 128 MiB DDR2 Ethernet: 2xLAN 10/100/1000 PLC: QCA75000 (Qualcomm HPAV2) PLC Uplink: 1Gbps MIMO PLC Link: RGMII 1Gbps (WAN) WiFi: Atheros AR9340 2.4GHz 802.11bgn Atheros AR9882-BR4A 5GHz 802.11ac Switch: QCA8337, Port0:CPU, Port2:PLC, Port3:LAN1, Port4:LAN2 Button: 3x Buttons (Reset, wifi and plc) LED: 3x Leds (wifi, plc white, plc red) GPIO Switch: 11-PLC Pairing (Active Low) 13-PLC Enable 21-WLAN power MACs Details verified with the stock firmware: Radio1: 2.4 GHz &wmac *:4c Art location: 0x1002 Radio0: 5.0 GHz &pcie *:4d Art location: 0x5006 Ethernet ðernet *:4e = 2.4 GHz + 2 PLC uplink --- *:4f = 2.4 GHz + 3 Label MAC address is from PLC uplink The Powerline (PLC) interface of the dLAN pro 1200+ WiFi ac requires 3rd party firmware which is not available from standard OpenWrt package feeds. There is a package feed on github which you must add to OpenWrt buildroot so you can build a firmware image which supports the plc interface. See: https://github.com/0xFelix/dlan-openwrt (forked from Devolo and added compatibility for OpenWrt 21.02) Flash instruction (TFTP): 1. Set PC to fixed ip address 192.168.0.100 2. Download the sysupgrade image and rename it to uploadfile 3. Start a tftp server with the image file in its root directory 4. Turn off the router 5. Press and hold Reset button 6. Turn on router with the reset button pressed and wait ~15 seconds 7. Release the reset button and after a short time the firmware should be transferred from the tftp server 8. Allow 1-2 minutes for the first boot. Signed-off-by: Felix Matouschek [add "plus" to compatible and device name] Signed-off-by: Adrian Schmutzler --- .../ar9344_devolo_dlan-pro-1200plus-ac.dts | 8 + .../ath79/dts/ar9344_devolo_dlan_wifi.dtsi | 170 ++++++++++++++++++ .../ath79/dts/ar9344_devolo_magic-2-wifi.dts | 167 +---------------- .../generic/base-files/etc/board.d/01_leds | 1 + .../generic/base-files/etc/board.d/02_network | 2 + .../base-files/etc/board.d/03_gpio_switches | 3 + .../etc/hotplug.d/firmware/11-ath10k-caldata | 1 + target/linux/ath79/image/generic.mk | 9 + 8 files changed, 195 insertions(+), 166 deletions(-) create mode 100644 target/linux/ath79/dts/ar9344_devolo_dlan-pro-1200plus-ac.dts create mode 100644 target/linux/ath79/dts/ar9344_devolo_dlan_wifi.dtsi diff --git a/target/linux/ath79/dts/ar9344_devolo_dlan-pro-1200plus-ac.dts b/target/linux/ath79/dts/ar9344_devolo_dlan-pro-1200plus-ac.dts new file mode 100644 index 0000000000..fb06d71ad4 --- /dev/null +++ b/target/linux/ath79/dts/ar9344_devolo_dlan-pro-1200plus-ac.dts @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar9344_devolo_dlan_wifi.dtsi" + +/ { + model = "Devolo dLAN pro 1200+ WiFi ac"; + compatible = "devolo,dlan-pro-1200plus-ac", "qca,ar9344"; +}; diff --git a/target/linux/ath79/dts/ar9344_devolo_dlan_wifi.dtsi b/target/linux/ath79/dts/ar9344_devolo_dlan_wifi.dtsi new file mode 100644 index 0000000000..9424e48654 --- /dev/null +++ b/target/linux/ath79/dts/ar9344_devolo_dlan_wifi.dtsi @@ -0,0 +1,170 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar9344.dtsi" + +#include +#include + +/ { + aliases { + led-boot = &led_dlan_red; + led-failsafe = &led_dlan_red; + led-running = &led_dlan_white; + led-upgrade = &led_dlan_red; + }; + + leds { + compatible = "gpio-leds"; + + wlan { + label = "white:wlan"; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + + led_dlan_white: dlan_white { + label = "white:dlan"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + + led_dlan_red: dlan_red { + label = "red:dlan"; + gpios = <&gpio 15 GPIO_ACTIVE_HIGH>; + panic-indicator; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "Reset button"; + linux,code = ; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + + wifi { + label = "WIFI button"; + linux,code = ; + gpios = <&gpio 20 GPIO_ACTIVE_HIGH>; + debounce-interval = <60>; + }; + + dlan { + label = "DLAN button"; + linux,code = ; + gpios = <&gpio 22 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; +}; + +&gpio { + wlan_power { + gpio-hog; + line-name = "WLAN power"; + gpios = <&gpio 21 GPIO_ACTIVE_HIGH>; + output-high; + }; +}; + +&spi { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + uboot: partition@0 { + label = "u-boot"; + reg = <0x0 0x40000>; + read-only; + }; + + partition@40000 { + label = "u-boot-env"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "Config1"; + reg = <0x50000 0x10000>; + read-only; + }; + + partition@60000 { + label = "Config2"; + reg = <0x60000 0x10000>; + read-only; + }; + + partition@70000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x70000 0xf80000>; + }; + + art: partition@ff0000 { + label = "art"; + reg = <0xff0000 0x10000>; + read-only; + }; + }; + }; +}; + +&ref { + clock-frequency = <40000000>; +}; + +ð0 { + status = "okay"; + + pll-data = <0x02000000 0x00000101 0x00001616>; + + mtd-mac-address = <&art 0x1002>; + mtd-mac-address-increment = <2>; + + phy-mode = "rgmii"; + phy-handle = <&phy0>; +}; + +&wmac { + status = "okay"; + + mtd-cal-data = <&art 0x1000>; +}; + +&pcie { + status = "okay"; + + wifi@0,0 { + compatible = "qcom,ath10k"; + reg = <0 0 0 0 0>; + }; +}; + +&mdio0 { + status = "okay"; + + phy0: ethernet-phy@0 { + reg = <0>; + phy-mode = "rgmii"; + + qca,ar8327-initvals = < + /* PORT0: RGMII, MAC0/6 exchange, tx_delay 01, No rx_delay */ + 0x04 0x06400000 + 0x08 0x00000000 /* PORT5 PAD MODE CTRL */ + 0x0c 0x00000000 /* PORT6 PAD MODE CTRL */ + 0x7c 0x0000007e /* PORT0_STATUS */ + >; + }; +}; diff --git a/target/linux/ath79/dts/ar9344_devolo_magic-2-wifi.dts b/target/linux/ath79/dts/ar9344_devolo_magic-2-wifi.dts index 627265bf70..d2fd8ecadf 100644 --- a/target/linux/ath79/dts/ar9344_devolo_magic-2-wifi.dts +++ b/target/linux/ath79/dts/ar9344_devolo_magic-2-wifi.dts @@ -1,173 +1,8 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -#include "ar9344.dtsi" - -#include -#include +#include "ar9344_devolo_dlan_wifi.dtsi" / { model = "Devolo Magic 2 Wifi"; compatible = "devolo,magic-2-wifi", "qca,ar9344"; - - aliases { - led-boot = &led_dlan_red; - led-failsafe = &led_dlan_red; - led-running = &led_dlan_white; - led-upgrade = &led_dlan_red; - }; - - leds { - compatible = "gpio-leds"; - - wlan { - label = "white:wlan"; - gpios = <&gpio 12 GPIO_ACTIVE_LOW>; - linux,default-trigger = "phy1tpt"; - }; - - led_dlan_white: dlan_white { - label = "white:dlan"; - gpios = <&gpio 14 GPIO_ACTIVE_LOW>; - }; - - led_dlan_red: dlan_red { - label = "red:dlan"; - gpios = <&gpio 15 GPIO_ACTIVE_HIGH>; - panic-indicator; - }; - }; - - keys { - compatible = "gpio-keys"; - - reset { - label = "Reset button"; - linux,code = ; - gpios = <&gpio 4 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - - wifi { - label = "WIFI button"; - linux,code = ; - gpios = <&gpio 20 GPIO_ACTIVE_HIGH>; - debounce-interval = <60>; - }; - - dlan { - label = "DLAN button"; - linux,code = ; - gpios = <&gpio 22 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - }; -}; - -&gpio { - wlan_power { - gpio-hog; - line-name = "WLAN power"; - gpios = <&gpio 21 GPIO_ACTIVE_HIGH>; - output-high; - }; -}; - -&spi { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <25000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - uboot: partition@0 { - label = "u-boot"; - reg = <0x0 0x40000>; - read-only; - }; - - partition@40000 { - label = "u-boot-env"; - reg = <0x40000 0x10000>; - read-only; - }; - - partition@50000 { - label = "Config1"; - reg = <0x50000 0x10000>; - read-only; - }; - - partition@60000 { - label = "Config2"; - reg = <0x60000 0x10000>; - read-only; - }; - - partition@70000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x70000 0xf80000>; - }; - - art: partition@ff0000 { - label = "art"; - reg = <0xff0000 0x10000>; - read-only; - }; - }; - }; -}; - -&ref { - clock-frequency = <40000000>; -}; - -ð0 { - status = "okay"; - - pll-data = <0x02000000 0x00000101 0x00001616>; - - mtd-mac-address = <&art 0x1002>; - mtd-mac-address-increment = <2>; - - phy-mode = "rgmii"; - phy-handle = <&phy0>; -}; - -&wmac { - status = "okay"; - - mtd-cal-data = <&art 0x1000>; -}; - -&pcie { - status = "okay"; - - wifi@0,0 { - compatible = "qcom,ath10k"; - reg = <0 0 0 0 0>; - }; -}; - -&mdio0 { - status = "okay"; - - phy0: ethernet-phy@0 { - reg = <0>; - phy-mode = "rgmii"; - - qca,ar8327-initvals = < - /* PORT0: RGMII, MAC0/6 exchage, tx_delay 01, No rx_delay */ - 0x04 0x06400000 - 0x08 0x00000000 /* PORT5 PAD MODE CTRL */ - 0x0c 0x00000000 /* PORT6 PAD MODE CTRL */ - 0x7c 0x0000007e /* PORT0_STATUS */ - >; - }; }; diff --git a/target/linux/ath79/generic/base-files/etc/board.d/01_leds b/target/linux/ath79/generic/base-files/etc/board.d/01_leds index 8ead3ec0a3..9720e37f99 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/01_leds +++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds @@ -178,6 +178,7 @@ compex,wpj531-16m) ucidef_set_led_rssi "sig3" "SIG3" "green:sig3" "wlan0" "65" "100" ucidef_set_led_rssi "sig4" "SIG4" "green:sig4" "wlan0" "50" "100" ;; +devolo,dlan-pro-1200plus-ac|\ devolo,magic-2-wifi) ucidef_set_led_netdev "plcw" "dLAN" "white:dlan" "eth0.1" "rx" ;; diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network index 8ea52af67a..ffafe7db20 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -210,6 +210,7 @@ ath79_setup_interfaces() ucidef_add_switch "switch0" \ "0@eth0" "3:lan" "2:wan" ;; + devolo,dlan-pro-1200plus-ac|\ devolo,magic-2-wifi) ucidef_add_switch "switch0" \ "0@eth0" "2:wan" "3:lan" "4:lan" @@ -502,6 +503,7 @@ ath79_setup_macs() compex,wpj563) wan_mac=$(mtd_get_mac_binary u-boot 0x2e018) ;; + devolo,dlan-pro-1200plus-ac|\ devolo,magic-2-wifi) label_mac=$(macaddr_add "$(mtd_get_mac_binary art 0x1002)" 3) ;; diff --git a/target/linux/ath79/generic/base-files/etc/board.d/03_gpio_switches b/target/linux/ath79/generic/base-files/etc/board.d/03_gpio_switches index cd21932bfd..83f428c54a 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/03_gpio_switches +++ b/target/linux/ath79/generic/base-files/etc/board.d/03_gpio_switches @@ -31,6 +31,9 @@ telco,t1) ucidef_add_gpio_switch "lte_poweroff" "LTE Poweroff" "1" "1" ucidef_add_gpio_switch "lte_reset" "LTE Reset" "12" "1" ;; +devolo,dlan-pro-1200plus-ac) + ucidef_add_gpio_switch "plc_enable" "PLC enable" "13" "0" + ;; devolo,magic-2-wifi) ucidef_add_gpio_switch "plc_pairing" "PLC pairing" "11" "1" ucidef_add_gpio_switch "plc_enable" "PLC enable" "13" "1" diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index b7cb2da8cd..b2392c2c64 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -23,6 +23,7 @@ case "$FIRMWARE" in ;; comfast,cf-wr650ac-v1|\ comfast,cf-wr650ac-v2|\ + devolo,dlan-pro-1200plus-ac|\ devolo,magic-2-wifi|\ qxwlan,e1700ac-v2-8m|\ qxwlan,e1700ac-v2-16m|\ diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index 4d3f455e49..b459136ef5 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -664,6 +664,15 @@ define Device/compex_wpj563 endef TARGET_DEVICES += compex_wpj563 +define Device/devolo_dlan-pro-1200plus-ac + SOC := ar9344 + DEVICE_VENDOR := Devolo + DEVICE_MODEL := dLAN pro 1200+ WiFi ac + DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct + IMAGE_SIZE := 15872k +endef +TARGET_DEVICES += devolo_dlan-pro-1200plus-ac + define Device/devolo_dvl1200e SOC := qca9558 DEVICE_VENDOR := devolo From a509b80065b6680e3e007203084c147f77b6717f Mon Sep 17 00:00:00 2001 From: Ben Gainey Date: Sun, 31 Jan 2021 11:15:38 +0000 Subject: [PATCH 02/25] ramips: add support for the Wavlink WL-WN579X3 About the device ---------------- SoC: MediaTek MT7620a @ 580MHz RAM: 64M FLASH: 8MB WiFi: SoC-integrated: MediaTek MT7620a bgn WiFi: MediaTek MT7612EN nac GbE: 2x (RTL8211F) BTN: - WPS - Reset - Router/Repeater/AP (3-way slide-switch) LED: - WPS (blue) - 3-segment Wifi signal representation (blue) - WiFi (blue) - WAN (blue) - LAN (blue) - Power (blue) UART: UART is present as Pads with through-holes on the PCB. They are located next to the reset button and are labelled Vcc/TX/RX/GND as appropriate. Use 3.3V, 57600-8N1. Installation ------------ Using the webcmd interface -------------------------- Warning: Do not update to the latest Wavlink firmware (version 20201201) as this removes the webcmd console and you will need to use the serial port instead. You will need to have built uboot/sqauashfs image for this device, and you will need to provide an HTTP service where the image can be downloaded from that is accessible by the device. You cannot use the device manufacturers firmware upgrade interface as it rejects the OpenWrt image. 1. Log into the device's admin portal. This is necessary to authenticate you as a user in order to be able to access the webcmd interface. 2. Navigate to http:///webcmd.shtml - you can access the console directly through this page, or you may wish to launch the installed `telnetd` and use telnet instead. * Using telnet is recommended since it provides a more convenient shell interface that the web form. * Launch telnetd from the form with the command `telnetd`. * Check the port that telnetd is running on using `netstat -antp|grep telnetd`, it is likely to be 2323. * Connect to the target using `telnet`. The username should be `admin2860`, and the password is your admin password. 3. On the target use `curl` to download the image. e.g. `curl -L -O http:///openwrt-ramips-mt7620-\ wavlink_wl-wn579x3-squashfs-sysupgrade.bin`. Check the hash using `md5sum`. 4. Use the mtd_write command to flash the image. * The flash partition should be mtd4, but check /sys/class/mtd/mtd4/name first. The partition should be called 'Kernel'. * To flash use the following command: `mtd_write -r -e /dev/mtd write /dev/mtd` Where mtd is the Kernel partition, and is the OpenWrt image previously downloaded. * The command above will erase, flash and then reboot the device. Once it reboots it will be running OpenWrt. Connect via ssh to the device at 192.168.1.1 on the LAN port. The WAN port will be configured via DHCP. Using the serial port --------------------- The device uses uboot like many other MT7260a based boards. To use this interface, you will need to connect to the serial interface, and provide a TFTP server. At boot follow the bootloader menu and select option 2 to erase/flash the image. Provide the address and filename details for the tftp server. The bootloader will do the rest. Once the image is flashed, the board will boot into OpenWrt. The console is available over the serial port. Signed-off-by: Ben Gainey --- .../ramips/dts/mt7620a_wavlink_wl-wn579x3.dts | 210 ++++++++++++++++++ target/linux/ramips/image/mt7620.mk | 9 + .../mt7620/base-files/etc/board.d/01_leds | 4 + .../mt7620/base-files/etc/board.d/02_network | 4 + 4 files changed, 227 insertions(+) create mode 100644 target/linux/ramips/dts/mt7620a_wavlink_wl-wn579x3.dts diff --git a/target/linux/ramips/dts/mt7620a_wavlink_wl-wn579x3.dts b/target/linux/ramips/dts/mt7620a_wavlink_wl-wn579x3.dts new file mode 100644 index 0000000000..679d9c2150 --- /dev/null +++ b/target/linux/ramips/dts/mt7620a_wavlink_wl-wn579x3.dts @@ -0,0 +1,210 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "mt7620a.dtsi" + +#include +#include + +/ { + compatible = "wavlink,wl-wn579x3", "ralink,mt7620a-soc"; + model = "Wavlink WL-WN579X3"; + + aliases { + led-boot = &led_wps; + led-failsafe = &led_wps; + led-running = &led_wps; + led-upgrade = &led_wps; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + switch_aps { + label = "mode_aps"; + gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; + linux,code = ; + linux,input-type = ; + }; + + switch_repeater { + label = "mode_repeater"; + gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; + linux,code = ; + linux,input-type = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_wps: wps { + label = "blue:wps"; + gpios = <&gpio2 2 GPIO_ACTIVE_LOW>; + }; + + lan { + label = "blue:lan"; + gpios = <&gpio2 4 GPIO_ACTIVE_LOW>; + }; + + wan { + label = "blue:wan"; + gpios = <&gpio2 1 GPIO_ACTIVE_LOW>; + }; + + wifi { + label = "blue:wifi"; + gpios = <&gpio3 0 GPIO_ACTIVE_LOW>; + }; + + /* These three form the signal wifi strength segments */ + wifi_high { + label = "blue:wifi_high"; + gpios = <&gpio0 13 GPIO_ACTIVE_LOW>; + }; + + wifi_medium { + label = "blue:wifi_medium"; + gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; + }; + + wifi_low { + label = "blue:wifi_low"; + gpios = <&gpio2 3 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&gpio2 { + status = "okay"; +}; + +&gpio3 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <50000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "config"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x50000 0x790000>; + }; + + partition@7e0000 { + label = "board_data"; + reg = <0x7e0000 0x10000>; + read-only; + }; + + partition@7f0000 { + label = "nvram"; + reg = <0x7f0000 0x10000>; + read-only; + }; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; + }; +}; + +ðernet { + pinctrl-names = "default"; + pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>; + + mtd-mac-address = <&factory 0x28>; + + mediatek,portmap = "llllw"; + + port@4 { + status = "okay"; + phy-handle = <&phy4>; + phy-mode = "rgmii"; + }; + + port@5 { + status = "okay"; + phy-handle = <&phy5>; + phy-mode = "rgmii"; + }; + + mdio-bus { + status = "okay"; + + phy4: ethernet-phy@4 { + reg = <4>; + phy-mode = "rgmii"; + }; + + phy5: ethernet-phy@5 { + reg = <5>; + phy-mode = "rgmii"; + }; + }; +}; + +&gsw { + mediatek,port4 = "gmac"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0x0>; +}; + +&state_default { + gpio { + groups = "ephy", "i2c", "wled", "uartf"; + function = "gpio"; + }; +}; diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk index fe41512f36..8f5d354e33 100644 --- a/target/linux/ramips/image/mt7620.mk +++ b/target/linux/ramips/image/mt7620.mk @@ -1092,6 +1092,15 @@ define Device/wavlink_wl-wn530hg4 endef TARGET_DEVICES += wavlink_wl-wn530hg4 +define Device/wavlink_wl-wn579x3 + SOC := mt7620a + IMAGE_SIZE := 7744k + DEVICE_VENDOR := Wavlink + DEVICE_MODEL := WL-WN579X3 + DEVICE_PACKAGES := kmod-mt76x2 kmod-phy-realtek +endef +TARGET_DEVICES += wavlink_wl-wn579x3 + define Device/wrtnode_wrtnode SOC := mt7620n IMAGE_SIZE := 16064k 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 bbedbe9f0d..53487d7526 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 @@ -194,6 +194,10 @@ tplink,archer-mr200) tplink,re200-v1) ucidef_set_led_netdev "lan" "lan" "green:lan" "eth0" ;; +wavlink,wl-wn579x3) + ucidef_set_led_switch "lan" "lan" "blue:lan" "switch0" "0x20" + ucidef_set_led_switch "wan" "wan" "blue:wan" "switch0" "0x10" + ;; zbtlink,zbt-ape522ii) ucidef_set_led_netdev "wlan2g4" "wlan1-link" "green:wlan2g4" "wlan1" ucidef_set_led_netdev "sys1" "wlan1" "green:sys1" "wlan1" "tx rx" 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 e2e2614483..71850863c0 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 @@ -215,6 +215,10 @@ ramips_setup_interfaces() ucidef_add_switch "switch0" \ "0:lan" "4:wan" "6@eth0" ;; + wavlink,wl-wn579x3) + ucidef_add_switch "switch0" \ + "5:lan" "4:wan" "6@eth0" + ;; youku,yk-l1|\ youku,yk-l1c) ucidef_add_switch "switch0" \ From 03d66d6b8fa6660a89648847a69d691a9a82d5b4 Mon Sep 17 00:00:00 2001 From: BERENYI Balazs Date: Sat, 2 Jan 2021 18:49:42 +0000 Subject: [PATCH 03/25] kirkwood: Add support for Sheevaplug Globalscale SheevaPlug: * Marvell Kirkwood 88F6281 * 512 MB SDRAM * 512 MB Flash * Gigabit Network * USB 2.0 * SD slot * Serial console The device is supported in mainline uboot/linux the commit adds only some openwrt config for building an image. Installation: 1 - Update uboot: setenv ipaddr '192.168.0.111' setenv serverip '192.168.0.1' tftpboot u-boot.kwb nand erase 0x0 0x100000 nand write 0x800000 0x0 0x100000 reset 2 - Install OpenWRT: setenv ethaddr 00:50:43:01:xx:xx saveenv setenv ipaddr '192.168.0.111' setenv serverip '192.168.0.1' tftpboot openwrt-kirkwood-globalscale_sheevaplug-squashfs-factory.bin nand erase.part ubi nand write 0x800000 ubi 0x600000 reset Signed-off-by: BERENYI Balazs Reviewed-by: Pawel Dembicki [add vendor name for uboot-kirkwood, merge patches, copy to 5.10, add AUTORELEASE for uboot-kirkwood, refresh patches] Signed-off-by: Adrian Schmutzler --- package/boot/uboot-envtools/files/kirkwood | 1 + package/boot/uboot-kirkwood/Makefile | 10 +++- .../patches/170-sheevaplug.patch | 39 +++++++++++++++ .../patches/200-openwrt-config.patch | 10 ++++ .../base-files/etc/board.d/02_network | 1 + target/linux/kirkwood/image/Makefile | 7 +++ .../patches-5.10/112-sheevaplug.patch | 47 +++++++++++++++++++ .../kirkwood/patches-5.4/112-sheevaplug.patch | 47 +++++++++++++++++++ 8 files changed, 160 insertions(+), 2 deletions(-) create mode 100644 package/boot/uboot-kirkwood/patches/170-sheevaplug.patch create mode 100644 target/linux/kirkwood/patches-5.10/112-sheevaplug.patch create mode 100644 target/linux/kirkwood/patches-5.4/112-sheevaplug.patch diff --git a/package/boot/uboot-envtools/files/kirkwood b/package/boot/uboot-envtools/files/kirkwood index d1986f206d..6a3dfcaba8 100644 --- a/package/boot/uboot-envtools/files/kirkwood +++ b/package/boot/uboot-envtools/files/kirkwood @@ -15,6 +15,7 @@ case "$board" in checkpoint,l-50|\ cloudengines,pogoe02|\ cloudengines,pogoplugv4|\ +globalscale,sheevaplug|\ iom,ix2-200|\ linksys,e4200-v2|\ linksys,ea4500|\ diff --git a/package/boot/uboot-kirkwood/Makefile b/package/boot/uboot-kirkwood/Makefile index 1ed1743e21..d9cb10ce13 100644 --- a/package/boot/uboot-kirkwood/Makefile +++ b/package/boot/uboot-kirkwood/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_VERSION:=2020.04 -PKG_RELEASE:=1 +PKG_RELEASE:=$(AUTORELEASE) PKG_HASH:=fe732aaf037d9cc3c0909bad8362af366ae964bbdac6913a34081ff4ad565372 @@ -94,6 +94,11 @@ define U-Boot/pogoplugv4 BUILD_DEVICES:=cloudengines_pogoplugv4 endef +define U-Boot/sheevaplug + NAME:=Globalscale SheevaPlug + BUILD_DEVICES:=globalscale_sheevaplug +endef + UBOOT_TARGETS := \ dockstar dockstar_second_stage \ goflexhome \ @@ -105,7 +110,8 @@ UBOOT_TARGETS := \ nsa310s \ nsa325 \ pogo_e02 pogo_e02_second_stage \ - pogoplugv4 + pogoplugv4 \ + sheevaplug define Build/Configure $(if $(findstring _second_stage,$(BUILD_VARIANT)), diff --git a/package/boot/uboot-kirkwood/patches/170-sheevaplug.patch b/package/boot/uboot-kirkwood/patches/170-sheevaplug.patch new file mode 100644 index 0000000000..12b3e68d00 --- /dev/null +++ b/package/boot/uboot-kirkwood/patches/170-sheevaplug.patch @@ -0,0 +1,39 @@ +--- a/include/configs/sheevaplug.h ++++ b/include/configs/sheevaplug.h +@@ -45,15 +45,17 @@ + /* + * Default environment variables + */ +-#define CONFIG_BOOTCOMMAND "${x_bootcmd_kernel}; " \ +- "setenv bootargs ${x_bootargs} ${x_bootargs_root}; " \ +- "bootm 0x6400000;" ++#define CONFIG_BOOTCOMMAND \ ++ "setenv bootargs ${console} ${mtdparts} ${bootargs_root}; " \ ++ "ubi part ubi; " \ ++ "ubi read 0x800000 kernel; " \ ++ "bootm 0x800000" + +-#define CONFIG_EXTRA_ENV_SETTINGS "x_bootargs=console" \ +- "=ttyS0,115200 mtdparts="CONFIG_MTDPARTS_DEFAULT \ +- "x_bootcmd_kernel=nand read 0x6400000 0x100000 0x400000\0" \ +- "x_bootcmd_usb=usb start\0" \ +- "x_bootargs_root=root=/dev/mtdblock3 rw rootfstype=jffs2\0" ++#define CONFIG_EXTRA_ENV_SETTINGS \ ++ "console=console=ttyS0,115200\0" \ ++ "mtdids="CONFIG_MTDIDS_DEFAULT "\0" \ ++ "mtdparts="CONFIG_MTDPARTS_DEFAULT "\0" \ ++ "bootargs_root=\0" + + /* + * Ethernet Driver configuration +--- a/configs/sheevaplug_defconfig ++++ b/configs/sheevaplug_defconfig +@@ -30,7 +30,7 @@ CONFIG_CMD_FAT=y + CONFIG_CMD_JFFS2=y + CONFIG_CMD_MTDPARTS=y + CONFIG_MTDIDS_DEFAULT="nand0=orion_nand" +-CONFIG_MTDPARTS_DEFAULT="mtdparts=orion_nand:512K(uboot),512K(env),4M(kernel),-(rootfs)" ++CONFIG_MTDPARTS_DEFAULT="mtdparts=orion_nand:1M(uboot),-(ubi)" + CONFIG_CMD_UBI=y + CONFIG_ISO_PARTITION=y + CONFIG_OF_CONTROL=y diff --git a/package/boot/uboot-kirkwood/patches/200-openwrt-config.patch b/package/boot/uboot-kirkwood/patches/200-openwrt-config.patch index 83eb0f9d2c..ae9fdf3390 100644 --- a/package/boot/uboot-kirkwood/patches/200-openwrt-config.patch +++ b/package/boot/uboot-kirkwood/patches/200-openwrt-config.patch @@ -204,3 +204,13 @@ +#include "openwrt-kirkwood-common.h" + #endif /* _CONFIG_NSA310S_H */ +--- a/configs/sheevaplug_defconfig ++++ b/configs/sheevaplug_defconfig +@@ -49,4 +49,7 @@ + CONFIG_DM_USB=y + CONFIG_USB_EHCI_HCD=y + CONFIG_USB_STORAGE=y ++CONFIG_FIT=y ++CONFIG_FIT_VERBOSE=y + CONFIG_LZMA=y ++CONFIG_LZO=y diff --git a/target/linux/kirkwood/base-files/etc/board.d/02_network b/target/linux/kirkwood/base-files/etc/board.d/02_network index 0578691144..c379d13046 100644 --- a/target/linux/kirkwood/base-files/etc/board.d/02_network +++ b/target/linux/kirkwood/base-files/etc/board.d/02_network @@ -18,6 +18,7 @@ case "$board" in ;; "cloudengines,pogoe02"|\ "cloudengines,pogoplugv4"|\ +"globalscale,sheevaplug"|\ "iom,iconnect-1.1"|\ "iom,ix2-200"|\ "raidsonic,ib-nas62x0"|\ diff --git a/target/linux/kirkwood/image/Makefile b/target/linux/kirkwood/image/Makefile index e06eb050ef..c2c5bcab8f 100644 --- a/target/linux/kirkwood/image/Makefile +++ b/target/linux/kirkwood/image/Makefile @@ -67,6 +67,13 @@ define Device/cloudengines_pogoplugv4 endef TARGET_DEVICES += cloudengines_pogoplugv4 +define Device/globalscale_sheevaplug + DEVICE_VENDOR := Globalscale + DEVICE_MODEL := Sheevaplug + DEVICE_PACKAGES := kmod-mvsdio +endef +TARGET_DEVICES += globalscale_sheevaplug + define Device/iom_iconnect-1.1 DEVICE_VENDOR := Iomega DEVICE_MODEL := Iconnect diff --git a/target/linux/kirkwood/patches-5.10/112-sheevaplug.patch b/target/linux/kirkwood/patches-5.10/112-sheevaplug.patch new file mode 100644 index 0000000000..d1ff9884a0 --- /dev/null +++ b/target/linux/kirkwood/patches-5.10/112-sheevaplug.patch @@ -0,0 +1,47 @@ +--- a/arch/arm/boot/dts/kirkwood-sheevaplug-common.dtsi ++++ b/arch/arm/boot/dts/kirkwood-sheevaplug-common.dtsi +@@ -78,13 +78,8 @@ + }; + + partition@100000 { +- label = "uImage"; +- reg = <0x0100000 0x400000>; +- }; +- +- partition@500000 { +- label = "root"; +- reg = <0x0500000 0x1fb00000>; ++ label = "ubi"; ++ reg = <0x0100000 0x1ff00000>; + }; + }; + +--- a/arch/arm/boot/dts/kirkwood-sheevaplug.dts ++++ b/arch/arm/boot/dts/kirkwood-sheevaplug.dts +@@ -13,6 +13,13 @@ + model = "Globalscale Technologies SheevaPlug"; + compatible = "globalscale,sheevaplug", "marvell,kirkwood-88f6281", "marvell,kirkwood"; + ++ aliases { ++ led-boot = &led_health; ++ led-failsafe = &led_health; ++ led-running = &led_health; ++ led-upgrade = &led_health; ++ }; ++ + ocp@f1000000 { + mvsdio@90000 { + pinctrl-0 = <&pmx_sdio>; +@@ -28,10 +35,10 @@ + pinctrl-0 = <&pmx_led_blue &pmx_led_red>; + pinctrl-names = "default"; + +- health { ++ led_health: health { + label = "sheevaplug:blue:health"; + gpios = <&gpio1 17 GPIO_ACTIVE_LOW>; +- default-state = "keep"; ++ default-state = "on"; + }; + + misc { diff --git a/target/linux/kirkwood/patches-5.4/112-sheevaplug.patch b/target/linux/kirkwood/patches-5.4/112-sheevaplug.patch new file mode 100644 index 0000000000..d1ff9884a0 --- /dev/null +++ b/target/linux/kirkwood/patches-5.4/112-sheevaplug.patch @@ -0,0 +1,47 @@ +--- a/arch/arm/boot/dts/kirkwood-sheevaplug-common.dtsi ++++ b/arch/arm/boot/dts/kirkwood-sheevaplug-common.dtsi +@@ -78,13 +78,8 @@ + }; + + partition@100000 { +- label = "uImage"; +- reg = <0x0100000 0x400000>; +- }; +- +- partition@500000 { +- label = "root"; +- reg = <0x0500000 0x1fb00000>; ++ label = "ubi"; ++ reg = <0x0100000 0x1ff00000>; + }; + }; + +--- a/arch/arm/boot/dts/kirkwood-sheevaplug.dts ++++ b/arch/arm/boot/dts/kirkwood-sheevaplug.dts +@@ -13,6 +13,13 @@ + model = "Globalscale Technologies SheevaPlug"; + compatible = "globalscale,sheevaplug", "marvell,kirkwood-88f6281", "marvell,kirkwood"; + ++ aliases { ++ led-boot = &led_health; ++ led-failsafe = &led_health; ++ led-running = &led_health; ++ led-upgrade = &led_health; ++ }; ++ + ocp@f1000000 { + mvsdio@90000 { + pinctrl-0 = <&pmx_sdio>; +@@ -28,10 +35,10 @@ + pinctrl-0 = <&pmx_led_blue &pmx_led_red>; + pinctrl-names = "default"; + +- health { ++ led_health: health { + label = "sheevaplug:blue:health"; + gpios = <&gpio1 17 GPIO_ACTIVE_LOW>; +- default-state = "keep"; ++ default-state = "on"; + }; + + misc { From 482e65a16d2c49b5547b032caa060f423a3cb4a5 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Sun, 6 Jun 2021 19:06:29 +0200 Subject: [PATCH 04/25] uboot-kirkwood: refresh patches This is only cosmetic, but the next one adding a patch here would have to do it anyway, and thus will get a smaller diff for review now. Signed-off-by: Adrian Schmutzler --- .../patches/007-nsa310-uboot-generic.patch | 4 ++-- .../patches/010-pogoplug_v4.patch | 16 +++++++-------- .../uboot-kirkwood/patches/110-dockstar.patch | 6 +++--- .../uboot-kirkwood/patches/120-iconnect.patch | 4 ++-- .../uboot-kirkwood/patches/130-ib62x0.patch | 4 ++-- .../patches/140-pogoplug_e02.patch | 4 ++-- .../patches/150-goflexhome.patch | 4 ++-- .../patches/200-openwrt-config.patch | 20 +++++++++---------- ...xx-add-support-for-RGMII-TX-RX-delay.patch | 7 +------ ...-mv88e61xx-add-support-for-MV88E6171.patch | 11 +++------- 10 files changed, 35 insertions(+), 45 deletions(-) diff --git a/package/boot/uboot-kirkwood/patches/007-nsa310-uboot-generic.patch b/package/boot/uboot-kirkwood/patches/007-nsa310-uboot-generic.patch index 09dc587bf7..16a1f08c84 100644 --- a/package/boot/uboot-kirkwood/patches/007-nsa310-uboot-generic.patch +++ b/package/boot/uboot-kirkwood/patches/007-nsa310-uboot-generic.patch @@ -28,13 +28,13 @@ NOTE: this patch is ready for upstream, LEDE-specific parts are in @@ -53,6 +53,9 @@ config TARGET_GOFLEXHOME config TARGET_NAS220 bool "BlackArmor NAS220" - + +config TARGET_NSA310 + bool "Zyxel NSA310 Board" + config TARGET_NSA310S bool "Zyxel NSA310S" - + @@ -86,6 +89,7 @@ source "board/raidsonic/ib62x0/Kconfig" source "board/Seagate/dockstar/Kconfig" source "board/Seagate/goflexhome/Kconfig" diff --git a/package/boot/uboot-kirkwood/patches/010-pogoplug_v4.patch b/package/boot/uboot-kirkwood/patches/010-pogoplug_v4.patch index 58bf664238..250caafbf8 100644 --- a/package/boot/uboot-kirkwood/patches/010-pogoplug_v4.patch +++ b/package/boot/uboot-kirkwood/patches/010-pogoplug_v4.patch @@ -3,13 +3,13 @@ @@ -25,6 +25,9 @@ config TARGET_LSXL config TARGET_POGO_E02 bool "pogo_e02 Board" - + +config TARGET_POGOPLUGV4 + bool "Pogoplug V4 Board" + config TARGET_DNS325 bool "dns325 Board" - + @@ -83,6 +86,7 @@ source "board/Marvell/guruplug/Kconfig" source "board/Marvell/sheevaplug/Kconfig" source "board/buffalo/lsxl/Kconfig" @@ -22,11 +22,11 @@ +++ b/arch/arm/mach-kirkwood/include/mach/kw88f6192.h @@ -15,6 +15,6 @@ #define KW_REGS_PHY_BASE KW88F6192_REGS_PHYS_BASE - + /* TCLK Core Clock defination */ -#define CONFIG_SYS_TCLK 166000000 /* 166MHz */ +#define CONFIG_SYS_TCLK 166666667 /* 166MHz */ - + #endif /* _CONFIG_KW88F6192_H */ --- a/arch/arm/mach-kirkwood/include/mach/mpp.h +++ b/arch/arm/mach-kirkwood/include/mach/mpp.h @@ -35,12 +35,12 @@ #define MPP33_TDM_DTX MPP( 33, 0x2, 0, 1, 0, 0, 1, 1 ) #define MPP33_GE1_13 MPP( 33, 0x3, 0, 0, 0, 1, 1, 1 ) +#define MPP33_SATA1_ACTn MPP( 33, 0x5, 0, 1, 0, 1, 1, 1 ) - + #define MPP34_GPIO MPP( 34, 0x0, 1, 1, 0, 1, 1, 1 ) #define MPP34_TDM_SPI_CS1 MPP( 34, 0x2, 0, 1, 0, 0, 1, 1 ) #define MPP34_GE1_14 MPP( 34, 0x3, 0, 0, 0, 1, 1, 1 ) +#define MPP34_SATA1_ACTn MPP( 34, 0x5, 0, 1, 0, 1, 1, 1 ) - + #define MPP35_GPIO MPP( 35, 0x0, 1, 1, 1, 1, 1, 1 ) #define MPP35_TDM_CH0_TX_QL MPP( 35, 0x2, 0, 1, 0, 0, 1, 1 ) --- /dev/null @@ -630,7 +630,7 @@ obj-$(CONFIG_MMC_SDHCI_XENON) += xenon_sdhci.o obj-$(CONFIG_MMC_SDHCI_ZYNQ) += zynq_sdhci.o +obj-$(CONFIG_KIRKWOOD_MMC) += kirkwood_mmc.o - + obj-$(CONFIG_MMC_SUNXI) += sunxi_mmc.o obj-$(CONFIG_MMC_UNIPHIER) += tmio-common.o uniphier-sd.o --- /dev/null @@ -1123,7 +1123,7 @@ @@ -75,4 +75,10 @@ #define CONFIG_SYS_MAX_NAND_DEVICE 1 #endif - + +/* + * Kirkwood MMC + */ diff --git a/package/boot/uboot-kirkwood/patches/110-dockstar.patch b/package/boot/uboot-kirkwood/patches/110-dockstar.patch index b3837956bc..c3889e122e 100644 --- a/package/boot/uboot-kirkwood/patches/110-dockstar.patch +++ b/package/boot/uboot-kirkwood/patches/110-dockstar.patch @@ -5,7 +5,7 @@ #define CONFIG_KW88F6281 1 /* SOC Name */ #define CONFIG_SKIP_LOWLEVEL_INIT /* disable board lowlevel_init */ +#define CONFIG_SYS_MVFS - + /* * mv-common.h should be defined after CMD configs since it used them @@ -37,19 +38,15 @@ @@ -20,7 +20,7 @@ + "ubi part ubi; " \ + "ubi read 0x800000 kernel; " \ + "bootm 0x800000" - + #define CONFIG_EXTRA_ENV_SETTINGS \ - "console=console=ttyS0,115200\0" \ - "mtdids=nand0=orion_nand\0" \ @@ -32,7 +32,7 @@ + "mtdids=nand0=orion_nand\0" \ + "mtdparts="CONFIG_MTDPARTS_DEFAULT "\0" \ + "bootargs_root=\0" - + /* * Ethernet Driver configuration --- a/configs/dockstar_defconfig diff --git a/package/boot/uboot-kirkwood/patches/120-iconnect.patch b/package/boot/uboot-kirkwood/patches/120-iconnect.patch index 770a52f737..dad3dd4744 100644 --- a/package/boot/uboot-kirkwood/patches/120-iconnect.patch +++ b/package/boot/uboot-kirkwood/patches/120-iconnect.patch @@ -10,7 +10,7 @@ + "ubi part ubi; " \ + "ubi read 0x800000 kernel; " \ "bootm 0x800000" - + #define CONFIG_EXTRA_ENV_SETTINGS \ "console=console=ttyS0,115200\0" \ "mtdids=nand0=orion_nand\0" \ @@ -19,7 +19,7 @@ - "bootargs_root=noinitrd ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs\0" + "mtdparts="CONFIG_MTDPARTS_DEFAULT "\0" \ + "bootargs_root=\0" - + /* * Ethernet driver configuration --- a/configs/iconnect_defconfig diff --git a/package/boot/uboot-kirkwood/patches/130-ib62x0.patch b/package/boot/uboot-kirkwood/patches/130-ib62x0.patch index 0092d989e1..c4ee8f0330 100644 --- a/package/boot/uboot-kirkwood/patches/130-ib62x0.patch +++ b/package/boot/uboot-kirkwood/patches/130-ib62x0.patch @@ -14,7 +14,7 @@ + "ubi part ubi; " \ + "ubi read 0x800000 kernel; " \ + "bootm 0x800000" - + #define CONFIG_EXTRA_ENV_SETTINGS \ "console=console=ttyS0,115200\0" \ "mtdids=nand0=orion_nand\0" \ @@ -24,7 +24,7 @@ - "bootargs_root=ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs rw\0" + "mtdparts="CONFIG_MTDPARTS_DEFAULT "\0" \ + "bootargs_root=\0" - + /* * Ethernet driver configuration --- a/configs/ib62x0_defconfig diff --git a/package/boot/uboot-kirkwood/patches/140-pogoplug_e02.patch b/package/boot/uboot-kirkwood/patches/140-pogoplug_e02.patch index d077915c93..53ad98291c 100644 --- a/package/boot/uboot-kirkwood/patches/140-pogoplug_e02.patch +++ b/package/boot/uboot-kirkwood/patches/140-pogoplug_e02.patch @@ -12,7 +12,7 @@ + "ubifsmount ubi:rootfs; " \ + "ubi read 0x800000 kernel; " \ + "bootm 0x800000" - + #define CONFIG_EXTRA_ENV_SETTINGS \ - "mtdparts=mtdparts=orion_nand:1M(u-boot),4M(uImage)," \ - "32M(rootfs),-(data)\0"\ @@ -24,7 +24,7 @@ + "mtdids=nand0=orion_nand\0" \ + "mtdparts="CONFIG_MTDPARTS_DEFAULT "\0" \ + "bootargs_root=\0" - + /* * Ethernet Driver configuration --- a/configs/pogo_e02_defconfig diff --git a/package/boot/uboot-kirkwood/patches/150-goflexhome.patch b/package/boot/uboot-kirkwood/patches/150-goflexhome.patch index 55d69b81d5..014ae66338 100644 --- a/package/boot/uboot-kirkwood/patches/150-goflexhome.patch +++ b/package/boot/uboot-kirkwood/patches/150-goflexhome.patch @@ -10,7 +10,7 @@ + "ubi part ubi; " \ + "ubi read 0x800000 kernel; " \ "bootm 0x800000" - + #define CONFIG_EXTRA_ENV_SETTINGS \ "console=console=ttyS0,115200\0" \ "mtdids=nand0=orion_nand\0" \ @@ -19,7 +19,7 @@ - "bootargs_root=ubi.mtd=root root=ubi0:root rootfstype=ubifs ro\0" + "mtdparts="CONFIG_MTDPARTS_DEFAULT "\0" \ + "bootargs_root=\0" - + /* * Ethernet Driver configuration --- a/configs/goflexhome_defconfig diff --git a/package/boot/uboot-kirkwood/patches/200-openwrt-config.patch b/package/boot/uboot-kirkwood/patches/200-openwrt-config.patch index ae9fdf3390..bfd3d3278e 100644 --- a/package/boot/uboot-kirkwood/patches/200-openwrt-config.patch +++ b/package/boot/uboot-kirkwood/patches/200-openwrt-config.patch @@ -3,7 +3,7 @@ @@ -107,4 +107,7 @@ source "board/alliedtelesis/SBx81LIFXCAT source "board/Marvell/db-88f6281-bp/Kconfig" source "board/checkpoint/l-50/Kconfig" - + +config SECOND_STAGE + bool "OpenWrt second stage hack" + @@ -13,7 +13,7 @@ @@ -60,4 +60,6 @@ * File system */ - + +#include "openwrt-kirkwood-common.h" + #endif /* _CONFIG_DOCKSTAR_H */ @@ -22,7 +22,7 @@ @@ -77,4 +77,6 @@ #define CONFIG_RTC_MV #endif /* CONFIG_CMD_DATE */ - + +#include "openwrt-kirkwood-common.h" + #endif /* _CONFIG_IB62x0_H */ @@ -31,7 +31,7 @@ @@ -67,4 +67,6 @@ * File system */ - + +#include "openwrt-kirkwood-common.h" + #endif /* _CONFIG_ICONNECT_H */ @@ -40,7 +40,7 @@ @@ -12,6 +12,8 @@ #ifndef _CONFIG_L50_H #define _CONFIG_L50_H - + +#include "openwrt-kirkwood-common.h" + /* @@ -85,7 +85,7 @@ @@ -66,4 +66,6 @@ * File system */ - + +#include "openwrt-kirkwood-common.h" + #endif /* _CONFIG_POGO_E02_H */ @@ -94,7 +94,7 @@ @@ -85,4 +85,6 @@ #define CONFIG_SYS_ATA_IDE0_OFFSET MV_SATA_PORT0_OFFSET #endif /*CONFIG_MVSATA_IDE*/ - + +#include "openwrt-kirkwood-common.h" + #endif /* _CONFIG_GOFLEXHOME_H */ @@ -103,7 +103,7 @@ @@ -100,4 +100,6 @@ #define CONFIG_RTC_MV #endif /* CONFIG_CMD_DATE */ - + +#include "openwrt-kirkwood-common.h" + #endif /* _CONFIG_NSA310_H */ @@ -200,13 +200,13 @@ @@ -63,4 +63,6 @@ #define CONFIG_RTC_MV #endif /* CONFIG_CMD_DATE */ - + +#include "openwrt-kirkwood-common.h" + #endif /* _CONFIG_NSA310S_H */ --- a/configs/sheevaplug_defconfig +++ b/configs/sheevaplug_defconfig -@@ -49,4 +49,7 @@ +@@ -49,4 +49,7 @@ CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_STORAGE=y diff --git a/package/boot/uboot-kirkwood/patches/701-phy-mv88e61xx-add-support-for-RGMII-TX-RX-delay.patch b/package/boot/uboot-kirkwood/patches/701-phy-mv88e61xx-add-support-for-RGMII-TX-RX-delay.patch index 6e358857b7..66550f91fa 100644 --- a/package/boot/uboot-kirkwood/patches/701-phy-mv88e61xx-add-support-for-RGMII-TX-RX-delay.patch +++ b/package/boot/uboot-kirkwood/patches/701-phy-mv88e61xx-add-support-for-RGMII-TX-RX-delay.patch @@ -17,8 +17,6 @@ Signed-off-by: Pawel Dembicki drivers/net/phy/mv88e61xx.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) -diff --git a/drivers/net/phy/mv88e61xx.c b/drivers/net/phy/mv88e61xx.c -index 5aff7ed397..889327639d 100644 --- a/drivers/net/phy/mv88e61xx.c +++ b/drivers/net/phy/mv88e61xx.c @@ -94,6 +94,8 @@ @@ -30,7 +28,7 @@ index 5aff7ed397..889327639d 100644 #define PORT_REG_PHYS_CTRL_PCS_AN_EN BIT(10) #define PORT_REG_PHYS_CTRL_PCS_AN_RST BIT(9) #define PORT_REG_PHYS_CTRL_FC_VALUE BIT(7) -@@ -747,9 +749,16 @@ static int mv88e61xx_fixed_port_setup(struct phy_device *phydev, u8 port) +@@ -747,9 +749,16 @@ static int mv88e61xx_fixed_port_setup(st PORT_REG_PHYS_CTRL_SPD1000; } @@ -48,6 +46,3 @@ index 5aff7ed397..889327639d 100644 return mv88e61xx_port_write(phydev, port, PORT_REG_PHYS_CTRL, val); --- -2.20.1 - diff --git a/package/boot/uboot-kirkwood/patches/702-phy-mv88e61xx-add-support-for-MV88E6171.patch b/package/boot/uboot-kirkwood/patches/702-phy-mv88e61xx-add-support-for-MV88E6171.patch index c91a06cbed..e9caa00852 100644 --- a/package/boot/uboot-kirkwood/patches/702-phy-mv88e61xx-add-support-for-MV88E6171.patch +++ b/package/boot/uboot-kirkwood/patches/702-phy-mv88e61xx-add-support-for-MV88E6171.patch @@ -16,8 +16,6 @@ Signed-off-by: Pawel Dembicki drivers/net/phy/mv88e61xx.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) -diff --git a/drivers/net/phy/mv88e61xx.c b/drivers/net/phy/mv88e61xx.c -index 889327639d..e0b648a54e 100644 --- a/drivers/net/phy/mv88e61xx.c +++ b/drivers/net/phy/mv88e61xx.c @@ -180,6 +180,7 @@ @@ -28,7 +26,7 @@ index 889327639d..e0b648a54e 100644 #define PORT_SWITCH_ID_6172 0x1720 #define PORT_SWITCH_ID_6176 0x1760 #define PORT_SWITCH_ID_6220 0x2200 -@@ -997,6 +998,7 @@ static int mv88e61xx_probe(struct phy_device *phydev) +@@ -997,6 +998,7 @@ static int mv88e61xx_probe(struct phy_de switch (priv->id) { case PORT_SWITCH_ID_6096: case PORT_SWITCH_ID_6097: @@ -36,7 +34,7 @@ index 889327639d..e0b648a54e 100644 case PORT_SWITCH_ID_6172: case PORT_SWITCH_ID_6176: case PORT_SWITCH_ID_6240: -@@ -1152,6 +1154,17 @@ static struct phy_driver mv88e61xx_driver = { +@@ -1152,6 +1154,17 @@ static struct phy_driver mv88e61xx_drive .shutdown = &genphy_shutdown, }; @@ -54,7 +52,7 @@ index 889327639d..e0b648a54e 100644 static struct phy_driver mv88e609x_driver = { .name = "Marvell MV88E609x", .uid = 0x1410c89, -@@ -1177,6 +1190,7 @@ static struct phy_driver mv88e6071_driver = { +@@ -1177,6 +1190,7 @@ static struct phy_driver mv88e6071_drive int phy_mv88e61xx_init(void) { phy_register(&mv88e61xx_driver); @@ -62,6 +60,3 @@ index 889327639d..e0b648a54e 100644 phy_register(&mv88e609x_driver); phy_register(&mv88e6071_driver); --- -2.20.1 - From 2341c621e42e5fadd6b3205365fb448e44bcbbe0 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Sun, 6 Jun 2021 19:17:47 +0200 Subject: [PATCH 05/25] treewide: do not quote compatible in shell scripts The compatible is a literal string without any problematic characters, so there is no reason to quote it. Signed-off-by: Adrian Schmutzler --- .../arc770/base-files/etc/board.d/02_network | 2 +- .../base-files/etc/board.d/02_network | 36 +++++++++---------- .../lib/preinit/05_layerscape_reorder_eth | 4 +-- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/target/linux/arc770/base-files/etc/board.d/02_network b/target/linux/arc770/base-files/etc/board.d/02_network index f326f48763..c90f3fb6a6 100644 --- a/target/linux/arc770/base-files/etc/board.d/02_network +++ b/target/linux/arc770/base-files/etc/board.d/02_network @@ -7,7 +7,7 @@ board_config_update case "$(board_name)" in -"snps,axs101") +snps,axs101) ucidef_set_interface_lan "eth0" "dhcp" ;; esac diff --git a/target/linux/kirkwood/base-files/etc/board.d/02_network b/target/linux/kirkwood/base-files/etc/board.d/02_network index c379d13046..694bcaecce 100644 --- a/target/linux/kirkwood/base-files/etc/board.d/02_network +++ b/target/linux/kirkwood/base-files/etc/board.d/02_network @@ -10,33 +10,33 @@ board_config_update board=$(board_name) case "$board" in -"checkpoint,l-50") +checkpoint,l-50) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan5 lan6 lan7 lan8 dmz" "eth0" ;; -"cisco,on100") +cisco,on100) ucidef_set_interface_lan "eth0 eth1" ;; -"cloudengines,pogoe02"|\ -"cloudengines,pogoplugv4"|\ -"globalscale,sheevaplug"|\ -"iom,iconnect-1.1"|\ -"iom,ix2-200"|\ -"raidsonic,ib-nas62x0"|\ -"seagate,blackarmor-nas220"|\ -"seagate,dockstar"|\ -"seagate,goflexhome"|\ -"seagate,goflexnet"|\ -"zyxel,nsa310s") +cloudengines,pogoe02|\ +cloudengines,pogoplugv4|\ +globalscale,sheevaplug|\ +iom,iconnect-1.1|\ +iom,ix2-200|\ +raidsonic,ib-nas62x0|\ +seagate,blackarmor-nas220|\ +seagate,dockstar|\ +seagate,goflexhome|\ +seagate,goflexnet|\ +zyxel,nsa310s) ucidef_set_interface_lan "eth0" "dhcp" ;; -"linksys,e4200-v2"|\ -"linksys,ea3500"|\ -"linksys,ea4500") +linksys,e4200-v2|\ +linksys,ea3500|\ +linksys,ea4500) ucidef_set_interfaces_lan_wan "ethernet1 ethernet2 ethernet3 ethernet4" "internet" ucidef_set_interface_macaddr "wan" $( mtd_get_mac_ascii u_env eth1addr ) ;; -"zyxel,nsa310b"|\ -"zyxel,nsa325") +zyxel,nsa310b|\ +zyxel,nsa325) ucidef_set_interface_lan "eth0" "dhcp" ucidef_set_interface_macaddr "lan" $( mtd_get_mac_ascii uboot_env ethaddr ) ;; diff --git a/target/linux/layerscape/base-files/lib/preinit/05_layerscape_reorder_eth b/target/linux/layerscape/base-files/lib/preinit/05_layerscape_reorder_eth index 141aac8a6d..c6b741a5ce 100644 --- a/target/linux/layerscape/base-files/lib/preinit/05_layerscape_reorder_eth +++ b/target/linux/layerscape/base-files/lib/preinit/05_layerscape_reorder_eth @@ -6,8 +6,8 @@ reorder_layerscape_interfaces() { board=$(cat /tmp/sysinfo/board_name) case "$board" in - "traverse,ls1043v" | \ - "traverse,ls1043s") + traverse,ls1043v|\ + traverse,ls1043s) # Reorder ethernet interfaces to match the physical order ip link set eth2 name fm1-mac3 From a3d8c1295ed9eeceabd78ab86e73b151ae2868a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20B=C3=B6hler?= Date: Mon, 15 Mar 2021 00:07:17 +0100 Subject: [PATCH 06/25] ramips: Add support for SERCOMM NA502 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The SERCOMM NA502 is a smart home gateway manufactured by SERCOMM and sold under different brands (among others, A1 Telekom Austria SmartHome Gateway). It has multi-protocol radio support in addition to LAN and WiFi. Note: BLE is currently unsupported. Specifications -------------- - MT7621ST 880MHz, Single-Core, Dual-Thread - MT7603EN 2.4GHz WiFi - MT7662EN 5GHz WiFi + BLE - 128MiB NAND - 256MiB DDR3 RAM - SD3503 ZWave Controller - EM357 Zigbee Coordinator MAC address assignment ---------------------- LAN MAC is read from the config partition, WiFi 2.4GHz is LAN+2 and matches the OEM firmware. WiFi 5GHz with LAN+1 is an educated guess since the OEM firmware does not enable 5GHz WiFi. Installation ------------ Attach serial console, then boot the initramfs image via TFTP. Once inside OpenWrt, run sysupgrade -n with the sysupgrade file. Attention: The device has a dual-firmware design. We overwrite kernel2, since kernel1 contains an automatic recovery image. If you get NAND ECC errors and are stuck with bad eraseblocks, try to erase the mtd partition first with mtd unlock ubi mtd erase ubi This should only be needed once. Signed-off-by: Andreas Böhler [use kiB for IMAGE_SIZE] Signed-off-by: Adrian Schmutzler --- .../linux/ramips/dts/mt7621_sercomm_na502.dts | 212 ++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 14 ++ .../mt7621/base-files/etc/board.d/02_network | 1 + .../mt7621/base-files/lib/upgrade/platform.sh | 1 + 4 files changed, 228 insertions(+) create mode 100644 target/linux/ramips/dts/mt7621_sercomm_na502.dts diff --git a/target/linux/ramips/dts/mt7621_sercomm_na502.dts b/target/linux/ramips/dts/mt7621_sercomm_na502.dts new file mode 100644 index 0000000000..af55d1058f --- /dev/null +++ b/target/linux/ramips/dts/mt7621_sercomm_na502.dts @@ -0,0 +1,212 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "mt7621.dtsi" + +#include +#include + +/ { + compatible = "sercomm,na502", "mediatek,mt7621-soc"; + model = "SERCOMM NA502"; + + aliases { + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_power; + }; + + leds { + compatible = "gpio-leds"; + + led_power: power { + label = "green:power"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + + internet { + label = "green:internet"; + gpios = <&gpio 24 GPIO_ACTIVE_LOW>; + }; + + wifi { + label = "green:wifi"; + gpios = <&gpio 23 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + zwave { + label = "green:zwave"; + gpios = <&gpio 22 GPIO_ACTIVE_LOW>; + }; + + service { + label = "green:service"; + gpios = <&gpio 26 GPIO_ACTIVE_LOW>; + }; + + zigbee { + label = "green:zigbee"; + gpios = <&gpio 27 GPIO_ACTIVE_LOW>; + }; + + bluetooth { + label = "green:bluetooth"; + gpios = <&gpio 25 GPIO_ACTIVE_LOW>; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 28 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + select { + label = "select"; + gpios = <&gpio 0 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + sync { + label = "sync"; + gpios = <&gpio 32 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-export { + compatible = "gpio-export"; + + zwave_reset { + gpio-export,name = "zwave_reset"; + gpio-export,output = <1>; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + }; + + zigbee_reset { + gpio-export,name = "zigbee_reset"; + gpio-export,output = <1>; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&gmac0 { + mtd-mac-address = <&factory 0xe000>; +}; + +&nand { + status = "okay"; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x80000>; + read-only; + }; + + partition@80000 { + label = "config"; + reg = <0x80000 0x80000>; + read-only; + }; + + factory: partition@100000 { + label = "factory"; + reg = <0x100000 0x40000>; + }; + + partition@140000 { + label = "kernel1"; + reg = <0x140000 0x1400000>; + }; + + partition@1540000 { + label = "kernel"; + reg = <0x1540000 0x400000>; + }; + + partition@1940000 { + label = "ubi"; + reg = <0x1940000 0x1000000>; + }; + + partition@2940000 { + label = "user_storage"; + reg = <0x2940000 0x100000>; + }; + + partition@2a40000 { + label = "data"; + reg = <0x2a40000 0x1000000>; + }; + + partition@3a40000 { + label = "storage"; + reg = <0x3a40000 0x3200000>; + }; + + partition@6c40000 { + label = "backup"; + reg = <0x6c40000 0x1340000>; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + mtd-mac-address = <&factory 0xe000>; + mtd-mac-address-increment = <1>; + ieee80211-freq-limit = <5000000 6000000>; + }; +}; + +&pcie1 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0000>; + mtd-mac-address = <&factory 0xe000>; + mtd-mac-address-increment = <2>; + ieee80211-freq-limit = <2400000 2500000>; + }; +}; + +&state_default { + gpio { + groups = "jtag", "rgmii2"; + function = "gpio"; + }; +}; + +&switch0 { + ports { + port@4 { + status = "okay"; + label = "lan"; + }; + }; +}; + +&uartlite2 { + status = "okay"; +}; + +&uartlite3 { + status = "okay"; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 96a66b2398..efeac698b1 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -1167,6 +1167,20 @@ define Device/samknows_whitebox-v8 endef TARGET_DEVICES += samknows_whitebox-v8 +define Device/sercomm_na502 + $(Device/uimage-lzma-loader) + BLOCKSIZE := 128k + PAGESIZE := 2048 + IMAGE_SIZE := 20480k + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + UBINIZE_OPTS := -E 5 + KERNEL_SIZE := 4096k + DEVICE_VENDOR := SERCOMM + DEVICE_MODEL := NA502 + DEVICE_PACKAGES := kmod-mt76x2 kmod-mt7603 kmod-usb3 +endef +TARGET_DEVICES += sercomm_na502 + define Device/storylink_sap-g3200u3 $(Device/dsa-migration) IMAGE_SIZE := 7872k diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index d84d3e317f..aa1d644938 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -12,6 +12,7 @@ ramips_setup_interfaces() edimax,re23s|\ mikrotik,routerboard-m11g|\ netgear,ex6150|\ + sercomm,na502|\ thunder,timecloud|\ tplink,re350-v1|\ tplink,re500-v1|\ diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh index 4943ad1305..c2ad4d3ed6 100755 --- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh @@ -72,6 +72,7 @@ platform_do_upgrade() { netgear,wac104|\ netgear,wac124|\ netis,wf2881|\ + sercomm,na502|\ xiaomi,mi-router-3g|\ xiaomi,mi-router-3-pro|\ xiaomi,mi-router-4|\ From a4e2766a5bfa1ac1c706d1cd58c6706ffdcde895 Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Thu, 25 Mar 2021 00:19:59 +0900 Subject: [PATCH 07/25] ath79: add support for NEC Aterm WF1200CR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit NEC Aterm WF1200CR is a 2.4/5 GHz band 11ac (Wi-Fi 5) router, based on QCA9561. Specification: - SoC : Qualcomm Atheros QCA9561 - RAM : DDR2 128 MiB (W971GG6SB-25) - Flash : SPI-NOR 8 MiB (MX25L6433FM2I-08G) - WLAN : 2.4/5 GHz 2T2R - 2.4 GHz : QCA9561 (SoC) - 5 GHz : QCA9888 - Ethernet : 2x 10/100 Mbps - Switch : QCA9561 (SoC) - LEDs/Keys : 8x/3x (2x buttons, 1x slide-switch) - UART : through-hole on PCB - JP1: Vcc, GND, NC, TX, RX from "JP1" marking - 115200n8 - Power : 12 VDC, 0.9 A Flash instruction using factory image (stock: < v1.3.2): 1. Boot WF1200CR normally with "Router" mode 2. Access to "http://192.168.10.1/" and open firmware update page ("ファームウェア更新") 3. Select the OpenWrt factory image and click update ("更新") button to perform firmware update 4. Wait ~150 seconds to complete flashing Alternate flash instruction using initramfs image (stock: >= v1.3.2): 1. Prepare the TFTP server with the IP address 192.168.1.10 and place the OpenWrt initramfs image to the TFTP directory with the name "0101A8C0.img" 2. Connect serial console to WF1200CR 3. Boot WF1200CR and interrupt with any key after the message "Hit any key to stop autoboot: 2", the U-Boot starts telnetd after the message "starting telnetd server from server 192.168.1.1" 4. login the telnet (address: 192.168.1.1) 5. Perform the following commands to modify "bootcmd" variable temporary and check the value (to ignore the limitation of available commands, "tp; " command at the first is required as dummy, and the output of "printenv" is printed on the serial console) tp; set bootcmd 'set autostart yes; tftpboot' tp; printenv 6. Save the modified variable with the following command and reset device tp; saveenv tp; reset 7. The U-Boot downloads initramfs image from TFTP server and boots it 8. On initramfs image, download the sysupgrade image to the device and perform the following commands to erase stock firmware and sysupgrade mtd erase firmware sysupgrade 9. After the rebooting by completion of sysupgrade, start U-Boot telnetd and login with the same way above (3, 4) 10. Perform the following commands to reset "bootcmd" variable to the default and reset the device tp; run seattle tp; reset (the contents of "seattle": setenv bootcmd 'bootm 0x9f070040' && saveenv) 11. Wait booting-up the device Known issues: - the following 6x LEDs are connected to the gpio controller on QCA9888 chip and the implementation of control via the controller is missing in ath10k/ath10k-ct - "ACTIVE" (Red/Green) - "2.4GHz" (Red/Green) - "5GHz" (Red/Green) Note: - after the version v1.3.2 of stock firmware, "offline update" by uploading image by user is deleted and the factory image cannot be used - the U-Boot on WF1200CR doesn't configure the port-side LEDs on WAN/LAN and the configuration is required on OpenWrt - gpio-hog: set the direction of GPIO 14(WAN)/19(LAN) to output - pinmux: set GPIO 14/19 as switch-controlled LEDs Signed-off-by: INAGAKI Hiroshi --- .../linux/ath79/dts/qca9561_nec_wf1200cr.dts | 166 ++++++++++++++++++ .../generic/base-files/etc/board.d/02_network | 6 + .../etc/hotplug.d/firmware/10-ath9k-eeprom | 1 + .../etc/hotplug.d/firmware/11-ath10k-caldata | 1 + target/linux/ath79/image/generic.mk | 29 ++- 5 files changed, 197 insertions(+), 6 deletions(-) create mode 100644 target/linux/ath79/dts/qca9561_nec_wf1200cr.dts diff --git a/target/linux/ath79/dts/qca9561_nec_wf1200cr.dts b/target/linux/ath79/dts/qca9561_nec_wf1200cr.dts new file mode 100644 index 0000000000..90aac30d7f --- /dev/null +++ b/target/linux/ath79/dts/qca9561_nec_wf1200cr.dts @@ -0,0 +1,166 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca956x.dtsi" + +#include +#include + +/ { + model = "NEC Aterm WF1200CR"; + compatible = "nec,wf1200cr", "qca,qca9561"; + + aliases { + led-boot = &led_power_green; + led-failsafe = &led_power_red; + led-running = &led_power_green; + led-upgrade = &led_power_green; + }; + + leds { + compatible = "gpio-leds"; + /* other LEDs are connected to ath10k (QCA9888) gpiochip */ + + led_power_green: power_green { + label = "green:power"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + + led_power_red: power_red { + label = "red:power"; + gpios = <&gpio 21 GPIO_ACTIVE_LOW>; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 1 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + + router { + label = "rt"; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + linux,code = ; + linux,input-type = ; + debounce-interval = <60>; + }; + + wps { + label = "wps"; + gpios = <&gpio 22 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + }; +}; + +&spi { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x000000 0x040000>; + read-only; + }; + + partition@40000 { + label = "devdata"; + reg = <0x040000 0x010000>; + read-only; + }; + + partition@50000 { + label = "devconf"; + reg = <0x050000 0x010000>; + read-only; + }; + + partition@60000 { + label = "misc"; + reg = <0x060000 0x010000>; + read-only; + }; + + partition@70000 { + compatible = "seama"; + label = "firmware"; + reg = <0x070000 0x780000>; + }; + + partition@7f0000 { + label = "art"; + reg = <0x7f0000 0x010000>; + read-only; + }; + }; + }; +}; + +ð0 { + status = "okay"; + + pll-data = <0x03000101 0x00000101 0x00001919>; + + phy-handle = <&swphy0>; + + gmac-config { + device = <&gmac>; + + switch-phy-swap = <1>; + switch-phy-addr-swap = <0>; + }; +}; + +ð1 { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&pinmux_swled_enable_pins>; +}; + +&gpio { + switch_leds { + gpio-hog; + gpios = <14 GPIO_ACTIVE_HIGH>, /* WAN */ + <19 GPIO_ACTIVE_HIGH>; /* LAN */ + output-high; + line-name = "led:wan-lan"; + }; +}; + +&pinmux { + pinmux_swled_enable_pins: swled_enable_pins { + pinctrl-single,bits = + <0xc 0x240000 0xff0000>, /* WAN */ + <0x10 0x10000000 0xff000000>; /* LAN */ + }; +}; + +&pcie { + status = "okay"; + + wifi@0,0 { + compatible = "qcom,ath10k"; + reg = <0x0000 0 0 0 0>; + }; +}; + +&wmac { + status = "okay"; + + qca,no-eeprom; +}; diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network index ffafe7db20..f07c086977 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -300,6 +300,11 @@ ath79_setup_interfaces() ucidef_add_switch "switch0" \ "0@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan" ;; + nec,wf1200cr) + ucidef_set_interface_wan "eth1" + ucidef_add_switch "switch0" \ + "0@eth0" "1:lan" + ;; nec,wg1200cr|\ qxwlan,e1700ac-v2-8m|\ qxwlan,e1700ac-v2-16m|\ @@ -599,6 +604,7 @@ ath79_setup_macs() base_mac=$(mtd_get_mac_binary u-boot 0x1fc00) wan_mac=$(macaddr_add "$base_mac" 1) ;; + nec,wf1200cr|\ nec,wg1200cr) lan_mac=$(mtd_get_mac_ascii devdata "lanmac") wan_mac=$(mtd_get_mac_ascii devdata "wanmac") diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom index 62f2f1e8b4..388f477856 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom @@ -32,6 +32,7 @@ case "$FIRMWARE" in dlink,dir-842-c2|\ dlink,dir-842-c3|\ dlink,dir-859-a1|\ + nec,wf1200cr|\ nec,wg1200cr|\ wd,mynet-n750) caldata_extract "art" 0x1000 0x440 diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index b2392c2c64..feb9a5186e 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -201,6 +201,7 @@ case "$FIRMWARE" in ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \ /lib/firmware/ath10k/QCA9888/hw2.0/board.bin ;; + nec,wf1200cr|\ nec,wg1200cr) caldata_extract "art" 0x5000 0x2f20 ath10k_patch_mac $(mtd_get_mac_ascii devdata wlan5mac) diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index b459136ef5..9d0be2b86b 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -1417,20 +1417,37 @@ define Device/mercury_mw4530r-v1 endef TARGET_DEVICES += mercury_mw4530r-v1 -define Device/nec_wg1200cr - SOC := qca9563 +define Device/nec_wx1200cr DEVICE_VENDOR := NEC + IMAGE/default := append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | append-rootfs + IMAGE/sysupgrade.bin := $$(IMAGE/default) | seama | pad-rootfs | \ + append-metadata | check-size + DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca9888-ct +endef + +define Device/nec_wf1200cr + $(Device/nec_wx1200cr) + SOC := qca9561 + DEVICE_MODEL := Aterm WF1200CR + IMAGE_SIZE := 7680k + SEAMA_MTDBLOCK := 5 + SEAMA_SIGNATURE := wrgac62_necpf.2016gui_wf1200cr + IMAGES += factory.bin + IMAGE/factory.bin := $$(IMAGE/default) | pad-rootfs -x 64 | seama | \ + seama-seal | nec-enc ryztfyutcrqqo69d | check-size +endef +TARGET_DEVICES += nec_wf1200cr + +define Device/nec_wg1200cr + $(Device/nec_wx1200cr) + SOC := qca9563 DEVICE_MODEL := Aterm WG1200CR IMAGE_SIZE := 7616k SEAMA_MTDBLOCK := 6 SEAMA_SIGNATURE := wrgac72_necpf.2016gui_wg1200cr IMAGES += factory.bin - IMAGE/default := append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | append-rootfs - IMAGE/sysupgrade.bin := $$(IMAGE/default) | seama | pad-rootfs | \ - append-metadata | check-size IMAGE/factory.bin := $$(IMAGE/default) | pad-rootfs -x 64 | seama | \ seama-seal | nec-enc 9gsiy9nzep452pad | check-size - DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca9888-ct endef TARGET_DEVICES += nec_wg1200cr From 3e0387b3db86b35e101b147692d0af04c5083ca9 Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Sun, 25 Apr 2021 22:41:46 +0200 Subject: [PATCH 08/25] ath79: Support for Ubiquiti Rocket 5AC Lite The Ubiquiti Rocket 5AC Lite (R5AC-Lite) is an outdoor router. Specifications: - SoC: Qualcomm Atheros QCA9558 - RAM: 128 MB - Flash: 16 MB SPI - Ethernet: 1x 10/100/1000 Mbps - WiFi 5 GHz: QCA988x - Buttons: 1x (reset) - LEDs: 1x power, 1x Ethernet, 4x RSSI Installation: - Instructions for XC-type Ubiquiti: https://openwrt.org/toh/ubiquiti/common Signed-off-by: Nick Hainke --- .../dts/qca9558_ubnt_rocket-5ac-lite.dts | 38 +++++++++++++++++++ .../generic/base-files/etc/board.d/02_network | 1 + .../etc/hotplug.d/firmware/11-ath10k-caldata | 1 + target/linux/ath79/image/generic-ubnt.mk | 9 +++++ 4 files changed, 49 insertions(+) create mode 100644 target/linux/ath79/dts/qca9558_ubnt_rocket-5ac-lite.dts diff --git a/target/linux/ath79/dts/qca9558_ubnt_rocket-5ac-lite.dts b/target/linux/ath79/dts/qca9558_ubnt_rocket-5ac-lite.dts new file mode 100644 index 0000000000..e8e2322c56 --- /dev/null +++ b/target/linux/ath79/dts/qca9558_ubnt_rocket-5ac-lite.dts @@ -0,0 +1,38 @@ +// SPDX-License-Identifier: GPL-2.0-only + +#include "qca955x_ubnt_xc.dtsi" + +/ { + compatible = "ubnt,rocket-5ac-lite", "ubnt,xc", "qca,qca9558"; + model = "Ubiquiti Rocket 5AC Lite"; + + keys { + compatible = "gpio-keys"; + + reset { + label = "Reset button"; + linux,code = ; + gpios = <&gpio 19 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; +}; + +&mdio0 { + status = "okay"; + + phy-mask = <4>; + phy4: ethernet-phy@4 { + phy-mode = "sgmii"; + reg = <4>; + at803x-override-sgmii-link-check; + }; +}; + +ð0 { + status = "okay"; + + mtd-mac-address = <&art 0x0>; + phy-mode = "sgmii"; + phy-handle = <&phy4>; +}; diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network index f07c086977..c1ba760182 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -86,6 +86,7 @@ ath79_setup_interfaces() ubnt,powerbeam-5ac-500|\ ubnt,powerbeam-5ac-gen2|\ ubnt,powerbridge-m|\ + ubnt,rocket-5ac-lite|\ ubnt,rocket-m|\ ubnt,unifiac-lite|\ ubnt,unifiac-lr|\ diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index feb9a5186e..8d070cba27 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -43,6 +43,7 @@ case "$FIRMWARE" in ubnt,nanostation-ac-loco|\ ubnt,powerbeam-5ac-500|\ ubnt,powerbeam-5ac-gen2|\ + ubnt,rocket-5ac-lite|\ ubnt,unifiac-pro|\ yuncore,a770) caldata_extract "art" 0x5000 0x844 diff --git a/target/linux/ath79/image/generic-ubnt.mk b/target/linux/ath79/image/generic-ubnt.mk index 733d803d7a..f8e1d1e432 100644 --- a/target/linux/ath79/image/generic-ubnt.mk +++ b/target/linux/ath79/image/generic-ubnt.mk @@ -337,6 +337,15 @@ define Device/ubnt_powerbridge-m endef TARGET_DEVICES += ubnt_powerbridge-m +define Device/ubnt_rocket-5ac-lite + $(Device/ubnt-xc) + SOC := qca9558 + DEVICE_MODEL := Rocket 5AC + DEVICE_VARIANT := Lite + DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct +endef +TARGET_DEVICES += ubnt_rocket-5ac-lite + define Device/ubnt_rocket-m $(Device/ubnt-xm) SOC := ar7241 From f36990eae77c3a22842a2c418378c5dd40dec366 Mon Sep 17 00:00:00 2001 From: "Jonathan A. Kollasch" Date: Fri, 11 Sep 2020 14:33:39 -0500 Subject: [PATCH 09/25] ath79: fix eth0 PLL registers on WD My Net Wi-Fi Range Extender This replaces the register bits for RGMII delay on the MAC side in favor of having the RGMII delay on the PHY side by setting the phy-mode property to rgmii-id (RGMII internal delay), which is supported by the at803x driver. Speed 1000 is fixed as a result, so now all ethernet speeds function. Signed-off-by: Jonathan A. Kollasch Reviewed-by: Michael Pratt --- target/linux/ath79/dts/ar9344_wd_mynet-wifi-rangeextender.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/ath79/dts/ar9344_wd_mynet-wifi-rangeextender.dts b/target/linux/ath79/dts/ar9344_wd_mynet-wifi-rangeextender.dts index 575c72ee7c..7313e9acc2 100644 --- a/target/linux/ath79/dts/ar9344_wd_mynet-wifi-rangeextender.dts +++ b/target/linux/ath79/dts/ar9344_wd_mynet-wifi-rangeextender.dts @@ -144,10 +144,10 @@ ð0 { status = "okay"; - pll-data = <0x0e000000 0x3c000101 0x3c001313>; + pll-data = <0x02000000 0x00000101 0x00001313>; /* ethernet MAC is stored in nvram */ - phy-mode = "rgmii"; + phy-mode = "rgmii-id"; phy-handle = <&phy4>; gmac-config { From 3a8b75b56927d679dbf1a86827ceffef35207281 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 7 Jun 2021 23:13:18 +0100 Subject: [PATCH 10/25] ugps: update to git HEAD 86ee86e nmea: parse $GPZDA sentences for date/time 8e12414 nmea: parse $GPGLL sentences for position 5e88403 ubus: display only available information Signed-off-by: Daniel Golle --- package/utils/ugps/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/utils/ugps/Makefile b/package/utils/ugps/Makefile index 4ce64d9631..c70a7b7ea6 100644 --- a/package/utils/ugps/Makefile +++ b/package/utils/ugps/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ugps -PKG_RELEASE:=1 +PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE_URL=$(PROJECT_GIT)/project/ugps.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2020-08-29 -PKG_SOURCE_VERSION:=511a5b3c84fa715ef0305cf26c98619c12a4867a -PKG_MIRROR_HASH:=551d57b4c18da4c4695fa2f7a959c25a03be35d14cf872785e7db740f12366e2 +PKG_SOURCE_DATE:=2021-06-08 +PKG_SOURCE_VERSION:=5e88403fc0d39ae8a270d2c6c6e9c8a4d5232cf3 +PKG_MIRROR_HASH:=a3dfc2cc6def3b634d8b7cda9139926be3d876cf2faa5251c4821987954442a5 PKG_MAINTAINER:=John Crispin PKG_LICENSE:=GPL-2.0+ From 1412424fc51209480fa4efed9f3f0badc6dcab09 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Sun, 16 May 2021 18:01:28 +0200 Subject: [PATCH 11/25] ethtool: update to version 5.12 Update ethtool to newly released 5.12 version. Signed-off-by: Robert Marko --- package/network/utils/ethtool/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/network/utils/ethtool/Makefile b/package/network/utils/ethtool/Makefile index 3efc90490b..d645cf9bbb 100644 --- a/package/network/utils/ethtool/Makefile +++ b/package/network/utils/ethtool/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ethtool -PKG_VERSION:=5.10 +PKG_VERSION:=5.12 PKG_RELEASE:=1 PKG_MAINTAINER:=Felix Fietkau PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/software/network/ethtool -PKG_HASH:=817d5396a9307b4c637b435d4c558b8f5f964a1464a035ca3c0180f4cc93cfcf +PKG_HASH:=f5ddfa9c75053d8011b8c8c99ec4e2d3c83cd1972f638692d62e37fa3ef36f07 PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:=COPYING From 15167671b0d7cf0c95568dd6f9620db082df5d96 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Fri, 4 Jun 2021 15:12:14 +0200 Subject: [PATCH 12/25] generic: backport at803x fixes As patches for the AR8031/AR8033 copper page selection were merged upstream, we can backport these patches. This also fixes a PHY capabilities detection issue on the Ubiquiti ER-X-SFP. Signed-off-by: David Bauer --- ...x-select-correct-page-on-config-init.patch | 108 ++++++++++++++++++ ...ix-probe-error-if-copper-page-is-sel.patch | 73 ++++++++++++ ...x-select-correct-page-on-config-init.patch | 104 +++++++++++++++++ ...ix-probe-error-if-copper-page-is-sel.patch | 41 +++++++ ...net-phy-at803x-fix-at8033-sgmii-mode.patch | 51 --------- ...6-net-phy-at803x-add-at8031-features.patch | 36 ------ ...net-phy-at803x-fix-at8033-sgmii-mode.patch | 51 --------- ...6-net-phy-at803x-add-at8031-features.patch | 36 ------ ...acket-drops-at-low-traffic-rate-due-.patch | 9 +- ...dd-vddio-1v8-and-eee-disable-support.patch | 26 ++--- .../ramips/patches-5.10/710-at803x.patch | 17 +-- .../linux/ramips/patches-5.4/991-at803x.patch | 17 +-- 12 files changed, 361 insertions(+), 208 deletions(-) create mode 100644 target/linux/generic/backport-5.10/730-net-phy-at803x-select-correct-page-on-config-init.patch create mode 100644 target/linux/generic/backport-5.10/731-net-phy-at803x-fix-probe-error-if-copper-page-is-sel.patch create mode 100644 target/linux/generic/backport-5.4/790-net-phy-at803x-select-correct-page-on-config-init.patch create mode 100644 target/linux/generic/backport-5.4/791-net-phy-at803x-fix-probe-error-if-copper-page-is-sel.patch delete mode 100644 target/linux/generic/pending-5.10/735-net-phy-at803x-fix-at8033-sgmii-mode.patch delete mode 100644 target/linux/generic/pending-5.10/736-net-phy-at803x-add-at8031-features.patch delete mode 100644 target/linux/generic/pending-5.4/735-net-phy-at803x-fix-at8033-sgmii-mode.patch delete mode 100644 target/linux/generic/pending-5.4/736-net-phy-at803x-add-at8031-features.patch diff --git a/target/linux/generic/backport-5.10/730-net-phy-at803x-select-correct-page-on-config-init.patch b/target/linux/generic/backport-5.10/730-net-phy-at803x-select-correct-page-on-config-init.patch new file mode 100644 index 0000000000..00be403299 --- /dev/null +++ b/target/linux/generic/backport-5.10/730-net-phy-at803x-select-correct-page-on-config-init.patch @@ -0,0 +1,108 @@ +From c329e5afb42ff0a88285eb4d8a391a18793e4777 Mon Sep 17 00:00:00 2001 +From: David Bauer +Date: Thu, 15 Apr 2021 03:26:50 +0200 +Subject: [PATCH] net: phy: at803x: select correct page on config init + +The Atheros AR8031 and AR8033 expose different registers for SGMII/Fiber +as well as the copper side of the PHY depending on the BT_BX_REG_SEL bit +in the chip configure register. + +The driver assumes the copper side is selected on probe, but this might +not be the case depending which page was last selected by the +bootloader. Notably, Ubiquiti UniFi bootloaders show this behavior. + +Select the copper page when probing to circumvent this. + +Signed-off-by: David Bauer +Signed-off-by: David S. Miller +--- + drivers/net/phy/at803x.c | 50 +++++++++++++++++++++++++++++++++++++++- + 1 file changed, 49 insertions(+), 1 deletion(-) + +--- a/drivers/net/phy/at803x.c ++++ b/drivers/net/phy/at803x.c +@@ -139,6 +139,9 @@ + #define ATH8035_PHY_ID 0x004dd072 + #define AT8030_PHY_ID_MASK 0xffffffef + ++#define AT803X_PAGE_FIBER 0 ++#define AT803X_PAGE_COPPER 1 ++ + MODULE_DESCRIPTION("Qualcomm Atheros AR803x PHY driver"); + MODULE_AUTHOR("Matus Ujhelyi"); + MODULE_LICENSE("GPL"); +@@ -190,6 +193,35 @@ static int at803x_debug_reg_mask(struct + return phy_write(phydev, AT803X_DEBUG_DATA, val); + } + ++static int at803x_write_page(struct phy_device *phydev, int page) ++{ ++ int mask; ++ int set; ++ ++ if (page == AT803X_PAGE_COPPER) { ++ set = AT803X_BT_BX_REG_SEL; ++ mask = 0; ++ } else { ++ set = 0; ++ mask = AT803X_BT_BX_REG_SEL; ++ } ++ ++ return __phy_modify(phydev, AT803X_REG_CHIP_CONFIG, mask, set); ++} ++ ++static int at803x_read_page(struct phy_device *phydev) ++{ ++ int ccr = __phy_read(phydev, AT803X_REG_CHIP_CONFIG); ++ ++ if (ccr < 0) ++ return ccr; ++ ++ if (ccr & AT803X_BT_BX_REG_SEL) ++ return AT803X_PAGE_COPPER; ++ ++ return AT803X_PAGE_FIBER; ++} ++ + static int at803x_enable_rx_delay(struct phy_device *phydev) + { + return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0, 0, +@@ -508,6 +540,7 @@ static int at803x_probe(struct phy_devic + { + struct device *dev = &phydev->mdio.dev; + struct at803x_priv *priv; ++ int ret; + + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + if (!priv) +@@ -515,7 +548,20 @@ static int at803x_probe(struct phy_devic + + phydev->priv = priv; + +- return at803x_parse_dt(phydev); ++ ret = at803x_parse_dt(phydev); ++ if (ret) ++ return ret; ++ ++ /* Some bootloaders leave the fiber page selected. ++ * Switch to the copper page, as otherwise we read ++ * the PHY capabilities from the fiber side. ++ */ ++ if (at803x_match_phy_id(phydev, ATH8031_PHY_ID)) { ++ ret = phy_select_page(phydev, AT803X_PAGE_COPPER); ++ ret = phy_restore_page(phydev, AT803X_PAGE_COPPER, ret); ++ } ++ ++ return ret; + } + + static void at803x_remove(struct phy_device *phydev) +@@ -1097,6 +1143,8 @@ static struct phy_driver at803x_driver[] + .get_wol = at803x_get_wol, + .suspend = at803x_suspend, + .resume = at803x_resume, ++ .read_page = at803x_read_page, ++ .write_page = at803x_write_page, + /* PHY_GBIT_FEATURES */ + .read_status = at803x_read_status, + .aneg_done = at803x_aneg_done, diff --git a/target/linux/generic/backport-5.10/731-net-phy-at803x-fix-probe-error-if-copper-page-is-sel.patch b/target/linux/generic/backport-5.10/731-net-phy-at803x-fix-probe-error-if-copper-page-is-sel.patch new file mode 100644 index 0000000000..d6ec7450e8 --- /dev/null +++ b/target/linux/generic/backport-5.10/731-net-phy-at803x-fix-probe-error-if-copper-page-is-sel.patch @@ -0,0 +1,73 @@ +From 8f7e876273e294b732b42af2e5e6bba91d798954 Mon Sep 17 00:00:00 2001 +From: Michael Walle +Date: Tue, 20 Apr 2021 12:29:29 +0200 +Subject: [PATCH] net: phy: at803x: fix probe error if copper page is selected + +The commit c329e5afb42f ("net: phy: at803x: select correct page on +config init") selects the copper page during probe. This fails if the +copper page was already selected. In this case, the value of the copper +page (which is 1) is propagated through phy_restore_page() and is +finally returned for at803x_probe(). Fix it, by just using the +at803x_page_write() directly. + +Also in case of an error, the regulator is not disabled and leads to a +WARN_ON() when the probe fails. This couldn't happen before, because +at803x_parse_dt() was the last call in at803x_probe(). It is hard to +see, that the parse_dt() actually enables the regulator. Thus move the +regulator_enable() to the probe function and undo it in case of an +error. + +Fixes: c329e5afb42f ("net: phy: at803x: select correct page on config init") +Signed-off-by: Michael Walle +Reviewed-by: David Bauer +Signed-off-by: David S. Miller +--- + drivers/net/phy/at803x.c | 23 +++++++++++++++++------ + 1 file changed, 17 insertions(+), 6 deletions(-) + +--- a/drivers/net/phy/at803x.c ++++ b/drivers/net/phy/at803x.c +@@ -527,10 +527,6 @@ static int at803x_parse_dt(struct phy_de + phydev_err(phydev, "failed to get VDDIO regulator\n"); + return PTR_ERR(priv->vddio); + } +- +- ret = regulator_enable(priv->vddio); +- if (ret < 0) +- return ret; + } + + return 0; +@@ -552,15 +548,30 @@ static int at803x_probe(struct phy_devic + if (ret) + return ret; + ++ if (priv->vddio) { ++ ret = regulator_enable(priv->vddio); ++ if (ret < 0) ++ return ret; ++ } ++ + /* Some bootloaders leave the fiber page selected. + * Switch to the copper page, as otherwise we read + * the PHY capabilities from the fiber side. + */ + if (at803x_match_phy_id(phydev, ATH8031_PHY_ID)) { +- ret = phy_select_page(phydev, AT803X_PAGE_COPPER); +- ret = phy_restore_page(phydev, AT803X_PAGE_COPPER, ret); ++ phy_lock_mdio_bus(phydev); ++ ret = at803x_write_page(phydev, AT803X_PAGE_COPPER); ++ phy_unlock_mdio_bus(phydev); ++ if (ret) ++ goto err; + } + ++ return 0; ++ ++err: ++ if (priv->vddio) ++ regulator_disable(priv->vddio); ++ + return ret; + } + diff --git a/target/linux/generic/backport-5.4/790-net-phy-at803x-select-correct-page-on-config-init.patch b/target/linux/generic/backport-5.4/790-net-phy-at803x-select-correct-page-on-config-init.patch new file mode 100644 index 0000000000..c6811736f8 --- /dev/null +++ b/target/linux/generic/backport-5.4/790-net-phy-at803x-select-correct-page-on-config-init.patch @@ -0,0 +1,104 @@ +From c329e5afb42ff0a88285eb4d8a391a18793e4777 Mon Sep 17 00:00:00 2001 +From: David Bauer +Date: Thu, 15 Apr 2021 03:26:50 +0200 +Subject: [PATCH] net: phy: at803x: select correct page on config init + +The Atheros AR8031 and AR8033 expose different registers for SGMII/Fiber +as well as the copper side of the PHY depending on the BT_BX_REG_SEL bit +in the chip configure register. + +The driver assumes the copper side is selected on probe, but this might +not be the case depending which page was last selected by the +bootloader. Notably, Ubiquiti UniFi bootloaders show this behavior. + +Select the copper page when probing to circumvent this. + +Signed-off-by: David Bauer +Signed-off-by: David S. Miller +--- + drivers/net/phy/at803x.c | 50 +++++++++++++++++++++++++++++++++++++++- + 1 file changed, 49 insertions(+), 1 deletion(-) + +--- a/drivers/net/phy/at803x.c ++++ b/drivers/net/phy/at803x.c +@@ -67,6 +67,9 @@ + #define ATH8035_PHY_ID 0x004dd072 + #define AT803X_PHY_ID_MASK 0xffffffef + ++#define AT803X_PAGE_FIBER 0 ++#define AT803X_PAGE_COPPER 1 ++ + MODULE_DESCRIPTION("Atheros 803x PHY driver"); + MODULE_AUTHOR("Matus Ujhelyi"); + MODULE_LICENSE("GPL"); +@@ -112,6 +115,35 @@ static int at803x_debug_reg_mask(struct + return phy_write(phydev, AT803X_DEBUG_DATA, val); + } + ++static int at803x_write_page(struct phy_device *phydev, int page) ++{ ++ int mask; ++ int set; ++ ++ if (page == AT803X_PAGE_COPPER) { ++ set = AT803X_BT_BX_REG_SEL; ++ mask = 0; ++ } else { ++ set = 0; ++ mask = AT803X_BT_BX_REG_SEL; ++ } ++ ++ return __phy_modify(phydev, AT803X_REG_CHIP_CONFIG, mask, set); ++} ++ ++static int at803x_read_page(struct phy_device *phydev) ++{ ++ int ccr = __phy_read(phydev, AT803X_REG_CHIP_CONFIG); ++ ++ if (ccr < 0) ++ return ccr; ++ ++ if (ccr & AT803X_BT_BX_REG_SEL) ++ return AT803X_PAGE_COPPER; ++ ++ return AT803X_PAGE_FIBER; ++} ++ + static int at803x_enable_rx_delay(struct phy_device *phydev) + { + return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0, 0, +@@ -244,6 +276,7 @@ static int at803x_probe(struct phy_devic + { + struct device *dev = &phydev->mdio.dev; + struct at803x_priv *priv; ++ int ret; + + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + if (!priv) +@@ -251,7 +284,16 @@ static int at803x_probe(struct phy_devic + + phydev->priv = priv; + +- return 0; ++ /* Some bootloaders leave the fiber page selected. ++ * Switch to the copper page, as otherwise we read ++ * the PHY capabilities from the fiber side. ++ */ ++ if ((phydev->phy_id & phydev->drv->phy_id_mask) == (ATH8031_PHY_ID & phydev->drv->phy_id_mask)) { ++ ret = phy_select_page(phydev, AT803X_PAGE_COPPER); ++ ret = phy_restore_page(phydev, AT803X_PAGE_COPPER, ret); ++ } ++ ++ return ret; + } + + static int at803x_config_init(struct phy_device *phydev) +@@ -466,6 +508,8 @@ static struct phy_driver at803x_driver[] + .get_wol = at803x_get_wol, + .suspend = at803x_suspend, + .resume = at803x_resume, ++ .read_page = at803x_read_page, ++ .write_page = at803x_write_page, + /* PHY_GBIT_FEATURES */ + .read_status = at803x_read_status, + .aneg_done = at803x_aneg_done, diff --git a/target/linux/generic/backport-5.4/791-net-phy-at803x-fix-probe-error-if-copper-page-is-sel.patch b/target/linux/generic/backport-5.4/791-net-phy-at803x-fix-probe-error-if-copper-page-is-sel.patch new file mode 100644 index 0000000000..ac9583a89e --- /dev/null +++ b/target/linux/generic/backport-5.4/791-net-phy-at803x-fix-probe-error-if-copper-page-is-sel.patch @@ -0,0 +1,41 @@ +From 8f7e876273e294b732b42af2e5e6bba91d798954 Mon Sep 17 00:00:00 2001 +From: Michael Walle +Date: Tue, 20 Apr 2021 12:29:29 +0200 +Subject: [PATCH] net: phy: at803x: fix probe error if copper page is selected + +The commit c329e5afb42f ("net: phy: at803x: select correct page on +config init") selects the copper page during probe. This fails if the +copper page was already selected. In this case, the value of the copper +page (which is 1) is propagated through phy_restore_page() and is +finally returned for at803x_probe(). Fix it, by just using the +at803x_page_write() directly. + +Also in case of an error, the regulator is not disabled and leads to a +WARN_ON() when the probe fails. This couldn't happen before, because +at803x_parse_dt() was the last call in at803x_probe(). It is hard to +see, that the parse_dt() actually enables the regulator. Thus move the +regulator_enable() to the probe function and undo it in case of an +error. + +Fixes: c329e5afb42f ("net: phy: at803x: select correct page on config init") +Signed-off-by: Michael Walle +Reviewed-by: David Bauer +Signed-off-by: David S. Miller +--- + drivers/net/phy/at803x.c | 23 +++++++++++++++++------ + 1 file changed, 17 insertions(+), 6 deletions(-) + +--- a/drivers/net/phy/at803x.c ++++ b/drivers/net/phy/at803x.c +@@ -289,8 +289,9 @@ static int at803x_probe(struct phy_devic + * the PHY capabilities from the fiber side. + */ + if ((phydev->phy_id & phydev->drv->phy_id_mask) == (ATH8031_PHY_ID & phydev->drv->phy_id_mask)) { +- ret = phy_select_page(phydev, AT803X_PAGE_COPPER); +- ret = phy_restore_page(phydev, AT803X_PAGE_COPPER, ret); ++ mutex_lock(&phydev->mdio.bus->mdio_lock); ++ ret = at803x_write_page(phydev, AT803X_PAGE_COPPER); ++ mutex_unlock(&phydev->mdio.bus->mdio_lock); + } + + return ret; diff --git a/target/linux/generic/pending-5.10/735-net-phy-at803x-fix-at8033-sgmii-mode.patch b/target/linux/generic/pending-5.10/735-net-phy-at803x-fix-at8033-sgmii-mode.patch deleted file mode 100644 index b063b10251..0000000000 --- a/target/linux/generic/pending-5.10/735-net-phy-at803x-fix-at8033-sgmii-mode.patch +++ /dev/null @@ -1,51 +0,0 @@ -From: Roman Yeryomin -Subject: kernel: add at803x fix for sgmii mode - -Some (possibly broken) bootloaders incorreclty initialize at8033 -phy. This patch enables sgmii autonegotiation mode. - -[john@phrozen.org: felix added this to his upstream queue] - -Signed-off-by: Roman Yeryomin ---- - drivers/net/phy/at803x.c | 25 +++++++++++++++++++++++++ - 1 file changed, 25 insertions(+) - ---- a/drivers/net/phy/at803x.c -+++ b/drivers/net/phy/at803x.c -@@ -76,6 +76,7 @@ - #define AT803X_LOC_MAC_ADDR_32_47_OFFSET 0x804A - #define AT803X_REG_CHIP_CONFIG 0x1f - #define AT803X_BT_BX_REG_SEL 0x8000 -+#define AT803X_SGMII_ANEG_EN 0x1000 - - #define AT803X_DEBUG_ADDR 0x1D - #define AT803X_DEBUG_DATA 0x1E -@@ -562,6 +563,27 @@ static int at8031_pll_config(struct phy_ - static int at803x_config_init(struct phy_device *phydev) - { - int ret; -+ u32 v; -+ -+ if (phydev->drv->phy_id == ATH8031_PHY_ID && -+ phydev->interface == PHY_INTERFACE_MODE_SGMII) -+ { -+ v = phy_read(phydev, AT803X_REG_CHIP_CONFIG); -+ /* select SGMII/fiber page */ -+ ret = phy_write(phydev, AT803X_REG_CHIP_CONFIG, -+ v & ~AT803X_BT_BX_REG_SEL); -+ if (ret) -+ return ret; -+ /* enable SGMII autonegotiation */ -+ ret = phy_write(phydev, MII_BMCR, AT803X_SGMII_ANEG_EN); -+ if (ret) -+ return ret; -+ /* select copper page */ -+ ret = phy_write(phydev, AT803X_REG_CHIP_CONFIG, -+ v | AT803X_BT_BX_REG_SEL); -+ if (ret) -+ return ret; -+ } - - /* The RX and TX delay default is: - * after HW reset: RX delay enabled and TX delay disabled diff --git a/target/linux/generic/pending-5.10/736-net-phy-at803x-add-at8031-features.patch b/target/linux/generic/pending-5.10/736-net-phy-at803x-add-at8031-features.patch deleted file mode 100644 index 77d3946aae..0000000000 --- a/target/linux/generic/pending-5.10/736-net-phy-at803x-add-at8031-features.patch +++ /dev/null @@ -1,36 +0,0 @@ -Add back explicit PHY feature flags for the AR8031 and -AR8033 PHY instead of reading them from the PHY. - -The Botloader for Ubiquiti UniFi AC boards (and possibly more) -leave fiber page selected, thus we will end up reading the PHY -capabilities of the SGMII side (which does not offer 10 Mbit/s). - -We already have a hack in place, which switches back to the copper -page, however this happens after capabilities are read. - -The original conversation about 735-net-phy-at803x-fix-at8033-sgmii-mode -back in 2015 explicitly mention the UniFi AC Lite. The issue however is -not missing autonegotiation on the Fiber side, but the fact the PHY -is never switched to the copper side. So half of this patch is superfluous. - -A fix is currently being upstreamed. Once this is mainlined and available to us, -these patches can be dropped: - -735-net-phy-at803x-fix-at8033-sgmii-mode.patch -736-net-phy-at803x-add-at8031-features.patch - -This was tested on a UniFi AC Lite. - -See https://patchwork.kernel.org/project/netdevbpf/list/?series=467341 - ---- a/drivers/net/phy/at803x.c -+++ b/drivers/net/phy/at803x.c -@@ -1119,7 +1119,7 @@ static struct phy_driver at803x_driver[] - .get_wol = at803x_get_wol, - .suspend = at803x_suspend, - .resume = at803x_resume, -- /* PHY_GBIT_FEATURES */ -+ .features = PHY_GBIT_FEATURES, - .read_status = at803x_read_status, - .aneg_done = at803x_aneg_done, - .ack_interrupt = &at803x_ack_interrupt, diff --git a/target/linux/generic/pending-5.4/735-net-phy-at803x-fix-at8033-sgmii-mode.patch b/target/linux/generic/pending-5.4/735-net-phy-at803x-fix-at8033-sgmii-mode.patch deleted file mode 100644 index 795743057a..0000000000 --- a/target/linux/generic/pending-5.4/735-net-phy-at803x-fix-at8033-sgmii-mode.patch +++ /dev/null @@ -1,51 +0,0 @@ -From: Roman Yeryomin -Subject: kernel: add at803x fix for sgmii mode - -Some (possibly broken) bootloaders incorreclty initialize at8033 -phy. This patch enables sgmii autonegotiation mode. - -[john@phrozen.org: felix added this to his upstream queue] - -Signed-off-by: Roman Yeryomin ---- - drivers/net/phy/at803x.c | 25 +++++++++++++++++++++++++ - 1 file changed, 25 insertions(+) - ---- a/drivers/net/phy/at803x.c -+++ b/drivers/net/phy/at803x.c -@@ -46,6 +46,7 @@ - #define AT803X_LOC_MAC_ADDR_32_47_OFFSET 0x804A - #define AT803X_REG_CHIP_CONFIG 0x1f - #define AT803X_BT_BX_REG_SEL 0x8000 -+#define AT803X_SGMII_ANEG_EN 0x1000 - - #define AT803X_DEBUG_ADDR 0x1D - #define AT803X_DEBUG_DATA 0x1E -@@ -259,6 +260,27 @@ static int at803x_probe(struct phy_devic - static int at803x_config_init(struct phy_device *phydev) - { - int ret; -+ u32 v; -+ -+ if (phydev->drv->phy_id == ATH8031_PHY_ID && -+ phydev->interface == PHY_INTERFACE_MODE_SGMII) -+ { -+ v = phy_read(phydev, AT803X_REG_CHIP_CONFIG); -+ /* select SGMII/fiber page */ -+ ret = phy_write(phydev, AT803X_REG_CHIP_CONFIG, -+ v & ~AT803X_BT_BX_REG_SEL); -+ if (ret) -+ return ret; -+ /* enable SGMII autonegotiation */ -+ ret = phy_write(phydev, MII_BMCR, AT803X_SGMII_ANEG_EN); -+ if (ret) -+ return ret; -+ /* select copper page */ -+ ret = phy_write(phydev, AT803X_REG_CHIP_CONFIG, -+ v | AT803X_BT_BX_REG_SEL); -+ if (ret) -+ return ret; -+ } - - /* The RX and TX delay default is: - * after HW reset: RX delay enabled and TX delay disabled diff --git a/target/linux/generic/pending-5.4/736-net-phy-at803x-add-at8031-features.patch b/target/linux/generic/pending-5.4/736-net-phy-at803x-add-at8031-features.patch deleted file mode 100644 index aa70f82823..0000000000 --- a/target/linux/generic/pending-5.4/736-net-phy-at803x-add-at8031-features.patch +++ /dev/null @@ -1,36 +0,0 @@ -Add back explicit PHY feature flags for the AR8031 and -AR8033 PHY instead of reading them from the PHY. - -The Botloader for Ubiquiti UniFi AC boards (and possibly more) -leave fiber page selected, thus we will end up reading the PHY -capabilities of the SGMII side (which does not offer 10 Mbit/s). - -We already have a hack in place, which switches back to the copper -page, however this happens after capabilities are read. - -The original conversation about 735-net-phy-at803x-fix-at8033-sgmii-mode -back in 2015 explicitly mention the UniFi AC Lite. The issue however is -not missing autonegotiation on the Fiber side, but the fact the PHY -is never switched to the copper side. So half of this patch is superfluous. - -A fix is currently being upstreamed. Once this is mainlined and available to us, -these patches can be dropped: - -735-net-phy-at803x-fix-at8033-sgmii-mode.patch -736-net-phy-at803x-add-at8031-features.patch - -This was tested on a UniFi AC Lite. - -See https://patchwork.kernel.org/project/netdevbpf/list/?series=467341 - ---- a/drivers/net/phy/at803x.c -+++ b/drivers/net/phy/at803x.c -@@ -490,7 +490,7 @@ static struct phy_driver at803x_driver[] - .get_wol = at803x_get_wol, - .suspend = at803x_suspend, - .resume = at803x_resume, -- /* PHY_GBIT_FEATURES */ -+ .features = PHY_GBIT_FEATURES, - .read_status = at803x_read_status, - .aneg_done = at803x_aneg_done, - .ack_interrupt = &at803x_ack_interrupt, diff --git a/target/linux/layerscape/patches-5.4/701-net-0327-at803x-Address-packet-drops-at-low-traffic-rate-due-.patch b/target/linux/layerscape/patches-5.4/701-net-0327-at803x-Address-packet-drops-at-low-traffic-rate-due-.patch index 303d122459..f8dda3a22d 100644 --- a/target/linux/layerscape/patches-5.4/701-net-0327-at803x-Address-packet-drops-at-low-traffic-rate-due-.patch +++ b/target/linux/layerscape/patches-5.4/701-net-0327-at803x-Address-packet-drops-at-low-traffic-rate-due-.patch @@ -41,7 +41,7 @@ Signed-off-by: Vladimir Oltean depends on BCM63XX || COMPILE_TEST --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c -@@ -63,6 +63,8 @@ +@@ -62,6 +62,8 @@ #define AT803X_DEBUG_REG_5 0x05 #define AT803X_DEBUG_TX_CLK_DLY_EN BIT(8) @@ -50,8 +50,8 @@ Signed-off-by: Vladimir Oltean #define ATH8030_PHY_ID 0x004dd076 #define ATH8031_PHY_ID 0x004dd074 #define ATH8032_PHY_ID 0x004dd023 -@@ -257,6 +259,19 @@ static int at803x_probe(struct phy_devic - return 0; +@@ -299,10 +301,30 @@ static int at803x_probe(struct phy_devic + return ret; } +static void at803x_enable_smart_eee(struct phy_device *phydev, int on) @@ -70,9 +70,6 @@ Signed-off-by: Vladimir Oltean static int at803x_config_init(struct phy_device *phydev) { int ret; -@@ -282,6 +297,13 @@ static int at803x_config_init(struct phy - return ret; - } + +#ifdef CONFIG_AT803X_PHY_SMART_EEE diff --git a/target/linux/layerscape/patches-5.4/701-net-0330-net-phy-at803x-add-vddio-1v8-and-eee-disable-support.patch b/target/linux/layerscape/patches-5.4/701-net-0330-net-phy-at803x-add-vddio-1v8-and-eee-disable-support.patch index 32339191e4..7ae1ba3333 100644 --- a/target/linux/layerscape/patches-5.4/701-net-0330-net-phy-at803x-add-vddio-1v8-and-eee-disable-support.patch +++ b/target/linux/layerscape/patches-5.4/701-net-0330-net-phy-at803x-add-vddio-1v8-and-eee-disable-support.patch @@ -28,10 +28,10 @@ Signed-off-by: Yangbo Lu #define AT803X_REG_CHIP_CONFIG 0x1f #define AT803X_BT_BX_REG_SEL 0x8000 +#define AT803X_SMARTEEE_DISABLED_VAL 0x1000 - #define AT803X_SGMII_ANEG_EN 0x1000 #define AT803X_DEBUG_ADDR 0x1D -@@ -65,6 +70,9 @@ + #define AT803X_DEBUG_DATA 0x1E +@@ -64,6 +69,9 @@ #define AT803X_LPI_EN BIT(8) @@ -41,9 +41,9 @@ Signed-off-by: Yangbo Lu #define ATH8030_PHY_ID 0x004dd076 #define ATH8031_PHY_ID 0x004dd074 #define ATH8032_PHY_ID 0x004dd023 -@@ -72,12 +80,16 @@ - #define AT803X_PHY_ID_MASK 0xffffffef - #define AT8032_PHY_ID_MASK 0xffffffff +@@ -74,12 +82,16 @@ + #define AT803X_PAGE_FIBER 0 + #define AT803X_PAGE_COPPER 1 +#define AT803X_EEE_FEATURE_DISABLE (1 << 1) +#define AT803X_VDDIO_1P8V (1 << 2) @@ -58,7 +58,7 @@ Signed-off-by: Yangbo Lu }; struct at803x_context { -@@ -141,6 +153,39 @@ static int at803x_disable_tx_delay(struc +@@ -172,6 +184,39 @@ static int at803x_disable_tx_delay(struc AT803X_DEBUG_TX_CLK_DLY_EN, 0); } @@ -98,7 +98,7 @@ Signed-off-by: Yangbo Lu /* save relevant PHY registers to private copy */ static void at803x_context_save(struct phy_device *phydev, struct at803x_context *context) -@@ -254,6 +299,12 @@ static int at803x_probe(struct phy_devic +@@ -286,6 +331,12 @@ static int at803x_probe(struct phy_devic if (!priv) return -ENOMEM; @@ -110,16 +110,16 @@ Signed-off-by: Yangbo Lu + phydev->priv = priv; - return 0; -@@ -275,6 +326,7 @@ static void at803x_enable_smart_eee(stru + /* Some bootloaders leave the fiber page selected. +@@ -316,6 +367,7 @@ static void at803x_enable_smart_eee(stru + static int at803x_config_init(struct phy_device *phydev) { - int ret; + struct at803x_priv *priv = phydev->priv; - u32 v; + int ret; - if (phydev->drv->phy_id == ATH8031_PHY_ID && -@@ -323,6 +375,18 @@ static int at803x_config_init(struct phy + +@@ -344,6 +396,18 @@ static int at803x_config_init(struct phy else ret = at803x_disable_tx_delay(phydev); diff --git a/target/linux/ramips/patches-5.10/710-at803x.patch b/target/linux/ramips/patches-5.10/710-at803x.patch index dab62b7607..d15dd92965 100644 --- a/target/linux/ramips/patches-5.10/710-at803x.patch +++ b/target/linux/ramips/patches-5.10/710-at803x.patch @@ -23,7 +23,7 @@ Signed-off-by: René van Dorst #define AT803X_SPECIFIC_FUNCTION_CONTROL 0x10 #define AT803X_SFC_ASSERT_CRS BIT(11) -@@ -83,9 +85,18 @@ +@@ -82,9 +84,18 @@ #define AT803X_MODE_CFG_MASK 0x0F #define AT803X_MODE_CFG_SGMII 0x01 @@ -42,7 +42,7 @@ Signed-off-by: René van Dorst #define AT803X_DEBUG_REG_0 0x00 #define AT803X_DEBUG_RX_CLK_DLY_EN BIT(15) -@@ -505,10 +516,72 @@ static int at803x_parse_dt(struct phy_de +@@ -532,12 +543,75 @@ static int at803x_parse_dt(struct phy_de return 0; } @@ -100,22 +100,25 @@ Signed-off-by: René van Dorst + .detach = phy_sfp_detach, + .module_insert = at803x_sfp_insert, +}; ++ + static int at803x_probe(struct phy_device *phydev) { struct device *dev = &phydev->mdio.dev; struct at803x_priv *priv; -+ int ret; + int ret; + + + if (at803x_mode(phydev) == AT803X_MODE_FIBER) { + ret = phy_sfp_probe(phydev, &at803x_sfp_ops); + if (ret < 0) + return ret; + } - ++ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) -@@ -709,6 +782,10 @@ static int at803x_read_status(struct phy + return -ENOMEM; +@@ -744,6 +818,10 @@ static int at803x_read_status(struct phy { int ss, err, old_link = phydev->link; @@ -126,7 +129,7 @@ Signed-off-by: René van Dorst /* Update the link, but return if there was an error */ err = genphy_update_link(phydev); if (err) -@@ -809,6 +886,12 @@ static int at803x_config_aneg(struct phy +@@ -844,6 +922,12 @@ static int at803x_config_aneg(struct phy { int ret; @@ -139,7 +142,7 @@ Signed-off-by: René van Dorst ret = at803x_config_mdix(phydev, phydev->mdix_ctrl); if (ret < 0) return ret; -@@ -1110,6 +1193,7 @@ static struct phy_driver at803x_driver[] +@@ -1145,6 +1229,7 @@ static struct phy_driver at803x_driver[] /* Qualcomm Atheros AR8031/AR8033 */ PHY_ID_MATCH_EXACT(ATH8031_PHY_ID), .name = "Qualcomm Atheros AR8031/AR8033", diff --git a/target/linux/ramips/patches-5.4/991-at803x.patch b/target/linux/ramips/patches-5.4/991-at803x.patch index 95411211b2..29e79e65d7 100644 --- a/target/linux/ramips/patches-5.4/991-at803x.patch +++ b/target/linux/ramips/patches-5.4/991-at803x.patch @@ -23,7 +23,7 @@ Signed-off-by: René van Dorst #define AT803X_SPECIFIC_STATUS 0x11 #define AT803X_SS_SPEED_MASK (3 << 14) -@@ -53,9 +55,18 @@ +@@ -52,9 +54,18 @@ #define AT803X_MODE_CFG_MASK 0x0F #define AT803X_MODE_CFG_SGMII 0x01 @@ -42,7 +42,7 @@ Signed-off-by: René van Dorst #define AT803X_DEBUG_REG_0 0x00 #define AT803X_DEBUG_RX_CLK_DLY_EN BIT(15) -@@ -243,10 +254,72 @@ static int at803x_resume(struct phy_devi +@@ -274,12 +285,73 @@ static int at803x_resume(struct phy_devi return phy_modify(phydev, MII_BMCR, BMCR_PDOWN | BMCR_ISOLATE, 0); } @@ -105,17 +105,18 @@ Signed-off-by: René van Dorst { struct device *dev = &phydev->mdio.dev; struct at803x_priv *priv; -+ int ret; -+ + int ret; + + if (at803x_mode(phydev) == AT803X_MODE_FIBER) { + ret = phy_sfp_probe(phydev, &at803x_sfp_ops); + if (ret < 0) + return ret; + } - ++ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) -@@ -394,6 +467,10 @@ static int at803x_read_status(struct phy + return -ENOMEM; +@@ -415,6 +487,10 @@ static int at803x_read_status(struct phy { int ss, err, old_link = phydev->link; @@ -126,7 +127,7 @@ Signed-off-by: René van Dorst /* Update the link, but return if there was an error */ err = genphy_update_link(phydev); if (err) -@@ -448,6 +525,19 @@ static int at803x_read_status(struct phy +@@ -469,6 +545,19 @@ static int at803x_read_status(struct phy return 0; } @@ -146,7 +147,7 @@ Signed-off-by: René van Dorst static struct phy_driver at803x_driver[] = { { /* ATHEROS 8035 */ -@@ -461,6 +551,7 @@ static struct phy_driver at803x_driver[] +@@ -482,6 +571,7 @@ static struct phy_driver at803x_driver[] .suspend = at803x_suspend, .resume = at803x_resume, /* PHY_GBIT_FEATURES */ From 441353743095d11c232bb855848a2aa2d1edafa0 Mon Sep 17 00:00:00 2001 From: Tomas Lara Date: Tue, 1 Jun 2021 14:00:15 -0400 Subject: [PATCH 13/25] linux-firmware: update to 20210511 git log --pretty=oneline --abbrev-commit 20201118..20210511 7685cf4 (HEAD, tag: 20210511) nvidia: Update Tegra194 XUSB firmware to v60.09 cf32752 nvidia: Update Tegra186 XUSB firmware to v55.18 cb8ca82 nvidia: Update Tegra210 XUSB firmware to v50.26 f99d6a1 linux-firmware: update firmware for mhdp8546 ecdfcf8 Merge branch 'adlp_dmc_firmware' of git://anongit.freedesktop.org/drm/drm-firmware into main 547b202 Merge https://github.com/suraj714/linux-firmware-venus into main 3d32f21 i915: Add ADL-P DMC Support 3f23f51 amdgpu: add new polaris 12 MC firmware a2565bb firmware: nvidia: Add VIC firmware for Tegra194 17ec2a5 qcom: add gpu firmwares for sc7280 b653cf4 Merge https://github.com/pkshih/linux-firmware into main 2a96c08 brcm: Add a link to enable khadas VIM2's WiFi ffc64a2 rtw89: 8852a: update fw to v0.13.8.0 3e3497c rtl_bt: Update RTL8852A BT USB firmware to 0xD9A8_7893 c7b11ed qcom: Add venus firmware files for VPU-2.0 2f4f0f8 rtw89: 8852a: update fw to v0.13.8.0 fa0efef linux-firmware: Update firmware file for Intel Bluetooth AX210 9be3daa linux-firmware: Update firmware file for Intel Bluetooth 9560 687d64a linux-firmware: Update firmware file for Intel Bluetooth 9260 a7f1249 linux-firmware: Update firmware file for Intel Bluetooth AX200 47650a0 linux-firmware: Update firmware file for Intel Bluetooth AX201 195ecf1 linux-firmware: Intel BT 7265: Fix Security Issues 4116d72 linux-firmware: Update firmware file for Intel Bluetooth 8265 ca83c73 qcom: update venus firmware files for v5.4 1334578 Merge branch 'mrvl-prestera' of https://github.com/PLVision/linux-firmware into main 16052e4 mrvl: prestera: Add Marvell Prestera Switchdev firmware 3.0 version bdf929d rtw88: 8822c: Update normal firmware to v9.9.9 0b558e8 brcm: add missing symlink for Pi Zero W NVRAM file cfa004c amdgpu: update arcturus firmware from 21.10 d5567c5 amdgpu: update navy flounder firmware from 21.10 ef5ea5d amdgpu: update sienna cichlid firmware from 21.10 f35700f amdgpu: update vega20 firmware from 21.10 1be98f1 amdgpu: update picasso firmware from 21.10 fee0497 amdgpu: update navi14 firmware from 21.10 15003b0 amdgpu: update green sardine firmware from 21.10 64555fb amdgpu: update vega12 firmware from 21.10 eb07276 amdgpu: update navi12 firmware from 21.10 e36c82a amdgpu: update vega10 firmware from 21.10 4a5eaa2 amdgpu: update renoir firmware from 21.10 65eb326 amdgpu: update navi10 firmware from 21.10 8bdca03 amdgpu: update raven2 firmware from 21.10 c9e44ca amdgpu: update raven firmware from 21.10 bc3e610 rtl_nic: add new firmware for RTL8153 and RTL8156 series 8528618 Merge branch 'for-upstream' of git://git.chelsio.net/pub/git/linux-firmware into main 940b7f4 cxgb4: Update firmware to revision 1.25.4.0 f66adc3 Merge branch 'main' of gitolite.kernel.org:/pub/scm/linux/kernel/git/maks/linux-firmware into main f350e91 Merge https://github.com/rjliao-qca/qca-btfw into main 9bc1bcc Merge https://github.com/Netronome/linux-firmware into main 2f30708 Mellanox: Add new mlxsw_spectrum firmware xx.2008.2438 393f272 brcm: Link CM4's WiFi firmware with DMI machine name. 73144e0 linux-firmware: Update firmware file for Intel Bluetooth AX201 8ab7aba amdgpu: update navi14 smc firmware 4fe6e53 amdgpu: update navi10 SMC firmware c296849 QCA: Update Bluetooth firmware for QCA6174 d6a18e9 WHENCE: link to similar config file for rtl8821a support 6c419ae nfp: update Agilio SmartNIC flower firmware to rev AOTC-2.14.A.6 af1ca28 amdgpu: add arcturus firmware 0dd245d Merge branch 'sm8250-new-fw' of https://github.com/lumag/linux-firmware into main 55cab07 rtl_bt: Add rtl8723bs_config-OBDA0623.bin symlink 2548d06 brcm: Add nvram for the Chuwi Hi8 (CWI509) tablet e45c137 brcm: Add nvram for the Predia Basic tablet d8fa0cf qcom: sm8250: update remoteproc firmware 84af0e0 qcom: update a650 firmware files 3f026a2 rtl_bt: Update RTL8822C BT(UART I/F) FW to 0x59A_76A3 c82cb46 amdgpu: update sienna cichlid firmware for 20.50 24fe696 amdgpu: update vega20 firmware for 20.50 e05d197 amdgpu: update picasso firmware for 20.50 76d07cd amdgpu: update navi14 firmware for 20.50 b2fc037 amdgpu: update vega12 firmware for 20.50 25451a4 amdgpu: update navi12 firmware for 20.50 b938597 amdgpu: update vega10 firmware for 20.50 2542ba7 amdgpu: update renoir firmware for 20.50 b55d063 amdgpu: update navi10 firmware for 20.50 1a62f28 amdgpu: update raven2 firmware for 20.50 4df488f amdgpu: update raven firmware for 20.50 a29bdb2 amdgpu: add initial support for navy flounder 3568f96 (tag: 20210315) linux-firmware: Update firmware file for Intel Bluetooth AX210 9e96e50 linux-firmware: Update firmware file for Intel Bluetooth AX200 c8d0db5 linux-firmware: Update firmware file for Intel Bluetooth AX201 5e2a387 Merge tag 'iwlwifi-fw-2021-03-05-v3' of git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/linux-firmware into main b0d3e31 rtw88: 8822c: Update normal firmware to v9.9.6 5a2fd63 iwlwifi: add new FWs from core59-66 release 4f54906 iwlwifi: update 9000-family firmwares 11b7607 iwlwifi: update 7265D firmware e425f76 Merge branch 'add-silabs-wf200' of github.com:jerome-pouiller/linux-firmware into main 5ecd13f Mellanox: Add new mlxsw_spectrum firmware xx.2008.2406 58fb90a linux-firmware: add frimware for mediatek bluetooth chip (MT7921) e576a1b rtw89: 8852a: add firmware v0.9.12.2 048a7cb WHENCE: add missing symlink for BananaPi M3 aa6c6e7 Add symlink for BananaPi M2 to brcmfmac43430-sdio config 58825f7 brcm: Fix Raspberry Pi 4B NVRAM file 520f71b silabs: add new firmware for WF200 f7915a0 amdgpu: add initial firmware for green sardine 80cb579 rtw88: RTL8822C: Update normal firmware to v9.9.5 b79d239 (tag: 20210208) Merge branch 'DG1-guc-huc-ADLS-dmc' of git://anongit.freedesktop.org/drm/drm-firmware into main 66970e1 Merge branch 'qcom-rb5' of https://github.com/lumag/linux-firmware into main cf6fc2b Mellanox: Add new mlxsw_spectrum firmware xx.2008.2304 391fd50 linux-firmware: add firmware for MT7921 c5e3240 rtw88: RTL8821C: Update firmware to v24.8 d33d2d8 linux-firmware: Update firmware file for Intel Bluetooth AX210 3027ae4 linux-firmware: Update firmware file for Intel Bluetooth AX200 13979c3 linux-firmware: Update firmware file for Intel Bluetooth AX201 348d8a9 i915: Add DMC v2.01 for ADL-S f33f1f7 i915: Add HuC v7.7.1 for DG1 6a422f5 i915: Add GuC v49.0.1 for DG1 df822a8 qcom: Add venus firmware files for VPU-1.0 11a1db1 qcom: Add SM8250 Compute DSP firmware e55248b qcom: Add SM8250 Audio DSP firmware da74cc6 qcom: add firmware files for Adreno a650 0578970 brcm: Link RPi4's WiFi firmware with DMI machine name. d528862 brcm: Add NVRAM for Vamrs 96boards Rock960 870b805 brcm: Update Raspberry Pi 3B+/4B NVRAM for downstream changes a28a590 cypress: Fix link direction 060ad8b cypress: Link the new cypress firmware to the old brcm files 0f0aefd brcm: remove old brcm firmwares that have newer cypress variants f580dc2 rtl_bt: Update RTL8822C BT(UART I/F) FW to 0x059A_25CB 7df2220 rtl_bt: Update RTL8822C BT(USB I/F) FW to 0x099a_7253 e79405d rtl_bt: Add firmware and config files for RTL8852A BT USB chip ef3813d rtl_bt: Update RTL8821C BT(USB I/F) FW to 0x829a_7644 646f159 (tag: 20201218) make AP6212 in bananpi m2 plus/zero work 28185ec linux-firmware: Update firmware file for Intel Bluetooth AX210 23da869 linux-firmware: Update firmware file for Intel Bluetooth AX200 2099248 linux-firmware: Update firmware file for Intel Bluetooth AX201 94de5e2 linux-firmware: Update firmware file for Intel Bluetooth 9560 27a3689 linux-firmware: Update firmware file for Intel Bluetooth 9260 5c3c4af Merge branch 'lt9611uxc' of https://github.com/lumag/linux-firmware into main aaed4a8 Merge branch 'v1.1.6' of https://github.com/irui-wang/linux_fw_vpu_v1.1.6 into main d8c9865 Merge branch 'master' of https://github.com/sampnimm/linux-firmware-BT into main 63ab3db linux-firmware: add firmware for Lontium LT9611UXC DSI to HDMI bridge 0fe0fe0 mediatek: update MT8173 VPU firmware to v1.1.6 1a08ec9 QCA : Updated firmware files for WCN3991 7455a36 Merge branch 'guc_v49' of git://anongit.freedesktop.org/drm/drm-firmware into main 7eb7fda linux-firmware: Update firmware file for Intel Bluetooth AX210 5cbf459 linux-firmware: Update firmware file for Intel Bluetooth AX210 c487f7d i915: Add GuC firmware v49.0.1 for all platforms d9ffb07 i915: Remove duplicate KBL DMC entry b362fd4 Mellanox: Add new mlxsw_spectrum firmware xx.2008.2018 bc9cd0b linux-firmware: Update AMD SEV firmware 54c797a amdgpu: add sienna cichlid firmware for 20.45 1340e9c amdgpu: update vega20 firmware for 20.45 b260c9c amdgpu: update vega12 firmware for 20.45 d683bd5 amdgpu: update vega10 firmware for 20.45 7c81cc2 amdgpu: update renoir firmware for 20.45 3619e57 amdgpu: update navi14 firmware for 20.45 68ce0fb amdgpu: update navi12 firmware for 20.45 e889b80 amdgpu: update navi10 firmware for 20.45 f4edc15 amdgpu: update raven2 firmware for 20.45 e71210f amdgpu: update raven firmware for 20.45 Signed-off-by: Tomas Lara [rebased; removed brcmfmac changes due to removed firmware] Signed-off-by: David Bauer --- package/firmware/linux-firmware/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/firmware/linux-firmware/Makefile b/package/firmware/linux-firmware/Makefile index e2fee3b6a2..2ad213b82b 100644 --- a/package/firmware/linux-firmware/Makefile +++ b/package/firmware/linux-firmware/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=linux-firmware -PKG_VERSION:=20210315 +PKG_VERSION:=20210511 PKG_RELEASE:=1 PKG_SOURCE_URL:=@KERNEL/linux/kernel/firmware PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_HASH:=a2348f03492713dca9aef202496c6e58f5e63ee5bec6a7bdfcf8b18ce7155e70 +PKG_HASH:=2aa6ae8b9808408f9811ac38f00c188e53e984a2b3990254f6c9c02c1ab13417 PKG_MAINTAINER:=Felix Fietkau From 6a15abbc753ca728d798cec9153fc532fce3791d Mon Sep 17 00:00:00 2001 From: David Bauer Date: Sun, 6 Jun 2021 19:45:24 +0200 Subject: [PATCH 14/25] ramips: make PHY initialization more descriptive The basic mode control register of the ESW PHYs is modified in this codeblock. Use the respective macros to make this code more readable. Signed-off-by: David Bauer --- .../ramips/files/drivers/net/ethernet/ralink/gsw_mt7620.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620.c index bd379e6c7d..451881fc73 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620.c +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620.c @@ -13,6 +13,7 @@ */ #include +#include #include #include #include @@ -168,9 +169,9 @@ static void mt7620_hw_init(struct mt7620_gsw *gsw, int mdio_mode) /* turn on all PHYs */ for (i = 0; i <= 4; i++) { - val = _mt7620_mii_read(gsw, gsw->ephy_base + i, 0); - val &= ~BIT(11); - _mt7620_mii_write(gsw, gsw->ephy_base + i, 0, val); + val = _mt7620_mii_read(gsw, gsw->ephy_base + i, MII_BMCR); + val &= ~BMCR_PDOWN; + _mt7620_mii_write(gsw, gsw->ephy_base + i, MII_BMCR, val); } } From 0056ffb468f40f34bea006eb889b70c9a4f562e0 Mon Sep 17 00:00:00 2001 From: Gaspare Bruno Date: Wed, 13 Jan 2021 18:03:39 -0300 Subject: [PATCH 15/25] ramips: mt7620: enable autonegotiation for all ports This enables autonegotiation for all ephy ports on probe. Some devices do not configure the ports, particularly port 4. Signed-off-by: Gaspare Bruno [replace magic values ; reword commit message] Signed-off-by: David Bauer --- .../linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620.c index 451881fc73..0b09814cc8 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620.c +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620.c @@ -171,6 +171,7 @@ static void mt7620_hw_init(struct mt7620_gsw *gsw, int mdio_mode) for (i = 0; i <= 4; i++) { val = _mt7620_mii_read(gsw, gsw->ephy_base + i, MII_BMCR); val &= ~BMCR_PDOWN; + val |= BMCR_ANRESTART | BMCR_ANENABLE | BMCR_SPEED100; _mt7620_mii_write(gsw, gsw->ephy_base + i, MII_BMCR, val); } } From 902d7e497c3c26c1a7d9c06945746c319866b335 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Mon, 7 Jun 2021 01:05:24 +0200 Subject: [PATCH 16/25] ramips: fix patch location The patch for adding the config_aneg function for the Atheros AR8031/AR8033 PHY was formatted in a way it moved to different PHY models while refreshing patches on kernel updates. Move the diff directly below the PHY name so this won't happen in the future. Signed-off-by: David Bauer --- target/linux/ramips/patches-5.4/991-at803x.patch | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/target/linux/ramips/patches-5.4/991-at803x.patch b/target/linux/ramips/patches-5.4/991-at803x.patch index 29e79e65d7..6e178b80ce 100644 --- a/target/linux/ramips/patches-5.4/991-at803x.patch +++ b/target/linux/ramips/patches-5.4/991-at803x.patch @@ -147,11 +147,11 @@ Signed-off-by: René van Dorst static struct phy_driver at803x_driver[] = { { /* ATHEROS 8035 */ -@@ -482,6 +571,7 @@ static struct phy_driver at803x_driver[] - .suspend = at803x_suspend, - .resume = at803x_resume, - /* PHY_GBIT_FEATURES */ +@@ -504,6 +593,7 @@ static struct phy_driver at803x_driver[] + /* ATHEROS 8031 */ + .phy_id = ATH8031_PHY_ID, + .name = "Atheros 8031 ethernet", + .config_aneg = at803x_config_aneg, - .read_status = at803x_read_status, - .ack_interrupt = at803x_ack_interrupt, - .config_intr = at803x_config_intr, + .phy_id_mask = AT803X_PHY_ID_MASK, + .probe = at803x_probe, + .config_init = at803x_config_init, From 1aa80ce3931736f1020f69f486a815c2b2575d19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Thu, 11 Feb 2021 10:57:06 +0100 Subject: [PATCH 17/25] scripts/feeds: generate index after all feeds are updated MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This separates index update from feed update. The result is that all requested feeds are first updated and only then indexed. The reason for this change is to prevent errors being reported and potentially invalid index being generated thanks to cross feeds dependency. The feeds script pulls in default all feeds as they come and on install prefers packages from first feeds (unless special feed is requested). Thus order of feeds in some way specifies preferences. This is handy for downstream distributions as they can simply override any package from upstream feeds by placing their feed before them. This removes need to patch or fork upstream feeds. The problem is that such feed most likely depends in some way also on subsequent feeds. The most likely feeds are 'packages' or 'luci'. The example would be Python package that needs 'python.mk' from 'packages' feed. Ordering custom feed after dependent feeds is sometimes just not possible because of preference requirement described before. The solution is to just first pull all feeds and generate indexes only after that. In the end this ensures that index is generated correctly at first try without any error. In terms of code this removes 'perform_update' argument from 'update_feed' as with index update removal the update is the only action performed in that subroutine. Thus this moves condition to 'update' subroutine. Signed-off-by: Karel Kočí --- scripts/feeds | 75 +++++++++++++++++++++------------------------------ 1 file changed, 31 insertions(+), 44 deletions(-) diff --git a/scripts/feeds b/scripts/feeds index eee0a50717..bbfd832c45 100755 --- a/scripts/feeds +++ b/scripts/feeds @@ -756,12 +756,11 @@ sub uninstall { return 0; } -sub update_feed($$$$$) +sub update_feed($$$$) { my $type=shift; my $name=shift; my $src=shift; - my $perform_update=shift; my $force_update=shift; my $force_relocate=update_location( $name, "@$src" ); my $rv=0; @@ -773,28 +772,22 @@ sub update_feed($$$$$) warn "Unknown type '$type' in feed $name\n"; return 1; }; - $perform_update and do { - my $failed = 1; - foreach my $feedsrc (@$src) { - warn "Updating feed '$name' from '$feedsrc' ...\n"; - if (update_feed_via($type, $name, $feedsrc, $force_relocate, $force_update) != 0) { - if ($force_update) { - $rv=1; - $failed=0; - warn "failed, ignore.\n"; - next; - } - last; + + my $failed = 1; + foreach my $feedsrc (@$src) { + warn "Updating feed '$name' from '$feedsrc' ...\n"; + if (update_feed_via($type, $name, $feedsrc, $force_relocate, $force_update) != 0) { + if ($force_update) { + $rv=1; + $failed=0; + warn "failed, ignore.\n"; + next; } - $failed = 0; + last; } - $failed and do { - warn "failed.\n"; - return 1; - }; - }; - warn "Create index file './feeds/$name.index' \n"; - update_index($name) == 0 or do { + $failed = 0; + } + $failed and do { warn "failed.\n"; return 1; }; @@ -803,45 +796,39 @@ sub update_feed($$$$$) sub update { my %opts; - my $feed_name; - my $perform_update=1; + my %argv_feeds; my $failed=0; $ENV{SCAN_COOKIE} = $$; $ENV{OPENWRT_VERBOSE} = 's'; getopts('ahif', \%opts); + %argv_feeds = map { $_ => 1 } @ARGV; if ($opts{h}) { usage(); return 0; } - if ($opts{i}) { - # don't update from (remote) repository - # only re-create index information - $perform_update=0; - } - -d "feeds" or do { mkdir "feeds" or die "Unable to create the feeds directory"; }; - if ( ($#ARGV == -1) or $opts{a}) { - foreach my $feed (@feeds) { - my ($type, $name, $src) = @$feed; - update_feed($type, $name, $src, $perform_update, $opts{f}) == 0 or $failed=1; - } - } else { - while ($feed_name = shift @ARGV) { - foreach my $feed (@feeds) { - my ($type, $name, $src) = @$feed; - if($feed_name ne $name) { - next; - } - update_feed($type, $name, $src, $perform_update, $opts{f}) == 0 or $failed=1; - } + my @index_feeds; + foreach my $feed (@feeds) { + my ($type, $name, $src) = @$feed; + next unless $#ARGV == -1 or $opts{a} or $argv_feeds{$name}; + if (not $opts{i}) { + update_feed($type, $name, $src, $opts{f}) == 0 or $failed=1; } + push @index_feeds, $name; + } + foreach my $name (@index_feeds) { + warn "Create index file './feeds/$name.index' \n"; + update_index($name) == 0 or do { + warn "failed.\n"; + $failed=1; + }; } refresh_config(); From bb749e49a6e149f681a058b3d7e45fd8d4f79305 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Tue, 8 Jun 2021 19:30:12 +0200 Subject: [PATCH 18/25] build: fix build for devices without initramfs Don't attempt to copy initramfs images for devices which do not output an initramfs image. This was breaking builds for mpc85xx-p1010 since mid-march. Signed-off-by: David Bauer --- include/image.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/image.mk b/include/image.mk index 0d0e3eaba1..a7473abe68 100644 --- a/include/image.mk +++ b/include/image.mk @@ -478,7 +478,7 @@ define Device/Build/initramfs $$(if $$(CONFIG_JSON_OVERVIEW_IMAGE_INFO), $(BUILD_DIR)/json_info_files/$$(KERNEL_INITRAMFS_IMAGE).json,)) $(KDIR)/$$(KERNEL_INITRAMFS_NAME):: image_prepare - $(1)-images: $(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE) + $(1)-images: $$(if $$(KERNEL_INITRAMFS),$(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE)) $(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE): $(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE) cp $$^ $$@ From 7f946a880a61816e338e99b79ece6fb206fc6f9c Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 9 Jun 2021 13:16:11 +0200 Subject: [PATCH 19/25] toolchain/gdb: fix broken non-python build Append configure args instead of overwriting them Fixes: 74417f8b3a80 ("toolchain: gdb: Add optional python support") Signed-off-by: Felix Fietkau --- toolchain/gdb/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolchain/gdb/Makefile b/toolchain/gdb/Makefile index 2708eff869..e769a3be3e 100644 --- a/toolchain/gdb/Makefile +++ b/toolchain/gdb/Makefile @@ -46,7 +46,7 @@ HOST_CONFIGURE_ARGS = \ ifneq ($(CONFIG_GDB_PYTHON),) HOST_CONFIGURE_ARGS+= --with-python else - HOST_CONFIGURE_ARGS:= --without-python + HOST_CONFIGURE_ARGS+= --without-python endif define Host/Install From ae9c5cd37bf5c08452f314b54afa963a00bdde30 Mon Sep 17 00:00:00 2001 From: Liu Yu Date: Tue, 8 Jun 2021 09:50:02 +0800 Subject: [PATCH 20/25] ramips: fix Ethernet random MAC address for HILINK HLK-7628N Set the ethernet address from flash. MAC addresses as verified by OEM firmware: use interface source 2g wlan0 factory 0x04 (label) LAN eth0.1 factory 0x28 (label+1) WAN eth0.2 factory 0x2e (label+2) Fixes: 671c9d16e382 ("ramips: add support for HILINK HLK-7628N") Signed-off-by: Liu Yu [drop old MAC address setup from 02_network, cut out state_default changes, face-lift commit message, add Fixes:] Signed-off-by: Adrian Schmutzler --- target/linux/ramips/dts/mt7628an_hilink_hlk-7628n.dts | 4 ++++ target/linux/ramips/mt76x8/base-files/etc/board.d/02_network | 5 +---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/target/linux/ramips/dts/mt7628an_hilink_hlk-7628n.dts b/target/linux/ramips/dts/mt7628an_hilink_hlk-7628n.dts index 69987b3566..f5106a5080 100644 --- a/target/linux/ramips/dts/mt7628an_hilink_hlk-7628n.dts +++ b/target/linux/ramips/dts/mt7628an_hilink_hlk-7628n.dts @@ -80,6 +80,10 @@ }; }; +ðernet { + mtd-mac-address = <&factory 0x28>; +}; + &wmac { status = "okay"; }; 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 d61a60591c..703936f217 100644 --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network @@ -168,6 +168,7 @@ ramips_setup_macs() lan_mac=$wan_mac ;; cudy,wr1000|\ + hilink,hlk-7628n|\ hilink,hlk-7688a|\ wavlink,wl-wn577a2|\ wavlink,wl-wn578a2) @@ -187,10 +188,6 @@ ramips_setup_macs() wan_mac=$(mtd_get_mac_binary factory 0x22) label_mac=$wan_mac ;; - hilink,hlk-7628n) - lan_mac=$(macaddr_setbit_la "$(cat /sys/class/net/eth0/address)") - wan_mac=$(macaddr_add "$lan_mac" 1) - ;; hiwifi,hc5661a|\ hiwifi,hc5761a|\ hiwifi,hc5861b) From e1d8a14cd0a9f8844f9ebb8ca220780b0ce5d6db Mon Sep 17 00:00:00 2001 From: Pawel Dembicki Date: Wed, 9 Jun 2021 12:22:39 +0200 Subject: [PATCH 21/25] ramips: mt7620: add kernel size for Jboot devices Since few months multiple users reported problems with various JBoot devices. [0][1][2][3] All of them was bricked. On my Lava LR-25G001 it freezes with current snapshot: CDW57CAM_003 Jboot B695 Giga Switch AR8327 init AR8327/AR8337 id ==> 0x1302 JRecovery Version R1.2 2014/04/01 18:25 SPI FLASH: MX25l12805d 16M . . (freeze) The kernel size is >2048k. I built current master with minimal config and it boots well: CDW57CAM_003 Jboot B695 Giga Switch AR8327 init AR8327/AR8337 id ==> 0x1302 JRecovery Version R1.2 2014/04/01 18:25 SPI FLASH: MX25l12805d 16M . ........................... Starting kernel @80000000... [ 0.000000] Linux version 5.4.124 Kernel size is <2048k. Jboot bootloader isn't open source, so it's impossible to find solution in code. It looks, that some buffer for kernel have 2MB size. To avoid bricked devices, this commit introduces 2048k limit kernel size for all jboot routers. [0] https://bugs.openwrt.org/index.php?do=details&task_id=3539 [1] https://eko.one.pl/forum/viewtopic.php?pid=254344 [2] https://eko.one.pl/forum/viewtopic.php?id=20930 [3] https://eko.one.pl/forum/viewtopic.php?pid=241376#p241376 Signed-off-by: Pawel Dembicki [remove Fixes:] Signed-off-by: Adrian Schmutzler --- target/linux/ramips/image/mt7620.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk index 8f5d354e33..e56e96d347 100644 --- a/target/linux/ramips/image/mt7620.mk +++ b/target/linux/ramips/image/mt7620.mk @@ -62,6 +62,7 @@ TARGET_DEVICES += alfa-network_tube-e4g define Device/amit_jboot DLINK_IMAGE_OFFSET := 0x10000 KERNEL := $(KERNEL_DTB) + KERNEL_SIZE := 2048k IMAGES += factory.bin IMAGE/sysupgrade.bin := mkdlinkfw | pad-rootfs | append-metadata IMAGE/factory.bin := mkdlinkfw | pad-rootfs | mkdlinkfw-factory From 2c97a02fef0c74b787fdf847e9e6b68457c67362 Mon Sep 17 00:00:00 2001 From: Pawel Dembicki Date: Wed, 9 Jun 2021 12:52:51 +0200 Subject: [PATCH 22/25] ramips: mt7620: disable Jboot devices build At this moment kernel size in mt7620 snapshot builds is bigger than 2048k. It should be disabled by default. Signed-off-by: Pawel Dembicki --- target/linux/ramips/image/mt7620.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk index e56e96d347..849bd31ef8 100644 --- a/target/linux/ramips/image/mt7620.mk +++ b/target/linux/ramips/image/mt7620.mk @@ -67,6 +67,7 @@ define Device/amit_jboot IMAGE/sysupgrade.bin := mkdlinkfw | pad-rootfs | append-metadata IMAGE/factory.bin := mkdlinkfw | pad-rootfs | mkdlinkfw-factory DEVICE_PACKAGES := jboot-tools kmod-usb2 kmod-usb-ohci + DEFAULT := n endef define Device/asus_rp-n53 From edaf432bf411767f3e8a9e5effc3a416bcac46c7 Mon Sep 17 00:00:00 2001 From: Adam Elyas Date: Tue, 8 Jun 2021 08:09:18 +0800 Subject: [PATCH 23/25] ramips: fix LAN LED trigger assignment for Xiaomi Router 3 Pro The default trigger for the amber lights on lan1 and lan3 were mistakenly swapped after the device's migration to DSA. This caused activity on one port to trigger the amber light on the other port. Swapping their default trigger in the DTS file fixes that. Signed-off-by: Adam Elyas [minor commit title adjustment, wrap commit message] Signed-off-by: Adrian Schmutzler --- target/linux/ramips/dts/mt7621_xiaomi_mi-router-3-pro.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-3-pro.dts b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-3-pro.dts index b9101b7ccb..e8f3a50dbe 100644 --- a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-3-pro.dts +++ b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-3-pro.dts @@ -48,7 +48,7 @@ lan3_amber { label = "amber:lan3"; gpios = <&gpio 13 GPIO_ACTIVE_LOW>; - linux,default-trigger = "dsa-0.0:01:1Gbps"; + linux,default-trigger = "dsa-0.0:03:1Gbps"; }; lan2_amber { @@ -60,7 +60,7 @@ lan1_amber { label = "amber:lan1"; gpios = <&gpio 15 GPIO_ACTIVE_LOW>; - linux,default-trigger = "dsa-0.0:03:1Gbps"; + linux,default-trigger = "dsa-0.0:01:1Gbps"; }; }; From 6e8475bbd0c841043c1187fb5a42d835071ad502 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 10 Jun 2021 08:52:28 +0200 Subject: [PATCH 24/25] iwinfo: update to the latest version aa0e3c4bbe12 iwinfo: nl80211: add support for printing the device path for a phy dd6d6d2dec35 iwinfo: nl80211: use new path lookup function for nl80211_phy_idx_from_uci_path 268bb26d2e2a iwinfo: nl80211: support looking up phy by path=.. and macaddr=... c0414642fead iwinfo: nl80211: fix typo Signed-off-by: Felix Fietkau --- package/network/utils/iwinfo/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/utils/iwinfo/Makefile b/package/network/utils/iwinfo/Makefile index d8c1befc97..b7c8370bba 100644 --- a/package/network/utils/iwinfo/Makefile +++ b/package/network/utils/iwinfo/Makefile @@ -11,9 +11,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/iwinfo.git -PKG_SOURCE_DATE:=2021-04-30 -PKG_SOURCE_VERSION:=c45f0b584b4b86f8250f90ea19afca271c114fa2 -PKG_MIRROR_HASH:=24ad04791254a0523cd15a4fec6116d9ff121e006c93e5e41459f91347b33ec2 +PKG_SOURCE_DATE:=2021-06-09 +PKG_SOURCE_VERSION:=c0414642fead263a4a6a686ad3cb7e965ec8a23a +PKG_MIRROR_HASH:=c5686bbae86753c53db03a686b034bbb80d31107cc359ebd8522ea1c82db35ea PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=GPL-2.0 From e1d57d4d4349efaa0d0cb4246456d1433b71ce7e Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 9 Jun 2021 14:32:32 +0200 Subject: [PATCH 25/25] mac80211: rely on iwinfo for phy->path and path->phy lookups This avoids inconsistencies from having multiple implementations do the same thing Signed-off-by: Felix Fietkau --- package/kernel/mac80211/Makefile | 1 - .../mac80211/files/lib/netifd/mac80211.sh | 36 ------------------- .../files/lib/netifd/wireless/mac80211.sh | 3 +- .../mac80211/files/lib/wifi/mac80211.sh | 5 ++- 4 files changed, 3 insertions(+), 42 deletions(-) delete mode 100644 package/kernel/mac80211/files/lib/netifd/mac80211.sh diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile index a8a84f843a..0ade95e35e 100644 --- a/package/kernel/mac80211/Makefile +++ b/package/kernel/mac80211/Makefile @@ -549,7 +549,6 @@ endef define KernelPackage/cfg80211/install $(INSTALL_DIR) $(1)/lib/wifi $(1)/lib/netifd/wireless $(INSTALL_DATA) ./files/lib/wifi/mac80211.sh $(1)/lib/wifi - $(INSTALL_DATA) ./files/lib/netifd/mac80211.sh $(1)/lib/netifd $(INSTALL_BIN) ./files/lib/netifd/wireless/mac80211.sh $(1)/lib/netifd/wireless $(INSTALL_DIR) $(1)/etc/hotplug.d/ieee80211 $(INSTALL_DATA) ./files/mac80211.hotplug $(1)/etc/hotplug.d/ieee80211/10-wifi-detect diff --git a/package/kernel/mac80211/files/lib/netifd/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/mac80211.sh deleted file mode 100644 index 92e5c0e395..0000000000 --- a/package/kernel/mac80211/files/lib/netifd/mac80211.sh +++ /dev/null @@ -1,36 +0,0 @@ -mac80211_phy_to_path() { - local phy="$1" - - [ -x /usr/bin/readlink -a -h /sys/class/ieee80211/${phy} ] || return - - local path="$(readlink -f /sys/class/ieee80211/${phy}/device)" - [ -n "$path" ] || return - - path="${path##/sys/devices/}" - case "$path" in - platform*/pci*) path="${path##platform/}";; - esac - - local p - local seq="" - for p in $(ls /sys/class/ieee80211/$phy/device/ieee80211); do - [ "$p" = "$phy" ] && { - echo "$path${seq:++$seq}" - break - } - - seq=$((${seq:-0} + 1)) - done -} - -mac80211_path_to_phy() { - local path="$1" - - local p - for p in $(ls /sys/class/ieee80211); do - local cur="$(mac80211_phy_to_path "$p")" - case "$cur" in - *$path) echo "$p"; return;; - esac - done -} diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh index f1ed47802a..c9a0fe542a 100644 --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh @@ -1,7 +1,6 @@ #!/bin/sh . /lib/netifd/netifd-wireless.sh . /lib/netifd/hostapd.sh -. /lib/netifd/mac80211.sh init_wireless_driver "$@" @@ -546,7 +545,7 @@ mac80211_generate_mac() { find_phy() { [ -n "$phy" -a -d /sys/class/ieee80211/$phy ] && return 0 [ -n "$path" ] && { - phy="$(mac80211_path_to_phy "$path")" + phy="$(iwinfo nl80211 phyname "path=$path")" [ -n "$phy" ] && return 0 } [ -n "$macaddr" ] && { diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh index 5eb7cc4c61..6aa46b0c74 100644 --- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh +++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh @@ -1,5 +1,4 @@ #!/bin/sh -. /lib/netifd/mac80211.sh append DRIVERS "mac80211" @@ -11,7 +10,7 @@ lookup_phy() { local devpath config_get devpath "$device" path [ -n "$devpath" ] && { - phy="$(mac80211_path_to_phy "$devpath")" + phy="$(iwinfo nl80211 phyname "path=$devpath")" [ -n "$phy" ] && return } @@ -161,7 +160,7 @@ detect_mac80211() { get_band_defaults "$dev" - path="$(mac80211_phy_to_path "$dev")" + path="$(iwinfo nl80211 path "$dev")" if [ -n "$path" ]; then dev_id="set wireless.radio${devidx}.path='$path'" else