diff options
author | Wenli Looi <wlooi@ucalgary.ca> | 2022-11-22 18:34:37 +0000 |
---|---|---|
committer | Hauke Mehrtens <hauke@hauke-m.de> | 2023-01-25 00:42:52 +0100 |
commit | f0eb73a888e2ed980b0943d4a2e4d19ad0af183a (patch) | |
tree | 6274bf1941220e5f2415cdb78122f6b62f866afb | |
parent | f0e4595188db797446f7b3d29a6162ede90586a6 (diff) | |
download | upstream-f0eb73a888e2ed980b0943d4a2e4d19ad0af183a.tar.gz upstream-f0eb73a888e2ed980b0943d4a2e4d19ad0af183a.tar.bz2 upstream-f0eb73a888e2ed980b0943d4a2e4d19ad0af183a.zip |
ath79: consolidate Netgear EX7300 series images
This change consolidates Netgear EX7300 series devices into two images
corresponding to devices that share the same manufacturer firmware
image. Similar to the manufacturer firmware, the actual device model is
detected at runtime. The logic is taken from the netgear GPL dumps in a
file called generate_board_conf.sh.
Hardware details for EX7300 v2 variants
---------------------------------------
SoC: QCN5502
Flash: 16 MiB
RAM: 128 MiB
Ethernet: 1 gigabit port
Wireless 2.4GHz (currently unsupported due to lack of ath9k support):
- EX6250 / EX6400 v2 / EX6410 / EX6420: QCN5502 3x3
- EX7300 v2 / EX7320: QCN5502 4x4
Wireless 5GHz:
- EX6250: QCA9986 3x3 (detected by ath10k as QCA9984 3x3)
- EX6400 v2 / EX6410 / EX6420 / EX7300 v2 / EX7320: QCA9984 4x4
Signed-off-by: Wenli Looi <wlooi@ucalgary.ca>
8 files changed, 282 insertions, 252 deletions
diff --git a/package/boot/uboot-envtools/files/ath79 b/package/boot/uboot-envtools/files/ath79 index cd94be66de..71dd104f55 100644 --- a/package/boot/uboot-envtools/files/ath79 +++ b/package/boot/uboot-envtools/files/ath79 @@ -42,7 +42,6 @@ etactica,eg200|\ glinet,gl-ar750s-nor|\ glinet,gl-ar750s-nor-nand|\ librerouter,librerouter-v1|\ -netgear,ex6400|\ netgear,ex7300|\ netgear,ex7300-v2|\ netgear,wndr4300-v2|\ diff --git a/target/linux/ath79/dts/qca9558_netgear_ex6400.dts b/target/linux/ath79/dts/qca9558_netgear_ex6400.dts deleted file mode 100644 index 273c872b6d..0000000000 --- a/target/linux/ath79/dts/qca9558_netgear_ex6400.dts +++ /dev/null @@ -1,8 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT - -#include "qca9558_netgear_ex7300.dtsi" - -/ { - model = "Netgear EX6400"; - compatible = "netgear,ex6400", "qca,qca9558"; -}; diff --git a/target/linux/ath79/dts/qca9558_netgear_ex7300.dts b/target/linux/ath79/dts/qca9558_netgear_ex7300.dts index 9802210b32..fc0b6de96c 100644 --- a/target/linux/ath79/dts/qca9558_netgear_ex7300.dts +++ b/target/linux/ath79/dts/qca9558_netgear_ex7300.dts @@ -1,8 +1,227 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -#include "qca9558_netgear_ex7300.dtsi" +#include "qca955x.dtsi" + +#include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/input/input.h> / { model = "Netgear EX7300"; compatible = "netgear,ex7300", "qca,qca9558"; + + aliases { + led-boot = &led_power_green; + led-failsafe = &led_power_amber; + led-running = &led_power_green; + led-upgrade = &led_power_amber; + label-mac-device = ð0; + }; + + led_spi { + compatible = "spi-gpio"; + #address-cells = <1>; + #size-cells = <0>; + + sck-gpios = <&gpio 18 GPIO_ACTIVE_HIGH>; + mosi-gpios = <&gpio 15 GPIO_ACTIVE_HIGH>; + num-chipselects = <0>; + + led_gpio: led_gpio@0 { + compatible = "nxp,74lvc594"; + reg = <0>; + gpio-controller; + #gpio-cells = <2>; + registers-number = <1>; + spi-max-frequency = <500000>; + + gpio_latch_bit { + gpio-hog; + gpios = <4 GPIO_ACTIVE_HIGH>; + output-high; + line-name = "gpio-latch-bit"; + }; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_power_green: power_green { + label = "green:power"; + gpios = <&gpio 19 GPIO_ACTIVE_LOW>; + }; + + led_power_amber: power_amber { + label = "amber:power"; + gpios = <&gpio 20 GPIO_ACTIVE_LOW>; + }; + + left_blue { + label = "blue:left"; + gpios = <&led_gpio 7 GPIO_ACTIVE_LOW>; + }; + + right_blue { + label = "blue:right"; + gpios = <&led_gpio 6 GPIO_ACTIVE_LOW>; + }; + + wps_green { + label = "green:wps"; + gpios = <&led_gpio 5 GPIO_ACTIVE_LOW>; + }; + + client_red { + label = "red:client"; + gpios = <&led_gpio 3 GPIO_ACTIVE_LOW>; + }; + + client_green { + label = "green:client"; + gpios = <&led_gpio 2 GPIO_ACTIVE_LOW>; + }; + + router_red { + label = "red:router"; + gpios = <&led_gpio 1 GPIO_ACTIVE_LOW>; + }; + + router_green { + label = "green:router"; + gpios = <&led_gpio 0 GPIO_ACTIVE_LOW>; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "Reset button"; + linux,code = <KEY_RESTART>; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + + wps { + label = "WPS button"; + linux,code = <KEY_WPS_BUTTON>; + gpios = <&gpio 22 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + + extender_apmode { + label = "EXTENDER/APMODE switch"; + gpios = <&gpio 23 GPIO_ACTIVE_LOW>; + linux,code = <BTN_0>; + linux,input-type = <EV_SW>; + debounce-interval = <60>; + }; + }; +}; + +&pcie0 { + status = "okay"; +}; + +&spi { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + uboot: partition@0 { + label = "u-boot"; + reg = <0x000000 0x040000>; + read-only; + }; + + partition@40000 { + label = "u-boot-env"; + reg = <0x040000 0x010000>; + }; + + caldata: partition@50000 { + label = "caldata"; + reg = <0x050000 0x010000>; + read-only; + }; + + partition@60000 { + label = "caldata-backup"; + reg = <0x060000 0x010000>; + read-only; + }; + + partition@70000 { + label = "config"; + reg = <0x070000 0x010000>; + }; + + partition@80000 { + label = "pot"; + reg = <0x080000 0x010000>; + }; + + partition@90000 { + label = "firmware"; + reg = <0x090000 0xf30000>; + compatible = "denx,uimage"; + }; + + partition@fc0000 { + label = "language"; + reg = <0xfc0000 0x040000>; + }; + }; + }; +}; + +&wmac { + status = "okay"; + + mtd-cal-data = <&caldata 0x1000>; + nvmem-cells = <&macaddr_caldata_6>; + nvmem-cell-names = "mac-address"; +}; + +&mdio0 { + status = "okay"; + + phy4: ethernet-phy@4 { + reg = <4>; + phy-mode = "rgmii"; + }; +}; + +ð0 { + status = "okay"; + + nvmem-cells = <&macaddr_caldata_0>; + nvmem-cell-names = "mac-address"; + + phy-handle = <&phy4>; + phy-mode = "rgmii-rxid"; + + pll-data = <0x86000000 0x80000101 0x80001313>; +}; + +&caldata { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_caldata_0: macaddr@0 { + reg = <0x0 0x6>; + }; + + macaddr_caldata_6: macaddr@6 { + reg = <0x6 0x6>; + }; }; diff --git a/target/linux/ath79/dts/qca9558_netgear_ex7300.dtsi b/target/linux/ath79/dts/qca9558_netgear_ex7300.dtsi deleted file mode 100644 index c266c52dad..0000000000 --- a/target/linux/ath79/dts/qca9558_netgear_ex7300.dtsi +++ /dev/null @@ -1,224 +0,0 @@ -// 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> - -/ { - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_amber; - led-running = &led_power_green; - led-upgrade = &led_power_amber; - label-mac-device = ð0; - }; - - led_spi { - compatible = "spi-gpio"; - #address-cells = <1>; - #size-cells = <0>; - - sck-gpios = <&gpio 18 GPIO_ACTIVE_HIGH>; - mosi-gpios = <&gpio 15 GPIO_ACTIVE_HIGH>; - num-chipselects = <0>; - - led_gpio: led_gpio@0 { - compatible = "nxp,74lvc594"; - reg = <0>; - gpio-controller; - #gpio-cells = <2>; - registers-number = <1>; - spi-max-frequency = <500000>; - - gpio_latch_bit { - gpio-hog; - gpios = <4 GPIO_ACTIVE_HIGH>; - output-high; - line-name = "gpio-latch-bit"; - }; - }; - }; - - leds { - compatible = "gpio-leds"; - - led_power_green: power_green { - label = "green:power"; - gpios = <&gpio 19 GPIO_ACTIVE_LOW>; - }; - - led_power_amber: power_amber { - label = "amber:power"; - gpios = <&gpio 20 GPIO_ACTIVE_LOW>; - }; - - left_blue { - label = "blue:left"; - gpios = <&led_gpio 7 GPIO_ACTIVE_LOW>; - }; - - right_blue { - label = "blue:right"; - gpios = <&led_gpio 6 GPIO_ACTIVE_LOW>; - }; - - wps_green { - label = "green:wps"; - gpios = <&led_gpio 5 GPIO_ACTIVE_LOW>; - }; - - client_red { - label = "red:client"; - gpios = <&led_gpio 3 GPIO_ACTIVE_LOW>; - }; - - client_green { - label = "green:client"; - gpios = <&led_gpio 2 GPIO_ACTIVE_LOW>; - }; - - router_red { - label = "red:router"; - gpios = <&led_gpio 1 GPIO_ACTIVE_LOW>; - }; - - router_green { - label = "green:router"; - gpios = <&led_gpio 0 GPIO_ACTIVE_LOW>; - }; - }; - - keys { - compatible = "gpio-keys"; - - reset { - label = "Reset button"; - linux,code = <KEY_RESTART>; - gpios = <&gpio 11 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - - wps { - label = "WPS button"; - linux,code = <KEY_WPS_BUTTON>; - gpios = <&gpio 22 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - - extender_apmode { - label = "EXTENDER/APMODE switch"; - gpios = <&gpio 23 GPIO_ACTIVE_LOW>; - linux,code = <BTN_0>; - linux,input-type = <EV_SW>; - debounce-interval = <60>; - }; - }; -}; - -&pcie0 { - status = "okay"; -}; - -&spi { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <25000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - uboot: partition@0 { - label = "u-boot"; - reg = <0x000000 0x040000>; - read-only; - }; - - partition@40000 { - label = "u-boot-env"; - reg = <0x040000 0x010000>; - }; - - caldata: partition@50000 { - label = "caldata"; - reg = <0x050000 0x010000>; - read-only; - }; - - partition@60000 { - label = "caldata-backup"; - reg = <0x060000 0x010000>; - read-only; - }; - - partition@70000 { - label = "config"; - reg = <0x070000 0x010000>; - }; - - partition@80000 { - label = "pot"; - reg = <0x080000 0x010000>; - }; - - partition@90000 { - label = "firmware"; - reg = <0x090000 0xf30000>; - compatible = "denx,uimage"; - }; - - partition@fc0000 { - label = "language"; - reg = <0xfc0000 0x040000>; - }; - }; - }; -}; - -&wmac { - status = "okay"; - - mtd-cal-data = <&caldata 0x1000>; - nvmem-cells = <&macaddr_caldata_6>; - nvmem-cell-names = "mac-address"; -}; - -&mdio0 { - status = "okay"; - - phy4: ethernet-phy@4 { - reg = <4>; - phy-mode = "rgmii"; - }; -}; - -ð0 { - status = "okay"; - - nvmem-cells = <&macaddr_caldata_0>; - nvmem-cell-names = "mac-address"; - - phy-handle = <&phy4>; - phy-mode = "rgmii-rxid"; - - pll-data = <0x86000000 0x80000101 0x80001313>; -}; - -&caldata { - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; - - macaddr_caldata_0: macaddr@0 { - reg = <0x0 0x6>; - }; - - macaddr_caldata_6: macaddr@6 { - reg = <0x6 0x6>; - }; -}; 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 8b0fba7c69..20352095a4 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 @@ -50,7 +50,6 @@ ath79_setup_interfaces() glinet,gl-usb150|\ hak5,wifi-pineapple-nano|\ meraki,mr16|\ - netgear,ex6400|\ netgear,ex7300|\ netgear,ex7300-v2|\ netgear,wndap360|\ diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 74e6738162..b4a2209fdf 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -216,7 +216,6 @@ case "$FIRMWARE" in ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \ /lib/firmware/ath10k/QCA9888/hw2.0/board.bin ;; - netgear,ex6400|\ netgear,ex7300) caldata_extract "caldata" 0x5000 0x2f20 ath10k_patch_mac $(mtd_get_mac_binary caldata 0xc) diff --git a/target/linux/ath79/generic/base-files/lib/preinit/02_sysinfo_fixup b/target/linux/ath79/generic/base-files/lib/preinit/02_sysinfo_fixup new file mode 100644 index 0000000000..e01469f0d9 --- /dev/null +++ b/target/linux/ath79/generic/base-files/lib/preinit/02_sysinfo_fixup @@ -0,0 +1,42 @@ +. /lib/functions.sh + +do_sysinfo_ath79_fixup() { + local model="" + + case $(board_name) in + netgear,ex7300) + local part=$(find_mtd_part caldata) + local board_hw_id=$(dd if=$part bs=1 skip=67 count=10 2>/dev/null) + case "$board_hw_id" in + 5508013406) + model="Netgear EX6400" + ;; + 5508013271) + model="Netgear EX7300" + ;; + esac + ;; + netgear,ex7300-v2) + local part=$(find_mtd_part artmtd) + local antenna_cfg=$(dd if=$part bs=1 skip=59 count=7 2>/dev/null) + local board_hw_id=$(dd if=$part bs=1 skip=67 count=6 2>/dev/null) + case "$antenna_cfg" in + 3X3+3X3) + model="Netgear EX6250" + ;; + 3X3+4X4) + # EX6400 v2, EX6410, EX6420 + model="Netgear ${board_hw_id:-EX6400 v2}" + ;; + 4X4+4X4) + # EX7300 v2, EX7320 + model="Netgear ${board_hw_id:-EX7300 v2}" + ;; + esac + ;; + esac + + [ -n "$model" ] && echo "$model" > /tmp/sysinfo/model +} + +boot_hook_add preinit_main do_sysinfo_ath79_fixup diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index ec7cbb950a..7712247d39 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -1732,41 +1732,45 @@ define Device/nec_wg800hp endef TARGET_DEVICES += nec_wg800hp -define Device/netgear_ex6400_ex7300 - $(Device/netgear_generic) +define Device/netgear_ex7300 SOC := qca9558 - UIMAGE_MAGIC := 0x27051956 + DEVICE_VENDOR := NETGEAR + DEVICE_MODEL := EX7300 + DEVICE_ALT0_VENDOR := NETGEAR + DEVICE_ALT0_MODEL := EX6400 NETGEAR_BOARD_ID := EX7300series NETGEAR_HW_ID := 29765104+16+0+128 IMAGE_SIZE := 15552k + IMAGES += factory.img IMAGE/default := append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | \ netgear-rootfs | pad-rootfs IMAGE/sysupgrade.bin := $$(IMAGE/default) | check-size | append-metadata IMAGE/factory.img := $$(IMAGE/default) | netgear-dni | check-size DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca99x0-ct -endef - -define Device/netgear_ex6400 - $(Device/netgear_ex6400_ex7300) - DEVICE_MODEL := EX6400 -endef -TARGET_DEVICES += netgear_ex6400 - -define Device/netgear_ex7300 - $(Device/netgear_ex6400_ex7300) - DEVICE_MODEL := EX7300 + SUPPORTED_DEVICES += netgear,ex6400 endef TARGET_DEVICES += netgear_ex7300 define Device/netgear_ex7300-v2 - $(Device/netgear_generic) SOC := qcn5502 + DEVICE_VENDOR := NETGEAR DEVICE_MODEL := EX7300 DEVICE_VARIANT := v2 - UIMAGE_MAGIC := 0x27051956 + DEVICE_ALT0_VENDOR := NETGEAR + DEVICE_ALT0_MODEL := EX6250 + DEVICE_ALT1_VENDOR := NETGEAR + DEVICE_ALT1_MODEL := EX6400 + DEVICE_ALT1_VARIANT := v2 + DEVICE_ALT2_VENDOR := NETGEAR + DEVICE_ALT2_MODEL := EX6410 + DEVICE_ALT3_VENDOR := NETGEAR + DEVICE_ALT3_MODEL := EX6420 + DEVICE_ALT4_VENDOR := NETGEAR + DEVICE_ALT4_MODEL := EX7320 NETGEAR_BOARD_ID := EX7300v2series NETGEAR_HW_ID := 29765907+16+0+128 IMAGE_SIZE := 14528k + IMAGES += factory.img IMAGE/default := append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | \ netgear-rootfs | pad-rootfs IMAGE/sysupgrade.bin := $$(IMAGE/default) | check-size | append-metadata |