[openwrt/openwrt] ipq40xx: add support for Linksys WHW01 v1

LEDE Commits lede-commits at lists.infradead.org
Sun Jun 5 12:24:00 PDT 2022


chunkeey pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/b4184c666c13fdf08ecd3abf340538d593e9084c

commit b4184c666c13fdf08ecd3abf340538d593e9084c
Author: Peter Adkins <peter at sunkenlab.com>
AuthorDate: Wed Jun 9 21:35:46 2021 +0100

    ipq40xx: add support for Linksys WHW01 v1
    
    This patch adds support for Linksys WHW01 v1 ("Velop") [FCC ID Q87-03331].
    
    Specification
    -------------
    
    SOC:             Qualcomm IPQ4018
    WiFi 1:          Qualcomm QCA4019 IEEE 802.11b/g/n
    WiFi 2:          Qualcomm QCA4019 IEEE 802.11a/n/ac
    Bluetooth:       Qualcomm CSR8811 (A12U)
    Ethernet:        Qualcomm QCA8072 (2-port)
    SPI Flash 1:     Mactronix MX25L1605D (2MB)
    SPI Flash 2:     Winbond W25M02GV (256MB)
    DRAM:            Nanya NT5CC128M16IP-DI (256MB)
    LED Controller:  NXP PCA963x (I2C)
    Buttons:         Single reset button (GPIO).
    
    Notes
    -----
    
    There does not appear to be a way to trigger TFTP recovery without entering
    U-Boot. The device must be opened to access the serial console in order to
    first flash OpenWrt onto a device from factory.
    
    The device has automatic recovery backed by a second set of partitions on
    the larger of the two SPI flash ICs. Both the primary and secondary must
    be flashed to prevent accidental rollback to "factory" after 3 failed boot
    attempts.
    
    Serial console
    --------------
    
    A serial console is available on the following pins of the populated J2
    connector on the device mainboard (115200 8n1).
    
    (<-- Top of PCB / Device)
    
      J2
      [o o o o o o]
           |   | |
           |   |  `-- GND
           |    `---- TX
           `--------- RX
    
    Installation instructions
    -------------------------
    
    1. Setup TFTP server with server IP set to 192.168.1.236.
    2. Copy compiled `...squashfs-factory.bin` to `nodes-jr.img` in tftp root.
    3. Connect to console using pinout detailed in the serial console section.
    4. Power on device and press enter when prompted to drop into U-Boot.
    5. Flash first partition device via `run flashimg`.
    6. Once complete, reset device and allow to power up completely.
    7. Once comfortable with device upgrade reboot and drop back into U-Boot.
    8. Flash the second partition (recovery) via `run flashimg2`.
    
    Revert to "factory"
    -------------------
    
    1. Download latest firmware update from vendor support site.
    2. Copy extracted `.img` file to `nodes-jr.img` in tftp root.
    3. Connect to console using pinout detailed in the serial console section.
    4. Power on device and press enter when prompted to drop into U-Boot.
    5. Flash first partition device via `run flashimg`.
    6. Once complete, reset device and allow to power up completely.
    7. Once comfortable with device upgrade reboot and drop back into U-Boot.
    8. Flash the second partition (recovery) via `run flashimg2`.
    
    Link: https://github.com/openwrt/openwrt/pull/3682
    Signed-off-by: Peter Adkins <peter at sunkenlab.com>
    (calibration from nvmem, updated to 5.10+5.15)
    Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
---
 package/boot/uboot-envtools/files/ipq40xx          |   3 +
 .../ipq40xx/base-files/etc/board.d/02_network      |   3 +-
 .../linux/ipq40xx/base-files/etc/init.d/bootcount  |   3 +-
 .../ipq40xx/base-files/lib/upgrade/platform.sh     |   3 +-
 .../arch/arm/boot/dts/qcom-ipq4018-whw01-v1.dts    | 330 +++++++++++++++++++++
 target/linux/ipq40xx/image/generic.mk              |  19 ++
 .../patches-5.10/901-arm-boot-add-dts-files.patch  |   3 +-
 .../patches-5.15/901-arm-boot-add-dts-files.patch  |   3 +-
 8 files changed, 362 insertions(+), 5 deletions(-)

diff --git a/package/boot/uboot-envtools/files/ipq40xx b/package/boot/uboot-envtools/files/ipq40xx
index 9a71a622f7..1937f9d1ce 100644
--- a/package/boot/uboot-envtools/files/ipq40xx
+++ b/package/boot/uboot-envtools/files/ipq40xx
@@ -60,6 +60,9 @@ linksys,ea8300|\
 linksys,mr8300)
 	ubootenv_add_uci_config "/dev/mtd7" "0x0" "0x40000" "0x20000"
 	;;
+linksys,whw01-v1)
+	ubootenv_add_uci_config "/dev/mtd6" "0x0" "0x40000" "0x10000"
+	;;
 zyxel,nbg6617)
 	ubootenv_add_uci_config "/dev/mtd6" "0x0" "0x10000" "0x10000"
 	;;
diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network b/target/linux/ipq40xx/base-files/etc/board.d/02_network
index f3dfd656c3..39450a5af7 100644
--- a/target/linux/ipq40xx/base-files/etc/board.d/02_network
+++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network
@@ -82,7 +82,8 @@ ipq40xx_setup_interfaces()
 		ucidef_add_switch "switch0" \
 			"0u at eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
 		;;
-	avm,fritzrepeater-3000)
+	avm,fritzrepeater-3000|\
+	linksys,whw01-v1)
 		ucidef_add_switch "switch0" \
 			"0u at eth0" "4:lan:1" "5:lan:2"
 		;;
diff --git a/target/linux/ipq40xx/base-files/etc/init.d/bootcount b/target/linux/ipq40xx/base-files/etc/init.d/bootcount
index 9abfbddc43..367ccfcd0c 100755
--- a/target/linux/ipq40xx/base-files/etc/init.d/bootcount
+++ b/target/linux/ipq40xx/base-files/etc/init.d/bootcount
@@ -10,7 +10,8 @@ boot() {
 		;;
 	linksys,ea6350v3|\
 	linksys,ea8300|\
-	linksys,mr8300)
+	linksys,mr8300|\
+	linksys,whw01-v1)
 		mtd resetbc s_env || true
 		;;
 	netgear,wac510)
diff --git a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh
index cded9e3a7f..8a6702df4e 100644
--- a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh
@@ -161,7 +161,8 @@ platform_do_upgrade() {
 		;;
 	linksys,ea6350v3 |\
 	linksys,ea8300 |\
-	linksys,mr8300)
+	linksys,mr8300 |\
+	linksys,whw01-v1)
 		platform_do_upgrade_linksys "$1"
 		;;
 	meraki,mr33)
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-whw01-v1.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-whw01-v1.dts
new file mode 100644
index 0000000000..6f244132ea
--- /dev/null
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-whw01-v1.dts
@@ -0,0 +1,330 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "qcom-ipq4019.dtsi"
+#include <dt-bindings/leds/common.h>
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+	model = "Linksys WHW01 v1";
+	compatible = "linksys,whw01-v1";
+
+	aliases {
+		serial0 = &blsp1_uart1;
+		led-boot = &led_system_blue;
+		led-running = &led_system_blue;
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+		bootargs-append = " root=/dev/ubiblock0_0";
+	};
+
+	soc {
+		keys {
+			compatible = "gpio-keys";
+
+			reset {
+				label = "reset";
+				gpios = <&tlmm 63 GPIO_ACTIVE_LOW>;
+				linux,code = <KEY_RESTART>;
+			};
+		};
+
+		ess-psgmii at 98000 {
+			status = "okay";
+		};
+
+		ess_tcsr at 1953000 {
+			status = "okay";
+		};
+
+		ess-switch at c000000 {
+			status = "okay";
+		};
+
+		edma at c080000 {
+			status = "okay";
+		};
+	};
+};
+
+&blsp_dma {
+	status = "okay";
+};
+
+&blsp1_i2c3 {
+	status = "okay";
+	pinctrl-0 = <&i2c_0_pins>;
+	pinctrl-1 = <&i2c_0_pins>;
+	pinctrl-names = "i2c_active", "i2c_sleep";
+
+	leds at 62 {
+		compatible = "nxp,pca9633";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0x62>;
+
+		/* RGB? */
+		led at 0 {
+			reg = <0>;
+			color = <LED_COLOR_ID_RED>;
+			function = LED_FUNCTION_POWER;
+		};
+
+		led at 1 {
+			reg = <1>;
+			color = <LED_COLOR_ID_GREEN>;
+			function = LED_FUNCTION_POWER;
+		};
+
+		led_system_blue: led at 2 {
+			reg = <2>;
+			color = <LED_COLOR_ID_BLUE>;
+			function = LED_FUNCTION_POWER;
+			linux,default-trigger = "default-on";
+		};
+	};
+};
+
+&blsp1_spi1 {
+	status = "okay";
+	pinctrl-0 = <&spi_0_pins>;
+	pinctrl-names = "default";
+	cs-gpios = <&tlmm 54 GPIO_ACTIVE_HIGH>, <&tlmm 4 GPIO_ACTIVE_HIGH>;
+
+	nor at 0 {
+		reg = <0>;
+		compatible = "jedec,spi-nor";
+		spi-max-frequency = <24000000>;
+
+		partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			partition at 0 {
+				label = "0:SBL1";
+				reg = <0x0 0x40000>;
+				read-only;
+			};
+
+			partition at 40000 {
+				label = "0:MIBIB";
+				reg = <0x40000 0x20000>;
+				read-only;
+			};
+
+			partition at 60000 {
+				label = "0:QSEE";
+				reg = <0x60000 0x60000>;
+				read-only;
+			};
+
+			partition at c0000 {
+				label = "0:CDT";
+				reg = <0xc0000 0x10000>;
+				read-only;
+			};
+
+			partition at d0000 {
+				label = "APPSBL";
+				reg = <0xd0000 0xa0000>;
+				read-only;
+			};
+
+			partition at 170000 {
+				label = "0:ART";
+				reg = <0x170000 0x10000>;
+				read-only;
+
+				compatible = "nvmem-cells";
+				#address-cells = <1>;
+				#size-cells = <1>;
+
+				precal_art_1000: precal at 1000 {
+					reg = <0x1000 0x2f20>;
+				};
+
+				precal_art_5000: precal at 5000 {
+					reg = <0x5000 0x2f20>;
+				};
+			};
+
+			partition at 180000 {
+				label = "u_env";
+				reg = <0x180000 0x40000>;
+			};
+
+			partition at 1c0000 {
+				label = "s_env";
+				reg = <0x1c0000 0x20000>;
+			};
+
+			partition at 1e0000 {
+				label = "devinfo";
+				reg = <0x1e0000 0x20000>;
+				read-only;
+			};
+		};
+	};
+
+	nand at 1 {
+		reg = <1>;
+		compatible = "spi-nand";
+		spi-max-frequency = <24000000>;
+
+		partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			partition at 0 {
+				label = "kernel";
+				reg = <0x0000000 0x5000000>;
+			};
+
+			partition at 600000 {
+				label = "rootfs";
+				reg = <0x0600000 0x4a00000>;
+			};
+
+			partition at 5000000 {
+				label = "alt_kernel";
+				reg = <0x5000000 0x5000000>;
+			};
+
+			partition at 5600000 {
+				label = "alt_rootfs";
+				reg = <0x5600000 0x4a00000>;
+			};
+
+			partition at a000000 {
+				label = "sysdiag";
+				reg = <0xa000000 0x0200000>;
+				read-only;
+			};
+
+			partition at a200000 {
+				label = "syscfg";
+				reg = <0xa200000 0x5e00000>;
+				read-only;
+			};
+		};
+	};
+};
+
+&blsp1_uart1 {
+	pinctrl-0 = <&serial_pins>;
+	pinctrl-names = "default";
+	status = "okay";
+};
+
+&mdio {
+	status = "okay";
+	pinctrl-0 = <&mdio_pins>;
+	pinctrl-names = "default";
+	phy-reset-gpio = <&tlmm 62 GPIO_ACTIVE_HIGH>;
+};
+
+&tlmm {
+	mdio_pins: mdio_pinmux {
+		mux_mdio {
+			pins = "gpio53";
+			function = "mdio";
+			bias-pull-up;
+		};
+
+		mux_mdc {
+			pins = "gpio52";
+			function = "mdc";
+			bias-pull-up;
+		};
+	};
+
+	serial_pins: serial_pinmux {
+		mux {
+			pins = "gpio60", "gpio61";
+			function = "blsp_uart0";
+			bias-disable;
+		};
+	};
+
+	spi_0_pins: spi_0_pinmux {
+		pinmux {
+			function = "blsp_spi0";
+			pins = "gpio55", "gpio56", "gpio57";
+		};
+
+		pinmux_cs {
+			function = "gpio";
+			pins = "gpio54", "gpio4";
+		};
+
+		pinconf {
+			pins = "gpio55", "gpio56", "gpio57";
+			drive-strength = <12>;
+			bias-disable;
+		};
+
+		pinconf_cs {
+			pins = "gpio54", "gpio4";
+			drive-strength = <2>;
+			bias-disable;
+			output-high;
+		};
+	};
+
+	i2c_0_pins: i2c_0_pinmux {
+		mux {
+			function = "blsp_i2c0";
+			pins = "gpio58", "gpio59";
+			bias-disable;
+		};
+	};
+
+	reset_pinmux {
+		mux {
+			pins = "gpio63";
+			bias-pull-up;
+		};
+	};
+};
+
+&usb2 {
+	status = "okay";
+};
+
+&usb2_hs_phy {
+	status = "okay";
+};
+
+&usb3 {
+	status = "okay";
+};
+
+&usb3_hs_phy {
+	status = "okay";
+};
+
+&usb3_ss_phy {
+	status = "okay";
+};
+
+&watchdog {
+	status = "okay";
+};
+
+&wifi0 {
+	status = "okay";
+	qcom,ath10k-calibration-variant = "linksys-whw01-v1";
+	nvmem-cell-names = "pre-calibration";
+	nvmem-cells = <&precal_art_1000>;
+};
+
+&wifi1 {
+	status = "okay";
+	qcom,ath10k-calibration-variant = "linksys-whw01-v1";
+	nvmem-cell-names = "pre-calibration";
+	nvmem-cells = <&precal_art_5000>;
+};
diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk
index 44880d157c..0ddff52ef8 100644
--- a/target/linux/ipq40xx/image/generic.mk
+++ b/target/linux/ipq40xx/image/generic.mk
@@ -662,6 +662,25 @@ define Device/linksys_mr8300
 endef
 TARGET_DEVICES += linksys_mr8300
 
+define Device/linksys_whw01-v1
+	$(call Device/FitzImage)
+	DEVICE_VENDOR := Linksys
+	DEVICE_MODEL := WHW01
+	DEVICE_VARIANT := v1
+	KERNEL_SIZE := 6144k
+	IMAGE_SIZE := 28704512  # 28032k minus linksys signature (256-bytes).
+	SOC := qcom-ipq4018
+	BLOCKSIZE := 128k
+	PAGESIZE := 2048
+	UBINIZE_OPTS := -E 5    # EOD marks to "hide" factory sig at EOF
+	IMAGES += factory.bin
+	IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | \
+		append-ubi | linksys-image type=WHW01 | pad-to $$$$(PAGESIZE) | \
+		check-size
+	DEVICE_PACKAGES := uboot-envtools kmod-leds-pca963x
+endef
+TARGET_DEVICES += linksys_whw01-v1
+
 define Device/luma_wrtq-329acn
 	$(call Device/FitImage)
 	DEVICE_VENDOR := Luma Home
diff --git a/target/linux/ipq40xx/patches-5.10/901-arm-boot-add-dts-files.patch b/target/linux/ipq40xx/patches-5.10/901-arm-boot-add-dts-files.patch
index a6a082a2c8..99ea2e423e 100644
--- a/target/linux/ipq40xx/patches-5.10/901-arm-boot-add-dts-files.patch
+++ b/target/linux/ipq40xx/patches-5.10/901-arm-boot-add-dts-files.patch
@@ -10,7 +10,7 @@ Signed-off-by: John Crispin <john at phrozen.org>
 
 --- a/arch/arm/boot/dts/Makefile
 +++ b/arch/arm/boot/dts/Makefile
-@@ -903,11 +903,76 @@ dtb-$(CONFIG_ARCH_QCOM) += \
+@@ -903,11 +903,77 @@ dtb-$(CONFIG_ARCH_QCOM) += \
  	qcom-apq8074-dragonboard.dtb \
  	qcom-apq8084-ifc6540.dtb \
  	qcom-apq8084-mtp.dtb \
@@ -40,6 +40,7 @@ Signed-off-by: John Crispin <john at phrozen.org>
 +	qcom-ipq4018-rt-ac58u.dtb \
 +	qcom-ipq4018-rutx10.dtb \
 +	qcom-ipq4018-wac510.dtb \
++	qcom-ipq4018-whw01-v1.dtb \
 +	qcom-ipq4018-wre6606.dtb \
 +	qcom-ipq4018-wrtq-329acn.dtb \
  	qcom-ipq4019-ap.dk01.1-c1.dtb \
diff --git a/target/linux/ipq40xx/patches-5.15/901-arm-boot-add-dts-files.patch b/target/linux/ipq40xx/patches-5.15/901-arm-boot-add-dts-files.patch
index af1c695c26..f9b3c513bb 100644
--- a/target/linux/ipq40xx/patches-5.15/901-arm-boot-add-dts-files.patch
+++ b/target/linux/ipq40xx/patches-5.15/901-arm-boot-add-dts-files.patch
@@ -10,7 +10,7 @@ Signed-off-by: John Crispin <john at phrozen.org>
 
 --- a/arch/arm/boot/dts/Makefile
 +++ b/arch/arm/boot/dts/Makefile
-@@ -951,11 +951,75 @@ dtb-$(CONFIG_ARCH_QCOM) += \
+@@ -951,11 +951,76 @@ dtb-$(CONFIG_ARCH_QCOM) += \
  	qcom-ipq4018-ap120c-ac.dtb \
  	qcom-ipq4018-ap120c-ac-bit.dtb \
  	qcom-ipq4018-jalapeno.dtb \
@@ -39,6 +39,7 @@ Signed-off-by: John Crispin <john at phrozen.org>
 +	qcom-ipq4018-rt-ac58u.dtb \
 +	qcom-ipq4018-rutx10.dtb \
 +	qcom-ipq4018-wac510.dtb \
++	qcom-ipq4018-whw01-v1.dtb \
 +	qcom-ipq4018-wre6606.dtb \
 +	qcom-ipq4018-wrtq-329acn.dtb \
  	qcom-ipq4019-ap.dk01.1-c1.dtb \




More information about the lede-commits mailing list