diff options
Diffstat (limited to 'target/linux/ath79')
75 files changed, 2086 insertions, 369 deletions
diff --git a/target/linux/ath79/config-6.6 b/target/linux/ath79/config-6.6 index f2d0646039..92057c343c 100644 --- a/target/linux/ath79/config-6.6 +++ b/target/linux/ath79/config-6.6 @@ -1,6 +1,7 @@ -CONFIG_AG71XX=y -# CONFIG_AG71XX_DEBUG is not set -CONFIG_AG71XX_DEBUG_FS=y +# CONFIG_AG71XX is not set +CONFIG_AG71XX_LEGACY=y +# CONFIG_AG71XX_LEGACY_DEBUG is not set +CONFIG_AG71XX_LEGACY_DEBUG_FS=y CONFIG_AR8216_PHY=y CONFIG_AR8216_PHY_LEDS=y CONFIG_ARCH_32BIT_OFF_T=y @@ -51,6 +52,7 @@ CONFIG_EARLY_PRINTK=y CONFIG_ETHERNET_PACKET_MANGLE=y CONFIG_EXCLUSIVE_SYSTEM_RAM=y CONFIG_FIXED_PHY=y +CONFIG_FORCE_NR_CPUS=y CONFIG_FS_IOMAP=y CONFIG_FUNCTION_ALIGNMENT=0 CONFIG_FWNODE_MDIO=y diff --git a/target/linux/ath79/dts/ar7242_buffalo_wzr-hp-g450h.dts b/target/linux/ath79/dts/ar7242_buffalo_wzr-hp-g450h.dts index 81290479b0..932144c227 100644 --- a/target/linux/ath79/dts/ar7242_buffalo_wzr-hp-g450h.dts +++ b/target/linux/ath79/dts/ar7242_buffalo_wzr-hp-g450h.dts @@ -79,6 +79,7 @@ qca,no-eeprom; #gpio-cells = <2>; gpio-controller; + qca,tx-gain-buffalo; }; }; diff --git a/target/linux/ath79/dts/ar7242_tplink_tl-wr2543-v1.dts b/target/linux/ath79/dts/ar7242_tplink_tl-wr2543-v1.dts index 77eeedc588..0124ddff87 100644 --- a/target/linux/ath79/dts/ar7242_tplink_tl-wr2543-v1.dts +++ b/target/linux/ath79/dts/ar7242_tplink_tl-wr2543-v1.dts @@ -78,7 +78,7 @@ compatible = "realtek,rtl8367"; gpio-sda = <&gpio 1 GPIO_ACTIVE_HIGH>; gpio-sck = <&gpio 6 GPIO_ACTIVE_HIGH>; - realtek,extif0 = <1 0 1 1 1 1 1 1 2>; + realtek,extif = <9 1 0 1 1 1 1 1 1 2>; mdio-bus { #address-cells = <1>; diff --git a/target/linux/ath79/dts/ar9344_huawei_ap6010dn.dts b/target/linux/ath79/dts/ar9344_huawei_ap6010dn.dts new file mode 100644 index 0000000000..2f2e6e2331 --- /dev/null +++ b/target/linux/ath79/dts/ar9344_huawei_ap6010dn.dts @@ -0,0 +1,243 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar9344.dtsi" + +#include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/input/input.h> +#include <dt-bindings/leds/common.h> + +/ { + model = "Huawei AP6010DN"; + compatible = "huawei,ap6010dn", "qca,ar9344"; + + chosen { + bootargs = "console=ttyS0,9600n8"; + }; + + aliases { + led-boot = &led_function_green; + led-failsafe = &led_function_red; + led-running = &led_function_green; + led-upgrade = &led_function_red; + label-mac-device = ð0; + }; + + leds { + compatible = "gpio-leds"; + + led_function_green: led-status-green { + function = LED_FUNCTION_STATUS; + color = <LED_COLOR_ID_GREEN>; + gpios = <&gpio 13 GPIO_ACTIVE_HIGH>; + }; + + led_function_red: led-status-red { + function = LED_FUNCTION_STATUS; + color = <LED_COLOR_ID_RED>; + gpios = <&gpio 14 GPIO_ACTIVE_HIGH>; + }; + + }; + + keys { + compatible = "gpio-keys"; + + restart { + label = "reset"; + linux,code = <KEY_RESTART>; + gpios = <&gpio 21 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; + + watchdog { + pinctrl-names = "default"; + pinctrl-0 = <&wdt_gpio15>; + + compatible = "linux,wdt-gpio"; + gpios = <&gpio 15 GPIO_ACTIVE_HIGH>; + hw_algo = "toggle"; + hw_margin_ms = <100>; + always-running; + }; + + virtual_flash { + compatible = "mtd-concat"; + devices = <&fwconcat0 &fwconcat1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "firmware"; + reg = <0x0 0x1e00000>; + compatible = "openwrt,uimage", "denx,uimage"; + }; + }; + }; +}; + +&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-a"; + reg = <0x0 0x80000>; + read-only; + }; + + partition@80000 { + label = "BootupA"; + reg = <0x80000 0x20000>; + }; + + partition@a0000 { + label = "BootupB"; + reg = <0xa0000 0x20000>; + }; + + partition@c0000 { + label = "u-boot-env"; + reg = <0xc0000 0x20000>; + read-only; + }; + + partition@e0000 { + label = "BoardData"; + reg = <0xe0000 0x20000>; + read-only; + }; + + // In the vendor layout, there are the "SysImageA" (12 MiB) + // and the "ConfigA" (3 MiB) partitions here. + fwconcat0: partition@100000 { + label = "fwconcat0"; + reg = <0x100000 0xf00000>; + }; + + partition@1000000 { + label = "u-boot-b"; + reg = <0x1000000 0x80000>; + read-only; + }; + + partition@1080000 { + label = "ResultA"; + reg = <0x1080000 0x20000>; + read-only; + }; + + partition@10a0000 { + label = "ResultB"; + reg = <0x10a0000 0x20000>; + read-only; + }; + + // In the vendor layout, there are the "SysImageB" (12 MiB) + // and the "ConfigB" (3 MiB) partitions here. + fwconcat1: partition@10c0000 { + label = "fwconcat1"; + reg = <0x10c0000 0xf00000>; + }; + + art: partition@1fc0000 { + label = "art"; + reg = <0x1fc0000 0x40000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_art_2005b: macaddr@2005b { + compatible = "mac-base"; + reg = <0x2005b 0x6>; + #nvmem-cell-cells = <1>; + }; + + cal_art_1000: cal@1000 { + reg = <0x1000 0x440>; + }; + + cal_art_5000: cal@5000 { + reg = <0x5000 0x844>; + }; + }; + }; + }; + }; +}; + +&wmac { + status = "okay"; + + nvmem-cells = <&macaddr_art_2005b 1>, <&cal_art_1000>; + nvmem-cell-names = "mac-address", "calibration"; +}; + +&pcie { + status = "okay"; + + ath9k: wifi@0,0 { + compatible = "pci168c,0033"; + reg = <0x0000 0 0 0 0>; + gpio-controller; + #gpio-cells = <2>; + + nvmem-cells = <&macaddr_art_2005b 2>, <&cal_art_5000>; + nvmem-cell-names = "mac-address", "calibration"; + }; +}; + +&ref { + clock-frequency = <40000000>; +}; + +ð0 { + status = "okay"; + + nvmem-cells = <&macaddr_art_2005b 0>; + nvmem-cell-names = "mac-address"; + + pll-data = <0x06000000 0x04000101 0x0c001313>; + phy-mode = "rgmii-id"; + phy-handle = <&phy>; + + gmac-config { + device = <&gmac>; + rgmii-gmac0 = <1>; + rxdv-delay = <3>; + rxd-delay = <3>; + }; +}; + +&mdio0 { + status = "okay"; + + phy: ethernet-phy@18 { + reg = <0x4>; + }; +}; + +&pinmux { + wdt_gpio15: pinmux_wdt_gpio15 { + pinctrl-single,bits = <0xc 0x0 0xFF000000>; + }; +}; + +&wdt { + status = "disabled"; +}; diff --git a/target/linux/ath79/dts/ar9344_nec_aterm.dtsi b/target/linux/ath79/dts/ar9344_nec_aterm.dtsi new file mode 100644 index 0000000000..dfe2b064b7 --- /dev/null +++ b/target/linux/ath79/dts/ar9344_nec_aterm.dtsi @@ -0,0 +1,300 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/input/input.h> +#include <dt-bindings/leds/common.h> + +#include "ar9344.dtsi" + +/ { + aliases { + led-running = &led_power_green; + led-upgrade = &led_power_green; + }; + + chosen { + /* + * don't specify bootargs property in DeviceTree to + * enable a console with a default baudrate (9600) + * or passed console= parameter from the bootloader + */ + /delete-property/ bootargs; + stdout-path = &uart; + }; + + keys: keys { + compatible = "gpio-keys"; + pinctrl-names = "default"; + pinctrl-0 = <&jtag_disable_pins>; + + button-eco { + label = "eco"; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + linux,code = <BTN_0>; + debounce-interval = <60>; + }; + + switch-ap { + label = "ap"; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + linux,code = <BTN_1>; + debounce-interval = <60>; + }; + + button-reset { + label = "reset"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + linux,code = <KEY_RESTART>; + debounce-interval = <60>; + }; + + button-wps { + label = "wps"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + linux,code = <KEY_WPS_BUTTON>; + debounce-interval = <60>; + }; + }; + + ath9k_leds: ath9k-leds { + /* all LEDs are connected to ath9k chip (AR938x) */ + compatible = "gpio-leds"; + + led_power_green: led-0 { + gpios = <&ath9k 0 GPIO_ACTIVE_LOW>; + color = <LED_COLOR_ID_GREEN>; + function = LED_FUNCTION_POWER; + default-state = "on"; + }; + + led-1 { + gpios = <&ath9k 1 GPIO_ACTIVE_LOW>; + color = <LED_COLOR_ID_RED>; + function = LED_FUNCTION_POWER; + }; + + led-2 { + gpios = <&ath9k 2 GPIO_ACTIVE_LOW>; + color = <LED_COLOR_ID_GREEN>; + function = LED_FUNCTION_WAN_ONLINE; + }; + + led-3 { + gpios = <&ath9k 3 GPIO_ACTIVE_LOW>; + color = <LED_COLOR_ID_RED>; + function = LED_FUNCTION_WAN_ONLINE; + }; + + led-4 { + gpios = <&ath9k 4 GPIO_ACTIVE_LOW>; + color = <LED_COLOR_ID_GREEN>; + function = LED_FUNCTION_WLAN_2GHZ; + linux,default-trigger = "phy0tpt"; + }; + + led-5 { + gpios = <&ath9k 5 GPIO_ACTIVE_LOW>; + color = <LED_COLOR_ID_RED>; + function = LED_FUNCTION_WLAN_2GHZ; + }; + + led-6 { + gpios = <&ath9k 6 GPIO_ACTIVE_LOW>; + color = <LED_COLOR_ID_GREEN>; + function = LED_FUNCTION_WLAN_5GHZ; + linux,default-trigger = "phy1tpt"; + }; + + led-7 { + gpios = <&ath9k 7 GPIO_ACTIVE_LOW>; + color = <LED_COLOR_ID_RED>; + function = LED_FUNCTION_WLAN_5GHZ; + }; + + led-8 { + gpios = <&ath9k 12 GPIO_ACTIVE_LOW>; + color = <LED_COLOR_ID_GREEN>; + function = "tv"; + }; + + led-9 { + gpios = <&ath9k 13 GPIO_ACTIVE_LOW>; + color = <LED_COLOR_ID_RED>; + function = "tv"; + }; + }; + + regulator { + compatible = "regulator-fixed"; + regulator-name = "usb-vbus"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpio = <&gpio 20 GPIO_ACTIVE_HIGH>; + enable-active-high; + regulator-always-on; + }; +}; + +&ref { + clock-frequency = <40000000>; +}; + +&spi { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions: partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + /* + * since the OEM bootloader requires unknown + * filesystem on firmware area, needs to be + * replaced to u-boot before OpenWrt installation + */ + partition@0 { + label = "bootloader"; + reg = <0x000000 0x020000>; + }; + + /* not compatible with u-boot */ + partition@20000 { + label = "config"; + reg = <0x020000 0x010000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_config_6: macaddr@6 { + reg = <0x6 0x6>; + }; + }; + }; + + partition@30000 { + label = "art"; + reg = <0x030000 0x010000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + cal_art_1000: calibration@1000 { + reg = <0x1000 0x440>; + }; + + cal_art_5000: calibration@5000 { + reg = <0x5000 0x440>; + }; + }; + }; + }; + }; +}; + +&mdio0 { + status = "okay"; + + phy0: ethernet-phy@0 { + reg = <0>; + + qca,ar8327-initvals = < + 0x04 0x07a00000 /* PORT0_PAD_MODE_CTRL */ + 0x08 0x00000000 /* PORT5_PAD_MODE_CTRL */ + 0x0c 0x00000000 /* PORT6_PAD_MODE_CTRL */ + 0x10 0x81000080 /* POWER_ON_STRAP */ + 0x50 0xcf37cf37 /* LED_CTRL0 */ + 0x54 0x00000000 /* LED_CTRL1 */ + 0x58 0x00000000 /* LED_CTRL2 */ + 0x5c 0x03ffff00 /* LED_CTRL3 */ + 0x7c 0x0000007e /* PORT0_STATUS */ + >; + }; +}; + +ð0 { + status = "okay"; + + pll-data = <0x06000000 0x00000101 0x00001616>; + + phy-mode = "rgmii"; + phy-handle = <&phy0>; + + nvmem-cells = <&macaddr_config_6>; + nvmem-cell-names = "mac-address"; + + gmac-config { + device = <&gmac>; + + rgmii-gmac0 = <1>; + rxdv-delay = <0>; + rxd-delay = <0>; + txd-delay = <0>; + txen-delay = <0>; + }; +}; + +&gpio { + switch-reset { + gpio-hog; + gpios = <13 GPIO_ACTIVE_HIGH>; + output-high; + }; +}; + +&pcie { + status = "okay"; + + ath9k: wifi@0,0 { + compatible = "pci168c,0030"; + reg = <0x0000 0 0 0 0>; + #gpio-cells = <2>; + gpio-controller; + + nvmem-cells = <&cal_art_5000>; + nvmem-cell-names = "calibration"; + + usb-hub-reset { + gpio-hog; + gpios = <10 GPIO_ACTIVE_HIGH>; + output-high; + }; + }; +}; + +&usb_phy { + status = "okay"; +}; + +&usb { + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + + dr_mode = "host"; + + /delete-node/ port@1; + + /* NEC uPD720114 */ + hub@1 { + compatible = "usb0409,005a"; + reg = <1>; + }; +}; + +&wmac { + status = "okay"; + + nvmem-cells = <&cal_art_1000>; + nvmem-cell-names = "calibration"; +}; diff --git a/target/linux/ath79/dts/ar9344_nec_wg600hp.dts b/target/linux/ath79/dts/ar9344_nec_wg600hp.dts new file mode 100644 index 0000000000..e586dce7ca --- /dev/null +++ b/target/linux/ath79/dts/ar9344_nec_wg600hp.dts @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar9344_nec_aterm.dtsi" + +/ { + compatible = "nec,wg600hp", "qca,ar9344"; + model = "NEC Aterm WG600HP"; +}; + +&partitions { + partition@40000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x040000 0x7c0000>; + }; +}; diff --git a/target/linux/ath79/dts/ar9344_nec_wr8750n.dts b/target/linux/ath79/dts/ar9344_nec_wr8750n.dts new file mode 100644 index 0000000000..47e49dddc5 --- /dev/null +++ b/target/linux/ath79/dts/ar9344_nec_wr8750n.dts @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar9344_nec_aterm.dtsi" + +/ { + compatible = "nec,wr8750n", "qca,ar9344"; + model = "NEC Aterm WR8750N"; +}; + +&partitions { + partition@40000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x040000 0x7c0000>; + }; +}; diff --git a/target/linux/ath79/dts/ar9344_nec_wr9500n.dts b/target/linux/ath79/dts/ar9344_nec_wr9500n.dts new file mode 100644 index 0000000000..1919e09829 --- /dev/null +++ b/target/linux/ath79/dts/ar9344_nec_wr9500n.dts @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar9344_nec_aterm.dtsi" + +/ { + compatible = "nec,wr9500n", "qca,ar9344"; + model = "NEC Aterm WR9500N"; +}; + +&keys { + switch-converter { + label = "cnv"; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + linux,code = <BTN_2>; + debounce-interval = <60>; + }; +}; + +&ath9k_leds { + led-10 { + gpios = <&ath9k 14 GPIO_ACTIVE_LOW>; + color = <LED_COLOR_ID_GREEN>; + function = "converter"; + }; + + led-11 { + gpios = <&ath9k 15 GPIO_ACTIVE_LOW>; + color = <LED_COLOR_ID_RED>; + function = "converter"; + }; +}; + +&partitions { + partition@40000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x040000 0xfc0000>; + }; +}; diff --git a/target/linux/ath79/dts/ar9344_qihoo_c301.dts b/target/linux/ath79/dts/ar9344_qihoo_c301.dts index 1d9c6ca9a4..0e9104dbb9 100644 --- a/target/linux/ath79/dts/ar9344_qihoo_c301.dts +++ b/target/linux/ath79/dts/ar9344_qihoo_c301.dts @@ -166,6 +166,10 @@ #address-cells = <1>; #size-cells = <1>; + cal_radiocfg_1000: calibration@1000 { + reg = <0x1000 0x440>; + }; + cal_radiocfg_5000: calibration@5000 { reg = <0x5000 0x844>; }; @@ -220,7 +224,9 @@ &wmac { status = "okay"; - qca,no-eeprom; + + nvmem-cells = <&cal_radiocfg_1000>; + nvmem-cell-names = "calibration"; }; ð1 { diff --git a/target/linux/ath79/dts/qca9531_alfa-network_wifi-camppro-nano-duo.dts b/target/linux/ath79/dts/qca9531_alfa-network_wifi-camppro-nano-duo.dts new file mode 100644 index 0000000000..e505081f98 --- /dev/null +++ b/target/linux/ath79/dts/qca9531_alfa-network_wifi-camppro-nano-duo.dts @@ -0,0 +1,60 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include <dt-bindings/leds/common.h> + +#include "qca9531_alfa-network_r36a.dtsi" + +/ { + model = "ALFA Network WiFi CampPro Nano Duo"; + compatible = "alfa-network,wifi-camppro-nano-duo", "qca,qca9531"; + + aliases { + led-boot = &led_status; + led-failsafe = &led_status; + led-running = &led_status; + led-upgrade = &led_status; + }; + + leds { + compatible = "gpio-leds"; + + pinctrl-names = "default"; + pinctrl-0 = <&enable_gpio4>; + + lan { + function = LED_FUNCTION_LAN; + color = <LED_COLOR_ID_GREEN>; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + + led_status: status { + function = LED_FUNCTION_STATUS; + color = <LED_COLOR_ID_GREEN>; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + }; + + wlan2g { + function = LED_FUNCTION_WLAN_2GHZ; + color = <LED_COLOR_ID_BLUE>; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + }; +}; + +ð0 { + nvmem-cells = <&macaddr_art_1002 (-1)>; + nvmem-cell-names = "mac-address"; +}; + +ð1 { + compatible = "syscon", "simple-mfd"; +}; + +&gpio_export { + usb-power { + gpio-export,name = "usb-power"; + gpio-export,output = <0>; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + }; +}; diff --git a/target/linux/ath79/dts/qca9531_comfast_cf-e355ac-v2.dts b/target/linux/ath79/dts/qca9531_comfast_cf-e355ac-v2.dts new file mode 100644 index 0000000000..81c0af19a5 --- /dev/null +++ b/target/linux/ath79/dts/qca9531_comfast_cf-e355ac-v2.dts @@ -0,0 +1,161 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca953x.dtsi" + +#include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/input/input.h> +#include <dt-bindings/leds/common.h> + +/ { + compatible = "comfast,cf-e355ac-v2", "qca,qca9531"; + model = "COMFAST CF-E355AC V2"; + + aliases { + serial0 = &uart; + led-boot = &led_lan; + led-failsafe = &led_lan; + led-upgrade = &led_lan; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = <KEY_RESTART>; + gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; + + leds { + /* Single RGB led controlled via GPIO */ + compatible = "gpio-leds"; + + pinctrl-names = "default"; + pinctrl-0 = <&jtag_disable_pins>; + + led_lan: lan { + color = <LED_COLOR_ID_GREEN>; + function = LED_FUNCTION_LAN; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + }; + + wlan2g { + color = <LED_COLOR_ID_BLUE>; + function = "LED_FUNCTION_WLAN_2GHZ"; + gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy1tpt"; + }; + + wlan5g { + color = <LED_COLOR_ID_RED>; + function = "LED_FUNCTION_WLAN_5GHZ"; + gpios = <&gpio 2 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy0tpt"; + }; + }; + + watchdog { + compatible = "linux,wdt-gpio"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + hw_algo = "toggle"; + hw_margin_ms = <1200>; + always-running; + }; +}; + +ð0 { + status = "okay"; + phy-handle = <&swphy4>; + + nvmem-cells = <&macaddr_art_0 0>; + nvmem-cell-names = "mac-address"; +}; + +ð1 { + nvmem-cells = <&macaddr_art_0 1>; + nvmem-cell-names = "mac-address"; +}; + +&pcie0 { + status = "okay"; + + wifi@0,0 { + compatible = "qcom,ath10k"; + reg = <0x0000 0 0 0 0>; + nvmem-cells = <&precal_art_5000>, <&macaddr_art_0 10>; + nvmem-cell-names = "pre-calibration", "mac-address"; + }; +}; + +&spi { + status = "okay"; + + flash@0 { + compatible = "winbond,w25q128", "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 0x010000>; + read-only; + }; + + partition@10000 { + label = "art"; + reg = <0x010000 0x010000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_art_0: macaddr@0 { + compatible = "mac-base"; + reg = <0x0 0x6>; + #nvmem-cell-cells = <1>; + }; + + cal_art_1000: calibration@1000 { + reg = <0x1000 0x440>; + }; + + precal_art_5000: pre-calibration@5000 { + reg = <0x5000 0x2f20>; + }; + }; + }; + + partition@20000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x020000 0xfd0000>; + }; + + partition@ff0000 { + label = "nvram"; + reg = <0xff0000 0x010000>; + read-only; + }; + }; + }; +}; + +&wdt { + status = "disabled"; +}; + +&wmac { + status = "okay"; + + nvmem-cells = <&cal_art_1000>, <&macaddr_art_0 2>; + nvmem-cell-names = "calibration", "mac-address"; +}; diff --git a/target/linux/ath79/dts/qca9531_glinet_gl-ar750.dts b/target/linux/ath79/dts/qca9531_glinet_gl-ar750.dts index 4d809b922a..802d90b752 100644 --- a/target/linux/ath79/dts/qca9531_glinet_gl-ar750.dts +++ b/target/linux/ath79/dts/qca9531_glinet_gl-ar750.dts @@ -63,8 +63,8 @@ i2c { compatible = "i2c-gpio"; - sda-gpios = <&gpio 17 GPIO_ACTIVE_LOW>; - scl-gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + sda-gpios = <&gpio 1 GPIO_ACTIVE_HIGH>; + scl-gpios = <&gpio 16 GPIO_ACTIVE_HIGH>; }; }; diff --git a/target/linux/ath79/dts/qca9558_sophos_ap15.dts b/target/linux/ath79/dts/qca9557_sophos_ap15.dts index 7949d3e88f..773b423cde 100644 --- a/target/linux/ath79/dts/qca9558_sophos_ap15.dts +++ b/target/linux/ath79/dts/qca9557_sophos_ap15.dts @@ -7,7 +7,7 @@ #include <dt-bindings/leds/common.h> / { - compatible = "sophos,ap15", "qca,qca9558"; + compatible = "sophos,ap15", "qca,qca9557"; model = "Sophos AP15"; aliases { @@ -40,17 +40,6 @@ }; }; -&pcie0 { - status = "okay"; - - wifi@0,0 { - compatible = "qcom,ath10k"; - reg = <0x0000 0 0 0 0>; - nvmem-cells = <&cal_art_5000>; - nvmem-cell-names = "calibration"; - }; -}; - &spi { status = "okay"; @@ -88,10 +77,6 @@ cal_art_1000: calibration@1000 { reg = <0x1000 0x440>; }; - - cal_art_5000: calibration@5000 { - reg = <0x5000 0x844>; - }; }; }; diff --git a/target/linux/ath79/dts/qca9557_sophos_ap15c.dts b/target/linux/ath79/dts/qca9557_sophos_ap15c.dts new file mode 100644 index 0000000000..68d02e97a5 --- /dev/null +++ b/target/linux/ath79/dts/qca9557_sophos_ap15c.dts @@ -0,0 +1,159 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca955x.dtsi" + +#include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/input/input.h> +#include <dt-bindings/leds/common.h> + +/ { + compatible = "sophos,ap15c", "qca,qca9557"; + model = "Sophos AP15C"; + + aliases { + led-boot = &led_status_green; + led-failsafe = &led_status_yellow; + led-running = &led_status_green; + led-upgrade = &led_status_yellow; + label-mac-device = ð0; + }; + + chosen { + bootargs = "console=ttyS0,115200n8"; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = <KEY_RESTART>; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status_green: status_green { + function = LED_FUNCTION_STATUS; + color = <LED_COLOR_ID_GREEN>; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + + led_status_yellow: status_yellow { + function = LED_FUNCTION_STATUS; + color = <LED_COLOR_ID_YELLOW>; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&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 = "u-boot-env"; + reg = <0x040000 0x010000>; + }; + + partition@50000 { + label = "art"; + reg = <0x050000 0x010000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + cal_art_1000: calibration@1000 { + reg = <0x1000 0x440>; + }; + }; + }; + + partition@60000 { + label = "config"; + reg = <0x060000 0x010000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_config_201a: macaddr@201a { + reg = <0x201a 0x6>; + }; + }; + }; + + partition@70000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x070000 0xf90000>; + }; + }; + }; +}; + +&mdio0 { + status = "okay"; + + phy-mask = <0x10>; + + phy4: ethernet-phy@4 { + reg = <4>; + eee-broken-100tx; + eee-broken-1000t; + }; +}; + +ð0 { + status = "okay"; + + pll-data = <0xa6000000 0xa0000101 0xa0001313>; + + nvmem-cells = <&macaddr_config_201a>; + nvmem-cell-names = "mac-address"; + + phy-mode = "rgmii-id"; + phy-handle = <&phy4>; + + gmac_config: gmac-config { + device = <&gmac>; + + rgmii-enabled = <1>; + + rxdv-delay = <3>; + rxd-delay = <3>; + txen-delay = <3>; + txd-delay = <3>; + }; +}; + +&wmac { + status = "okay"; + + nvmem-cells = <&cal_art_1000>; + nvmem-cell-names = "calibration"; +}; diff --git a/target/linux/ath79/dts/qca9557_zyxel_nbg6616.dts b/target/linux/ath79/dts/qca9557_zyxel_nbg6616.dts index 4372a07d51..828096f8f6 100644 --- a/target/linux/ath79/dts/qca9557_zyxel_nbg6616.dts +++ b/target/linux/ath79/dts/qca9557_zyxel_nbg6616.dts @@ -6,7 +6,7 @@ / { compatible = "zyxel,nbg6616", "qca,qca9557"; - model = "ZyXEL NBG6616"; + model = "Zyxel NBG6616"; aliases { led-boot = &led_power; diff --git a/target/linux/ath79/dts/qca9558_aruba_ap-115.dts b/target/linux/ath79/dts/qca9558_aruba_ap-115.dts index a5318b6cdd..7a59bda6eb 100644 --- a/target/linux/ath79/dts/qca9558_aruba_ap-115.dts +++ b/target/linux/ath79/dts/qca9558_aruba_ap-115.dts @@ -98,10 +98,9 @@ ath9k: wifi@0,0 { compatible = "pci168c,0033"; reg = <0x0000 0 0 0 0>; - qca,no-eeprom; - nvmem-cells = <&macaddr_oemdata_1d 1>; - nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_oemdata_1d 1>, <&cal_oemdata_5000>; + nvmem-cell-names = "mac-address", "calibration"; }; }; @@ -161,7 +160,7 @@ reg = <0x100000 0xe00000>; }; - oemdata: partition@fe0000 { + partition@fe0000 { label = "oemdata"; reg = <0xfe0000 0x010000>; read-only; @@ -176,6 +175,14 @@ reg = <0x1d 0x6>; #nvmem-cell-cells = <1>; }; + + cal_oemdata_1000: calibration@1000 { + reg = <0x1000 0x440>; + }; + + cal_oemdata_5000: calibration@5000 { + reg = <0x5000 0x440>; + }; }; }; @@ -190,9 +197,8 @@ &wmac { status = "okay"; - qca,no-eeprom; - nvmem-cells = <&macaddr_oemdata_1d 0>; - nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_oemdata_1d 0>, <&cal_oemdata_1000>; + nvmem-cell-names = "mac-address", "calibration"; }; &mdio0 { diff --git a/target/linux/ath79/dts/qca9558_linksys_ea4500-v3.dts b/target/linux/ath79/dts/qca9558_linksys_ea4500-v3.dts index 6c799efe33..1da46d7214 100644 --- a/target/linux/ath79/dts/qca9558_linksys_ea4500-v3.dts +++ b/target/linux/ath79/dts/qca9558_linksys_ea4500-v3.dts @@ -123,7 +123,7 @@ partition@2c0000 { label = "firmware"; - reg = <0x2c0000 0x5000000>; + reg = <0x2c0000 0x7d40000>; compatible = "fixed-partitions"; #address-cells = <1>; @@ -136,7 +136,7 @@ partition@400000 { label = "ubi"; - reg = <0x400000 0x4c00000>; + reg = <0x400000 0x7940000>; }; /* Original layout for secondary partitions */ @@ -151,11 +151,11 @@ }; */ }; - partition@52c0000 { + /* Original layout for user data partition */ + /* partition@52c0000 { label = "syscfg"; reg = <0x52c0000 0x2d40000>; - read-only; - }; + }; */ }; }; diff --git a/target/linux/ath79/dts/qca9558_nec_aterm.dtsi b/target/linux/ath79/dts/qca9558_nec_aterm.dtsi new file mode 100644 index 0000000000..76d39c2ee7 --- /dev/null +++ b/target/linux/ath79/dts/qca9558_nec_aterm.dtsi @@ -0,0 +1,371 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/input/input.h> +#include <dt-bindings/leds/common.h> + +#include "qca955x.dtsi" + +/ { + chosen { + /* + * don't specify bootargs property in DeviceTree to + * enable a console with a default baudrate (9600) + * or passed console= parameter from the bootloader + */ + /delete-property/ bootargs; + stdout-path = &uart0; + }; + + aliases { + led-boot = &led_power_green; + led-failsafe = &led_power_red; + led-running = &led_power_green; + led-upgrade = &led_power_green; + label-mac-device = ð0; + }; + + i2c { + compatible = "i2c-gpio"; + + pinctrl-names = "default"; + pinctrl-0 = <&pmx_gpio_i2c_pins>; + sda-gpios = <&gpio 20 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + scl-gpios = <&gpio 19 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + #address-cells = <1>; + #size-cells = <0>; + + gpio1: gpio@20 { + compatible = "ti,tca6416"; + reg = <0x20>; + reset-gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + gpio-controller; + #gpio-cells = <2>; + + usb-hub-reset { + gpio-hog; + gpios = <0 GPIO_ACTIVE_HIGH>; + output-high; + }; + }; + }; + + keys { + compatible = "gpio-keys"; + pinctrl-names = "default"; + pinctrl-0 = <&jtag_disable_pins>; + + button-wps { + label = "wps"; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + linux,code = <KEY_WPS_BUTTON>; + debounce-interval = <60>; + }; + + button-eco { + label = "eco"; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + linux,code = <BTN_0>; + debounce-interval = <60>; + }; + + switch-bridge { + label = "br"; + gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + linux,code = <BTN_1>; + debounce-interval = <60>; + }; + + button-reset { + label = "reset"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + linux,code = <KEY_RESTART>; + debounce-interval = <60>; + }; + + switch-converter { + label = "cnv"; + gpios = <&gpio 23 GPIO_ACTIVE_LOW>; + linux,code = <BTN_2>; + debounce-interval = <60>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led-0 { + gpios = <&gpio1 4 GPIO_ACTIVE_LOW>; + color = <LED_COLOR_ID_RED>; + function = "converter"; + }; + + led-1 { + label = "green:converter"; + gpios = <&gpio1 5 GPIO_ACTIVE_LOW>; + color = <LED_COLOR_ID_GREEN>; + function = "converter"; + }; + + led-2 { + gpios = <&gpio1 6 GPIO_ACTIVE_LOW>; + color = <LED_COLOR_ID_RED>; + function = "tv"; + }; + + led-3 { + gpios = <&gpio1 7 GPIO_ACTIVE_LOW>; + color = <LED_COLOR_ID_GREEN>; + function = "tv"; + }; + + led-4 { + gpios = <&gpio1 8 GPIO_ACTIVE_LOW>; + color = <LED_COLOR_ID_RED>; + function = LED_FUNCTION_WLAN_5GHZ; + }; + + led-5 { + gpios = <&gpio1 9 GPIO_ACTIVE_LOW>; + color = <LED_COLOR_ID_GREEN>; + function = LED_FUNCTION_WLAN_5GHZ; + linux,default-trigger = "phy0tpt"; + }; + + led-6 { + gpios = <&gpio1 10 GPIO_ACTIVE_LOW>; + color = <LED_COLOR_ID_RED>; + function = LED_FUNCTION_WLAN_2GHZ; + }; + + led-7 { + gpios = <&gpio1 11 GPIO_ACTIVE_LOW>; + color = <LED_COLOR_ID_GREEN>; + function = LED_FUNCTION_WLAN_2GHZ; + linux,default-trigger = "phy1tpt"; + }; + + led-8 { + gpios = <&gpio1 12 GPIO_ACTIVE_LOW>; + color = <LED_COLOR_ID_RED>; + function = LED_FUNCTION_WAN_ONLINE; + }; + + led-9 { + gpios = <&gpio1 13 GPIO_ACTIVE_LOW>; + color = <LED_COLOR_ID_GREEN>; + function = LED_FUNCTION_WAN_ONLINE; + }; + + led_power_red: led-10 { + gpios = <&gpio1 14 GPIO_ACTIVE_LOW>; + color = <LED_COLOR_ID_RED>; + function = LED_FUNCTION_POWER; + }; + + led_power_green: led-11 { + gpios = <&gpio1 15 GPIO_ACTIVE_LOW>; + color = <LED_COLOR_ID_GREEN>; + function = LED_FUNCTION_POWER; + default-state = "on"; + }; + }; + + regulator { + compatible = "regulator-fixed"; + regulator-name = "usb-vbus"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpios = <&gpio 22 GPIO_ACTIVE_HIGH>; + enable-active-high; + regulator-always-on; + }; +}; + +&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>; + + /* + * since the OEM bootloader requires unknown + * filesystem on firmware area, needs to be + * replaced to u-boot before OpenWrt installation + */ + partition@0 { + label = "bootloader"; + reg = <0x000000 0x020000>; + }; + + /* not compatible with u-boot */ + partition@20000 { + label = "config"; + reg = <0x020000 0x010000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_config_0: macaddr@0 { + reg = <0x0 0x6>; + }; + + macaddr_config_6: macaddr@6 { + reg = <0x6 0x6>; + }; + + macaddr_config_c: macaddr@c { + reg = <0xc 0x6>; + }; + + macaddr_config_12: macaddr@12 { + reg = <0x12 0x6>; + }; + }; + }; + + partition@30000 { + label = "art"; + reg = <0x030000 0x010000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + cal_art_1000: calibration@1000 { + reg = <0x1000 0x440>; + }; + + cal_art_5000: calibration@5000 { + reg = <0x5000 0x844>; + }; + }; + }; + + partition@40000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x040000 0xfc0000>; + }; + }; + }; +}; + +&mdio0 { + status = "okay"; + + phy0: ethernet-phy@0 { + reg = <0>; + + qca,ar8327-initvals = < + 0x04 0x00080080 /* PORT0_PAD_MODE_CTRL */ + 0x08 0x00000000 /* PORT5_PAD_MODE_CTRL */ + 0x0c 0x07600000 /* PORT6_PAD_MODE_CTRL */ + 0x10 0xa12613a0 /* POWER_ON_STRAP */ + 0x50 0xcc36cc36 /* LED_CTRL0 */ + 0x54 0xca36ca36 /* LED_CTRL1 */ + 0x58 0xc936c936 /* LED_CTRL2 */ + 0x5c 0x03ffff00 /* LED_CTRL3 */ + 0x7c 0x0000007e /* PORT0_STATUS */ + 0x94 0x0000007e /* PORT6_STATUS */ + 0xe0 0xc74164d0 /* SGMII_CONTROL */ + >; + }; +}; + +ð0 { + status = "okay"; + + nvmem-cells = <&macaddr_config_c>; + nvmem-cell-names = "mac-address"; + phy-handle = <&phy0>; + qca955x-sgmii-fixup; + + gmac-config { + device = <&gmac>; + + rgmii-enabled = <1>; + rxdv-delay = <2>; + rxd-delay = <2>; + }; +}; + +ð1 { + status = "okay"; + + nvmem-cells = <&macaddr_config_6>; + nvmem-cell-names = "mac-address"; + pll-data = <0x03000000 0x00000101 0x00001616>; + + fixed-link { + speed = <1000>; + full-duplex; + }; +}; + +&gpio { + switch-reset { + gpio-hog; + gpios = <11 GPIO_ACTIVE_HIGH>; + output-high; + }; +}; + +&pcie0 { + status = "okay"; + + wifi@0,0 { + compatible = "pci168c,003c"; + reg = <0x0000 0 0 0 0>; + nvmem-cells = <&cal_art_5000>, <&macaddr_config_12>; + nvmem-cell-names = "calibration", "mac-address"; + }; +}; + +&pinmux { + /* mux GPIO19/20 as GPIO instead of native I2C on QCA9558 */ + pmx_gpio_i2c_pins: gpio-i2c-pins { + pinctrl-single,bits = <0x10 0x0 0xff000000>, + <0x14 0x0 0xff>; + }; +}; + +&usb_phy0 { + status = "okay"; +}; + +&usb0 { + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + + dr_mode = "host"; + + /delete-node/ port@1; + + /* NEC uPD720114 */ + hub@1 { + compatible = "usb0409,005a"; + reg = <1>; + }; +}; + +&wmac { + status = "okay"; + + nvmem-cells = <&cal_art_1000>, <&macaddr_config_0>; + nvmem-cell-names = "calibration", "mac-address"; +}; diff --git a/target/linux/ath79/dts/qca9558_nec_wg1400hp.dts b/target/linux/ath79/dts/qca9558_nec_wg1400hp.dts new file mode 100644 index 0000000000..bfcac09d55 --- /dev/null +++ b/target/linux/ath79/dts/qca9558_nec_wg1400hp.dts @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca9558_nec_aterm.dtsi" + +/ { + compatible = "nec,wg1400hp", "qca,qca9558"; + model = "NEC Aterm WG1400HP"; +}; + +ð0 { + pll-data = <0x5a000000 0x00000101 0x00001616>; +}; diff --git a/target/linux/ath79/dts/qca9558_nec_wg1800hp.dts b/target/linux/ath79/dts/qca9558_nec_wg1800hp.dts new file mode 100644 index 0000000000..47679c5869 --- /dev/null +++ b/target/linux/ath79/dts/qca9558_nec_wg1800hp.dts @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca9558_nec_aterm.dtsi" + +/ { + compatible = "nec,wg1800hp", "qca,qca9558"; + model = "NEC Aterm WG1800HP"; +}; + +ð0 { + pll-data = <0x5a000000 0x00000101 0x00001616>; +}; diff --git a/target/linux/ath79/dts/qca9558_nec_wg1800hp2.dts b/target/linux/ath79/dts/qca9558_nec_wg1800hp2.dts new file mode 100644 index 0000000000..39dec5b2c4 --- /dev/null +++ b/target/linux/ath79/dts/qca9558_nec_wg1800hp2.dts @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca9558_nec_aterm.dtsi" + +/ { + compatible = "nec,wg1800hp2", "qca,qca9558"; + model = "NEC Aterm WG1800HP2"; +}; + +ð0 { + pll-data = <0x96000000 0x00000101 0x00001616>; +}; diff --git a/target/linux/ath79/dts/qca9558_zyxel_emg2926_q10a.dts b/target/linux/ath79/dts/qca9558_zyxel_emg2926_q10a.dts index c00109a5b4..bf8d0f2f95 100644 --- a/target/linux/ath79/dts/qca9558_zyxel_emg2926_q10a.dts +++ b/target/linux/ath79/dts/qca9558_zyxel_emg2926_q10a.dts @@ -4,5 +4,5 @@ / { compatible = "zyxel,emg2926-q10a", "zyxel,nbg6716", "qca,qca9558"; - model = "ZyXEL EMG2926-Q10A"; + model = "Zyxel EMG2926-Q10A"; }; diff --git a/target/linux/ath79/dts/qca9558_zyxel_nbg6716.dts b/target/linux/ath79/dts/qca9558_zyxel_nbg6716.dts index 19f1245022..463553fe27 100644 --- a/target/linux/ath79/dts/qca9558_zyxel_nbg6716.dts +++ b/target/linux/ath79/dts/qca9558_zyxel_nbg6716.dts @@ -6,7 +6,7 @@ / { compatible = "zyxel,nbg6716", "qca,qca9558"; - model = "ZyXEL NBG6716"; + model = "Zyxel NBG6716"; aliases { led-boot = &led_power; diff --git a/target/linux/ath79/dts/qca955x.dtsi b/target/linux/ath79/dts/qca955x.dtsi index 9d410ceb46..f8318b8f65 100644 --- a/target/linux/ath79/dts/qca955x.dtsi +++ b/target/linux/ath79/dts/qca955x.dtsi @@ -64,8 +64,8 @@ compatible ="qca,qca9550-usb-phy", "qca,ar7200-usb-phy"; reg = <0x18030000 4>, <0x18030004 4>; - reset-names = "usb-phy", "usb-suspend-override"; - resets = <&rst 4>, <&rst 3>; + reset-names = "usb-phy-analog", "usb-phy", "usb-suspend-override"; + resets = <&rst 11>, <&rst 4>, <&rst 3>; #phy-cells = <0>; @@ -76,8 +76,8 @@ compatible = "qca,qca9550-usb-phy", "qca,ar7200-usb-phy"; reg = <0x18030010 4>, <0x18030014 4>; - reset-names = "usb-phy", "usb-suspend-override"; - resets = <&rst2 4>, <&rst2 3>; + reset-names = "usb-phy-analog", "usb-phy", "usb-suspend-override"; + resets = <&rst2 11>, <&rst2 4>, <&rst2 3>; #phy-cells = <0>; @@ -362,6 +362,8 @@ resets = <&rst 9>, <&rst 22>; reset-names = "mac", "mdio"; + clocks = <&pll ATH79_CLK_AHB>, <&pll ATH79_CLK_REF>; + clock-names = "eth", "mdio"; }; &mdio1 { @@ -379,4 +381,6 @@ resets = <&rst 13>, <&rst 23>; reset-names = "mac", "mdio"; + clocks = <&pll ATH79_CLK_AHB>, <&pll ATH79_CLK_REF>; + clock-names = "eth", "mdio"; }; diff --git a/target/linux/ath79/dts/qca955x_elecom_wab.dtsi b/target/linux/ath79/dts/qca955x_elecom_wab.dtsi index 43e34c6029..53bb5b0141 100644 --- a/target/linux/ath79/dts/qca955x_elecom_wab.dtsi +++ b/target/linux/ath79/dts/qca955x_elecom_wab.dtsi @@ -8,6 +8,7 @@ / { aliases { + label-mac-device = ð0; led-boot = &led_status; led-failsafe = &led_status; led-upgrade = &led_status; @@ -107,6 +108,9 @@ phy-mode = "rgmii-rxid"; pll-data = <0xae000000 0x80000101 0x80001313>; + nvmem-cells = <&macaddr_uboot_ethaddr 0>; + nvmem-cell-names = "mac-address"; + gmac-config { device = <&gmac>; @@ -144,8 +148,8 @@ wifi@0,0 { compatible = "qcom,ath10k"; reg = <0x0000 0 0 0 0>; - nvmem-cells = <&cal_art_5000>; - nvmem-cell-names = "calibration"; + nvmem-cells = <&cal_art_5000>, <&macaddr_uboot_ethaddr 1>; + nvmem-cell-names = "calibration", "mac-address"; }; }; @@ -169,9 +173,14 @@ }; partition@40000 { + compatible = "u-boot,env"; label = "u-boot-env"; reg = <0x40000 0x10000>; read-only; + + macaddr_uboot_ethaddr: ethaddr { + #nvmem-cell-cells = <1>; + }; }; partition@50000 { @@ -252,6 +261,6 @@ &wmac { status = "okay"; - nvmem-cells = <&cal_art_1000>; - nvmem-cell-names = "calibration"; + nvmem-cells = <&cal_art_1000>, <&macaddr_uboot_ethaddr 0>; + nvmem-cell-names = "calibration", "mac-address"; }; diff --git a/target/linux/ath79/dts/qca9561_nec_wf1200cr.dts b/target/linux/ath79/dts/qca9561_nec_wf1200cr.dts index c4671bf57f..4e66f45ebe 100644 --- a/target/linux/ath79/dts/qca9561_nec_wf1200cr.dts +++ b/target/linux/ath79/dts/qca9561_nec_wf1200cr.dts @@ -114,6 +114,10 @@ #address-cells = <1>; #size-cells = <1>; + cal_art_1000: calibration@1000 { + reg = <0x1000 0x440>; + }; + precal_art_5000: pre-calibration@5000 { reg = <0x5000 0x2f20>; }; @@ -177,5 +181,6 @@ &wmac { status = "okay"; - qca,no-eeprom; + nvmem-cells = <&cal_art_1000>; + nvmem-cell-names = "calibration"; }; diff --git a/target/linux/ath79/dts/qca9563_nec_wg1200cr.dts b/target/linux/ath79/dts/qca9563_nec_wg1200cr.dts index 7f8866bd36..c9e47938d3 100644 --- a/target/linux/ath79/dts/qca9563_nec_wg1200cr.dts +++ b/target/linux/ath79/dts/qca9563_nec_wg1200cr.dts @@ -129,6 +129,10 @@ #address-cells = <1>; #size-cells = <1>; + cal_art_1000: calibration@1000 { + reg = <0x1000 0x440>; + }; + precal_art_5000: pre-calibration@5000 { reg = <0x5000 0x2f20>; }; @@ -178,5 +182,6 @@ &wmac { status = "okay"; - qca,no-eeprom; + nvmem-cells = <&cal_art_1000>; + nvmem-cell-names = "calibration"; }; diff --git a/target/linux/ath79/dts/qca9563_nec_wg800hp.dts b/target/linux/ath79/dts/qca9563_nec_wg800hp.dts index d2621fa304..d8ecf46201 100644 --- a/target/linux/ath79/dts/qca9563_nec_wg800hp.dts +++ b/target/linux/ath79/dts/qca9563_nec_wg800hp.dts @@ -142,6 +142,24 @@ #address-cells = <1>; #size-cells = <1>; + macaddr_board_data_280: macaddr@280 { + compatible = "mac-base"; + reg = <0x280 0x11>; + #nvmem-cell-cells = <1>; + }; + + macaddr_board_data_480: macaddr@480 { + compatible = "mac-base"; + reg = <0x480 0x11>; + #nvmem-cell-cells = <1>; + }; + + macaddr_board_data_680: macaddr@680 { + compatible = "mac-base"; + reg = <0x680 0x11>; + #nvmem-cell-cells = <1>; + }; + macaddr_board_data_880: macaddr@880 { compatible = "mac-base"; reg = <0x880 0x11>; @@ -160,6 +178,10 @@ #address-cells = <1>; #size-cells = <1>; + cal_art_1000: calibration@1000 { + reg = <0x1000 0x440>; + }; + cal_art_5000: calibration@5000 { reg = <0x5000 0x844>; }; @@ -191,6 +213,9 @@ phy-mode = "sgmii"; phy-handle = <&phy0>; + + nvmem-cells = <&macaddr_board_data_280 0>; + nvmem-cell-names = "mac-address"; }; &pcie { @@ -206,5 +231,7 @@ &wmac { status = "okay"; - qca,no-eeprom; + + nvmem-cells = <&macaddr_board_data_680 0>, <&cal_art_1000>; + nvmem-cell-names = "mac-address", "calibration"; }; diff --git a/target/linux/ath79/dts/qca9563_zte_mf286.dts b/target/linux/ath79/dts/qca9563_zte_mf286.dts index 4b92239666..897ecf66ea 100644 --- a/target/linux/ath79/dts/qca9563_zte_mf286.dts +++ b/target/linux/ath79/dts/qca9563_zte_mf286.dts @@ -70,13 +70,20 @@ #address-cells = <1>; #size-cells = <1>; + /* ath9k */ cal_caldata_1000: cal@1000 { reg = <0x1000 0x440>; }; + /* ath10k wave1 in plain MF286 */ cal_caldata_5000: cal@5000 { reg = <0x5000 0x844>; }; + + /* ath10k wave2 in early MF286A */ + precal_caldata_5000: precal@5000 { + reg = <0x5000 0x2f20>; + }; }; }; @@ -128,7 +135,7 @@ }; &wifi_ath10k { - nvmem-cells = <&macaddr_mac_0 1>, <&cal_caldata_5000>, <&cal_caldata_5000>; + nvmem-cells = <&macaddr_mac_0 1>, <&cal_caldata_5000>, <&precal_caldata_5000>; nvmem-cell-names = "mac-address", "calibration", "pre-calibration"; }; diff --git a/target/linux/ath79/files/drivers/gpio/gpio-latch-mikrotik.c b/target/linux/ath79/files/drivers/gpio/gpio-latch-mikrotik.c index 8f53974e46..a0759fe9e3 100644 --- a/target/linux/ath79/files/drivers/gpio/gpio-latch-mikrotik.c +++ b/target/linux/ath79/files/drivers/gpio/gpio-latch-mikrotik.c @@ -28,11 +28,6 @@ struct gpio_latch_chip { struct gpio_desc *gpios[GPIO_LATCH_LINES]; }; -static inline struct gpio_latch_chip *to_gpio_latch_chip(struct gpio_chip *gc) -{ - return container_of(gc, struct gpio_latch_chip, gc); -} - static void gpio_latch_lock(struct gpio_latch_chip *glc, bool enable) { mutex_lock(&glc->mutex); @@ -58,7 +53,7 @@ static void gpio_latch_unlock(struct gpio_latch_chip *glc, bool disable) static int gpio_latch_get(struct gpio_chip *gc, unsigned offset) { - struct gpio_latch_chip *glc = to_gpio_latch_chip(gc); + struct gpio_latch_chip *glc = gpiochip_get_data(gc); int ret; gpio_latch_lock(glc, false); @@ -71,7 +66,7 @@ gpio_latch_get(struct gpio_chip *gc, unsigned offset) static void gpio_latch_set(struct gpio_chip *gc, unsigned offset, int value) { - struct gpio_latch_chip *glc = to_gpio_latch_chip(gc); + struct gpio_latch_chip *glc = gpiochip_get_data(gc); bool enable_latch = false; bool disable_latch = false; @@ -88,7 +83,7 @@ gpio_latch_set(struct gpio_chip *gc, unsigned offset, int value) static int gpio_latch_direction_output(struct gpio_chip *gc, unsigned offset, int value) { - struct gpio_latch_chip *glc = to_gpio_latch_chip(gc); + struct gpio_latch_chip *glc = gpiochip_get_data(gc); bool enable_latch = false; bool disable_latch = false; int ret; @@ -110,35 +105,34 @@ static int gpio_latch_probe(struct platform_device *pdev) struct gpio_latch_chip *glc; struct gpio_chip *gc; struct device *dev = &pdev->dev; - struct fwnode_handle *fwnode = dev->fwnode; - int i, n; + int err, i, n; glc = devm_kzalloc(dev, sizeof(*glc), GFP_KERNEL); if (!glc) return -ENOMEM; - mutex_init(&glc->mutex); - mutex_init(&glc->latch_mutex); + err = devm_mutex_init(&pdev->dev, &glc->mutex); + if (err) + return err; + + err = devm_mutex_init(&pdev->dev, &glc->latch_mutex); + if (err) + return err; n = gpiod_count(dev, NULL); - if (n <= 0) { - dev_err(dev, "failed to get gpios: %d\n", n); - return n; - } else if (n != GPIO_LATCH_LINES) { - dev_err(dev, "expected %d gpios\n", GPIO_LATCH_LINES); + if (n <= 0) + return dev_err_probe(dev, n, "failed to get gpios"); + if (n != GPIO_LATCH_LINES) { + dev_err(dev, "expected %d gpios", GPIO_LATCH_LINES); return -EINVAL; } for (i = 0; i < n; i++) { glc->gpios[i] = devm_gpiod_get_index_optional(dev, NULL, i, GPIOD_OUT_LOW); - if (IS_ERR(glc->gpios[i])) { - if (PTR_ERR(glc->gpios[i]) != -EPROBE_DEFER) { - dev_err(dev, "failed to get gpio %d: %ld\n", i, - PTR_ERR(glc->gpios[i])); - } - return PTR_ERR(glc->gpios[i]); - } + if (IS_ERR(glc->gpios[i])) + return dev_err_probe(dev, PTR_ERR(glc->gpios[i]), + "failed to get gpio %d", i); } glc->le_gpio = 8; @@ -152,31 +146,15 @@ static int gpio_latch_probe(struct platform_device *pdev) gc = &glc->gc; gc->label = GPIO_LATCH_DRIVER_NAME; + gc->parent = dev; gc->can_sleep = true; gc->base = -1; gc->ngpio = GPIO_LATCH_LINES; gc->get = gpio_latch_get; gc->set = gpio_latch_set; gc->direction_output = gpio_latch_direction_output; - gc->fwnode = fwnode; - - platform_set_drvdata(pdev, glc); - - i = gpiochip_add(&glc->gc); - if (i) { - dev_err(dev, "gpiochip_add() failed: %d\n", i); - return i; - } - - return 0; -} - -static int gpio_latch_remove(struct platform_device *pdev) -{ - struct gpio_latch_chip *glc = platform_get_drvdata(pdev); - gpiochip_remove(&glc->gc); - return 0; + return devm_gpiochip_add_data(dev, gc, glc); } static const struct of_device_id gpio_latch_match[] = { @@ -188,10 +166,8 @@ MODULE_DEVICE_TABLE(of, gpio_latch_match); static struct platform_driver gpio_latch_driver = { .probe = gpio_latch_probe, - .remove = gpio_latch_remove, .driver = { .name = GPIO_LATCH_DRIVER_NAME, - .owner = THIS_MODULE, .of_match_table = gpio_latch_match, }, }; diff --git a/target/linux/ath79/files/drivers/gpio/gpio-rb4xx.c b/target/linux/ath79/files/drivers/gpio/gpio-rb4xx.c index f8022436e0..db381f5d30 100644 --- a/target/linux/ath79/files/drivers/gpio/gpio-rb4xx.c +++ b/target/linux/ath79/files/drivers/gpio/gpio-rb4xx.c @@ -105,6 +105,7 @@ static int rb4xx_gpio_probe(struct platform_device *pdev) struct device *parent = dev->parent; struct rb4xx_gpio *gpio; u32 val; + int err; if (!parent) return -ENODEV; @@ -117,7 +118,10 @@ static int rb4xx_gpio_probe(struct platform_device *pdev) gpio->cpld = dev_get_drvdata(parent); gpio->dev = dev; gpio->values = 0; - mutex_init(&gpio->lock); + + err = devm_mutex_init(&pdev->dev, &gpio->lock); + if (err) + return err; gpio->chip.label = "rb4xx-gpio"; gpio->chip.parent = dev; @@ -134,17 +138,7 @@ static int rb4xx_gpio_probe(struct platform_device *pdev) if (!of_property_read_u32(dev->of_node, "base", &val)) gpio->chip.base = val; - return gpiochip_add_data(&gpio->chip, gpio); -} - -static int rb4xx_gpio_remove(struct platform_device *pdev) -{ - struct rb4xx_gpio *gpio = platform_get_drvdata(pdev); - - gpiochip_remove(&gpio->chip); - mutex_destroy(&gpio->lock); - - return 0; + return devm_gpiochip_add_data(&pdev->dev, &gpio->chip, gpio); } static const struct platform_device_id rb4xx_gpio_id_table[] = { @@ -155,7 +149,6 @@ MODULE_DEVICE_TABLE(platform, rb4xx_gpio_id_table); static struct platform_driver rb4xx_gpio_driver = { .probe = rb4xx_gpio_probe, - .remove = rb4xx_gpio_remove, .id_table = rb4xx_gpio_id_table, .driver = { .name = "rb4xx-gpio", diff --git a/target/linux/ath79/files/drivers/gpio/gpio-rb91x-key.c b/target/linux/ath79/files/drivers/gpio/gpio-rb91x-key.c index 8996b2a906..d83b690afe 100644 --- a/target/linux/ath79/files/drivers/gpio/gpio-rb91x-key.c +++ b/target/linux/ath79/files/drivers/gpio/gpio-rb91x-key.c @@ -41,14 +41,9 @@ struct gpio_rb91x_key { struct gpio_desc *gpio; }; -static inline struct gpio_rb91x_key *to_gpio_rb91x_key(struct gpio_chip *gc) -{ - return container_of(gc, struct gpio_rb91x_key, gc); -} - static int gpio_rb91x_key_get(struct gpio_chip *gc, unsigned offset) { - struct gpio_rb91x_key *drvdata = to_gpio_rb91x_key(gc); + struct gpio_rb91x_key *drvdata = gpiochip_get_data(gc); struct gpio_desc *gpio = drvdata->gpio; int val, bak_val; @@ -97,7 +92,7 @@ static int gpio_rb91x_key_direction_input(struct gpio_chip *gc, unsigned offset) static void gpio_rb91x_key_set(struct gpio_chip *gc, unsigned offset, int value) { - struct gpio_rb91x_key *drvdata = to_gpio_rb91x_key(gc); + struct gpio_rb91x_key *drvdata = gpiochip_get_data(gc); struct gpio_desc *gpio = drvdata->gpio; mutex_lock(&drvdata->mutex); @@ -144,27 +139,27 @@ static int gpio_rb91x_key_probe(struct platform_device *pdev) struct gpio_rb91x_key *drvdata; struct gpio_chip *gc; struct device *dev = &pdev->dev; - struct fwnode_handle *fwnode = dev->fwnode; - int r; + int err; drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) return -ENOMEM; - mutex_init(&drvdata->mutex); - mutex_init(&drvdata->poll_mutex); + err = devm_mutex_init(dev, &drvdata->mutex); + if (err) + return err; + + err = devm_mutex_init(dev, &drvdata->poll_mutex); + if (err) + return err; drvdata->gpio = devm_gpiod_get(dev, NULL, GPIOD_OUT_LOW); - if (IS_ERR(drvdata->gpio)) { - if (PTR_ERR(drvdata->gpio) != -EPROBE_DEFER) { - dev_err(dev, "failed to get gpio: %ld\n", - PTR_ERR(drvdata->gpio)); - } - return PTR_ERR(drvdata->gpio); - } + if (IS_ERR(drvdata->gpio)) + return dev_err_probe(dev, PTR_ERR(drvdata->gpio), "failed to get gpio"); gc = &drvdata->gc; gc->label = GPIO_RB91X_KEY_DRIVER_NAME; + gc->parent = dev; gc->can_sleep = 1; gc->base = -1; gc->ngpio = GPIO_RB91X_KEY_NGPIOS; @@ -172,25 +167,8 @@ static int gpio_rb91x_key_probe(struct platform_device *pdev) gc->set = gpio_rb91x_key_set; gc->direction_output = gpio_rb91x_key_direction_output; gc->direction_input = gpio_rb91x_key_direction_input; - gc->fwnode = fwnode; - - platform_set_drvdata(pdev, drvdata); - - r = gpiochip_add(&drvdata->gc); - if (r) { - dev_err(dev, "gpiochip_add() failed: %d\n", r); - return r; - } - - return 0; -} - -static int gpio_rb91x_key_remove(struct platform_device *pdev) -{ - struct gpio_rb91x_key *drvdata = platform_get_drvdata(pdev); - gpiochip_remove(&drvdata->gc); - return 0; + return devm_gpiochip_add_data(dev, gc, drvdata); } static const struct of_device_id gpio_rb91x_key_match[] = { @@ -202,10 +180,8 @@ MODULE_DEVICE_TABLE(of, gpio_rb91x_key_match); static struct platform_driver gpio_rb91x_key_driver = { .probe = gpio_rb91x_key_probe, - .remove = gpio_rb91x_key_remove, .driver = { .name = GPIO_RB91X_KEY_DRIVER_NAME, - .owner = THIS_MODULE, .of_match_table = gpio_rb91x_key_match, }, }; diff --git a/target/linux/ath79/files/drivers/mtd/nand/raw/ar934x_nand.c b/target/linux/ath79/files/drivers/mtd/nand/raw/ar934x_nand.c index 28bdcb066d..029142ca61 100644 --- a/target/linux/ath79/files/drivers/mtd/nand/raw/ar934x_nand.c +++ b/target/linux/ath79/files/drivers/mtd/nand/raw/ar934x_nand.c @@ -1359,7 +1359,6 @@ static const struct nand_controller_ops ar934x_nfc_controller_ops = { static int ar934x_nfc_probe(struct platform_device *pdev) { struct ar934x_nfc *nfc; - struct resource *res; struct mtd_info *mtd; struct nand_chip *nand; int ret; @@ -1367,19 +1366,13 @@ static int ar934x_nfc_probe(struct platform_device *pdev) pdev->dev.dma_mask = &ar934x_nfc_dma_mask; pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(&pdev->dev, "failed to get I/O memory\n"); - return -EINVAL; - } - nfc = devm_kzalloc(&pdev->dev, sizeof(struct ar934x_nfc), GFP_KERNEL); if (!nfc) { dev_err(&pdev->dev, "failed to allocate driver data\n"); return -ENOMEM; } - nfc->base = devm_ioremap_resource(&pdev->dev, res); + nfc->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(nfc->base)) { dev_err(&pdev->dev, "failed to remap I/O memory\n"); return PTR_ERR(nfc->base); @@ -1485,7 +1478,6 @@ static struct platform_driver ar934x_nfc_driver = { .remove = ar934x_nfc_remove, .driver = { .name = AR934X_NFC_DRIVER_NAME, - .owner = THIS_MODULE, .of_match_table = ar934x_nfc_match, }, }; diff --git a/target/linux/ath79/files/drivers/mtd/nand/raw/rb91x_nand.c b/target/linux/ath79/files/drivers/mtd/nand/raw/rb91x_nand.c index c502f4a064..cf2809bfa3 100644 --- a/target/linux/ath79/files/drivers/mtd/nand/raw/rb91x_nand.c +++ b/target/linux/ath79/files/drivers/mtd/nand/raw/rb91x_nand.c @@ -284,13 +284,8 @@ static int rb91x_nand_probe(struct platform_device *pdev) platform_set_drvdata(pdev, drvdata); gpios = gpiod_get_array(dev, NULL, GPIOD_OUT_LOW); - if (IS_ERR(gpios)) { - if (PTR_ERR(gpios) != -EPROBE_DEFER) { - dev_err(dev, "failed to get gpios: %ld\n", - PTR_ERR(gpios)); - } - return PTR_ERR(gpios); - } + if (IS_ERR(gpios)) + return dev_err_probe(dev, PTR_ERR(gpios), "failed to get gpios"); if (gpios->ndescs != RB91X_NAND_GPIOS) { dev_err(dev, "expected %d gpios\n", RB91X_NAND_GPIOS); @@ -333,16 +328,11 @@ static int rb91x_nand_probe(struct platform_device *pdev) r = mtd_device_register(mtd, NULL, 0); if (r) { - dev_err(dev, "mtd_device_register() failed: %d\n", - r); - goto err_release_nand; + rb91x_nand_release(drvdata); + return dev_err_probe(dev, r, "mtd_device_register() failed"); } return 0; - -err_release_nand: - rb91x_nand_release(drvdata); - return r; } static int rb91x_nand_remove(struct platform_device *pdev) @@ -366,7 +356,6 @@ static struct platform_driver rb91x_nand_driver = { .remove = rb91x_nand_remove, .driver = { .name = "rb91x-nand", - .owner = THIS_MODULE, .of_match_table = rb91x_nand_match, }, }; diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/Kconfig b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/Kconfig index dfcedcf70e..e1504b9234 100644 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/Kconfig +++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/Kconfig @@ -1,4 +1,4 @@ -config AG71XX +config AG71XX_LEGACY tristate "Atheros AR7XXX/AR9XXX built-in ethernet mac support" depends on ATH79 select PHYLIB @@ -6,14 +6,14 @@ config AG71XX If you wish to compile a kernel for AR7XXX/91XXX and enable ethernet support, then you should always answer Y to this. -if AG71XX +if AG71XX_LEGACY -config AG71XX_DEBUG +config AG71XX_LEGACY_DEBUG bool "Atheros AR71xx built-in ethernet driver debugging" help Atheros AR71xx built-in ethernet driver debugging messages. -config AG71XX_DEBUG_FS +config AG71XX_LEGACY_DEBUG_FS bool "Atheros AR71xx built-in ethernet driver debugfs support" depends on DEBUG_FS help diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/Makefile b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/Makefile index 87add0d208..86e47290e6 100644 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/Makefile +++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/Makefile @@ -2,12 +2,12 @@ # Makefile for the Atheros AR71xx built-in ethernet macs # -ag71xx-y += ag71xx_main.o -ag71xx-y += ag71xx_gmac.o -ag71xx-y += ag71xx_ethtool.o -ag71xx-y += ag71xx_phy.o +ag71xx_legacy-y += ag71xx_main.o +ag71xx_legacy-y += ag71xx_gmac.o +ag71xx_legacy-y += ag71xx_ethtool.o +ag71xx_legacy-y += ag71xx_phy.o -ag71xx-$(CONFIG_AG71XX_DEBUG_FS) += ag71xx_debugfs.o +ag71xx_legacy-$(CONFIG_AG71XX_LEGACY_DEBUG_FS) += ag71xx_legacy_debugfs.o -obj-$(CONFIG_AG71XX) += ag71xx_mdio.o -obj-$(CONFIG_AG71XX) += ag71xx.o +obj-$(CONFIG_AG71XX_LEGACY) += ag71xx_legacy_mdio.o +obj-$(CONFIG_AG71XX_LEGACY) += ag71xx_legacy.o diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h index fca072a83a..da716d94c3 100644 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h +++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h @@ -40,7 +40,7 @@ #include <asm/mach-ath79/ar71xx_regs.h> #include <asm/mach-ath79/ath79.h> -#define AG71XX_DRV_NAME "ag71xx" +#define AG71XX_DRV_NAME "ag71xx-legacy" /* * For our NAPI weight bigger does *NOT* mean better - it means more @@ -68,7 +68,7 @@ #define AG71XX_TX_RING_SIZE_MAX 256 #define AG71XX_RX_RING_SIZE_MAX 256 -#ifdef CONFIG_AG71XX_DEBUG +#ifdef CONFIG_AG71XX_LEGACY_DEBUG #define DBG(fmt, args...) pr_debug(fmt, ## args) #else #define DBG(fmt, args...) do {} while (0) @@ -195,7 +195,7 @@ struct ag71xx { u32 pllreg[3]; struct regmap *pllregmap; -#ifdef CONFIG_AG71XX_DEBUG_FS +#ifdef CONFIG_AG71XX_LEGACY_DEBUG_FS struct ag71xx_debug debug; #endif }; @@ -425,7 +425,7 @@ static inline void ag71xx_int_disable(struct ag71xx *ag, u32 ints) ag71xx_cb(ag, AG71XX_REG_INT_ENABLE, ints); } -#ifdef CONFIG_AG71XX_DEBUG_FS +#ifdef CONFIG_AG71XX_LEGACY_DEBUG_FS int ag71xx_debugfs_root_init(void); void ag71xx_debugfs_root_exit(void); int ag71xx_debugfs_init(struct ag71xx *ag); @@ -441,7 +441,7 @@ static inline void ag71xx_debugfs_update_int_stats(struct ag71xx *ag, u32 status) {} static inline void ag71xx_debugfs_update_napi_stats(struct ag71xx *ag, int rx, int tx) {} -#endif /* CONFIG_AG71XX_DEBUG_FS */ +#endif /* CONFIG_AG71XX_LEGACY_DEBUG_FS */ int ag71xx_ar7240_init(struct ag71xx *ag, struct device_node *np); void ag71xx_ar7240_cleanup(struct ag71xx *ag); diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_debugfs.c b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_legacy_debugfs.c index 20cf1c15c8..20cf1c15c8 100644 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_debugfs.c +++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_legacy_debugfs.c diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_mdio.c b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_legacy_mdio.c index fd05dbd0ca..fda561a374 100644 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_mdio.c +++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_legacy_mdio.c @@ -241,7 +241,7 @@ static struct platform_driver ag71xx_mdio_driver = { .probe = ag71xx_mdio_probe, .remove = ag71xx_mdio_remove, .driver = { - .name = "ag71xx-mdio", + .name = "ag71xx-legacy-mdio", .of_match_table = ag71xx_mdio_match, } }; diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c index f63e93f978..c6fcea1abd 100644 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c +++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c @@ -1162,33 +1162,10 @@ static int ag71xx_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { struct ag71xx *ag = netdev_priv(dev); + if (ag->phy_dev == NULL) + return -ENODEV; - switch (cmd) { - case SIOCSIFHWADDR: - if (copy_from_user - ((void*)dev->dev_addr, ifr->ifr_data, sizeof(dev->dev_addr))) - return -EFAULT; - return 0; - - case SIOCGIFHWADDR: - if (copy_to_user - (ifr->ifr_data, dev->dev_addr, sizeof(dev->dev_addr))) - return -EFAULT; - return 0; - - case SIOCGMIIPHY: - case SIOCGMIIREG: - case SIOCSMIIREG: - if (ag->phy_dev == NULL) - break; - - return phy_mii_ioctl(ag->phy_dev, ifr, cmd); - - default: - break; - } - - return -EOPNOTSUPP; + return phy_mii_ioctl(ag->phy_dev, ifr, cmd); } static void ag71xx_oom_timer_handler(struct timer_list *t) @@ -1501,7 +1478,7 @@ static const struct net_device_ops ag71xx_netdev_ops = { .ndo_open = ag71xx_open, .ndo_stop = ag71xx_stop, .ndo_start_xmit = ag71xx_hard_start_xmit, - .ndo_do_ioctl = ag71xx_do_ioctl, + .ndo_eth_ioctl = ag71xx_do_ioctl, .ndo_tx_timeout = ag71xx_tx_timeout, .ndo_change_mtu = ag71xx_change_mtu, .ndo_set_mac_address = eth_mac_addr, 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 143309a8b2..0e5731dd74 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 @@ -22,6 +22,7 @@ alcatel,hh40v) ;; alfa-network,ap121f|\ alfa-network,ap121fe|\ +alfa-network,wifi-camppro-nano-duo|\ avm,fritz450e|\ glinet,6408|\ glinet,6416|\ 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 7905d6e496..8f79a3fad8 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 @@ -14,6 +14,7 @@ ath79_setup_interfaces() alfa-network,ap121f|\ alfa-network,pi-wifi4|\ alfa-network,tube-2hq|\ + alfa-network,wifi-camppro-nano-duo|\ araknis,an-300-ap-i-n|\ araknis,an-500-ap-i-ac|\ araknis,an-700-ap-i-ac|\ @@ -52,6 +53,7 @@ ath79_setup_interfaces() glinet,gl-ar300m-lite|\ glinet,gl-usb150|\ hak5,wifi-pineapple-nano|\ + huawei,ap6010dn|\ meraki,mr16|\ netgear,ex7300|\ netgear,ex7300-v2|\ @@ -74,6 +76,7 @@ ath79_setup_interfaces() ruckus,zf7351|\ siemens,ws-ap3610|\ sophos,ap15|\ + sophos,ap15c|\ sophos,ap55|\ sophos,ap55c|\ sophos,ap100|\ @@ -188,6 +191,9 @@ ath79_setup_interfaces() ;; belkin,f9j1108-v2|\ belkin,f9k1115-v2|\ + nec,wg1400hp|\ + nec,wg1800hp|\ + nec,wg1800hp2|\ tplink,archer-c5-v1|\ tplink,archer-c7-v1|\ tplink,archer-c7-v2|\ @@ -568,9 +574,7 @@ ath79_setup_interfaces() "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan" ;; ubnt,edgeswitch-8xp) - ucidef_set_interface_wan "eth1" - ucidef_add_switch "switch0" \ - "0:lan:1" "1:lan:2" "2:lan:3" "3:lan:4" "4:lan:5" "5:lan:6" "6:lan:7" "7:lan:8" "8@eth0" + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan5 lan6 lan7 lan8" "eth1" ;; ubnt,routerstation-pro) ucidef_set_interface_wan "eth0" @@ -620,6 +624,7 @@ ath79_setup_macs() alfa-network,pi-wifi4|\ alfa-network,r36a|\ alfa-network,tube-2hq|\ + alfa-network,wifi-camppro-nano-duo|\ engenius,eap300-v2|\ engenius,ens202ext-v1) label_mac=$(mtd_get_mac_binary art 0x1002) @@ -711,9 +716,6 @@ ath79_setup_macs() lan_mac=$(mtd_get_mac_ascii devdata "lanmac") wan_mac=$(mtd_get_mac_ascii devdata "wanmac") ;; - elecom,wab-i1750-ps|\ - elecom,wab-s1167-ps|\ - elecom,wab-s600-ps|\ engenius,ecb1200|\ engenius,ecb1750) lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr) @@ -783,7 +785,6 @@ ath79_setup_macs() label_mac=$wan_mac ;; nec,wg800hp) - lan_mac=$(mtd_get_mac_text board_data 0x280) wan_mac=$(mtd_get_mac_text board_data 0x480) label_mac=$wan_mac ;; 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 ddcef7b685..17639ad439 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 @@ -9,9 +9,6 @@ board=$(board_name) case "$FIRMWARE" in "ath9k-eeprom-ahb-18100000.wmac.bin") case $board in - aruba,ap-115) - caldata_extract "oemdata" 0x1000 0x440 - ;; asus,pl-ac56|\ asus,rp-ac51|\ asus,rp-ac66) @@ -30,8 +27,6 @@ case "$FIRMWARE" in dlink,dir-842-c1|\ dlink,dir-842-c2|\ dlink,dir-842-c3|\ - nec,wf1200cr|\ - nec,wg1200cr|\ wd,mynet-n600|\ wd,mynet-n750) caldata_extract "art" 0x1000 0x440 @@ -63,14 +58,6 @@ case "$FIRMWARE" in caldata_extract "art" 0x1000 0x440 ath9k_patch_mac $(mtd_get_mac_ascii u-boot-env mac_addr) ;; - nec,wg800hp) - caldata_extract "art" 0x1000 0x440 - ath9k_patch_mac $(mtd_get_mac_text board_data 0x680) - ;; - qihoo,c301) - caldata_extract "radiocfg" 0x1000 0x440 - ath9k_patch_mac $(mtd_get_mac_ascii devdata "wlan24mac") - ;; tplink,deco-s4-v2) caldata_extract "art" 0x1000 0x440 base_mac=$(mtd_get_mac_encrypted_deco $(find_mtd_part config)) @@ -83,9 +70,6 @@ case "$FIRMWARE" in ;; "ath9k-eeprom-pci-0000:00:00.0.bin") case $board in - aruba,ap-115) - caldata_extract "oemdata" 0x5000 0x440 - ;; avm,fritz300e) caldata_extract_reverse "urloader" 0x1541 0x440 ;; diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac index 2a1f230eb4..6676e4d509 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac @@ -42,16 +42,6 @@ case "$board" in [ "$PHYNBR" -eq 1 ] && \ mtd_get_mac_ascii bdcfg "wlanmac" > /sys${DEVPATH}/macaddress ;; - elecom,wab-i1750-ps|\ - elecom,wab-s1167-ps|\ - elecom,wab-s600-ps) - # set the 5G MAC address (= ethaddr + 1) - [ "$PHYNBR" -eq 0 ] && \ - macaddr_add "$(mtd_get_mac_ascii u-boot-env ethaddr)" 1 > /sys${DEVPATH}/macaddress - # set the 2.4G MAC address (= ethaddr) - [ "$PHYNBR" -eq 1 ] && \ - mtd_get_mac_ascii u-boot-env "ethaddr" > /sys${DEVPATH}/macaddress - ;; engenius,ecb1200|\ engenius,ecb1750) [ "$PHYNBR" -eq 0 ] && \ @@ -93,6 +83,8 @@ case "$board" in qihoo,c301) [ "$PHYNBR" -eq 0 ] && \ mtd_get_mac_ascii devdata wlan5mac > /sys${DEVPATH}/macaddress + [ "$PHYNBR" -eq 1 ] && \ + mtd_get_mac_ascii devdata wlan24mac > /sys${DEVPATH}/macaddress ;; phicomm,k2t) [ "$PHYNBR" -eq 0 ] && \ diff --git a/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh b/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh index 076a785cbf..0e314dd311 100644 --- a/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh +++ b/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh @@ -17,6 +17,17 @@ platform_check_image() { ubnt,routerstation-pro) platform_check_image_redboot_fis "$1" ;; + nec,wg1400hp|\ + nec,wg1800hp|\ + nec,wg1800hp2) + local uboot_mtd=$(find_mtd_part "bootloader") + + # check "U-Boot <year>.<month>" string in the "bootloader" partition + if ! grep -q "U-Boot [0-9]\{4\}\.[0-9]\{2\}" $uboot_mtd; then + v "The bootloader doesn't seem to be replaced to U-Boot!" + return 1 + fi + ;; *) return 0 ;; @@ -68,7 +79,8 @@ platform_do_upgrade() { ROOTFS_FILE="root.squashfs" platform_do_upgrade_failsafe_datachk "$1" ;; - huawei,ap5030dn) + huawei,ap5030dn|\ + huawei,ap6010dn) # Store beginning address of the "firmware" partition # as KernelA address and KernelB address, each to BootupA & BootupB # This is the address from which the bootloader will try to load the kernel. diff --git a/target/linux/ath79/generic/config-default b/target/linux/ath79/generic/config-default index a37d341821..1141d7ae47 100644 --- a/target/linux/ath79/generic/config-default +++ b/target/linux/ath79/generic/config-default @@ -20,8 +20,6 @@ CONFIG_MTD_SPI_NOR_USE_VARIABLE_ERASE=y CONFIG_MTD_SPLIT_EVA_FW=y CONFIG_NVMEM_SYSFS=y CONFIG_NVMEM_U_BOOT_ENV=y -CONFIG_PHY_AR7100_USB=y -CONFIG_PHY_AR7200_USB=y CONFIG_REALTEK_PHY=y CONFIG_REGMAP_I2C=y CONFIG_REGULATOR_FIXED_VOLTAGE=y diff --git a/target/linux/ath79/image/common-nec.mk b/target/linux/ath79/image/common-nec.mk new file mode 100644 index 0000000000..7981a72d8e --- /dev/null +++ b/target/linux/ath79/image/common-nec.mk @@ -0,0 +1,25 @@ +DEVICE_VARS += NEC_FW_TYPE + +define Build/nec-usbaterm-fw + $(STAGING_DIR_HOST)/bin/nec-usbatermfw $@.new -t $(NEC_FW_TYPE) $(1) + mv $@.new $@ +endef + +define Device/nec-netbsd-aterm + DEVICE_VENDOR := NEC + LOADER_TYPE := bin + KERNEL := kernel-bin | append-dtb | lzma | loader-kernel | uImage none + KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | loader-kernel | uImage none + ARTIFACTS := uboot.bin +ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) + COMPILE := loader-$(1).bin + COMPILE/loader-$(1).bin := loader-okli-compile + ARTIFACTS += initramfs-factory.bin + ARTIFACT/initramfs-factory.bin := append-image-stage initramfs-kernel.bin | \ + pad-to 4 skip=16 | \ + nec-usbaterm-fw -f 0x0003 -d $$(KDIR)/loader-$(1).bin -d $$$$@ | check-size +endif + UBOOT_PATH := $$(STAGING_DIR_IMAGE)/$$(SOC)_nec_aterm-u-boot.bin + ARTIFACT/uboot.bin := append-uboot | check-size 128k + DEVICE_PACKAGES := kmod-usb2 -uboot-envtools +endef diff --git a/target/linux/ath79/image/generic-tp-link.mk b/target/linux/ath79/image/generic-tp-link.mk index ec433e5b64..643de76f7c 100644 --- a/target/linux/ath79/image/generic-tp-link.mk +++ b/target/linux/ath79/image/generic-tp-link.mk @@ -683,7 +683,7 @@ define Device/tplink_tl-wdr6500-v2 SOC := qca9561 DEVICE_MODEL := TL-WDR6500 DEVICE_VARIANT := v2 - DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-ledtrig-usbdev \ + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport \ kmod-ath9k kmod-ath10k-ct ath10k-firmware-qca988x-ct IMAGE_SIZE := 8000k KERNEL := kernel-bin | append-dtb | lzma | uImage lzma diff --git a/target/linux/ath79/image/generic-ubnt.mk b/target/linux/ath79/image/generic-ubnt.mk index f7bab4b697..51d0aaef03 100644 --- a/target/linux/ath79/image/generic-ubnt.mk +++ b/target/linux/ath79/image/generic-ubnt.mk @@ -24,6 +24,7 @@ define Device/ubnt_amplifi-router-hd UBNT_TYPE := AFi-R UBNT_VERSION := 3.6.3 SOC := qca9563 + DEVICE_VENDOR := Ubiquiti DEVICE_MODEL := AmpliFi Router HD UBNT_CHIP := qca956x DEVICE_PACKAGES += kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct kmod-usb2 @@ -57,8 +58,9 @@ TARGET_DEVICES += ubnt_edgeswitch-5xp define Device/ubnt_edgeswitch-8xp $(Device/ubnt-sw) DEVICE_MODEL := EdgeSwitch 8XP - DEVICE_PACKAGES += kmod-switch-bcm53xx-mdio - DEFAULT := n + DEVICE_PACKAGES += kmod-dsa-b53-mdio + DEVICE_COMPAT_VERSION := 1.1 + DEVICE_COMPAT_MESSAGE := Config cannot be migrated from swconfig to DSA endef TARGET_DEVICES += ubnt_edgeswitch-8xp diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index f6dba8604d..0173f5cb16 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -1,4 +1,5 @@ include ./common-buffalo.mk +include ./common-nec.mk include ./common-netgear.mk include ./common-senao.mk include ./common-tp-link.mk @@ -345,6 +346,16 @@ define Device/alfa-network_tube-2hq endef TARGET_DEVICES += alfa-network_tube-2hq +define Device/alfa-network_wifi-camppro-nano-duo + SOC := qca9531 + DEVICE_VENDOR := ALFA Network + DEVICE_MODEL := WiFi CampPro Nano Duo + DEVICE_PACKAGES := kmod-usb2 kmod-mt76x0u -swconfig + IMAGE_SIZE := 15872k + SUPPORTED_DEVICES += campnano-duo +endef +TARGET_DEVICES += alfa-network_wifi-camppro-nano-duo + define Device/allnet_all-wap02860ac $(Device/senao_loader_okli) SOC := qca9558 @@ -798,6 +809,17 @@ define Device/comfast_cf-e314n-v2 endef TARGET_DEVICES += comfast_cf-e314n-v2 +define Device/comfast_cf-e355ac-v2 + SOC := qca9531 + DEVICE_VENDOR := COMFAST + DEVICE_MODEL := CF-E355AC + DEVICE_VARIANT := v2 + DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca9888-ct \ + -swconfig -uboot-envtools + IMAGE_SIZE := 16192k +endef +TARGET_DEVICES += comfast_cf-e355ac-v2 + define Device/comfast_cf-e375ac SOC := qca9563 DEVICE_VENDOR := COMFAST @@ -1806,6 +1828,21 @@ define Device/huawei_ap5030dn endef TARGET_DEVICES += huawei_ap5030dn +define Device/huawei_ap6010dn + SOC := ar9344 + DEVICE_VENDOR := Huawei + DEVICE_MODEL := AP6010DN + LOADER_TYPE := bin + LOADER_FLASH_OFFS := 0x111DC0 + KERNEL_SIZE := 15360k + IMAGE_SIZE := 30720k + COMPILE := loader-$(1).bin + COMPILE/loader-$(1).bin := loader-okli-compile | pad-to 64k | uImage none + KERNEL := kernel-bin | append-dtb | lzma | uImage lzma -M 0x4f4b4c49 | loader-okli $(1) 8128 + KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | loader-kernel | uImage none +endef +TARGET_DEVICES += huawei_ap6010dn + define Device/iodata_etg3-r SOC := ar9342 DEVICE_VENDOR := I-O DATA @@ -2045,6 +2082,36 @@ define Device/nec_wg1200cr endef TARGET_DEVICES += nec_wg1200cr +define Device/nec_wg1400hp + SOC := qca9558 + DEVICE_MODEL := Aterm WG1400HP + IMAGE_SIZE := 16128k + NEC_FW_TYPE := H040b + $(Device/nec-netbsd-aterm) + DEVICE_PACKAGES += kmod-ath10k-ct ath10k-firmware-qca988x-ct +endef +TARGET_DEVICES += nec_wg1400hp + +define Device/nec_wg1800hp + SOC := qca9558 + DEVICE_MODEL := Aterm WG1800HP + IMAGE_SIZE := 16128k + NEC_FW_TYPE := H040a + $(Device/nec-netbsd-aterm) + DEVICE_PACKAGES += kmod-ath10k-ct ath10k-firmware-qca988x-ct +endef +TARGET_DEVICES += nec_wg1800hp + +define Device/nec_wg1800hp2 + SOC := qca9558 + DEVICE_MODEL := Aterm WG1800HP2 + IMAGE_SIZE := 16128k + NEC_FW_TYPE := H049 + $(Device/nec-netbsd-aterm) + DEVICE_PACKAGES += kmod-ath10k-ct ath10k-firmware-qca988x-ct +endef +TARGET_DEVICES += nec_wg1800hp2 + define Device/nec_wg800hp SOC := qca9563 DEVICE_VENDOR := NEC @@ -2898,14 +2965,21 @@ endef TARGET_DEVICES += sitecom_wlr-8100 define Device/sophos_ap15 - SOC := qca9558 + SOC := qca9557 DEVICE_VENDOR := Sophos DEVICE_MODEL := AP15 - DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct IMAGE_SIZE := 15936k endef TARGET_DEVICES += sophos_ap15 +define Device/sophos_ap15c + SOC := qca9557 + DEVICE_VENDOR := Sophos + DEVICE_MODEL := AP15C + IMAGE_SIZE := 15936k +endef +TARGET_DEVICES += sophos_ap15c + define Device/sophos_ap55 SOC := qca9558 DEVICE_VENDOR := Sophos @@ -3248,7 +3322,7 @@ TARGET_DEVICES += zbtlink_zbt-wd323 define Device/zyxel_nwa11xx $(Device/loader-okli-uimage) SOC := ar9342 - DEVICE_VENDOR := ZyXEL + DEVICE_VENDOR := Zyxel LOADER_FLASH_OFFS := 0x050000 KERNEL := kernel-bin | append-dtb | lzma | uImage lzma -M 0x4f4b4c49 IMAGE_SIZE := 8192k @@ -3295,7 +3369,7 @@ TARGET_DEVICES += zyxel_nwa1123-ni define Device/zyxel_nbg6616 SOC := qca9557 - DEVICE_VENDOR := ZyXEL + DEVICE_VENDOR := Zyxel DEVICE_MODEL := NBG6616 DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport kmod-rtc-pcf8563 \ kmod-ath10k-ct ath10k-firmware-qca988x-ct diff --git a/target/linux/ath79/image/lzma-loader/src/ar71xx_regs.h b/target/linux/ath79/image/lzma-loader/src/ar71xx_regs.h index e7d7683973..62474ff047 100644 --- a/target/linux/ath79/image/lzma-loader/src/ar71xx_regs.h +++ b/target/linux/ath79/image/lzma-loader/src/ar71xx_regs.h @@ -670,6 +670,7 @@ #define AR934X_GPIO_FUNC_SPI_CS_0_EN BIT(13) #define AR934X_GPIO_OUT_GPIO 0x00 +#define AR934X_GPIO_OUTSEL_CLK_OBS4 0x14 #define QCA955X_GPIO_OUTSEL_CLK_OBS5 0x54 @@ -740,5 +741,7 @@ #define QCA955X_ETH_CFG_SGMII_GMAC0 BIT(6) #define QCA955X_GMAC_REG_SGMII_SERDES 0x0018 +#define QCA955X_GMAC_REG_MR_AN_CONTROL 0x1c +#define QCA955X_GMAC_REG_SGMII_CONFIG 0x34 #endif /* __ASM_MACH_AR71XX_REGS_H */ diff --git a/target/linux/ath79/image/lzma-loader/src/board.c b/target/linux/ath79/image/lzma-loader/src/board.c index 13926e9b1e..1445108508 100644 --- a/target/linux/ath79/image/lzma-loader/src/board.c +++ b/target/linux/ath79/image/lzma-loader/src/board.c @@ -51,9 +51,12 @@ static void tlwr1043nd_init(void) static inline void tlwr1043nd_init(void) {} #endif -#ifdef CONFIG_BOARD_MERAKI_MR18 +#if defined(CONFIG_BOARD_MERAKI_MR18) || \ + defined(CONFIG_BOARD_NEC_WG1400HP) || \ + defined(CONFIG_BOARD_NEC_WG1800HP) || \ + defined(CONFIG_BOARD_NEC_WG1800HP2) -static int mr18_extract_sgmii_res_cal(void) +static int extract_qca955x_sgmii_res_cal(void) { unsigned int base; unsigned int reversed_sgmii_value; @@ -138,7 +141,7 @@ static void qca955x_device_reset_clear(unsigned int mask) WRITEREG(reg, t & ~mask); } -static void mr18_setup_qca955x_eth_serdes_cal(unsigned int sgmii_value) +static void setup_qca955x_eth_serdes_cal(unsigned int sgmii_value) { unsigned int ethbase, pllbase, t; @@ -166,50 +169,188 @@ static void mr18_setup_qca955x_eth_serdes_cal(unsigned int sgmii_value) QCA955X_SGMII_SERDES_LOCK_DETECT_STATUS)) ; } +#endif +#ifdef CONFIG_BOARD_MERAKI_MR18 static inline void mr18_init(void) { int res; printf("Meraki MR18\n"); - res = mr18_extract_sgmii_res_cal(); + res = extract_qca955x_sgmii_res_cal(); if (res >= 0) - mr18_setup_qca955x_eth_serdes_cal(res); + setup_qca955x_eth_serdes_cal(res); } #else static inline void mr18_init(void) { } #endif -#ifdef CONFIG_BOARD_HUAWEI_AP5030DN -static inline void ap5030dn_init(void) +#if defined(CONFIG_BOARD_HUAWEI_AP5030DN) || defined(CONFIG_BOARD_HUAWEI_AP6010DN) +static inline void huawei_ap_init(void) { - const unsigned int ap5030dn_watchdog_gpio = 15; + const unsigned int watchdog_gpio = 15; unsigned int gpiobase, reg; gpiobase = KSEG1ADDR(AR71XX_GPIO_BASE); - printf("Huawei AP5030DN\n"); + printf("Huawei AP\n"); reg = READREG(gpiobase + AR71XX_GPIO_REG_OE); WRITEREG(gpiobase + AR71XX_GPIO_REG_OE, - reg & ~(1 << ap5030dn_watchdog_gpio)); + reg & ~(1 << watchdog_gpio)); /* Set GPIO15 MUX to output CLK_OBS5 (= CPU_CLK/4) - * to keep the watchdog happy until wdt-gpio takes over + * or CLK_OBS4 (= AHB_CLK/2) to keep the watchdog happy + * until wdt-gpio takes over */ reg = READREG(gpiobase + AR934X_GPIO_REG_OUT_FUNC3); +#if defined(CONFIG_BOARD_HUAWEI_AP5030DN) WRITEREG(gpiobase + AR934X_GPIO_REG_OUT_FUNC3, reg | (QCA955X_GPIO_OUTSEL_CLK_OBS5 << 24)); +#else if defined(CONFIG_BOARD_HUAWEI_AP6010DN) + WRITEREG(gpiobase + AR934X_GPIO_REG_OUT_FUNC3, + reg | (AR934X_GPIO_OUTSEL_CLK_OBS4 << 24)); +#endif +} +#else +static inline void huawei_ap_init(void) {} +#endif + +#if defined(CONFIG_BOARD_NEC_WG1400HP) || \ + defined(CONFIG_BOARD_NEC_WG1800HP) || \ + defined(CONFIG_BOARD_NEC_WG1800HP2) || \ + defined(CONFIG_BOARD_NEC_WG600HP) || \ + defined(CONFIG_BOARD_NEC_WR8750N) || \ + defined(CONFIG_BOARD_NEC_WR9500N) +static inline void nec_aterm_reset_common(void) +{ + unsigned int reg = KSEG1ADDR(AR71XX_RESET_BASE); + +#ifndef LOADADDR + /* + * This is for initramfs-factory image. + * When the system was reset by power source or FULL_CHIP_RESET + * and started from the OEM bootloader with a dummy tp data + * (this loader), reset again by timeout of the watchdog timer + * to load an actual OpenWrt initramfs image in firmware block + * in a factory image. + * Note: On the stock firmware, TP block contains a POST function + * and sub commands of "tp" command. + * + * Behaviors of OEM bootloader: + * + * - reset by watchdog (ex.: rebooting on the stock firmware): + * called as "SOFT-RESET", boot a firmware without POST + * + * - reset by FULL_CHIP_RESET (or powering on): + * called as "HARD-RESET", run POST and boot a firmware + */ + printf("\n## booted with dummy tp (lzma-loader)," + " waiting reset... (count: 0x%08x) ##\n", + READREG(reg + AR71XX_RESET_REG_WDOG)); + while (1); +#endif + /* + * set maximum watchdog count to avoid reset while + * booting from stock bootloader + */ + WRITEREG(reg + AR71XX_RESET_REG_WDOG, 0xffffffff); +} +#endif + +#if defined(CONFIG_BOARD_NEC_WG600HP) || \ + defined(CONFIG_BOARD_NEC_WR8750N) || \ + defined(CONFIG_BOARD_NEC_WR9500N) + +#define AR934X_PLL_SWITCH_CLK_CTRL_REG 0x24 +#define AR934X_PLL_SWITCH_CLK_CTRL_SWITCHCLK_SEL BIT(0) + +static inline void nec_aterm_init(void) +{ + unsigned int reg, val; + + printf("NEC Aterm series (AR9344)\n"); + + /* set REFCLK=40MHz to switch PLL */ + reg = KSEG1ADDR(AR71XX_PLL_BASE); + val = READREG(reg + AR934X_PLL_SWITCH_CLK_CTRL_REG); + val &= ~AR934X_PLL_SWITCH_CLK_CTRL_SWITCHCLK_SEL; + WRITEREG(reg + AR934X_PLL_SWITCH_CLK_CTRL_REG, val); + + nec_aterm_reset_common(); + + /* + * deassert some RESET bits not handled by drivers + * and mainline U-Boot + * + * - ETH_SWITCH(_ANALOG): eth0 + * - RTC : wmac + */ + reg = KSEG1ADDR(AR71XX_RESET_BASE); + val = READREG(reg + AR934X_RESET_REG_RESET_MODULE); + val &= ~(AR934X_RESET_ETH_SWITCH | AR934X_RESET_ETH_SWITCH_ANALOG | + AR934X_RESET_RTC); + WRITEREG(reg + AR934X_RESET_REG_RESET_MODULE, val); +} +#elif defined(CONFIG_BOARD_NEC_WG1400HP) || \ + defined(CONFIG_BOARD_NEC_WG1800HP) || \ + defined(CONFIG_BOARD_NEC_WG1800HP2) + +#define QCA955X_GMAC_MR_AN_CONTROL_PHY_RESET_MASK BIT(15) +#define QCA955X_GMAC_MR_AN_CONTROL_FULL_DUPLEX_MASK BIT(8) +#define QCA955X_GMAC_MR_AN_CONTROL_SPEED_SEL1_MASK BIT(6) + +#define QCA955X_GMAC_SGMII_CONFIG_SPEED_SHIFT 6 + #define QCA955X_GMAC_SGMII_CONFIG_SPEED_1000M 0x2 +#define QCA955X_GMAC_SGMII_CONFIG_FORCE_SPEED_MASK BIT(5) +#define QCA955X_GMAC_SGMII_CONFIG_MODE_CTRL_SHIFT 0 + #define QCA955X_GMAC_SGMII_CONFIG_MODE_SGMII 0x2 + +static inline void nec_aterm_init(void) +{ + unsigned int reg, val; + int ret; + + printf("NEC Aterm series (QCA9558)\n"); + + nec_aterm_reset_common(); + + printf("\nCalibrating SGMII\n"); + ret = extract_qca955x_sgmii_res_cal(); + if (ret >= 0) + setup_qca955x_eth_serdes_cal(ret); + + /* set SGMII force mode to make eth1 working */ + printf("\nConfiguring SGMII force mode\n"); + reg = KSEG1ADDR(QCA955X_GMAC_BASE); + WRITEREG(reg + QCA955X_GMAC_REG_SGMII_CONFIG, + QCA955X_GMAC_SGMII_CONFIG_SPEED_1000M + << QCA955X_GMAC_SGMII_CONFIG_SPEED_SHIFT | + QCA955X_GMAC_SGMII_CONFIG_FORCE_SPEED_MASK | + QCA955X_GMAC_SGMII_CONFIG_MODE_SGMII + << QCA955X_GMAC_SGMII_CONFIG_MODE_CTRL_SHIFT); + printf(" SGMII_CONFIG : 0x%08x\n", + READREG(reg + QCA955X_GMAC_REG_SGMII_CONFIG)); + val = QCA955X_GMAC_MR_AN_CONTROL_FULL_DUPLEX_MASK | + QCA955X_GMAC_MR_AN_CONTROL_SPEED_SEL1_MASK; + WRITEREG(reg + QCA955X_GMAC_REG_MR_AN_CONTROL, + val | QCA955X_GMAC_MR_AN_CONTROL_PHY_RESET_MASK); + printf(" MR_AN_CONTROL: 0x%08x\n", + READREG(reg + QCA955X_GMAC_REG_MR_AN_CONTROL)); + WRITEREG(reg + QCA955X_GMAC_REG_MR_AN_CONTROL, val); + printf(" MR_AN_CONTROL: 0x%08x\n", + READREG(reg + QCA955X_GMAC_REG_MR_AN_CONTROL)); } #else -static inline void ap5030dn_init(void) { } +static inline void nec_aterm_init(void) {} #endif void board_init(void) { tlwr1043nd_init(); mr18_init(); - ap5030dn_init(); + huawei_ap_init(); + nec_aterm_init(); } diff --git a/target/linux/ath79/image/nand.mk b/target/linux/ath79/image/nand.mk index 1a7eebc92a..d3c1120aa2 100644 --- a/target/linux/ath79/image/nand.mk +++ b/target/linux/ath79/image/nand.mk @@ -281,6 +281,12 @@ TARGET_DEVICES += glinet_gl-x1200-nor define Device/linksys_ea4500-v3 SOC := qca9558 + DEVICE_COMPAT_VERSION := 1.1 + DEVICE_COMPAT_MESSAGE := Partition table has been changed. Please \ + install kmod-mtd-rw and erase mtd8 (syscfg) before upgrade \ + to keep configures, or forcibly flash factory image to mtd5 \ + (firmware) partition with mtd tool to discard configures but \ + claim additional space immediately. DEVICE_VENDOR := Linksys DEVICE_MODEL := EA4500 DEVICE_VARIANT := v3 @@ -288,7 +294,7 @@ define Device/linksys_ea4500-v3 BLOCKSIZE := 128k PAGESIZE := 2048 KERNEL_SIZE := 4096k - IMAGE_SIZE := 81920k + IMAGE_SIZE := 128256k IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata LINKSYS_HWNAME := EA4500V3 IMAGES += factory.img @@ -487,7 +493,7 @@ TARGET_DEVICES += zte_mf286r define Device/zyxel_nbg6716 SOC := qca9558 - DEVICE_VENDOR := ZyXEL + DEVICE_VENDOR := Zyxel DEVICE_MODEL := NBG6716 DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport kmod-ath10k-ct \ ath10k-firmware-qca988x-ct diff --git a/target/linux/ath79/image/tiny.mk b/target/linux/ath79/image/tiny.mk index 955d0fbff2..53111119d8 100644 --- a/target/linux/ath79/image/tiny.mk +++ b/target/linux/ath79/image/tiny.mk @@ -1,4 +1,5 @@ include ./common-buffalo.mk +include ./common-nec.mk include ./common-senao.mk define Device/buffalo_whr-g301n @@ -120,6 +121,36 @@ define Device/engenius_enh202-v1 endef TARGET_DEVICES += engenius_enh202-v1 +define Device/nec_wg600hp + DEVICE_MODEL := Aterm WG600HP + SOC := ar9344 + BLOCKSIZE := 4k + IMAGE_SIZE := 7936k + NEC_FW_TYPE := H044 + $(Device/nec-netbsd-aterm) +endef +TARGET_DEVICES += nec_wg600hp + +define Device/nec_wr8750n + SOC := ar9344 + DEVICE_MODEL := Aterm WR8750N + BLOCKSIZE := 4k + IMAGE_SIZE := 7936k + NEC_FW_TYPE := H033a + $(Device/nec-netbsd-aterm) +endef +TARGET_DEVICES += nec_wr8750n + +define Device/nec_wr9500n + SOC := ar9344 + DEVICE_MODEL := Aterm WR9500N + BLOCKSIZE := 4k + IMAGE_SIZE := 16128k + NEC_FW_TYPE := H033 + $(Device/nec-netbsd-aterm) +endef +TARGET_DEVICES += nec_wr9500n + define Device/pqi_air-pen SOC := ar9330 DEVICE_VENDOR := PQI diff --git a/target/linux/ath79/mikrotik/config-default b/target/linux/ath79/mikrotik/config-default index 71b64b26ad..2976c24470 100644 --- a/target/linux/ath79/mikrotik/config-default +++ b/target/linux/ath79/mikrotik/config-default @@ -15,6 +15,7 @@ CONFIG_MFD_CORE=y CONFIG_MFD_RB4XX_CPLD=y CONFIG_MIKROTIK=y CONFIG_MIKROTIK_RB_SYSFS=y +CONFIG_MIKROTIK_WLAN_DECOMPRESS_LZ77=y CONFIG_MTD_NAND_AR934X=y CONFIG_MTD_NAND_CORE=y CONFIG_MTD_NAND_ECC=y @@ -35,8 +36,6 @@ CONFIG_NET_DSA=y CONFIG_NET_SWITCHDEV=y # CONFIG_NVMEM_LAYOUT_MIKROTIK is not set CONFIG_PHYLINK=y -CONFIG_PHY_AR7100_USB=y -CONFIG_PHY_AR7200_USB=y CONFIG_REGULATOR_FIXED_VOLTAGE=y CONFIG_SGL_ALLOC=y CONFIG_SPI_RB4XX=y diff --git a/target/linux/ath79/nand/base-files/etc/board.d/05_compat-version b/target/linux/ath79/nand/base-files/etc/board.d/05_compat-version index 238927aa7b..4d826d978d 100644 --- a/target/linux/ath79/nand/base-files/etc/board.d/05_compat-version +++ b/target/linux/ath79/nand/base-files/etc/board.d/05_compat-version @@ -4,6 +4,7 @@ board_config_update case "$(board_name)" in + linksys,ea4500-v3|\ netgear,wndr4300-v2|\ netgear,wndr4500-v3) ucidef_set_compat_version "1.1" diff --git a/target/linux/ath79/nand/config-default b/target/linux/ath79/nand/config-default index dd47d2a3ea..71ce1caad7 100644 --- a/target/linux/ath79/nand/config-default +++ b/target/linux/ath79/nand/config-default @@ -18,7 +18,6 @@ CONFIG_MTD_UBI_BEB_LIMIT=20 CONFIG_MTD_UBI_BLOCK=y CONFIG_MTD_UBI_WL_THRESHOLD=4096 # CONFIG_PCI_AR71XX is not set -CONFIG_PHY_AR7200_USB=y CONFIG_POWER_RESET=y CONFIG_POWER_RESET_GPIO_RESTART=y CONFIG_SGL_ALLOC=y diff --git a/target/linux/ath79/patches-6.6/317-MIPS-pci-ar724x-clear-power-down-of-pll-on-AR934x.patch b/target/linux/ath79/patches-6.6/317-MIPS-pci-ar724x-clear-power-down-of-pll-on-AR934x.patch new file mode 100644 index 0000000000..dfb7e483a7 --- /dev/null +++ b/target/linux/ath79/patches-6.6/317-MIPS-pci-ar724x-clear-power-down-of-pll-on-AR934x.patch @@ -0,0 +1,34 @@ +From f2ca10b22ace3ce53b4e3f189bf1dd53a4482475 Mon Sep 17 00:00:00 2001 +From: INAGAKI Hiroshi <musashino.open@gmail.com> +Date: Fri, 26 Apr 2024 23:53:58 +0900 +Subject: [PATCH 1/2] MIPS: pci-ar724x: clear power down of pll on AR934x + +Fix PCIe initialization on AR934x by clearing PLL_PWD bit in addition to +PPL_RESET bit of AR724x. + +Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com> +--- + +--- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h ++++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h +@@ -347,6 +347,8 @@ + #define AR934X_PLL_CPU_DDR_CLK_CTRL_DDRCLK_FROM_DDRPLL BIT(21) + #define AR934X_PLL_CPU_DDR_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24) + ++#define AR934X_PLL_PCIE_CONFIG_PLL_PWD BIT(30) ++ + #define AR934X_PLL_SWITCH_CLOCK_CONTROL_MDIO_CLK_SEL BIT(6) + + #define QCA953X_PLL_CPU_CONFIG_REG 0x00 +--- a/arch/mips/pci/pci-ar724x.c ++++ b/arch/mips/pci/pci-ar724x.c +@@ -360,7 +360,8 @@ static void ar724x_pci_hw_init(struct ar + } else { + /* remove the reset of the PCIE PLL */ + ppl = ath79_pll_rr(AR724X_PLL_REG_PCIE_CONFIG); +- ppl &= ~AR724X_PLL_REG_PCIE_CONFIG_PPL_RESET; ++ ppl &= ~(AR934X_PLL_PCIE_CONFIG_PLL_PWD | ++ AR724X_PLL_REG_PCIE_CONFIG_PPL_RESET); + ath79_pll_wr(AR724X_PLL_REG_PCIE_CONFIG, ppl); + + /* deassert bypass for the PCIE PLL */ diff --git a/target/linux/ath79/patches-6.6/318-MIPS-pci-ar724x-deassert-the-reset-of-PCIe-endpoint.patch b/target/linux/ath79/patches-6.6/318-MIPS-pci-ar724x-deassert-the-reset-of-PCIe-endpoint.patch new file mode 100644 index 0000000000..c906bdbbb6 --- /dev/null +++ b/target/linux/ath79/patches-6.6/318-MIPS-pci-ar724x-deassert-the-reset-of-PCIe-endpoint.patch @@ -0,0 +1,41 @@ +From 859c93981a8994ffa69967b44b247d2e7d6a01f1 Mon Sep 17 00:00:00 2001 +From: INAGAKI Hiroshi <musashino.open@gmail.com> +Date: Fri, 26 Apr 2024 23:54:57 +0900 +Subject: [PATCH 2/2] MIPS: pci-ar724x: deassert the reset of PCIe endpoint + +Fix PCIe initialization by de-assertion of PCIe endpoint reset. + +Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com> +--- + +--- a/arch/mips/pci/pci-ar724x.c ++++ b/arch/mips/pci/pci-ar724x.c +@@ -25,6 +25,7 @@ + + #define AR724X_PCI_APP_LTSSM_ENABLE BIT(0) + ++#define AR724X_PCI_RESET_EP_RESET_L BIT(2) + #define AR724X_PCI_RESET_LINK_UP BIT(0) + + #define AR724X_PCI_INT_DEV0 BIT(14) +@@ -340,7 +341,7 @@ static void ar724x_pci_irq_init(struct a + + static void ar724x_pci_hw_init(struct ar724x_pci_controller *apc) + { +- u32 ppl, app; ++ u32 ppl, rst, app; + int wait = 0; + + /* deassert PCIe host controller and PCIe PHY reset */ +@@ -370,6 +371,11 @@ static void ar724x_pci_hw_init(struct ar + ath79_pll_wr(AR724X_PLL_REG_PCIE_CONFIG, ppl); + } + ++ /* deassert the reset state of the PCIE endpoint */ ++ rst = __raw_readl(apc->ctrl_base + AR724X_PCI_REG_RESET); ++ rst |= AR724X_PCI_RESET_EP_RESET_L; ++ __raw_writel(rst, apc->ctrl_base + AR724X_PCI_REG_RESET); ++ + /* set PCIE Application Control to ready */ + app = __raw_readl(apc->ctrl_base + AR724X_PCI_REG_APP); + app |= AR724X_PCI_APP_LTSSM_ENABLE; diff --git a/target/linux/ath79/patches-6.6/330-missing-registers.patch b/target/linux/ath79/patches-6.6/330-missing-registers.patch index 74789437ec..d05e741c7e 100644 --- a/target/linux/ath79/patches-6.6/330-missing-registers.patch +++ b/target/linux/ath79/patches-6.6/330-missing-registers.patch @@ -7,7 +7,7 @@ Subject: [PATCH] ath79: gmac: add parsers for rxd(v)- and tx(d|en)-delay for --- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h +++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -@@ -1231,6 +1231,10 @@ +@@ -1233,6 +1233,10 @@ #define AR934X_ETH_CFG_RDV_DELAY BIT(16) #define AR934X_ETH_CFG_RDV_DELAY_MASK 0x3 #define AR934X_ETH_CFG_RDV_DELAY_SHIFT 16 diff --git a/target/linux/ath79/patches-6.6/331-MIPS-ath79-add-missing-QCA955x-GMAC-registers.patch b/target/linux/ath79/patches-6.6/331-MIPS-ath79-add-missing-QCA955x-GMAC-registers.patch index c2f228dfe1..5d9c77c69f 100644 --- a/target/linux/ath79/patches-6.6/331-MIPS-ath79-add-missing-QCA955x-GMAC-registers.patch +++ b/target/linux/ath79/patches-6.6/331-MIPS-ath79-add-missing-QCA955x-GMAC-registers.patch @@ -16,7 +16,7 @@ Signed-off-by: David Bauer <mail@david-bauer.net> --- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h +++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -@@ -1251,7 +1251,12 @@ +@@ -1253,7 +1253,12 @@ */ #define QCA955X_GMAC_REG_ETH_CFG 0x00 @@ -29,7 +29,7 @@ Signed-off-by: David Bauer <mail@david-bauer.net> #define QCA955X_ETH_CFG_RGMII_EN BIT(0) #define QCA955X_ETH_CFG_MII_GE0 BIT(1) -@@ -1273,9 +1278,58 @@ +@@ -1275,9 +1280,58 @@ #define QCA955X_ETH_CFG_TXE_DELAY_MASK 0x3 #define QCA955X_ETH_CFG_TXE_DELAY_SHIFT 20 diff --git a/target/linux/ath79/patches-6.6/332-ath79-sgmii-config.patch b/target/linux/ath79/patches-6.6/332-ath79-sgmii-config.patch index a6a50e4a8a..6f6217ce75 100644 --- a/target/linux/ath79/patches-6.6/332-ath79-sgmii-config.patch +++ b/target/linux/ath79/patches-6.6/332-ath79-sgmii-config.patch @@ -21,7 +21,7 @@ Submitted-by: David Bauer <mail@david-bauer.net> --- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h +++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -@@ -1380,5 +1380,6 @@ +@@ -1382,5 +1382,6 @@ #define QCA956X_SGMII_CONFIG_MODE_CTRL_SHIFT 0 #define QCA956X_SGMII_CONFIG_MODE_CTRL_MASK 0x7 diff --git a/target/linux/ath79/patches-6.6/340-register_gpio_driver_earlier.patch b/target/linux/ath79/patches-6.6/340-register_gpio_driver_earlier.patch new file mode 100644 index 0000000000..a3bdf890c4 --- /dev/null +++ b/target/linux/ath79/patches-6.6/340-register_gpio_driver_earlier.patch @@ -0,0 +1,26 @@ +From: John Crispin <john@phrozen.org> +Subject: ath79: Register GPIO driver earlier + +HACK: register the GPIO driver earlier to ensure that gpio_request calls +from mach files succeed. + +Submitted-by: John Crispin <john@phrozen.org> +--- + drivers/gpio/gpio-ath79.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +--- a/drivers/gpio/gpio-ath79.c ++++ b/drivers/gpio/gpio-ath79.c +@@ -300,7 +300,11 @@ static struct platform_driver ath79_gpio + .probe = ath79_gpio_probe, + }; + +-module_platform_driver(ath79_gpio_driver); ++static int __init ath79_gpio_init(void) ++{ ++ return platform_driver_register(&ath79_gpio_driver); ++} ++postcore_initcall(ath79_gpio_init); + + MODULE_DESCRIPTION("Atheros AR71XX/AR724X/AR913X GPIO API support"); + MODULE_LICENSE("GPL v2"); diff --git a/target/linux/ath79/patches-6.6/360-MIPS-ath79-export-UART1-reference-clock.patch b/target/linux/ath79/patches-6.6/360-MIPS-ath79-export-UART1-reference-clock.patch index b24ff21692..ae2f5aa0cd 100644 --- a/target/linux/ath79/patches-6.6/360-MIPS-ath79-export-UART1-reference-clock.patch +++ b/target/linux/ath79/patches-6.6/360-MIPS-ath79-export-UART1-reference-clock.patch @@ -45,8 +45,8 @@ Submitted-by: Daniel Golle <daniel@makrotopia.org> goto err_iounmap; --- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h +++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -@@ -348,6 +348,7 @@ - #define AR934X_PLL_CPU_DDR_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24) +@@ -350,6 +350,7 @@ + #define AR934X_PLL_PCIE_CONFIG_PLL_PWD BIT(30) #define AR934X_PLL_SWITCH_CLOCK_CONTROL_MDIO_CLK_SEL BIT(6) +#define AR934X_PLL_SWITCH_CLOCK_CONTROL_UART1_CLK_SEL BIT(7) diff --git a/target/linux/ath79/patches-6.6/430-mtd-ar934x-nand-driver.patch b/target/linux/ath79/patches-6.6/430-mtd-ar934x-nand-driver.patch index 603750cbe9..fc4c3804a7 100644 --- a/target/linux/ath79/patches-6.6/430-mtd-ar934x-nand-driver.patch +++ b/target/linux/ath79/patches-6.6/430-mtd-ar934x-nand-driver.patch @@ -9,7 +9,7 @@ SVN-Revision: 33385 --- a/drivers/mtd/nand/raw/Kconfig +++ b/drivers/mtd/nand/raw/Kconfig -@@ -543,4 +543,12 @@ config MTD_NAND_DISKONCHIP_BBTWRITE +@@ -542,4 +542,12 @@ config MTD_NAND_DISKONCHIP_BBTWRITE load time (assuming you build diskonchip as a module) with the module parameter "inftl_bbt_write=1". diff --git a/target/linux/ath79/patches-6.6/700-phy-add-ath79-usb-phys.patch b/target/linux/ath79/patches-6.6/700-phy-add-ath79-usb-phys.patch index 0a9de68a39..98c399c9e0 100644 --- a/target/linux/ath79/patches-6.6/700-phy-add-ath79-usb-phys.patch +++ b/target/linux/ath79/patches-6.6/700-phy-add-ath79-usb-phys.patch @@ -51,7 +51,7 @@ Signed-off-by: John Crispin <john@phrozen.org> obj-$(CONFIG_PHY_LPC18XX_USB_OTG) += phy-lpc18xx-usb-otg.o --- /dev/null +++ b/drivers/phy/phy-ar7100-usb.c -@@ -0,0 +1,140 @@ +@@ -0,0 +1,127 @@ +/* + * Copyright (C) 2018 John Crispin <john@phrozen.org> + * @@ -118,50 +118,38 @@ Signed-off-by: John Crispin <john@phrozen.org> +static int ar7100_usb_phy_probe(struct platform_device *pdev) +{ + struct phy_provider *phy_provider; -+ struct resource *res; + struct ar7100_usb_phy *priv; + + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + -+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ priv->io_base = devm_ioremap_resource(&pdev->dev, res); ++ priv->io_base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(priv->io_base)) + return PTR_ERR(priv->io_base); + + priv->rst_phy = devm_reset_control_get(&pdev->dev, "usb-phy"); -+ if (IS_ERR(priv->rst_phy)) { -+ dev_err(&pdev->dev, "phy reset is missing\n"); -+ return PTR_ERR(priv->rst_phy); -+ } ++ if (IS_ERR(priv->rst_phy)) ++ return dev_err_probe(&pdev->dev, PTR_ERR(priv->rst_phy), "phy reset is missing"); + + priv->rst_host = devm_reset_control_get(&pdev->dev, "usb-host"); -+ if (IS_ERR(priv->rst_host)) { -+ dev_err(&pdev->dev, "host reset is missing\n"); -+ return PTR_ERR(priv->rst_host); -+ } ++ if (IS_ERR(priv->rst_host)) ++ return dev_err_probe(&pdev->dev, PTR_ERR(priv->rst_host), "host reset is missing"); + + priv->rst_ohci_dll = devm_reset_control_get(&pdev->dev, "usb-ohci-dll"); -+ if (IS_ERR(priv->rst_ohci_dll)) { -+ dev_err(&pdev->dev, "ohci-dll reset is missing\n"); -+ return PTR_ERR(priv->rst_host); -+ } ++ if (IS_ERR(priv->rst_ohci_dll)) ++ return dev_err_probe(&pdev->dev, PTR_ERR(priv->rst_host), "ohci-dll reset is missing"); + + priv->phy = devm_phy_create(&pdev->dev, NULL, &ar7100_usb_phy_ops); -+ if (IS_ERR(priv->phy)) { -+ dev_err(&pdev->dev, "failed to create PHY\n"); -+ return PTR_ERR(priv->phy); -+ } ++ if (IS_ERR(priv->phy)) ++ return dev_err_probe(&pdev->dev, PTR_ERR(priv->phy), "failed to create PHY"); + + priv->gpio = of_get_named_gpio(pdev->dev.of_node, "gpios", 0); + if (gpio_is_valid(priv->gpio)) { + int ret = devm_gpio_request(&pdev->dev, priv->gpio, dev_name(&pdev->dev)); ++ if (ret) ++ return dev_err_probe(&pdev->dev, ret, "failed to request gpio"); + -+ if (ret) { -+ dev_err(&pdev->dev, "failed to request gpio\n"); -+ return ret; -+ } + gpio_export_with_name(gpio_to_desc(priv->gpio), 0, dev_name(&pdev->dev)); + gpio_set_value(priv->gpio, 1); + } @@ -170,7 +158,6 @@ Signed-off-by: John Crispin <john@phrozen.org> + + phy_provider = devm_of_phy_provider_register(&pdev->dev, of_phy_simple_xlate); + -+ + return PTR_ERR_OR_ZERO(phy_provider); +} + @@ -194,7 +181,7 @@ Signed-off-by: John Crispin <john@phrozen.org> +MODULE_LICENSE("GPL"); --- /dev/null +++ b/drivers/phy/phy-ar7200-usb.c -@@ -0,0 +1,136 @@ +@@ -0,0 +1,120 @@ +/* + * Copyright (C) 2015 Alban Bedel <albeu@free.fr> + * @@ -264,44 +251,28 @@ Signed-off-by: John Crispin <john@phrozen.org> + return -ENOMEM; + + priv->rst_phy = devm_reset_control_get(&pdev->dev, "usb-phy"); -+ if (IS_ERR(priv->rst_phy)) { -+ if (PTR_ERR(priv->rst_phy) != -EPROBE_DEFER) -+ dev_err(&pdev->dev, "phy reset is missing\n"); -+ return PTR_ERR(priv->rst_phy); -+ } ++ if (IS_ERR(priv->rst_phy)) ++ return dev_err_probe(&pdev->dev, PTR_ERR(priv->rst_phy), "phy reset is missing"); + + priv->rst_phy_analog = devm_reset_control_get_optional( + &pdev->dev, "usb-phy-analog"); -+ if (IS_ERR(priv->rst_phy_analog)) { -+ if (PTR_ERR(priv->rst_phy_analog) == -ENOENT) -+ priv->rst_phy_analog = NULL; -+ else -+ return PTR_ERR(priv->rst_phy_analog); -+ } ++ if (IS_ERR(priv->rst_phy_analog)) ++ return PTR_ERR(priv->rst_phy_analog); + + priv->suspend_override = devm_reset_control_get_optional( + &pdev->dev, "usb-suspend-override"); -+ if (IS_ERR(priv->suspend_override)) { -+ if (PTR_ERR(priv->suspend_override) == -ENOENT) -+ priv->suspend_override = NULL; -+ else -+ return PTR_ERR(priv->suspend_override); -+ } ++ if (IS_ERR(priv->suspend_override)) ++ return PTR_ERR(priv->suspend_override); + + priv->phy = devm_phy_create(&pdev->dev, NULL, &ar7200_usb_phy_ops); -+ if (IS_ERR(priv->phy)) { -+ dev_err(&pdev->dev, "failed to create PHY\n"); -+ return PTR_ERR(priv->phy); -+ } ++ if (IS_ERR(priv->phy)) ++ return dev_err_probe(&pdev->dev, PTR_ERR(priv->phy), "failed to create PHY"); + + priv->gpio = of_get_named_gpio(pdev->dev.of_node, "gpios", 0); + if (gpio_is_valid(priv->gpio)) { + int ret = devm_gpio_request(&pdev->dev, priv->gpio, dev_name(&pdev->dev)); -+ -+ if (ret) { -+ dev_err(&pdev->dev, "failed to request gpio\n"); -+ return ret; -+ } ++ if (ret) ++ return dev_err_probe(&pdev->dev, ret, "failed to request gpio"); + gpio_export_with_name(gpio_to_desc(priv->gpio), 0, dev_name(&pdev->dev)); + gpio_set_value(priv->gpio, 1); + } diff --git a/target/linux/ath79/patches-6.6/710-net-use-downstream-ag71xx.patch b/target/linux/ath79/patches-6.6/710-net-use-downstream-ag71xx.patch index 54e64fb11c..0997aa1ab8 100644 --- a/target/linux/ath79/patches-6.6/710-net-use-downstream-ag71xx.patch +++ b/target/linux/ath79/patches-6.6/710-net-use-downstream-ag71xx.patch @@ -13,30 +13,22 @@ Submitted-by: John Crispin <john@phrozen.org> --- a/drivers/net/ethernet/atheros/Kconfig +++ b/drivers/net/ethernet/atheros/Kconfig -@@ -17,14 +17,7 @@ config NET_VENDOR_ATHEROS +@@ -26,6 +26,8 @@ config AG71XX + If you wish to compile a kernel for AR7XXX/91XXX and enable + ethernet support, then you should always answer Y to this. - if NET_VENDOR_ATHEROS - --config AG71XX -- tristate "Atheros AR7XXX/AR9XXX built-in ethernet mac support" -- depends on ATH79 -- select PHYLINK -- imply NET_SELFTESTS -- help -- If you wish to compile a kernel for AR7XXX/91XXX and enable -- ethernet support, then you should always answer Y to this. +source "drivers/net/ethernet/atheros/ag71xx/Kconfig" - ++ config ATL2 tristate "Atheros L2 Fast Ethernet support" + depends on PCI --- a/drivers/net/ethernet/atheros/Makefile +++ b/drivers/net/ethernet/atheros/Makefile -@@ -3,7 +3,7 @@ - # Makefile for the Atheros network device drivers. +@@ -4,6 +4,7 @@ # --obj-$(CONFIG_AG71XX) += ag71xx.o -+obj-$(CONFIG_AG71XX) += ag71xx/ + obj-$(CONFIG_AG71XX) += ag71xx.o ++obj-$(CONFIG_AG71XX_LEGACY) += ag71xx/ obj-$(CONFIG_ATL1) += atlx/ obj-$(CONFIG_ATL2) += atlx/ obj-$(CONFIG_ATL1E) += atl1e/ diff --git a/target/linux/ath79/patches-6.6/730-ar8216-make-reg-access-atomic.patch b/target/linux/ath79/patches-6.6/730-ar8216-make-reg-access-atomic.patch index 02f763534e..16d9005699 100644 --- a/target/linux/ath79/patches-6.6/730-ar8216-make-reg-access-atomic.patch +++ b/target/linux/ath79/patches-6.6/730-ar8216-make-reg-access-atomic.patch @@ -14,7 +14,7 @@ with interrupts used. --- --- a/drivers/net/phy/ar8216.c +++ b/drivers/net/phy/ar8216.c -@@ -252,6 +252,7 @@ ar8xxx_mii_write32(struct ar8xxx_priv *p +@@ -251,6 +251,7 @@ ar8xxx_mii_write32(struct ar8xxx_priv *p u32 ar8xxx_read(struct ar8xxx_priv *priv, int reg) { @@ -22,7 +22,7 @@ with interrupts used. struct mii_bus *bus = priv->mii_bus; u16 r1, r2, page; u32 val; -@@ -259,11 +260,13 @@ ar8xxx_read(struct ar8xxx_priv *priv, in +@@ -258,11 +259,13 @@ ar8xxx_read(struct ar8xxx_priv *priv, in split_addr((u32) reg, &r1, &r2, &page); mutex_lock(&bus->mdio_lock); @@ -36,7 +36,7 @@ with interrupts used. mutex_unlock(&bus->mdio_lock); return val; -@@ -272,17 +275,20 @@ ar8xxx_read(struct ar8xxx_priv *priv, in +@@ -271,17 +274,20 @@ ar8xxx_read(struct ar8xxx_priv *priv, in void ar8xxx_write(struct ar8xxx_priv *priv, int reg, u32 val) { diff --git a/target/linux/ath79/patches-6.6/810-ath79-ignore-the-abused-interrupt-map-on-pcie-node.patch b/target/linux/ath79/patches-6.6/810-ath79-ignore-the-abused-interrupt-map-on-pcie-node.patch index 980c265fe6..330c0d139b 100644 --- a/target/linux/ath79/patches-6.6/810-ath79-ignore-the-abused-interrupt-map-on-pcie-node.patch +++ b/target/linux/ath79/patches-6.6/810-ath79-ignore-the-abused-interrupt-map-on-pcie-node.patch @@ -22,7 +22,7 @@ Signed-off-by: Shiji Yang <yangshiji66@outlook.com> --- a/drivers/of/irq.c +++ b/drivers/of/irq.c -@@ -86,6 +86,8 @@ EXPORT_SYMBOL_GPL(of_irq_find_parent); +@@ -89,6 +89,8 @@ EXPORT_SYMBOL_GPL(of_irq_find_parent); * drawing board. */ static const char * const of_irq_imap_abusers[] = { diff --git a/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch b/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch index 49a65ec622..c5b01b7dad 100644 --- a/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch +++ b/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch @@ -259,7 +259,7 @@ SVN-Revision: 35130 #include <linux/uaccess.h> #include <linux/ipv6.h> #include <linux/icmpv6.h> -@@ -897,10 +898,10 @@ static void tcp_v6_send_response(const s +@@ -893,10 +894,10 @@ static void tcp_v6_send_response(const s topt = (__be32 *)(t1 + 1); if (tsecr) { @@ -350,7 +350,7 @@ SVN-Revision: 35130 list_for_each_entry(p, head, list) { --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c -@@ -620,48 +620,53 @@ static void tcp_options_write(struct tcp +@@ -622,48 +622,53 @@ static void tcp_options_write(struct tcp u16 options = opts->options; /* mungable copy */ if (unlikely(OPTION_MD5 & options)) { @@ -427,7 +427,7 @@ SVN-Revision: 35130 } if (unlikely(opts->num_sack_blocks)) { -@@ -669,16 +674,17 @@ static void tcp_options_write(struct tcp +@@ -671,16 +676,17 @@ static void tcp_options_write(struct tcp tp->duplicate_sack : tp->selective_acks; int this_sack; @@ -451,7 +451,7 @@ SVN-Revision: 35130 } tp->rx_opt.dsack = 0; -@@ -691,13 +697,14 @@ static void tcp_options_write(struct tcp +@@ -693,13 +699,14 @@ static void tcp_options_write(struct tcp if (foc->exp) { len = TCPOLEN_EXP_FASTOPEN_BASE + foc->len; @@ -751,7 +751,7 @@ SVN-Revision: 35130 EXPORT_SYMBOL(xfrm_parse_spi); --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c -@@ -4188,14 +4188,16 @@ static bool tcp_parse_aligned_timestamp( +@@ -4262,14 +4262,16 @@ static bool tcp_parse_aligned_timestamp( { const __be32 *ptr = (const __be32 *)(th + 1); @@ -867,7 +867,7 @@ SVN-Revision: 35130 iph->daddr == iph2->daddr && iph->saddr == iph2->saddr) return segs; -@@ -255,7 +255,7 @@ struct sk_buff *tcp_gro_lookup(struct li +@@ -264,7 +264,7 @@ struct sk_buff *tcp_gro_lookup(struct li continue; th2 = tcp_hdr(p); @@ -876,7 +876,7 @@ SVN-Revision: 35130 NAPI_GRO_CB(p)->same_flow = 0; continue; } -@@ -321,8 +321,8 @@ struct sk_buff *tcp_gro_receive(struct l +@@ -330,8 +330,8 @@ struct sk_buff *tcp_gro_receive(struct l ~(TCP_FLAG_CWR | TCP_FLAG_FIN | TCP_FLAG_PSH)); flush |= (__force int)(th->ack_seq ^ th2->ack_seq); for (i = sizeof(*th); i < thlen; i += 4) diff --git a/target/linux/ath79/patches-6.6/910-mikrotik-rb4xx.patch b/target/linux/ath79/patches-6.6/910-mikrotik-rb4xx.patch index 980f29eef1..674cc2fe66 100644 --- a/target/linux/ath79/patches-6.6/910-mikrotik-rb4xx.patch +++ b/target/linux/ath79/patches-6.6/910-mikrotik-rb4xx.patch @@ -97,7 +97,7 @@ Submitted-by: Christopher Hill <ch6574@gmail.com> obj-$(CONFIG_GPIO_RDA) += gpio-rda.o --- a/drivers/mtd/nand/raw/Kconfig +++ b/drivers/mtd/nand/raw/Kconfig -@@ -551,4 +551,11 @@ config MTD_NAND_AR934X +@@ -550,4 +550,11 @@ config MTD_NAND_AR934X Enables support for NAND controller on Qualcomm Atheros SoCs. This controller is found on AR934x and QCA955x SoCs. diff --git a/target/linux/ath79/patches-6.6/911-mikrotik-rb91x.patch b/target/linux/ath79/patches-6.6/911-mikrotik-rb91x.patch index e610a4ff14..ddb7b52cbe 100644 --- a/target/linux/ath79/patches-6.6/911-mikrotik-rb91x.patch +++ b/target/linux/ath79/patches-6.6/911-mikrotik-rb91x.patch @@ -73,7 +73,7 @@ Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com> obj-$(CONFIG_GPIO_RDA) += gpio-rda.o --- a/drivers/mtd/nand/raw/Kconfig +++ b/drivers/mtd/nand/raw/Kconfig -@@ -558,4 +558,10 @@ config MTD_NAND_RB4XX +@@ -557,4 +557,10 @@ config MTD_NAND_RB4XX Enables support for the NAND flash chip on Mikrotik Routerboard RB4xx series. diff --git a/target/linux/ath79/tiny/base-files/etc/board.d/02_network b/target/linux/ath79/tiny/base-files/etc/board.d/02_network index fa2ea3aa6f..a204e820ca 100644 --- a/target/linux/ath79/tiny/base-files/etc/board.d/02_network +++ b/target/linux/ath79/tiny/base-files/etc/board.d/02_network @@ -69,6 +69,13 @@ ath79_setup_interfaces() ucidef_add_switch "switch0" \ "0@eth1" "4:lan:1" ;; + nec,wg600hp|\ + nec,wr8750n|\ + nec,wr9500n|\ + tplink,tl-wr941n-v7-cn) + ucidef_add_switch "switch0" \ + "0@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan" + ;; tplink,tl-mr3220-v1|\ tplink,tl-mr3420-v1|\ tplink,tl-mr3420-v3|\ @@ -105,10 +112,6 @@ ath79_setup_interfaces() tplink,tl-wr941-v2) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan" ;; - tplink,tl-wr941n-v7-cn) - ucidef_add_switch "switch0" \ - "0@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan" - ;; ubnt,airrouter) ucidef_set_interface_wan "eth1" ucidef_add_switch "switch0" \ @@ -152,6 +155,12 @@ ath79_setup_macs() ubnt,picostation-m) label_mac=$(cat /sys/class/ieee80211/phy0/macaddress) ;; + nec,wg600hp|\ + nec,wr8750n|\ + nec,wr9500n) + wan_mac=$(mtd_get_mac_binary config 0xc) + label_mac=$wan_mac + ;; tplink,tl-wr941-v2|\ tplink,tl-wr941n-v7-cn) base_mac=$(mtd_get_mac_binary u-boot 0x1fc00) diff --git a/target/linux/ath79/tiny/base-files/lib/upgrade/platform.sh b/target/linux/ath79/tiny/base-files/lib/upgrade/platform.sh index eb8441c6d2..8fc0efcfbd 100644 --- a/target/linux/ath79/tiny/base-files/lib/upgrade/platform.sh +++ b/target/linux/ath79/tiny/base-files/lib/upgrade/platform.sh @@ -9,7 +9,23 @@ RAMFS_COPY_BIN='fw_setenv' RAMFS_COPY_DATA='/etc/fw_env.config' platform_check_image() { - return 0 + local board=$(board_name) + + case "$board" in + nec,wg600hp|\ + nec,wr8750n|\ + nec,wr9500n) + local uboot_mtd=$(find_mtd_part "bootloader") + + # check "U-Boot <year>.<month>" string in the "bootloader" partition + if ! grep -q "U-Boot [0-9]\{4\}\.[0-9]\{2\}" $uboot_mtd; then + v "The bootloader doesn't seem to be replaced to U-Boot!" + return 1 + fi + ;; + *) + return 0 + esac } platform_do_upgrade() { diff --git a/target/linux/ath79/tiny/config-default b/target/linux/ath79/tiny/config-default index c738309ce4..e47260df82 100644 --- a/target/linux/ath79/tiny/config-default +++ b/target/linux/ath79/tiny/config-default @@ -8,6 +8,4 @@ CONFIG_NET_SWITCHDEV=y CONFIG_NVMEM_SYSFS=y CONFIG_NVMEM_U_BOOT_ENV=y CONFIG_PHYLINK=y -CONFIG_PHY_AR7100_USB=y -CONFIG_PHY_AR7200_USB=y CONFIG_REGULATOR_FIXED_VOLTAGE=y |