diff mbox series

[v7,1/2,v7,1/2] ipq806x: add support for Linksys E8350 v1

Message ID 20210124162022.24178-1-todorcolov@abv.bg
State Changes Requested
Headers show
Series [v7,1/2,v7,1/2] ipq806x: add support for Linksys E8350 v1 | expand

Commit Message

Todor Colov Jan. 24, 2021, 4:20 p.m. UTC
Signed-off-by: Todor Colov <todorcolov@abv.bg>
---
 .../ipq806x/base-files/etc/board.d/01_leds    |   3 +
 .../ipq806x/base-files/etc/board.d/02_network |   1 +
 .../base-files/lib/upgrade/platform.sh        |   3 +-
 .../arm/boot/dts/qcom-ipq8064-e8350-v1.dts    | 246 ++++++++++++++++++
 target/linux/ipq806x/image/Makefile           |  29 +++
 .../0069-arm-boot-add-dts-files.patch         |   3 +-
 6 files changed, 283 insertions(+), 2 deletions(-)
 create mode 100644 target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts

Comments

Hauke Mehrtens Feb. 22, 2021, 11:45 a.m. UTC | #1
On 1/24/21 5:20 PM, Todor Colov wrote:
> Signed-off-by: Todor Colov <todorcolov@abv.bg>

Please add a description.

> ---
>   .../ipq806x/base-files/etc/board.d/01_leds    |   3 +
>   .../ipq806x/base-files/etc/board.d/02_network |   1 +
>   .../base-files/lib/upgrade/platform.sh        |   3 +-
>   .../arm/boot/dts/qcom-ipq8064-e8350-v1.dts    | 246 ++++++++++++++++++
>   target/linux/ipq806x/image/Makefile           |  29 +++
>   .../0069-arm-boot-add-dts-files.patch         |   3 +-
>   6 files changed, 283 insertions(+), 2 deletions(-)
>   create mode 100644 target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts
> 
> diff --git a/target/linux/ipq806x/base-files/etc/board.d/01_leds b/target/linux/ipq806x/base-files/etc/board.d/01_leds
> index 284f9e2c1d..33c7f80fb9 100755
> --- a/target/linux/ipq806x/base-files/etc/board.d/01_leds
> +++ b/target/linux/ipq806x/base-files/etc/board.d/01_leds
> @@ -22,6 +22,9 @@ edgecore,ecw5410)
>   	ucidef_set_led_wlan "wlan2g" "WLAN2G" "green:wlan2g" "phy1tpt"
>   	ucidef_set_led_wlan "wlan5g" "WLAN5G" "green:wlan5g" "phy0tpt"
>   	;;
> +linksys,e8350-v1)
> +        ucidef_set_led_wlan "wlan" "WLAN" "green:wifi" "phy0tpt"
> +        ;;
>   nec,wg2600hp)
>   	ucidef_set_led_wlan "wlan2g" "WLAN2G" "green:wlan2g" "phy1tpt"
>   	ucidef_set_led_wlan "wlan5g" "WLAN5G" "green:wlan5g" "phy0tpt"
> diff --git a/target/linux/ipq806x/base-files/etc/board.d/02_network b/target/linux/ipq806x/base-files/etc/board.d/02_network
> index ddef4b7ac6..036cba2de5 100755
> --- a/target/linux/ipq806x/base-files/etc/board.d/02_network
> +++ b/target/linux/ipq806x/base-files/etc/board.d/02_network
> @@ -69,6 +69,7 @@ qcom,ipq8064-db149)
>   ubnt,unifi-ac-hd)
>   	ucidef_set_interface_lan "eth0 eth1"
>   	;;
> +linksys,e8350-v1 |\

Please add this alphabetical ordered.

