From bb46f0484d7017366f27f40d139562b262123303 Mon Sep 17 00:00:00 2001 From: Daniel Kestrel Date: Mon, 14 Feb 2022 21:50:06 +0100 Subject: [PATCH] lantiq: add support for AVM Fritzbox 7490 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This adds support for the Fritzbox 7490 device. It contains two SoCs, one Lantiq without WiFi and one QCA9558 with 2.4GHz and 5 GHz WiFi. Only the Lantiq has access to the flash memory, the Atheros runs fully from RAM and is booted by using a remoteproc kernel module and is not supported with this commit. The devices were manufactured with varying NAND chips which requires Micron and non-Micron versions of the images. Specifications: - SoC: Lantiq 500 MHz - RAM: 256 MB - Storage: 512 MB NAND, 1MB FLASH - Wireless, separate SOC QCA9558 with 128MB RAM (not supported yet): · Qualcomm-QCA9558 w/ 3×3 MIMO for 2.4GHz 802.11b/g/n · Qualcomm-QCA9880 w/ 3×3 MIMO for 5GHz 802.11a/ac · AG71xx ethernet - Ethernet: Built-in AR 803x, 7 port 4 phy switch, 4x 1000/100/10 port, Port 5 is fixed and connected to the WASP SOC - Renesas µPD720202 USB3 PCIe, requires firmware binary on the device - VDSL2 modem Unsupported: - DECT and ISDN telephony Installation: Check which NAND the device has by using the following procedure with stock firmware: Go to to http:///support.lua, download the support data file and search for string "NAND device" to get the manufacturer kernel output. Use Micron image if Micron is displayed otherwise the non-Micron image. Use the eva_ramboot.py script to boot the initramfs image. Follow the procedure to interrupt booting by ftp into 192.168.178.1 within 5 seconds after poweron. Then transfer the sysupgrade image to the device and run sysupgrade to flash it to the NAND. For making USB work, an renesas xhci firmware file (e.g. v2026) is needed and it should be copied to /lib/firmware/ (file name renesas_usb_fw.mem). Signed-off-by: Daniel Kestrel --- package/kernel/linux/modules/usb.mk | 1 + .../dts/lantiq/vr9_avm_fritz7490-micron.dts | 12 ++ .../boot/dts/lantiq/vr9_avm_fritz7490.dts | 8 + .../boot/dts/lantiq/vr9_avm_fritz7490.dtsi | 81 ++++++++ .../boot/dts/lantiq/vr9_avm_fritzxx90.dtsi | 174 ++++++++++++++++++ target/linux/lantiq/image/vr9.mk | 24 +++ .../xrx200/base-files/etc/board.d/01_leds | 4 +- .../xrx200/base-files/etc/board.d/02_network | 10 +- .../xrx200/base-files/lib/upgrade/platform.sh | 2 + 9 files changed, 313 insertions(+), 3 deletions(-) create mode 100644 target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7490-micron.dts create mode 100644 target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7490.dts create mode 100644 target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7490.dtsi create mode 100644 target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritzxx90.dtsi diff --git a/package/kernel/linux/modules/usb.mk b/package/kernel/linux/modules/usb.mk index 6218ec994c..7f9e627fdb 100644 --- a/package/kernel/linux/modules/usb.mk +++ b/package/kernel/linux/modules/usb.mk @@ -1739,6 +1739,7 @@ define KernelPackage/usb3 +TARGET_ramips_mt7621:kmod-usb-xhci-mtk \ +TARGET_mediatek:kmod-usb-xhci-mtk \ +TARGET_apm821xx_nand:kmod-usb-xhci-pci-renesas \ + +TARGET_lantiq_xrx200:kmod-usb-xhci-pci-renesas \ +TARGET_mvebu_cortexa9:kmod-usb-xhci-pci-renesas KCONFIG:= \ CONFIG_USB_PCI=y \ diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7490-micron.dts b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7490-micron.dts new file mode 100644 index 0000000000..8d763788a0 --- /dev/null +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7490-micron.dts @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "vr9_avm_fritz7490.dtsi" + +/ { + compatible = "avm,fritz7490-micron", "lantiq,xway", "lantiq,vr9"; + model = "AVM FRITZ!Box 7490 (Micron NAND)"; +}; + +&nand1 { + nand-ecc-engine = <&nand1>; +}; diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7490.dts b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7490.dts new file mode 100644 index 0000000000..cccefeaf41 --- /dev/null +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7490.dts @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "vr9_avm_fritz7490.dtsi" + +/ { + compatible = "avm,fritz7490", "lantiq,xway", "lantiq,vr9"; + model = "AVM FRITZ!Box 7490"; +}; diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7490.dtsi b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7490.dtsi new file mode 100644 index 0000000000..6488c574c2 --- /dev/null +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7490.dtsi @@ -0,0 +1,81 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "vr9_avm_fritzxx90.dtsi" + +/ { + compatible = "avm,fritz7490", "lantiq,xway", "lantiq,vr9"; + model = "AVM FRITZ!Box 7490"; +}; + +&aliases { + led-dsl = &led_info_green; + led-internet = &led_internet; + led-wifi = &led_wifi; +}; + +&leds { + led_internet: internet { + label = "green:internet"; + gpios = <&gpio 47 GPIO_ACTIVE_LOW>; + }; + + led_fon: fon { + label = "green:fon"; + gpios = <&gpio 36 GPIO_ACTIVE_LOW>; + }; + + led_wifi: wifi { + label = "green:wlan"; + gpios = <&gpio 35 GPIO_ACTIVE_LOW>; + }; +}; + +&gswip_mdio { + phy0: ethernet-phy@0 { + reg = <0x00>; + reset-gpios = <&gpio 32 GPIO_ACTIVE_LOW>; + }; + + phy1: ethernet-phy@1 { + reg = <0x01>; + reset-gpios = <&gpio 44 GPIO_ACTIVE_LOW>; + }; + + phy11: ethernet-phy@11 { + reg = <0x11>; + }; + + phy13: ethernet-phy@13 { + reg = <0x13>; + }; +}; + +&gswip_ports { + port@0 { + reg = <0>; + label = "lan3"; + phy-mode = "rgmii-rxid"; + phy-handle = <&phy0>; + }; + + port@1 { + reg = <1>; + label = "lan4"; + phy-mode = "rgmii-rxid"; + phy-handle = <&phy1>; + }; + + port@2 { + reg = <2>; + label = "lan2"; + phy-mode = "internal"; + phy-handle = <&phy11>; + }; + + port@4 { + reg = <4>; + label = "lan1"; + phy-mode = "internal"; + phy-handle = <&phy13>; + }; +}; diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritzxx90.dtsi b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritzxx90.dtsi new file mode 100644 index 0000000000..4d138a58e6 --- /dev/null +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritzxx90.dtsi @@ -0,0 +1,174 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "vr9.dtsi" + +#include +#include + +/ { + chosen { + bootargs = "console=ttyLTQ0,115200"; + }; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x10000000>; + }; + + aliases: aliases { + led-boot = &led_power_green; + led-failsafe = &led_info_red; + led-running = &led_power_green; + led-upgrade = &led_info_red; + }; + + keys { + compatible = "gpio-keys-polled"; + poll-interval = <100>; + + power { + label = "power"; + gpios = <&gpio 1 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wifi { + label = "wifi"; + gpios = <&gpio 29 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds: leds { + compatible = "gpio-leds"; + + led_power_green: power_green { + label = "green:power"; + gpios = <&gpio 45 GPIO_ACTIVE_LOW>; + default-state = "keep"; + }; + + led_info_green: info_green { + label = "green:info"; + gpios = <&gpio 33 GPIO_ACTIVE_LOW>; + }; + + led_info_red: info_red { + label = "red:info"; + gpios = <&gpio 46 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&gphy0 { + lantiq,gphy-mode = ; +}; + +&gphy1 { + lantiq,gphy-mode = ; +}; + +&gpio { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + gpio-ranges = <&gpio 0 0 56>; + + state_default: pinmux { + phy-rst { + lantiq,pins = "io32", "io44"; + lantiq,pull = <0>; + lantiq,open-drain; + lantiq,output = <1>; + }; + + pcie-rst { + lantiq,pins = "io21"; + lantiq,open-drain; + lantiq,output = <1>; + }; + }; + + usb-vbus { + gpio-hog; + line-name = "usb-vbus"; + gpios = <14 GPIO_ACTIVE_HIGH>; + output-high; + }; + + pcie-enable-dev { + gpio-hog; + line-name = "pcie-enable-dev"; + gpios = <22 GPIO_ACTIVE_LOW>; + output-low; + }; +}; + +&gswip { + pinctrl-0 = <&mdio_pins>; + pinctrl-names = "default"; +}; + +&spi { + status = "okay"; + + flash@4 { + compatible = "jedec,spi-nor"; + reg = <4>; + spi-max-frequency = <10000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + urlader: partition@0 { + reg = <0x0 0x40000>; + label = "urlader"; + read-only; + }; + + partition@40000 { + reg = <0x40000 0x60000>; + label = "tffs (1)"; + read-only; + }; + + partition@a0000 { + reg = <0xa0000 0x60000>; + label = "tffs (2)"; + read-only; + }; + }; + }; +}; + +&localbus { + nand1: nand@1 { + compatible = "lantiq,nand-xway"; + bank-width = <2>; + reg = <0x1 0x0 0x2000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "kernel"; + reg = <0x0 0x400000>; + }; + + partition@400000 { + label = "ubi"; + reg = <0x400000 0x1fc00000>; + }; + }; + }; +}; + +&pcie0 { + status = "okay"; + + gpio-reset = <&gpio 21 GPIO_ACTIVE_LOW>; + lantiq,switch-pcie-endianess; +}; diff --git a/target/linux/lantiq/image/vr9.mk b/target/linux/lantiq/image/vr9.mk index 3c05636f56..6df679dad9 100644 --- a/target/linux/lantiq/image/vr9.mk +++ b/target/linux/lantiq/image/vr9.mk @@ -208,6 +208,30 @@ define Device/avm_fritz7430 endef TARGET_DEVICES += avm_fritz7430 +define Device/avm_fritz7490 + $(Device/dsa-migration) + $(Device/AVM) + $(Device/NAND) + DEVICE_MODEL := FRITZ!Box 7490 + DEVICE_VARIANT := Other NAND + KERNEL_SIZE := 4096k + IMAGE_SIZE := 49152k + DEVICE_PACKAGES := kmod-usb3 fritz-tffs -kmod-owl-loader +endef +TARGET_DEVICES += avm_fritz7490 + +define Device/avm_fritz7490-micron + $(Device/dsa-migration) + $(Device/AVM) + $(Device/NAND) + DEVICE_MODEL := FRITZ!Box 7490 + DEVICE_VARIANT := Micron NAND + KERNEL_SIZE := 4096k + IMAGE_SIZE := 49152k + DEVICE_PACKAGES := kmod-usb3 fritz-tffs -kmod-owl-loader +endef +TARGET_DEVICES += avm_fritz7490-micron + define Device/bt_homehub-v5a $(Device/dsa-migration) $(Device/NAND) diff --git a/target/linux/lantiq/xrx200/base-files/etc/board.d/01_leds b/target/linux/lantiq/xrx200/base-files/etc/board.d/01_leds index 0c80aaa3b8..d1b50172de 100644 --- a/target/linux/lantiq/xrx200/base-files/etc/board.d/01_leds +++ b/target/linux/lantiq/xrx200/base-files/etc/board.d/01_leds @@ -41,7 +41,9 @@ arcadyan,vgv7519-brn) ;; avm,fritz3370-rev2-hynix|\ avm,fritz3370-rev2-micron|\ -avm,fritz3390) +avm,fritz3390|\ +avm,fritz7490|\ +avm,fritz7490-micron) ucidef_set_led_switch "lan" "LAN" "green:lan" "switch0" "0x17" ;; bt,homehub-v5a) diff --git a/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network b/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network index 3122d40c92..4b5950c347 100644 --- a/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network +++ b/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network @@ -36,6 +36,8 @@ lantiq_setup_interfaces() avm,fritz7360-v2|\ avm,fritz7362sl|\ avm,fritz7430|\ + avm,fritz7490|\ + avm,fritz7490-micron|\ buffalo,wbmr-300hpd|\ tplink,tdw8970|\ tplink,tdw8980|\ @@ -67,7 +69,9 @@ lantiq_setup_dsl() avm,fritz7360sl|\ avm,fritz7362sl|\ avm,fritz7412|\ - avm,fritz7430) + avm,fritz7430|\ + avm,fritz7490|\ + avm,fritz7490-micron) annex="b" ;; esac @@ -114,7 +118,9 @@ lantiq_setup_macs() wan_mac=$(macaddr_add "$(mtd_get_mac_binary urlader 0xa91)" 1) ;; avm,fritz3390|\ - avm,fritz7362sl) + avm,fritz7362sl|\ + avm,fritz7490|\ + avm,fritz7490-micron) lan_mac=$(fritz_tffs -n maca -i $(find_mtd_part "tffs (1)")) wan_mac=$(fritz_tffs -n macdsl -i $(find_mtd_part "tffs (1)")) ;; diff --git a/target/linux/lantiq/xrx200/base-files/lib/upgrade/platform.sh b/target/linux/lantiq/xrx200/base-files/lib/upgrade/platform.sh index ab01d3bbf7..0764c0554d 100755 --- a/target/linux/lantiq/xrx200/base-files/lib/upgrade/platform.sh +++ b/target/linux/lantiq/xrx200/base-files/lib/upgrade/platform.sh @@ -15,6 +15,8 @@ platform_do_upgrade() { avm,fritz7362sl|\ avm,fritz7412|\ avm,fritz7430|\ + avm,fritz7490|\ + avm,fritz7490-micron|\ bt,homehub-v5a|\ zyxel,p-2812hnu-f1|\ zyxel,p-2812hnu-f3) -- 2.30.2