From 03677de18760e03deb4f76cea986fe83be3e2f55 Mon Sep 17 00:00:00 2001 From: Vladdrako Date: Thu, 7 Mar 2024 11:47:04 +0200 Subject: [PATCH] qualcommax: ipq60xx: add Linksys MR7350 support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Linksys MR7350 is a 802.11ax Dual-band router/AP. Specifications: * CPU: Qualcomm IPQ6000 Quad core Cortex-A53 1.2GHz * RAM: 512MB of DDR3 * Storage: 256Mb NAND * Ethernet: 5x1G RJ45 ports (QCA8075) * WLAN: * 2.4GHz: Qualcomm QCN5022 2x2 802.11b/g/n/ax 574 Mbps PHY rate * 5GHz: Qualcomm QCN5052 2x2@80MHz or 802.11a/b/g/n/ac/ax 1201 Mbps PHY rate * LED-s: * RGB system led * Buttons: 1x Soft reset 1x WPS * Power: 12V DC Jack Installation instructions: Open Linksys Web UI - http://192.168.1.1/ca or http://10.65.1.1/ca depending on your setup. Login with your admin password. The default password can be found on a sticker under the device. To enter into the support mode, click on the “CA” link and the bottom of the page. Open the “Connectivity” menu and upload the squash-factory image with the “Choose file” button. Click start. Ignore all the prompts and warnings by click “yes” in all the popups. The Wifi radios are turned off by default. To configure the router, you will need to connect your computer to the LAN port of the device. Then you would need to write openwrt to the other partition for it to work - First Check booted partition: fw_printenv -n boot_part - Change the partition: fw_setenv boot_part 1 or fw_setenv boot_part 2 depending on the current partition - Then install Openwrt to the other partition if booted in slot 1: mtd -r -e alt_kernel -n write openwrt-qualcommax-ipq60xx-linksys_mr7350-squashfs-factory.bin alt_kernel - If in slot 2: mtd -r -e kernel -n write openwrt-qualcommax-ipq60xx-linksys_mr7350-squashfs-factory.bin kernel Co-Authored-by: Chukun Pan Signed-off-by: Vladyslav Andreichykov --- .../uboot-envtools/files/qualcommax_ipq60xx | 5 + package/firmware/ipq-wifi/Makefile | 2 + .../arm64/boot/dts/qcom/ipq6000-mr7350.dts | 375 ++++++++++++++++++ target/linux/qualcommax/image/ipq60xx.mk | 19 + .../ipq60xx/base-files/etc/board.d/01_leds | 25 ++ .../ipq60xx/base-files/etc/board.d/02_network | 24 ++ .../etc/hotplug.d/firmware/11-ath11-caldata | 1 + .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 18 + .../ipq60xx/base-files/etc/init.d/bootcount | 11 + .../base-files/lib/upgrade/platform.sh | 14 + 10 files changed, 494 insertions(+) create mode 100644 target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-mr7350.dts create mode 100644 target/linux/qualcommax/ipq60xx/base-files/etc/board.d/01_leds create mode 100644 target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac create mode 100644 target/linux/qualcommax/ipq60xx/base-files/etc/init.d/bootcount diff --git a/package/boot/uboot-envtools/files/qualcommax_ipq60xx b/package/boot/uboot-envtools/files/qualcommax_ipq60xx index 33cb94f99d18f1..d9552eddeed3c6 100644 --- a/package/boot/uboot-envtools/files/qualcommax_ipq60xx +++ b/package/boot/uboot-envtools/files/qualcommax_ipq60xx @@ -14,6 +14,11 @@ case "$board" in [ -n "$idx" ] && \ ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000" ;; +linksys,mr7350) + idx="$(find_mtd_index u_env)" + [ -n "$idx" ] && \ + ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000" "2" + ;; netgear,wax214) idx="$(find_mtd_index 0:appsblenv)" [ -n "$idx" ] && \ diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index ed4b26af3a20e4..4bbd927586ee17 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -36,6 +36,7 @@ ALLWIFIBOARDS:= \ dynalink_dl-wrx36 \ edgecore_eap102 \ edimax_cax1800 \ + linksys_mr7350 \ linksys_mx4200 \ linksys_mx5300 \ netgear_lbr20 \ @@ -153,6 +154,7 @@ $(eval $(call generate-ipq-wifi-package,compex_wpq873,Compex WPQ-873)) $(eval $(call generate-ipq-wifi-package,dynalink_dl-wrx36,Dynalink DL-WRX36)) $(eval $(call generate-ipq-wifi-package,edgecore_eap102,Edgecore EAP102)) $(eval $(call generate-ipq-wifi-package,edimax_cax1800,Edimax CAX1800)) +$(eval $(call generate-ipq-wifi-package,linksys_mr7350,Linksys MR7350)) $(eval $(call generate-ipq-wifi-package,linksys_mx4200,Linksys MX4200)) $(eval $(call generate-ipq-wifi-package,linksys_mx5300,Linksys MX5300)) $(eval $(call generate-ipq-wifi-package,netgear_lbr20,Netgear LBR20)) diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-mr7350.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-mr7350.dts new file mode 100644 index 00000000000000..369f949fd0d8fc --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-mr7350.dts @@ -0,0 +1,375 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; + +#include "ipq6018.dtsi" +#include "ipq6018-cp-cpu.dtsi" +#include "ipq6018-ess.dtsi" +#include +#include +#include + +/ { + model = "Linksys MR7350"; + compatible = "linksys,mr7350", "qcom,ipq6018"; + + aliases { + serial0 = &blsp1_uart3; + serial1 = &blsp1_uart2; + led-boot = &led_system_blue; + led-running = &led_system_blue; + led-failsafe = &led_system_red; + led-upgrade = &led_system_green; + }; + + chosen { + stdout-path = "serial0:115200n8"; + bootargs-append = " root=/dev/ubiblock0_0"; + }; + + keys { + compatible = "gpio-keys"; + + wps { + label = "wps"; + linux,code = ; + gpios = <&tlmm 56 GPIO_ACTIVE_LOW>; + }; + + reset { + label = "reset"; + linux,code = ; + gpios = <&tlmm 57 GPIO_ACTIVE_LOW>; + }; + }; + + leds { + compatible = "gpio-leds"; + + lan1-amber { + label = "amber:lan1"; + color = ; + gpios = <&qca8075_0 0 GPIO_ACTIVE_HIGH>; + }; + + lan1-green { + label = "green:lan1"; + color = ; + gpios = <&qca8075_0 1 GPIO_ACTIVE_HIGH>; + }; + + lan2-amber { + label = "amber:lan2"; + color = ; + gpios = <&qca8075_1 0 GPIO_ACTIVE_HIGH>; + }; + + lan2-green { + label = "green:lan2"; + color = ; + gpios = <&qca8075_1 1 GPIO_ACTIVE_HIGH>; + }; + + lan3-amber { + label = "amber:lan3"; + color = ; + gpios = <&qca8075_2 0 GPIO_ACTIVE_HIGH>; + }; + + lan3-green { + label = "green:lan3"; + color = ; + gpios = <&qca8075_2 1 GPIO_ACTIVE_HIGH>; + }; + + lan4-amber { + label = "amber:lan4"; + color = ; + gpios = <&qca8075_3 0 GPIO_ACTIVE_HIGH>; + }; + + lan4-green { + label = "green:lan4"; + color = ; + gpios = <&qca8075_3 1 GPIO_ACTIVE_HIGH>; + }; + + wan-amber { + color = ; + function = LED_FUNCTION_WAN; + gpios = <&qca8075_4 0 GPIO_ACTIVE_HIGH>; + }; + + wan-green { + color = ; + function = LED_FUNCTION_WAN; + gpios = <&qca8075_4 1 GPIO_ACTIVE_HIGH>; + }; + + usb { + color = ; + function = LED_FUNCTION_USB; + gpios = <&tlmm 60 GPIO_ACTIVE_HIGH>; + trigger-sources = <&usb3_port1>, <&usb3_port2>; + linux,default-trigger = "usbport"; + }; + }; + + reg_usb_vbus: regulator-usb-vbus { + compatible = "regulator-fixed"; + regulator-name = "usb_vbus"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpio = <&tlmm 61 GPIO_ACTIVE_LOW>; + regulator-always-on; + }; +}; + +&tlmm { + hsuart_pins: hsuart-pins { + mux { + pins = "gpio69", "gpio70", + "gpio71", "gpio72"; + function = "blsp1_uart"; + drive-strength = <8>; + bias-disable; + }; + }; + + i2c_pins: i2c-pins { + mux { + pins = "gpio42", "gpio43"; + function = "blsp2_i2c"; + drive-strength = <8>; + bias-pull-down; + }; + }; + + mdio_pins: mdio-pins { + mdc { + pins = "gpio64"; + function = "mdc"; + drive-strength = <8>; + bias-pull-up; + }; + + mdio { + pins = "gpio65"; + function = "mdio"; + drive-strength = <8>; + bias-pull-up; + }; + }; +}; + +&blsp1_i2c3 { + pinctrl-0 = <&i2c_pins>; + pinctrl-names = "default"; + status = "okay"; + + led-controller@62 { + compatible = "nxp,pca9633"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x62>; + + led_system_red: led@0 { + reg = <0>; + color = ; + function = LED_FUNCTION_STATUS; + }; + + led_system_green: led@1 { + reg = <1>; + color = ; + function = LED_FUNCTION_STATUS; + }; + + led_system_blue: led@2 { + reg = <2>; + color = ; + function = LED_FUNCTION_STATUS; + }; + }; +}; + +&blsp1_uart2 { + pinctrl-0 = <&hsuart_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&blsp1_uart3 { + pinctrl-0 = <&serial_3_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&dwc_0 { + #address-cells = <1>; + #size-cells = <0>; + + usb3_port1: port@1 { + reg = <1>; + #trigger-source-cells = <0>; + }; + + usb3_port2: port@2 { + reg = <2>; + #trigger-source-cells = <0>; + }; +}; + +&qpic_bam { + status = "okay"; +}; + +&qpic_nand { + status = "okay"; + + nand@0 { + reg = <0>; + nand-ecc-strength = <4>; + nand-ecc-step-size = <512>; + nand-bus-width = <8>; + + partitions { + compatible = "qcom,smem-part"; + }; + }; +}; + +&qusb_phy_0 { + status = "okay"; +}; + +&ssphy_0 { + status = "okay"; +}; + +&usb3 { + vbus-supply = <®_usb_vbus>; + status = "okay"; +}; + +&mdio { + status = "okay"; + + pinctrl-0 = <&mdio_pins>; + pinctrl-names = "default"; + reset-gpios = <&tlmm 75 GPIO_ACTIVE_LOW>; + + ethernet-phy-package@0 { + compatible = "qcom,qca8075-package"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + + qca8075_0: ethernet-phy@0 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <0>; + gpio-controller; + #gpio-cells = <2>; + }; + + qca8075_1: ethernet-phy@1 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <1>; + gpio-controller; + #gpio-cells = <2>; + }; + + qca8075_2: ethernet-phy@2 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <2>; + gpio-controller; + #gpio-cells = <2>; + }; + + qca8075_3: ethernet-phy@3 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <3>; + gpio-controller; + #gpio-cells = <2>; + }; + + qca8075_4: ethernet-phy@4 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <4>; + gpio-controller; + #gpio-cells = <2>; + }; + }; +}; + +&switch { + status = "okay"; + + switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4)>; + switch_wan_bmp = ; + switch_mac_mode = ; + + qcom,port_phyinfo { + port@1 { + port_id = <1>; + phy_address = <0>; + }; + port@2 { + port_id = <2>; + phy_address = <1>; + }; + port@3 { + port_id = <3>; + phy_address = <2>; + }; + port@4 { + port_id = <4>; + phy_address = <3>; + }; + port@5 { + port_id = <5>; + phy_address = <4>; + }; + }; +}; + +&edma { + status = "okay"; +}; + +&dp1 { + status = "okay"; + phy-handle = <&qca8075_0>; + label = "lan1"; +}; + +&dp2 { + status = "okay"; + phy-handle = <&qca8075_1>; + label = "lan2"; +}; + +&dp3 { + status = "okay"; + phy-handle = <&qca8075_2>; + label = "lan3"; +}; + +&dp4 { + status = "okay"; + phy-handle = <&qca8075_3>; + label = "lan4"; +}; + +&dp5 { + status = "okay"; + phy-handle = <&qca8075_4>; + label = "wan"; +}; + +&wifi { + status = "okay"; + + qcom,ath11k-calibration-variant = "Linksys-MR7350"; + qcom,ath11k-fw-memory-mode = <1>; +}; diff --git a/target/linux/qualcommax/image/ipq60xx.mk b/target/linux/qualcommax/image/ipq60xx.mk index a7851e3dc58671..5589446c221743 100644 --- a/target/linux/qualcommax/image/ipq60xx.mk +++ b/target/linux/qualcommax/image/ipq60xx.mk @@ -11,6 +11,25 @@ define Device/8devices_mango-dvk endef TARGET_DEVICES += 8devices_mango-dvk +define Device/linksys_mr7350 + $(call Device/FitImage) + DEVICE_VENDOR := Linksys + DEVICE_MODEL := MR7350 + SOC := ipq6000 + NAND_SIZE := 256m + KERNEL_SIZE := 8192k + BLOCKSIZE := 128k + PAGESIZE := 2048 + UBINIZE_OPTS := -E 5 + IMAGE_SIZE := 75776k + IMAGES += factory.bin + IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | \ + append-ubi | linksys-image type=MR7350 + DEVICE_PACKAGES := ipq-wifi-linksys_mr7350 \ + kmod-leds-pca963x kmod-usb-ledtrig-usbport +endef +TARGET_DEVICES += linksys_mr7350 + define Device/netgear_wax214 $(call Device/FitImage) $(call Device/UbiFit) diff --git a/target/linux/qualcommax/ipq60xx/base-files/etc/board.d/01_leds b/target/linux/qualcommax/ipq60xx/base-files/etc/board.d/01_leds new file mode 100644 index 00000000000000..fe2b2e0a9cb965 --- /dev/null +++ b/target/linux/qualcommax/ipq60xx/base-files/etc/board.d/01_leds @@ -0,0 +1,25 @@ + +. /lib/functions/uci-defaults.sh + +board_config_update + +board=$(board_name) + +case "$board" in +linksys,mr7350) + ucidef_set_led_netdev "lan1-port-activity" "LAN1-PORT-ACTIVITY" "amber:lan1" "lan1" "link tx rx" + ucidef_set_led_netdev "lan1-port-link" "LAN1-PORT-LINK" "green:lan1" "lan1" "link_10 link_100 link_1000" + ucidef_set_led_netdev "lan2-port-activity" "LAN2-PORT-ACTIVITY" "amber:lan2" "lan2" "link tx rx" + ucidef_set_led_netdev "lan2-port-link" "LAN2-PORT-LINK" "green:lan2" "lan2" "link_10 link_100 link_1000" + ucidef_set_led_netdev "lan3-port-activity" "LAN3-PORT-ACTIVITY" "amber:lan3" "lan3" "link tx rx" + ucidef_set_led_netdev "lan3-port-link" "LAN3-PORT-LINK" "green:lan3" "lan3" "link_10 link_100 link_1000" + ucidef_set_led_netdev "lan4-port-activity" "LAN4-PORT-ACTIVITY" "amber:lan4" "lan4" "link tx rx" + ucidef_set_led_netdev "lan4-port-link" "LAN4-PORT-LINK" "green:lan4" "lan4" "link_10 link_100 link_1000" + ucidef_set_led_netdev "wan-port-activity" "WAN-PORT-ACTIVITY" "amber:wan" "wan" "link tx rx" + ucidef_set_led_netdev "wan-port-link" "WAN-PORT-LINK" "green:wan" "wan" "link_10 link_100 link_1000" + ;; +esac + +board_config_flush + +exit 0 diff --git a/target/linux/qualcommax/ipq60xx/base-files/etc/board.d/02_network b/target/linux/qualcommax/ipq60xx/base-files/etc/board.d/02_network index aaa2522c928315..e0a3e720a42043 100644 --- a/target/linux/qualcommax/ipq60xx/base-files/etc/board.d/02_network +++ b/target/linux/qualcommax/ipq60xx/base-files/etc/board.d/02_network @@ -14,6 +14,9 @@ ipq60xx_setup_interfaces() 8devices,mango-dvk) ucidef_set_interfaces_lan_wan "lan1 lan2" "wan" ;; + linksys,mr7350) + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan" + ;; netgear,wax214) ucidef_set_interfaces_lan_wan "lan" ;; @@ -23,9 +26,30 @@ ipq60xx_setup_interfaces() esac } +ipq60xx_setup_macs() +{ + local board="$1" + local lan_mac="" + local wan_mac="" + local label_mac="" + + case $board in + linksys,mr7350) + label_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr) + lan_mac=$label_mac + wan_mac=$label_mac + ;; + esac + + [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac + [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac + [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac +} + board_config_update board=$(board_name) ipq60xx_setup_interfaces $board +ipq60xx_setup_macs $board board_config_flush exit 0 diff --git a/target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/firmware/11-ath11-caldata b/target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/firmware/11-ath11-caldata index 89d4c265abb517..db504d0b8f95e8 100644 --- a/target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/firmware/11-ath11-caldata +++ b/target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/firmware/11-ath11-caldata @@ -12,6 +12,7 @@ case "$FIRMWARE" in 8devices,mango-dvk) caldata_extract "0:ART" 0x1000 0x20000 ;; + linksys,mr7350|\ netgear,wax214) caldata_extract "0:art" 0x1000 0x10000 ;; diff --git a/target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac new file mode 100644 index 00000000000000..a67cc7262b3cac --- /dev/null +++ b/target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -0,0 +1,18 @@ +[ "$ACTION" == "add" ] || exit 0 + +PHYNBR=${DEVPATH##*/phy} + +[ -n $PHYNBR ] || exit 0 + +. /lib/functions.sh +. /lib/functions/system.sh + +board=$(board_name) + +case "$board" in + linksys,mr7350) + addr=$(mtd_get_mac_ascii devinfo hw_mac_addr) + [ "$PHYNBR" = "0" ] && macaddr_add $addr 2 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress + ;; +esac diff --git a/target/linux/qualcommax/ipq60xx/base-files/etc/init.d/bootcount b/target/linux/qualcommax/ipq60xx/base-files/etc/init.d/bootcount new file mode 100644 index 00000000000000..15ae67aaae6dd6 --- /dev/null +++ b/target/linux/qualcommax/ipq60xx/base-files/etc/init.d/bootcount @@ -0,0 +1,11 @@ +#!/bin/sh /etc/rc.common + +START=99 + +boot() { + case $(board_name) in + linksys,mr7350) + mtd resetbc s_env || true + ;; + esac +} diff --git a/target/linux/qualcommax/ipq60xx/base-files/lib/upgrade/platform.sh b/target/linux/qualcommax/ipq60xx/base-files/lib/upgrade/platform.sh index 4008cb0224193c..6fd9743d2e45ba 100644 --- a/target/linux/qualcommax/ipq60xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/qualcommax/ipq60xx/base-files/lib/upgrade/platform.sh @@ -10,6 +10,20 @@ platform_check_image() { platform_do_upgrade() { case "$(board_name)" in + linksys,mr7350) + boot_part="$(fw_printenv -n boot_part)" + if [ "$boot_part" -eq "1" ]; then + fw_setenv boot_part 2 + CI_KERNPART="alt_kernel" + CI_UBIPART="alt_rootfs" + else + fw_setenv boot_part 1 + CI_UBIPART="rootfs" + fi + fw_setenv boot_part_ready 3 + fw_setenv auto_recovery yes + nand_do_upgrade "$1" + ;; netgear,wax214) nand_do_upgrade "$1" ;;