>   zyxel,nbg6817)
>   	hw_mac_addr=$(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
>   	ucidef_add_switch "switch0" \
> diff --git a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
> index 4dc612492c..7b319a5b7c 100644
> --- a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
> +++ b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
> @@ -1,7 +1,7 @@
>   PART_NAME=firmware
>   REQUIRE_IMAGE_METADATA=1
>   
> -RAMFS_COPY_BIN='fw_printenv fw_setenv'
> +RAMFS_COPY_BIN='fw_printenv fw_setenv fwtool'

Why is fwtool added?

>   RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
>   
>   platform_check_image() {
> @@ -20,6 +20,7 @@ platform_do_upgrade() {
>   		nand_do_upgrade "$1"
>   		;;
>   	compex,wpq864|\
> +	linksys,e8350-v1|\
>   	netgear,d7800 |\
>   	netgear,r7500 |\
>   	netgear,r7500v2 |\
> diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts
> new file mode 100644
> index 0000000000..872deeb044
> --- /dev/null
> +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts
> @@ -0,0 +1,246 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
> +#include "qcom-ipq8064-v2.0.dtsi"
> +
> +#include <dt-bindings/input/input.h>
> +#include <dt-bindings/soc/qcom,tcsr.h>
> +
> +/ {
> +	model = "Linksys E8350 V1 WiFi Router";
> +	compatible = "linksys,e8350-v1", "qcom,ipq8064";
> +
> +	memory@0 {
> +		reg = <0x42000000 0x1e000000>;
> +		device_type = "memory";
> +	};
> +
> +	aliases {
> +		serial0 = &gsbi4_serial;
> +
> +		led-boot = &led_power;
> +		led-failsafe = &led_power;
> +		led-running = &led_power;
> +		led-upgrade = &led_power;
> +	};
> +
> +	keys {
> +		compatible = "gpio-keys";
> +		pinctrl-0 = <&button_pins>;
> +		pinctrl-names = "default";
> +
> +		reset {
> +			label = "reset";
> +			gpios = <&qcom_pinmux 68 GPIO_ACTIVE_LOW>;
> +			linux,code = <KEY_RESTART>;
> +		};
> +
> +		wps {
> +			label = "wps";
> +			gpios = <&qcom_pinmux 65 GPIO_ACTIVE_LOW>;
> +			linux,code = <KEY_WPS_BUTTON>;
> +		};
> +
> +		wifi {
> +			label = "wifi";
> +			gpios = <&qcom_pinmux 67 GPIO_ACTIVE_LOW>;
> +			linux,code = <KEY_RFKILL>;
> +		};
> +	};
> +
> +	nand-controller@1ac00000 {
> +		compatible = "qcom,ipq806x-nand";
> +		reg = <0x1ac00000 0x800>;
> +		clocks = <&gcc EBI2_CLK>,
> +			<&gcc EBI2_AON_CLK>;
> +		clock-names = "core", "aon";
> +		dmas = <&adm_dma 3>;
> +		dma-names = "rxtx";
> +		qcom,cmd-crci = <15>;
> +		qcom,data-crci = <3>;
> +
> +		nand@0 {
> +			reg = <0>;
> +
> +			nand-ecc-strength = <4>;
> +			nand-bus-width = <8>;
> +
> +			partitions {
> +				compatible = "fixed-partitions";
> +
> +				partition@0 {
> +					label = "ubi";
> +					reg = <0 0x4000000>;
> +				};
> +	
> +				partition@4000000 {
> +					label = "extra";
> +					reg = <0x4000000 0x4000000>;
> +				};
> +			};
> +		};
> +	};
> +
> +
> +	leds {
> +		compatible = "gpio-leds";
> +		pinctrl-0 = <&led_pins>;
> +		pinctrl-names = "default";
> +
> +		led_power: power {
> +			label = "green:power";
> +			gpios = <&qcom_pinmux 26 GPIO_ACTIVE_HIGH>;
> +			default-state = "keep";
> +		};
> +
> +		wps {
> +			label = "green:wps";
> +			gpios = <&qcom_pinmux 53 GPIO_ACTIVE_HIGH>;
> +                };
> +
> +		wifi {
> +			label = "green:wifi";
> +			gpios = <&qcom_pinmux 54 GPIO_ACTIVE_HIGH>;
> +		};
> +	};
> +};
> +
> +&qcom_pinmux {
> +	button_pins: button_pins {
> +		mux {
> +			pins = "gpio68","gpio65", "gpio67";
> +			function = "gpio";
> +			drive-strength = <2>;
> +			bias-pull-up;
> +		};
> +	};
> +
> +	led_pins: led_pins {
> +		mux {
> +			pins = "gpio26","gpio53", "gpio54";
> +			function = "gpio";
> +			drive-strength = <2>;
> +			bias-pull-up;
> +		};
> +	};
> +};
> +
> +&gsbi4 {
> +	qcom,mode = <GSBI_PROT_I2C_UART>;
> +	status = "okay";
> +	serial@16340000 {
> +		status = "okay";
> +	};
> +	/*
> +	* The i2c device on gsbi4 should not be enabled.
> +	* On ipq806x designs gsbi4 i2c is meant for exclusive
> +	* RPM usage. Turning this on in kernel manifests as
> +	* i2c failure for the RPM.
> +	*/
> +};
> +&gsbi5 {
> +	qcom,mode = <GSBI_PROT_SPI>;
> +	status = "okay";
> +
> +	spi5: spi@1a280000 {
> +		status = "okay";
> +
> +		pinctrl-0 = <&spi_pins>;
> +		pinctrl-names = "default";
> +
> +		cs-gpios = <&qcom_pinmux 20 GPIO_ACTIVE_HIGH>;
> +
> +		m25p80@0 {
> +			compatible = "jedec,spi-nor";
> +			spi-max-frequency = <51200000>;
> +			reg = <0>;
> +
> +			partitions {
> +				compatible = "qcom,smem";
> +			};
> +		};
> +	};
> +};
> +
> +&sata_phy {
> +	status = "okay";
> +};
> +
> +&sata {
> +	status = "okay";
> +};
> +
> +&usb3_0 {
> +	clocks = <&gcc USB30_1_MASTER_CLK>;
> +	status = "okay";
> +};
> +
> +&usb3_1 {
> +	clocks = <&gcc USB30_0_MASTER_CLK>;
> +	status = "okay";
> +};
> +
> +&pcie0 {
> +	status = "okay";
> +};
> +
> +&pcie1 {
> +	status = "okay";
> +};
> +
> +&pcie2 {
> +	status = "okay";
> +};
> +
> +&mdio0 {
> +	status = "okay";
> +
> +	pinctrl-0 = <&mdio0_pins>;
> +	pinctrl-names = "default";
> +
> +	phy0: ethernet-phy@0 {
> +		reg = <0>;
> +		qca,ar8327-initvals = <
> +			0x00004 0x7600000   /* PAD0_MODE */
> +			0x00008 0x1000000   /* PAD5_MODE */
> +			0x0000c 0x80        /* PAD6_MODE */
> +			0x00010 0x2613a0    /* PWS_REG */
> +			0x000e4 0x6a545     /* MAC_POWER_SEL */
> +			0x000e0 0xc74164de  /* SGMII_CTRL */
> +			0x0007c 0x4e        /* PORT0_STATUS */
> +			0x00094 0x4e        /* PORT6_STATUS */
> +			>;
> +	};
> +};
> +
> +&gmac1 {
> +	status = "okay";
> +	phy-mode = "rgmii";
> +	qcom,id = <1>;
> +
> +	pinctrl-0 = <&rgmii2_pins>;
> +	pinctrl-names = "default";
> +
> +	fixed-link {
> +		speed = <1000>;
> +		full-duplex;
> +	};
> +};
> +
> +&gmac2 {
> +	status = "okay";
> +	phy-mode = "sgmii";
> +	qcom,id = <2>;
> +
> +	fixed-link {
> +		speed = <1000>;
> +		full-duplex;
> +	};
> +};
> +
> +&tcsr {
> +	qcom,usb-ctrl-select = <TCSR_USB_SELECT_USB3_DUAL>;
> +	compatible = "qcom,tcsr";
> +};
> +
> +&adm_dma {
> +	status = "okay";
> +};
> diff --git a/target/linux/ipq806x/image/Makefile b/target/linux/ipq806x/image/Makefile
> index bab1da0090..5ea38f564d 100644
> --- a/target/linux/ipq806x/image/Makefile
> +++ b/target/linux/ipq806x/image/Makefile
> @@ -23,6 +23,17 @@ define Build/edimax-header
>   	@mv $@.new $@
>   endef
>   
> +# tune addpattern for Linksys E8350-V1 fw pattern generation
> +define Build/linksys-bin
> +        $(STAGING_DIR_HOST)/bin/addpattern -p $(FW_DEVICE_ID) -v $(FW_VERSION) $(if $(SERIAL),-s $(SERIAL)) -i $@ -o $@.new
> +        mv $@.new $@
> +endef
> +# Use Linksys fw header generator to upgrade openwrt factory image over the native Linksys WEB interface
> +define Build/linksys-addfwhdr
> +        -$(STAGING_DIR_HOST)/bin/addfwhdr -i $@ -o $@.new \
> +       	;mv "$@.new" "$@"
> +endef
> +
>   define Device/Default
>   	PROFILES := Default
>   	KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts)
> @@ -145,6 +156,24 @@ define Device/edgecore_ecw5410
>   endef
>   TARGET_DEVICES += edgecore_ecw5410
>   
> +define Device/linksys_e8350-v1
> +        $(call Device/LegacyImage)
> +        DEVICE_VENDOR := Linksys
> +        DEVICE_MODEL := E8350
> +        DEVICE_VARIANT := v1
> +        SOC := qcom-ipq8064
> +        FW_VERSION := v1.0.03.003
> +        FW_DEVICE_ID := 8350
> +        PAGESIZE := 2048
> +        BLOCKSIZE := 128k
> +        KERNEL_IN_UBI := 1
> +        IMAGES = factory.bin sysupgrade.ubi
> +        IMAGE/sysupgrade.ubi := append-ubi | check-size 0x04000000 | append-metadata

Is the sysupgrade.bin not working?
	IMAGE/sysupgrade.bin = sysupgrade-tar | append-metadata

> +        IMAGE/factory.bin := append-ubi | check-size 0x04000000 | linksys-addfwhdr | linksys-bin
> +        DEVICE_PACKAGES := ath10k-firmware-qca988x-ct
> +endef
> +TARGET_DEVICES += linksys_e8350-v1
> +
>   define Device/linksys_ea7500-v1
>   	$(call Device/LegacyImage)
>   	DEVICE_VENDOR := Linksys
> diff --git a/target/linux/ipq806x/patches-5.4/0069-arm-boot-add-dts-files.patch b/target/linux/ipq806x/patches-5.4/0069-arm-boot-add-dts-files.patch
> index 055a4cbc30..df37f18f23 100644
> --- a/target/linux/ipq806x/patches-5.4/0069-arm-boot-add-dts-files.patch
> +++ b/target/linux/ipq806x/patches-5.4/0069-arm-boot-add-dts-files.patch
> @@ -10,7 +10,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
>   
>   --- a/arch/arm/boot/dts/Makefile
>   +++ b/arch/arm/boot/dts/Makefile
> -@@ -842,7 +842,24 @@ dtb-$(CONFIG_ARCH_QCOM) += \
> +@@ -842,7 +842,25 @@ dtb-$(CONFIG_ARCH_QCOM) += \
>    	qcom-ipq4019-ap.dk04.1-c3.dtb \
>    	qcom-ipq4019-ap.dk07.1-c1.dtb \
>    	qcom-ipq4019-ap.dk07.1-c2.dtb \
> @@ -20,6 +20,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
>   +	qcom-ipq8064-d7800.dtb \
>   +	qcom-ipq8064-db149.dtb \
>   +	qcom-ipq8064-ap161.dtb \
> ++	qcom-ipq8064-e8350-v1.dtb \
>   +	qcom-ipq8064-ea7500-v1.dtb \
>   +	qcom-ipq8064-ea8500.dtb \
>   +	qcom-ipq8064-g10.dtb \
>
Adrian Schmutzler Feb. 22, 2021, 12:26 p.m. UTC | #2
Hi again,

> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces@lists.openwrt.org]
> On Behalf Of Todor Colov
> Sent: Sonntag, 24. Januar 2021 17:20
> To: openwrt-devel@lists.openwrt.org
> Cc: Todor Colov <todorcolov@abv.bg>
> Subject: [PATCH v7 1/2] [v7,1/2] ipq806x: add support for Linksys E8350 v1
> 
> Signed-off-by: Todor Colov <todorcolov@abv.bg>
> ---
>  .../ipq806x/base-files/etc/board.d/01_leds    |   3 +
>  .../ipq806x/base-files/etc/board.d/02_network |   1 +
>  .../base-files/lib/upgrade/platform.sh        |   3 +-
>  .../arm/boot/dts/qcom-ipq8064-e8350-v1.dts    | 246 ++++++++++++++++++
>  target/linux/ipq806x/image/Makefile           |  29 +++
>  .../0069-arm-boot-add-dts-files.patch         |   3 +-
>  6 files changed, 283 insertions(+), 2 deletions(-)  create mode 100644
> target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts
> 
> diff --git a/target/linux/ipq806x/base-files/etc/board.d/01_leds
> b/target/linux/ipq806x/base-files/etc/board.d/01_leds
> index 284f9e2c1d..33c7f80fb9 100755
> --- a/target/linux/ipq806x/base-files/etc/board.d/01_leds
> +++ b/target/linux/ipq806x/base-files/etc/board.d/01_leds
> @@ -22,6 +22,9 @@ edgecore,ecw5410)
>  	ucidef_set_led_wlan "wlan2g" "WLAN2G" "green:wlan2g" "phy1tpt"
>  	ucidef_set_led_wlan "wlan5g" "WLAN5G" "green:wlan5g" "phy0tpt"
>  	;;
> +linksys,e8350-v1)
> +        ucidef_set_led_wlan "wlan" "WLAN" "green:wifi" "phy0tpt"
> +        ;;

