From 6c52d1ded1f927c84d7a85de3f01779095d27ff2 Mon Sep 17 00:00:00 2001 From: aiamadeus <2789289348@qq.com> Date: Sun, 10 Dec 2023 23:25:08 +0800 Subject: [PATCH] ipq60xx: add GL.iNet GL-AX1800 support --- .../arm64/boot/dts/qcom/ipq6000-gl-ax1800.dts | 51 ++++ .../boot/dts/qcom/ipq6000-gl-axt1800.dts | 117 +++++++++ .../arm64/boot/dts/qcom/ipq6000-glinet.dtsi | 231 ++++++++++++++++++ target/linux/qualcommax/image/ipq60xx.mk | 26 ++ .../ipq60xx/base-files/etc/board.d/02_network | 4 + .../etc/hotplug.d/firmware/11-ath11k-caldata | 2 + .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 5 + .../base-files/lib/upgrade/platform.sh | 4 + .../0400-mtd-nand-raw-add-dosilicon-id.patch | 20 ++ 9 files changed, 460 insertions(+) create mode 100644 target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-gl-ax1800.dts create mode 100644 target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-gl-axt1800.dts create mode 100644 target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-glinet.dtsi create mode 100644 target/linux/qualcommax/patches-6.1/0400-mtd-nand-raw-add-dosilicon-id.patch diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-gl-ax1800.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-gl-ax1800.dts new file mode 100644 index 00000000000000..a9e42dca8d6317 --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-gl-ax1800.dts @@ -0,0 +1,51 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; + +#include "ipq6000-glinet.dtsi" + +/ { + model = "GL.iNet GL-AX1800"; + compatible = "glinet,gl-ax1800", "qcom,ipq6018"; + + aliases { + ethernet0 = &dp1; + ethernet1 = &dp2; + label-mac-device = &dp1; + }; +}; + +&switch { + switch_lan_bmp = <0x3c>; /* lan port bitmap */ + switch_wan_bmp = <0x02>; /* wan port bitmap */ +}; + +&dp1 { + status = "okay"; + phy-handle = <&qca8075_0>; + label = "wan"; +}; + +&dp2 { + status = "okay"; + phy-handle = <&qca8075_1>; + label = "lan1"; +}; + +&dp3 { + status = "okay"; + phy-handle = <&qca8075_2>; + label = "lan2"; +}; + +&dp4 { + status = "okay"; + phy-handle = <&qca8075_3>; + label = "lan3"; +}; + +&dp5 { + status = "okay"; + phy-handle = <&qca8075_4>; + label = "lan4"; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-gl-axt1800.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-gl-axt1800.dts new file mode 100644 index 00000000000000..6afdfa31d5c8fb --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-gl-axt1800.dts @@ -0,0 +1,117 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; + +#include "ipq6000-glinet.dtsi" + +/ { + model = "GL.iNet GL-AXT1800"; + compatible = "glinet,gl-axt1800", "qcom,ipq6018"; + + aliases { + ethernet0 = &dp1; + ethernet1 = &dp3; + label-mac-device = &dp1; + }; + + vcc_sd: regulator-vcc-sd { + compatible = "regulator-fixed"; + regulator-name = "vcc_sd"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + gpios = <&tlmm 66 GPIO_ACTIVE_HIGH>; + enable-active-high; + regulator-always-on; + }; + + vcc_fan: regulator-vcc-fan { + compatible = "regulator-fixed"; + regulator-name = "vcc_fan"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpio = <&tlmm 29 GPIO_ACTIVE_HIGH>; + enable-active-high; + regulator-boot-on; + }; + + fan: pwm-fan { + compatible = "pwm-fan"; + fan-supply = <&vcc_fan>; + pwms = <&pwm 1 40000 0>; + pinctrl-0 = <&fan_pins>; + pinctrl-names = "default"; + cooling-levels = <36 128 192 255>; + #cooling-cells = <2>; + }; +}; + +&tlmm { + fan_pins: fan-pins { + speed { + pins = "gpio31"; + function = "gpio"; + drive-strength = <8>; + bias-pull-down; + }; + }; + + pwm_pins: pwm-pins { + pwm { + pins = "gpio30"; + function = "pwm13"; + drive-strength = <8>; + }; + }; + + sd_pins: sd-pins { + sd { + pins = "gpio62"; + function = "sd_card"; + bias-pull-up; + }; + ldo { + pins = "gpio66"; + function = "gpio"; + bias-pull-up; + }; + }; +}; + +&pwm { + pinctrl-0 = <&pwm_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&sdhc { + mmc-ddr-1_8v; + bus-width = <4>; + cd-gpios = <&tlmm 62 GPIO_ACTIVE_LOW>; + pinctrl-0 = <&sd_pins>; + pinctrl-names = "default"; + vqmmc-supply = <&vcc_sd>; + status = "okay"; +}; + +&switch { + switch_lan_bmp = <0x0c>; /* lan port bitmap */ + switch_wan_bmp = <0x02>; /* wan port bitmap */ +}; + +&dp1 { + status = "okay"; + phy-handle = <&qca8075_0>; + label = "wan"; +}; + +&dp2 { + status = "okay"; + phy-handle = <&qca8075_1>; + label = "lan2"; +}; + +&dp3 { + status = "okay"; + phy-handle = <&qca8075_2>; + label = "lan1"; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-glinet.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-glinet.dtsi new file mode 100644 index 00000000000000..4538f75c1cbbce --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-glinet.dtsi @@ -0,0 +1,231 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ipq6018-512m.dtsi" +#include "ipq6018-ess.dtsi" +#include "ipq6000-opp.dtsi" + +#include +#include + +/ { + aliases { + led-boot = &led_run; + led-failsafe = &led_run; + led-running = &led_run; + led-upgrade = &led_run; + serial0 = &blsp1_uart3; + serial1 = &blsp1_uart4; + serial2 = &blsp1_uart5; + }; + + chosen { + stdout-path = "serial0:115200n8"; + bootargs-append = " root=/dev/ubiblock0_1"; + }; + + keys { + compatible = "gpio-keys"; + + switch { + label = "switch"; + linux,code = ; + linux,input-type = ; + gpios = <&tlmm 9 GPIO_ACTIVE_LOW>; + }; + + reset { + label = "reset"; + linux,code = ; + gpios = <&tlmm 18 GPIO_ACTIVE_LOW>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_run: run { + label = "blue:run"; + gpio = <&tlmm 37 GPIO_ACTIVE_HIGH>; + }; + + system { + label = "white:system"; + gpio = <&tlmm 35 GPIO_ACTIVE_HIGH>; + }; + }; + + reg_usb_vbus: regulator-usb-vbus { + compatible = "regulator-fixed"; + regulator-name = "usb_vbus"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpio = <&tlmm 0 GPIO_ACTIVE_HIGH>; + enable-active-high; + regulator-always-on; + }; +}; + +&tlmm { + 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; + }; + }; + + tluart_pins: tluart-pins { + mux { + pins = "gpio75", "gpio76"; + function = "blsp3_uart"; + drive-strength = <8>; + bias-disable; + }; + }; + + hsuart_pins: hsuart-pins { + mux { + pins = "gpio57", "gpio58"; + function = "blsp4_uart"; + drive-strength = <8>; + bias-disable; + }; + }; +}; + +&blsp1_uart3 { + pinctrl-0 = <&serial_3_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&blsp1_uart4 { + pinctrl-0 = <&tluart_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&blsp1_uart5 { + pinctrl-0 = <&hsuart_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&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"; +}; + +&rpm { + status = "disabled"; +}; + +&mdio { + status = "okay"; + + pinctrl-0 = <&mdio_pins>; + pinctrl-names = "default"; + reset-gpios = <&tlmm 74 GPIO_ACTIVE_LOW>; + + qca8075_0: ethernet-phy@0 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <0>; + }; + + qca8075_1: ethernet-phy@1 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <1>; + }; + + qca8075_2: ethernet-phy@2 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <2>; + }; + + qca8075_3: ethernet-phy@3 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <3>; + }; + + qca8075_4: ethernet-phy@4 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <4>; + }; +}; + +&switch { + status = "okay"; + + switch_cpu_bmp = <0x1>; /* cpu port bitmap */ + switch_mac_mode = <0x0>; /* mac mode for uniphy 0*/ + switch_mac_mode1 = <0xff>; /* mac mode for uniphy 1*/ + switch_mac_mode2 = <0xff>; /* mac mode for uniphy 2*/ + + qcom,port_phyinfo { + port@0 { + port_id = <1>; + phy_address = <0>; + }; + port@1 { + port_id = <2>; + phy_address = <1>; + }; + port@2 { + port_id = <3>; + phy_address = <2>; + }; + port@3 { + port_id = <4>; + phy_address = <3>; + }; + port@4 { + port_id = <5>; + phy_address = <4>; + }; + }; +}; + +&edma { + status = "okay"; +}; + +&wifi { + status = "okay"; + + qcom,ath11k-fw-memory-mode = <1>; +}; diff --git a/target/linux/qualcommax/image/ipq60xx.mk b/target/linux/qualcommax/image/ipq60xx.mk index a1ab215ceb9bbc..c11531a5e24a01 100644 --- a/target/linux/qualcommax/image/ipq60xx.mk +++ b/target/linux/qualcommax/image/ipq60xx.mk @@ -17,6 +17,32 @@ define Device/UbiFit IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef +define Device/glinet_gl-ax1800 + $(call Device/FitImage) + $(call Device/UbiFit) + DEVICE_VENDOR := GL.iNet + DEVICE_MODEL := GL-AX1800 + BLOCKSIZE := 128k + PAGESIZE := 2048 + DEVICE_DTS_CONFIG := config@cp03-c1 + SOC := ipq6000 + DEVICE_PACKAGES := ipq-wifi-glinet_gl-ax1800 +endef +TARGET_DEVICES += glinet_gl-ax1800 + +define Device/glinet_gl-axt1800 + $(call Device/FitImage) + $(call Device/UbiFit) + DEVICE_VENDOR := GL.iNet + DEVICE_MODEL := GL-AXT1800 + BLOCKSIZE := 128k + PAGESIZE := 2048 + DEVICE_DTS_CONFIG := config@cp03-c1 + SOC := ipq6000 + DEVICE_PACKAGES := ipq-wifi-glinet_gl-axt1800 kmod-hwmon-gpiofan +endef +TARGET_DEVICES += glinet_gl-axt1800 + define Device/linksys_mr7350 $(call Device/FitImage) DEVICE_VENDOR := Linksys 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 40ae93927ba88c..75f2be164125c9 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 @@ -11,9 +11,13 @@ ipq60xx_setup_interfaces() local board="$1" case "$board" in + glinet,gl-ax1800|\ linksys,mr7350) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan" ;; + glinet,gl-axt1800) + ucidef_set_interfaces_lan_wan "lan1 lan2" "wan" + ;; qihoo,360v6|\ xiaomi,rm1800) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan" diff --git a/target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata b/target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata index 7084b3a0111a07..7790992146a4ef 100644 --- a/target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata +++ b/target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata @@ -9,6 +9,8 @@ board=$(board_name) case "$FIRMWARE" in "ath11k/IPQ6018/hw1.0/cal-ahb-c000000.wifi.bin") case "$board" in + glinet,gl-ax1800|\ + glinet,gl-axt1800|\ linksys,mr7350|\ qihoo,360v6) caldata_extract "0:art" 0x1000 0x20000 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 index 88ff7c6ce2764f..b2180e9f6c0993 100644 --- 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 @@ -10,6 +10,11 @@ PHYNBR=${DEVPATH##*/phy} board=$(board_name) case "$board" in + glinet,gl-ax1800|\ + glinet,gl-axt1800) + [ "$PHYNBR" = "0" ] && macaddr_add $(get_mac_label) 3 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $(get_mac_label) 2 > /sys${DEVPATH}/macaddress + ;; linksys,mr7350) addr=$(mtd_get_mac_ascii devinfo hw_mac_addr) [ "$PHYNBR" = "0" ] && macaddr_add $addr 2 > /sys${DEVPATH}/macaddress 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 73fb1e3b69aeec..5e11b0b2127437 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,10 @@ platform_check_image() { platform_do_upgrade() { case "$(board_name)" in + glinet,gl-ax1800|\ + glinet,gl-axt1800) + nand_do_upgrade "$1" + ;; linksys,mr7350) boot_part="$(fw_printenv -n boot_part)" if [ "$boot_part" -eq "1" ]; then diff --git a/target/linux/qualcommax/patches-6.1/0400-mtd-nand-raw-add-dosilicon-id.patch b/target/linux/qualcommax/patches-6.1/0400-mtd-nand-raw-add-dosilicon-id.patch new file mode 100644 index 00000000000000..5d65f83d9e14ca --- /dev/null +++ b/target/linux/qualcommax/patches-6.1/0400-mtd-nand-raw-add-dosilicon-id.patch @@ -0,0 +1,20 @@ +--- a/drivers/mtd/nand/raw/internals.h ++++ b/drivers/mtd/nand/raw/internals.h +@@ -18,6 +18,7 @@ + */ + #define NAND_MFR_AMD 0x01 + #define NAND_MFR_ATO 0x9b ++#define NAND_MFR_DOSILICON 0xf8 + #define NAND_MFR_EON 0x92 + #define NAND_MFR_ESMT 0xc8 + #define NAND_MFR_FUJITSU 0x04 +--- a/drivers/mtd/nand/raw/nand_ids.c ++++ b/drivers/mtd/nand/raw/nand_ids.c +@@ -178,6 +178,7 @@ struct nand_flash_dev nand_flash_ids[] = + static const struct nand_manufacturer_desc nand_manufacturer_descs[] = { + {NAND_MFR_AMD, "AMD/Spansion", &amd_nand_manuf_ops}, + {NAND_MFR_ATO, "ATO"}, ++ {NAND_MFR_DOSILICON, "Dosilicon"}, + {NAND_MFR_EON, "Eon"}, + {NAND_MFR_ESMT, "ESMT", &esmt_nand_manuf_ops}, + {NAND_MFR_FUJITSU, "Fujitsu"},