Tabs should be used for indent. Apart from that, a DTS trigger is preferred.

>  nec,wg2600hp)
>  	ucidef_set_led_wlan "wlan2g" "WLAN2G" "green:wlan2g" "phy1tpt"
>  	ucidef_set_led_wlan "wlan5g" "WLAN5G" "green:wlan5g" "phy0tpt"
> diff --git a/target/linux/ipq806x/base-files/etc/board.d/02_network
> b/target/linux/ipq806x/base-files/etc/board.d/02_network
> index ddef4b7ac6..036cba2de5 100755
> --- a/target/linux/ipq806x/base-files/etc/board.d/02_network
> +++ b/target/linux/ipq806x/base-files/etc/board.d/02_network
> @@ -69,6 +69,7 @@ qcom,ipq8064-db149)
>  ubnt,unifi-ac-hd)
>  	ucidef_set_interface_lan "eth0 eth1"
>  	;;
> +linksys,e8350-v1 |\
>  zyxel,nbg6817)

Alphabetic sorting ... (did I really not write this before on a v7?)

>  	hw_mac_addr=$(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
>  	ucidef_add_switch "switch0" \
> diff --git a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
> b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
> index 4dc612492c..7b319a5b7c 100644
> --- a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
> +++ b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
> @@ -1,7 +1,7 @@
>  PART_NAME=firmware
>  REQUIRE_IMAGE_METADATA=1
> 
> -RAMFS_COPY_BIN='fw_printenv fw_setenv'
> +RAMFS_COPY_BIN='fw_printenv fw_setenv fwtool'

I still don't understand why we need fwtool for this particular device only.

This should be discussed broadly in the commit message.

>  RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
> 
>  platform_check_image() {
> @@ -20,6 +20,7 @@ platform_do_upgrade() {
>  		nand_do_upgrade "$1"
>  		;;
>  	compex,wpq864|\
> +	linksys,e8350-v1|\
>  	netgear,d7800 |\
>  	netgear,r7500 |\
>  	netgear,r7500v2 |\
> diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-
> e8350-v1.dts b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-
> e8350-v1.dts
> new file mode 100644
> index 0000000000..872deeb044
> --- /dev/null
> +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-e8350-
> v1
> +++ .dts
> @@ -0,0 +1,246 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT #include
> +"qcom-ipq8064-v2.0.dtsi"
> +
> +#include <dt-bindings/input/input.h>
> +#include <dt-bindings/soc/qcom,tcsr.h>
> +
> +/ {
> +	model = "Linksys E8350 V1 WiFi Router";
> +	compatible = "linksys,e8350-v1", "qcom,ipq8064";
> +
> +	memory@0 {
> +		reg = <0x42000000 0x1e000000>;
> +		device_type = "memory";
> +	};
> +
> +	aliases {
> +		serial0 = &gsbi4_serial;
> +
> +		led-boot = &led_power;
> +		led-failsafe = &led_power;
> +		led-running = &led_power;
> +		led-upgrade = &led_power;
> +	};
> +
> +	keys {
> +		compatible = "gpio-keys";
> +		pinctrl-0 = <&button_pins>;
> +		pinctrl-names = "default";
> +
> +		reset {
> +			label = "reset";
> +			gpios = <&qcom_pinmux 68 GPIO_ACTIVE_LOW>;
> +			linux,code = <KEY_RESTART>;
> +		};
> +
> +		wps {
> +			label = "wps";
> +			gpios = <&qcom_pinmux 65 GPIO_ACTIVE_LOW>;
> +			linux,code = <KEY_WPS_BUTTON>;
> +		};
> +
> +		wifi {
> +			label = "wifi";
> +			gpios = <&qcom_pinmux 67 GPIO_ACTIVE_LOW>;
> +			linux,code = <KEY_RFKILL>;
> +		};
> +	};
> +
> +	nand-controller@1ac00000 {
> +		compatible = "qcom,ipq806x-nand";
> +		reg = <0x1ac00000 0x800>;
> +		clocks = <&gcc EBI2_CLK>,
> +			<&gcc EBI2_AON_CLK>;
> +		clock-names = "core", "aon";
> +		dmas = <&adm_dma 3>;
> +		dma-names = "rxtx";
> +		qcom,cmd-crci = <15>;
> +		qcom,data-crci = <3>;
> +
> +		nand@0 {
> +			reg = <0>;
> +
> +			nand-ecc-strength = <4>;
> +			nand-bus-width = <8>;
> +
> +			partitions {
> +				compatible = "fixed-partitions";
> +
> +				partition@0 {
> +					label = "ubi";
> +					reg = <0 0x4000000>;
> +				};
> +
> +				partition@4000000 {
> +					label = "extra";
> +					reg = <0x4000000 0x4000000>;
> +				};
> +			};
> +		};
> +	};
> +
> +
> +	leds {
> +		compatible = "gpio-leds";
> +		pinctrl-0 = <&led_pins>;
> +		pinctrl-names = "default";
> +
> +		led_power: power {
> +			label = "green:power";
> +			gpios = <&qcom_pinmux 26 GPIO_ACTIVE_HIGH>;
> +			default-state = "keep";
> +		};
> +
> +		wps {
> +			label = "green:wps";
> +			gpios = <&qcom_pinmux 53 GPIO_ACTIVE_HIGH>;
> +                };
> +
> +		wifi {
> +			label = "green:wifi";
> +			gpios = <&qcom_pinmux 54 GPIO_ACTIVE_HIGH>;
> +		};
> +	};
> +};
> +
> +&qcom_pinmux {
> +	button_pins: button_pins {
> +		mux {
> +			pins = "gpio68","gpio65", "gpio67";
> +			function = "gpio";
> +			drive-strength = <2>;
> +			bias-pull-up;
> +		};
> +	};
> +
> +	led_pins: led_pins {
> +		mux {
> +			pins = "gpio26","gpio53", "gpio54";
> +			function = "gpio";
> +			drive-strength = <2>;
> +			bias-pull-up;
> +		};
> +	};
> +};
> +
> +&gsbi4 {
> +	qcom,mode = <GSBI_PROT_I2C_UART>;
> +	status = "okay";
> +	serial@16340000 {
> +		status = "okay";
> +	};
> +	/*
> +	* The i2c device on gsbi4 should not be enabled.
> +	* On ipq806x designs gsbi4 i2c is meant for exclusive
> +	* RPM usage. Turning this on in kernel manifests as
> +	* i2c failure for the RPM.
> +	*/
> +};

Please check the current contents of qcom-ipq8064-v2.0.dtsi. This entire block and several other components are already present there and can be removed here.

> +&gsbi5 {
> +	qcom,mode = <GSBI_PROT_SPI>;
> +	status = "okay";
> +
> +	spi5: spi@1a280000 {
> +		status = "okay";
> +
> +		pinctrl-0 = <&spi_pins>;
> +		pinctrl-names = "default";
> +
> +		cs-gpios = <&qcom_pinmux 20 GPIO_ACTIVE_HIGH>;
> +
> +		m25p80@0 {
> +			compatible = "jedec,spi-nor";
> +			spi-max-frequency = <51200000>;
> +			reg = <0>;
> +
> +			partitions {
> +				compatible = "qcom,smem";
> +			};
> +		};
> +	};
> +};
> +
> +&sata_phy {
> +	status = "okay";
> +};
> +
> +&sata {
> +	status = "okay";
> +};
> +
> +&usb3_0 {
> +	clocks = <&gcc USB30_1_MASTER_CLK>;
> +	status = "okay";
> +};
> +
> +&usb3_1 {
> +	clocks = <&gcc USB30_0_MASTER_CLK>;
> +	status = "okay";
> +};
> +
> +&pcie0 {
> +	status = "okay";
> +};
> +
> +&pcie1 {
> +	status = "okay";
> +};
> +
> +&pcie2 {
> +	status = "okay";
> +};
> +
> +&mdio0 {
> +	status = "okay";
> +
> +	pinctrl-0 = <&mdio0_pins>;
> +	pinctrl-names = "default";
> +
> +	phy0: ethernet-phy@0 {
> +		reg = <0>;
> +		qca,ar8327-initvals = <
> +			0x00004 0x7600000   /* PAD0_MODE */
> +			0x00008 0x1000000   /* PAD5_MODE */
> +			0x0000c 0x80        /* PAD6_MODE */
> +			0x00010 0x2613a0    /* PWS_REG */
> +			0x000e4 0x6a545     /* MAC_POWER_SEL */
> +			0x000e0 0xc74164de  /* SGMII_CTRL */
> +			0x0007c 0x4e        /* PORT0_STATUS */
> +			0x00094 0x4e        /* PORT6_STATUS */
> +			>;
> +	};
> +};
> +
> +&gmac1 {
> +	status = "okay";
> +	phy-mode = "rgmii";
> +	qcom,id = <1>;
> +
> +	pinctrl-0 = <&rgmii2_pins>;
> +	pinctrl-names = "default";
> +
> +	fixed-link {
> +		speed = <1000>;
> +		full-duplex;
> +	};
> +};
> +
> +&gmac2 {
> +	status = "okay";
> +	phy-mode = "sgmii";
> +	qcom,id = <2>;
> +
> +	fixed-link {
> +		speed = <1000>;
> +		full-duplex;
> +	};
> +};
> +
> +&tcsr {
> +	qcom,usb-ctrl-select = <TCSR_USB_SELECT_USB3_DUAL>;
> +	compatible = "qcom,tcsr";
> +};
> +
> +&adm_dma {
> +	status = "okay";
> +};
> diff --git a/target/linux/ipq806x/image/Makefile
> b/target/linux/ipq806x/image/Makefile
> index bab1da0090..5ea38f564d 100644
> --- a/target/linux/ipq806x/image/Makefile
> +++ b/target/linux/ipq806x/image/Makefile
> @@ -23,6 +23,17 @@ define Build/edimax-header
>  	@mv $@.new $@
>  endef
> 
> +# tune addpattern for Linksys E8350-V1 fw pattern generation define
> +Build/linksys-bin
> +        $(STAGING_DIR_HOST)/bin/addpattern -p $(FW_DEVICE_ID) -v
> $(FW_VERSION) $(if $(SERIAL),-s $(SERIAL)) -i $@ -o $@.new
> +        mv $@.new $@
> +endef
> +# Use Linksys fw header generator to upgrade openwrt factory image over
> +the native Linksys WEB interface define Build/linksys-addfwhdr
> +        -$(STAGING_DIR_HOST)/bin/addfwhdr -i $@ -o $@.new \
> +       	;mv "$@.new" "$@"
> +endef
> +
>  define Device/Default
>  	PROFILES := Default
>  	KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts)
> @@ -145,6 +156,24 @@ define Device/edgecore_ecw5410  endef
> TARGET_DEVICES += edgecore_ecw5410
> 
> +define Device/linksys_e8350-v1
> +        $(call Device/LegacyImage)
> +        DEVICE_VENDOR := Linksys
> +        DEVICE_MODEL := E8350
> +        DEVICE_VARIANT := v1
> +        SOC := qcom-ipq8064
> +        FW_VERSION := v1.0.03.003
> +        FW_DEVICE_ID := 8350
> +        PAGESIZE := 2048
> +        BLOCKSIZE := 128k
> +        KERNEL_IN_UBI := 1
> +        IMAGES = factory.bin sysupgrade.ubi
> +        IMAGE/sysupgrade.ubi := append-ubi | check-size 0x04000000 |
> append-metadata

There is not a single case among all supported devices where append-ubi is used for sysupgrade. Is this really correct?
Might this be the reason why you need fwtool while others don't?

Best

Adrian

> +        IMAGE/factory.bin := append-ubi | check-size 0x04000000 | linksys-
> addfwhdr | linksys-bin
> +        DEVICE_PACKAGES := ath10k-firmware-qca988x-ct endef
> +TARGET_DEVICES += linksys_e8350-v1
> +
>  define Device/linksys_ea7500-v1
>  	$(call Device/LegacyImage)
>  	DEVICE_VENDOR := Linksys
> diff --git a/target/linux/ipq806x/patches-5.4/0069-arm-boot-add-dts-
> files.patch b/target/linux/ipq806x/patches-5.4/0069-arm-boot-add-dts-
> files.patch
> index 055a4cbc30..df37f18f23 100644
> --- a/target/linux/ipq806x/patches-5.4/0069-arm-boot-add-dts-files.patch
> +++ b/target/linux/ipq806x/patches-5.4/0069-arm-boot-add-dts-files.patch
> @@ -10,7 +10,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
> 
>  --- a/arch/arm/boot/dts/Makefile
>  +++ b/arch/arm/boot/dts/Makefile
> -@@ -842,7 +842,24 @@ dtb-$(CONFIG_ARCH_QCOM) += \
> +@@ -842,7 +842,25 @@ dtb-$(CONFIG_ARCH_QCOM) += \
>   	qcom-ipq4019-ap.dk04.1-c3.dtb \
>   	qcom-ipq4019-ap.dk07.1-c1.dtb \
>   	qcom-ipq4019-ap.dk07.1-c2.dtb \
> @@ -20,6 +20,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
>  +	qcom-ipq8064-d7800.dtb \
>  +	qcom-ipq8064-db149.dtb \
>  +	qcom-ipq8064-ap161.dtb \
> ++	qcom-ipq8064-e8350-v1.dtb \
>  +	qcom-ipq8064-ea7500-v1.dtb \
>  +	qcom-ipq8064-ea8500.dtb \
>  +	qcom-ipq8064-g10.dtb \
> --
> 2.29.2
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
diff mbox series

Patch

diff --git a/target/linux/ipq806x/base-files/etc/board.d/01_leds b/target/linux/ipq806x/base-files/etc/board.d/01_leds
index 284f9e2c1d..33c7f80fb9 100755
--- a/target/linux/ipq806x/base-files/etc/board.d/01_leds
+++ b/target/linux/ipq806x/base-files/etc/board.d/01_leds
@@ -22,6 +22,9 @@  edgecore,ecw5410)
 	ucidef_set_led_wlan "wlan2g" "WLAN2G" "green:wlan2g" "phy1tpt"
 	ucidef_set_led_wlan "wlan5g" "WLAN5G" "green:wlan5g" "phy0tpt"
 	;;
+linksys,e8350-v1)
+        ucidef_set_led_wlan "wlan" "WLAN" "green:wifi" "phy0tpt"
+        ;;
 nec,wg2600hp)
 	ucidef_set_led_wlan "wlan2g" "WLAN2G" "green:wlan2g" "phy1tpt"
 	ucidef_set_led_wlan "wlan5g" "WLAN5G" "green:wlan5g" "phy0tpt"
diff --git a/target/linux/ipq806x/base-files/etc/board.d/02_network b/target/linux/ipq806x/base-files/etc/board.d/02_network
index ddef4b7ac6..036cba2de5 100755
--- a/target/linux/ipq806x/base-files/etc/board.d/02_network
+++ b/target/linux/ipq806x/base-files/etc/board.d/02_network
@@ -69,6 +69,7 @@  qcom,ipq8064-db149)
 ubnt,unifi-ac-hd)
 	ucidef_set_interface_lan "eth0 eth1"
 	;;
+linksys,e8350-v1 |\
 zyxel,nbg6817)
 	hw_mac_addr=$(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
 	ucidef_add_switch "switch0" \
diff --git a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
index 4dc612492c..7b319a5b7c 100644
--- a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
@@ -1,7 +1,7 @@ 
 PART_NAME=firmware
 REQUIRE_IMAGE_METADATA=1
 
-RAMFS_COPY_BIN='fw_printenv fw_setenv'
+RAMFS_COPY_BIN='fw_printenv fw_setenv fwtool'
 RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
 
 platform_check_image() {
@@ -20,6 +20,7 @@  platform_do_upgrade() {
 		nand_do_upgrade "$1"
 		;;
 	compex,wpq864|\
+	linksys,e8350-v1|\
 	netgear,d7800 |\
 	netgear,r7500 |\
 	netgear,r7500v2 |\
diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts
new file mode 100644
index 0000000000..872deeb044
--- /dev/null
+++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts
@@ -0,0 +1,246 @@ 
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+#include "qcom-ipq8064-v2.0.dtsi"
+
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/soc/qcom,tcsr.h>
+
+/ {
+	model = "Linksys E8350 V1 WiFi Router";
+	compatible = "linksys,e8350-v1", "qcom,ipq8064";
+
+	memory@0 {
+		reg = <0x42000000 0x1e000000>;
+		device_type = "memory";
+	};
+
+	aliases {
+		serial0 = &gsbi4_serial;
+
+		led-boot = &led_power;
+		led-failsafe = &led_power;
+		led-running = &led_power;
+		led-upgrade = &led_power;
+	};
+
+	keys {
+		compatible = "gpio-keys";
+		pinctrl-0 = <&button_pins>;
+		pinctrl-names = "default";
+
+		reset {
+			label = "reset";
+			gpios = <&qcom_pinmux 68 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_RESTART>;
+		};
+
+		wps {
+			label = "wps";
+			gpios = <&qcom_pinmux 65 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_WPS_BUTTON>;
+		};
+
+		wifi {
+			label = "wifi";
+			gpios = <&qcom_pinmux 67 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_RFKILL>;
+		};
+	};
+
+	nand-controller@1ac00000 {
+		compatible = "qcom,ipq806x-nand";
+		reg = <0x1ac00000 0x800>;
+		clocks = <&gcc EBI2_CLK>,
+			<&gcc EBI2_AON_CLK>;
+		clock-names = "core", "aon";
+		dmas = <&adm_dma 3>;
+		dma-names = "rxtx";
+		qcom,cmd-crci = <15>;
+		qcom,data-crci = <3>;
+
+		nand@0 {
+			reg = <0>;
+
+			nand-ecc-strength = <4>;
+			nand-bus-width = <8>;
+
+			partitions {
+				compatible = "fixed-partitions";
+
+				partition@0 {
+					label = "ubi";
+					reg = <0 0x4000000>;
+				};
+	
+				partition@4000000 {
+					label = "extra";
+					reg = <0x4000000 0x4000000>;
+				};
+			};
+		};
+	};
+
+
+	leds {
+		compatible = "gpio-leds";
+		pinctrl-0 = <&led_pins>;
+		pinctrl-names = "default";
+
+		led_power: power {
+			label = "green:power";
+			gpios = <&qcom_pinmux 26 GPIO_ACTIVE_HIGH>;
+			default-state = "keep";
+		};
+
+		wps {
+			label = "green:wps";
+			gpios = <&qcom_pinmux 53 GPIO_ACTIVE_HIGH>;
+                };
+
+		wifi {
+			label = "green:wifi";
+			gpios = <&qcom_pinmux 54 GPIO_ACTIVE_HIGH>;
+		};
+	};
+};
+
+&qcom_pinmux {
+	button_pins: button_pins {
+		mux {
+			pins = "gpio68","gpio65", "gpio67";
+			function = "gpio";
+			drive-strength = <2>;
+			bias-pull-up;
+		};
+	};
+
+	led_pins: led_pins {
+		mux {
+			pins = "gpio26","gpio53", "gpio54";
+			function = "gpio";
+			drive-strength = <2>;
+			bias-pull-up;
+		};
+	};
+};
+
+&gsbi4 {
+	qcom,mode = <GSBI_PROT_I2C_UART>;
+	status = "okay";
+	serial@16340000 {
+		status = "okay";
+	};
+	/*
+	* The i2c device on gsbi4 should not be enabled.
+	* On ipq806x designs gsbi4 i2c is meant for exclusive
+	* RPM usage. Turning this on in kernel manifests as
+	* i2c failure for the RPM.
+	*/
+};
+&gsbi5 {
+	qcom,mode = <GSBI_PROT_SPI>;
+	status = "okay";
+
+	spi5: spi@1a280000 {
+		status = "okay";
+
+		pinctrl-0 = <&spi_pins>;
+		pinctrl-names = "default";
+
+		cs-gpios = <&qcom_pinmux 20 GPIO_ACTIVE_HIGH>;
+
+		m25p80@0 {
+			compatible = "jedec,spi-nor";
+			spi-max-frequency = <51200000>;
+			reg = <0>;
+
+			partitions {
+				compatible = "qcom,smem";
+			};
+		};
+	};
+};
+
+&sata_phy {
+	status = "okay";
+};
+
+&sata {
+	status = "okay";
+};
+
+&usb3_0 {
+	clocks = <&gcc USB30_1_MASTER_CLK>;
+	status = "okay";
+};
+
+&usb3_1 {
+	clocks = <&gcc USB30_0_MASTER_CLK>;
+	status = "okay";
+};
+
+&pcie0 {
+	status = "okay";
+};
+
+&pcie1 {
+	status = "okay";
+};
+
+&pcie2 {
+	status = "okay";
+};
+
+&mdio0 {
+	status = "okay";
+
+	pinctrl-0 = <&mdio0_pins>;
+	pinctrl-names = "default";
+
+	phy0: ethernet-phy@0 {
+		reg = <0>;
+		qca,ar8327-initvals = <
+			0x00004 0x7600000   /* PAD0_MODE */
+			0x00008 0x1000000   /* PAD5_MODE */
+			0x0000c 0x80        /* PAD6_MODE */
+			0x00010 0x2613a0    /* PWS_REG */
+			0x000e4 0x6a545     /* MAC_POWER_SEL */
+			0x000e0 0xc74164de  /* SGMII_CTRL */
+			0x0007c 0x4e        /* PORT0_STATUS */
+			0x00094 0x4e        /* PORT6_STATUS */
+			>;
+	};
+};
+
+&gmac1 {
+	status = "okay";
+	phy-mode = "rgmii";
+	qcom,id = <1>;
+
+	pinctrl-0 = <&rgmii2_pins>;
+	pinctrl-names = "default";
+
+	fixed-link {
+		speed = <1000>;
+		full-duplex;
+	};
+};
+
+&gmac2 {
+	status = "okay";
+	phy-mode = "sgmii";
+	qcom,id = <2>;
+
+	fixed-link {
+		speed = <1000>;
+		full-duplex;
+	};
+};
+
+&tcsr {
+	qcom,usb-ctrl-select = <TCSR_USB_SELECT_USB3_DUAL>;
+	compatible = "qcom,tcsr";
+};
+
+&adm_dma {
+	status = "okay";
+};
diff --git a/target/linux/ipq806x/image/Makefile b/target/linux/ipq806x/image/Makefile
index bab1da0090..5ea38f564d 100644
--- a/target/linux/ipq806x/image/Makefile
+++ b/target/linux/ipq806x/image/Makefile
@@ -23,6 +23,17 @@  define Build/edimax-header
 	@mv $@.new $@
 endef
 
+# tune addpattern for Linksys E8350-V1 fw pattern generation
+define Build/linksys-bin
+        $(STAGING_DIR_HOST)/bin/addpattern -p $(FW_DEVICE_ID) -v $(FW_VERSION) $(if $(SERIAL),-s $(SERIAL)) -i $@ -o $@.new
+        mv $@.new $@
+endef
+# Use Linksys fw header generator to upgrade openwrt factory image over the native Linksys WEB interface
+define Build/linksys-addfwhdr
+        -$(STAGING_DIR_HOST)/bin/addfwhdr -i $@ -o $@.new \
+       	;mv "$@.new" "$@"
+endef
+
 define Device/Default
 	PROFILES := Default
 	KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts)
@@ -145,6 +156,24 @@  define Device/edgecore_ecw5410
 endef
 TARGET_DEVICES += edgecore_ecw5410
 
+define Device/linksys_e8350-v1
+        $(call Device/LegacyImage)
+        DEVICE_VENDOR := Linksys
+        DEVICE_MODEL := E8350
+        DEVICE_VARIANT := v1
+        SOC := qcom-ipq8064
+        FW_VERSION := v1.0.03.003
+        FW_DEVICE_ID := 8350
+        PAGESIZE := 2048
+        BLOCKSIZE := 128k
+        KERNEL_IN_UBI := 1
+        IMAGES = factory.bin sysupgrade.ubi
+        IMAGE/sysupgrade.ubi := append-ubi | check-size 0x04000000 | append-metadata
+        IMAGE/factory.bin := append-ubi | check-size 0x04000000 | linksys-addfwhdr | linksys-bin
+        DEVICE_PACKAGES := ath10k-firmware-qca988x-ct
+endef
+TARGET_DEVICES += linksys_e8350-v1
+
 define Device/linksys_ea7500-v1
 	$(call Device/LegacyImage)
 	DEVICE_VENDOR := Linksys
diff --git a/target/linux/ipq806x/patches-5.4/0069-arm-boot-add-dts-files.patch b/target/linux/ipq806x/patches-5.4/0069-arm-boot-add-dts-files.patch
index 055a4cbc30..df37f18f23 100644
--- a/target/linux/ipq806x/patches-5.4/0069-arm-boot-add-dts-files.patch
+++ b/target/linux/ipq806x/patches-5.4/0069-arm-boot-add-dts-files.patch
@@ -10,7 +10,7 @@  Signed-off-by: John Crispin <john@phrozen.org>
 
 --- a/arch/arm/boot/dts/Makefile
 +++ b/arch/arm/boot/dts/Makefile
-@@ -842,7 +842,24 @@ dtb-$(CONFIG_ARCH_QCOM) += \
+@@ -842,7 +842,25 @@ dtb-$(CONFIG_ARCH_QCOM) += \
  	qcom-ipq4019-ap.dk04.1-c3.dtb \
  	qcom-ipq4019-ap.dk07.1-c1.dtb \
  	qcom-ipq4019-ap.dk07.1-c2.dtb \
@@ -20,6 +20,7 @@  Signed-off-by: John Crispin <john@phrozen.org>
 +	qcom-ipq8064-d7800.dtb \
 +	qcom-ipq8064-db149.dtb \
 +	qcom-ipq8064-ap161.dtb \
++	qcom-ipq8064-e8350-v1.dtb \
 +	qcom-ipq8064-ea7500-v1.dtb \
 +	qcom-ipq8064-ea8500.dtb \
 +	qcom-ipq8064-g10.dtb \