From d76ef71367f87911588e48c381de13691ab90db7 Mon Sep 17 00:00:00 2001 From: Hugo Yuan <429632952@163.com> Date: Fri, 5 Nov 2021 00:05:49 +0800 Subject: [PATCH] ipq40xx: Add ZTE MF263 support (#8181) --- .../ipq-wifi/._board-zte_mf263.qca4019.bin | Bin 0 -> 4096 bytes package/firmware/ipq-wifi/Makefile | 4 +- .../firmware/ipq-wifi/board-zte_mf263.qca4019 | Bin 0 -> 24308 bytes .../ipq40xx/base-files/etc/board.d/02_network | 8 + .../etc/hotplug.d/firmware/11-ath10k-caldata | 8 + .../base-files/lib/upgrade/platform.sh | 4 + .../arm/boot/dts/qcom-ipq4019-zte-mf263.dts | 390 ++++++++++++++++++ target/linux/ipq40xx/image/Makefile | 14 + .../901-arm-boot-add-dts-files.patch | 3 +- 9 files changed, 429 insertions(+), 2 deletions(-) create mode 100755 package/firmware/ipq-wifi/._board-zte_mf263.qca4019.bin create mode 100755 package/firmware/ipq-wifi/board-zte_mf263.qca4019 create mode 100755 target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-zte-mf263.dts diff --git a/package/firmware/ipq-wifi/._board-zte_mf263.qca4019.bin b/package/firmware/ipq-wifi/._board-zte_mf263.qca4019.bin new file mode 100755 index 0000000000000000000000000000000000000000..12c97a5d1608ae0e781a2b4e3be751eb159c2c0d GIT binary patch literal 4096 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDJkFz{^v(m+1nBL)UWIUpMX1Yitw+A$;~ zh~b0cJBSX33Uv8V{%8n{hQMeDjE2By2#kinXb6mkz-S1JhQMeDjE2By2+$$~7=ea@ zFc`>%WMmdA6r~pDmlh?bDx~EXWh-Rnm89mCWaj53=Hyf=!cbj9 QnnLwI+$%B+a{vDW09alfl>h($ literal 0 HcmV?d00001 diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index 0baada32e..e21d4def6 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -59,7 +59,8 @@ ALLWIFIBOARDS:= \ redmi_ax6 \ xiaomi_ax3600 \ xiaomi_ax9000 \ - zte_mf269 + zte_mf269 \ + zte_mf263 ALLWIFIPACKAGES:=$(foreach BOARD,$(ALLWIFIBOARDS),ipq-wifi-$(BOARD)) @@ -164,5 +165,6 @@ $(eval $(call generate-ipq-wifi-package,redmi_ax6,Redmi AX6)) $(eval $(call generate-ipq-wifi-package,xiaomi_ax3600,Xiaomi AX3600)) $(eval $(call generate-ipq-wifi-package,xiaomi_ax9000,Xiaomi AX9000)) $(eval $(call generate-ipq-wifi-package,zte_mf269,ZTE MF269)) +$(eval $(call generate-ipq-wifi-package,zte_mf263,ZTE MF263)) $(foreach PACKAGE,$(ALLWIFIPACKAGES),$(eval $(call BuildPackage,$(PACKAGE)))) diff --git a/package/firmware/ipq-wifi/board-zte_mf263.qca4019 b/package/firmware/ipq-wifi/board-zte_mf263.qca4019 new file mode 100755 index 0000000000000000000000000000000000000000..8903e90b4737cc55efe1871e3993efc81ef7ed97 GIT binary patch literal 24308 zcmeHPdr(tX8b1j^)WyOLAtJ;}2;mWg0D)?d$Xm)I1&fLVSOh9aQlq@W!_WmgJ}5*) zuoesvv<%9lDI#O>0kK$HJEP40v48CB%(k6?hPR!ByGZD8sL86 zob#P?&v(vue)o{vo9~zVMtp2g?7pPXkkp{K^w^99AeBl1l#*a92Ve(Gg|doW1to=n zg;H_QnM7z_K88LRfsc^U;Pov z!_PT>VB$k%Q*B{(GCVk}Y^@b%?@5lD=*POjHa;|HZmP}}CP(51kNg6_#0}+HIK%77 z5fdLl0|{=>2L~z1PUZW<;o53TvorW1GX{Qh{rj0(EtH?>GWRfHFc%Ngwbg)<>6NXl z*52lV>WCu0Oh)QtdwG4LlzY%MZhWAuGx3anxm$kcU`}Vm8D@n`L0?mWETYhN@7Cmd ztw-y2ivx39qdx1eeLwvSw_@v?cLu9FUvCboW)zQ}Evbnr;$$KbcVWK-2{*?j>RO+; zBdKXywMWVA539O^>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poftChwK@)&7OiE^vAt`^wa4^D((QeOS=g7{<4@+^ zVd!h7{$C8+z8uk9P*uq@MZsU*)+kkV@;nh=b4ztmUM5Q9`)Eegy$ZQR#Ajf?5xaNa z&mTa8c9l%NU&NgnR-acKlVpha>QPmXL?TM#2Wmc6waKNTI6f0I7@zd>19&%yJX4-I zbw}N$kV*E6cBtdT5MIPR;OVf6=!I*CXmP-_%Q zNoCS*e>Z%FwVJ_?U^sj4OMNn3D(hj0znhz(xq6E0bD0tu7|l*}No8n%X+r4h|*7J-hD zqt~J@1T}h8T~Ys9nQ+dpZp+cii-{*WW$uNJiT8Vp&hCoMM$Zi$=T4TjJ{irSyzPAEh)0)@~_wKF~jWxF@lVeVkU@F>v&9bdzrl zt>9XxxG_o=aM&fa@A|Pzkte;&X?d6W3p!()y(*}A7y87P1gE_#TyoF09C$li!pfn> zj0{wCrJeP!b}L%58;4jpfxs$2V6ji%fX~3viwQi28}s?j_|rFheAw_0K6!)b?d8St z$^{)JIDOUWKf-OtF4wO0K( zzCBy}Xc-2>9pf>>$IiIByAf@x2Ls#R?~rE?nNS$lz86x5*p4tk7EBD}-*4>YG+-%Z zQeWa6dNO5(Lk~y^kgp#Q!7j7?brK#LBY^SYDU?GXtK<5^<>12`&$rZdb3A)p`!C70 v$L1#Z_IRvop&7xqUnp{foy{U(NzB+B$KJ5rW*4|f#|XatQh!QXH{SmN?KK!Y literal 0 HcmV?d00001 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 2014ca3e5..41dfd6ba7 100755 --- a/target/linux/ipq40xx/base-files/etc/board.d/02_network +++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network @@ -84,6 +84,10 @@ ipq40xx_setup_interfaces() ucidef_add_switch "switch0" \ "0t@eth0" "5:wan" "3:lan" ;; + zte,mf263) + ucidef_add_switch "switch0" \ + "0t@eth0" "2:lan" "3:lan" "4:lan" "5:wan" + ;; mobipromo,cm520-79f) ucidef_add_switch "switch0" \ "0t@eth0" "3:lan:2" "4:lan:1" "5:wan" @@ -168,6 +172,10 @@ ipq40xx_setup_macs() wan_mac=$(cat /sys/class/net/eth0/address) lan_mac=$(macaddr_add "$wan_mac" 1) ;; + zte,mf263) + wan_mac=$(mtd_get_mac_binary mac 0x0) + lan_mac=$(macaddr_add "$wan_mac" 1) + ;; esac [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac diff --git a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 4d2d564f7..bd42c51f7 100644 --- a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -147,6 +147,10 @@ case "$FIRMWARE" in caldata_extract "ART" 0x1000 0x2f20 ath10k_patch_mac $(mtd_get_mac_binary dnidata 0x0) ;; + zte,mf263) + caldata_extract "0:ART" 0x1000 0x2f20 + ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary mac 0x0) +2) + ;; zyxel,nbg6617 |\ zyxel,wre6606) caldata_extract "ART" 0x1000 0x2f20 @@ -250,6 +254,10 @@ case "$FIRMWARE" in caldata_extract "ART" 0x5000 0x2f20 ath10k_patch_mac $(mtd_get_mac_binary dnidata 0xc) ;; + zte,mf263) + caldata_extract "0:ART" 0x5000 0x2f20 + ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary mac 0x0) +3) + ;; zyxel,nbg6617 |\ zyxel,wre6606) caldata_extract "ART" 0x5000 0x2f20 diff --git a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh index 49fb4e3de..c6a1246b9 100644 --- a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh @@ -212,6 +212,10 @@ platform_do_upgrade() { asus_nand_upgrade_tar 20951040 "$1" fi ;; + zte,mf263) + PART_NAME=rootfs + nand_do_upgrade "$1" + ;; cellc,rtl30vw) CI_UBIPART="ubifs" askey_do_upgrade "$1" diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-zte-mf263.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-zte-mf263.dts new file mode 100755 index 000000000..ed78d8497 --- /dev/null +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-zte-mf263.dts @@ -0,0 +1,390 @@ +/* + * Copyright (c) 2021 Hugo Yuan + */ + +#include "qcom-ipq4019.dtsi" +#include +#include +#include + +/ { + model = "ZTE MF263"; + compatible = "zte,mf263", "qcom,ipq4019"; + + memory { + device_type = "memory"; + reg = <0x80000000 0x10000000>; /* 256MB */ + }; + + aliases { + led-boot = &power; + led-failsafe = &power; + led-running = &power; + led-upgrade = &power; + }; + + chosen { + bootargs-override = "ubi.mtd=rootfs root=/dev/ubiblock0_1 rootfstype=squashfs rootwait clk_ignore_unused"; + }; + + soc { + mdio@90000 { + status = "okay"; + pinctrl-0 = <&mdio_pins>; + pinctrl-names = "default"; + }; + + ess-psgmii@98000 { + status = "okay"; + }; + + tcsr@1949000 { + compatible = "qcom,tcsr"; + reg = <0x1949000 0x100>; + qcom,wifi_glb_cfg = ; + }; + + tcsr@194b000 { + /* select hostmode */ + compatible = "qcom,tcsr"; + reg = <0x194b000 0x100>; + qcom,usb-hsphy-mode-select = ; + status = "okay"; + }; + + ess_tcsr@1953000 { + compatible = "qcom,tcsr"; + reg = <0x1953000 0x1000>; + qcom,ess-interface-select = ; + }; + + tcsr@1957000 { + compatible = "qcom,tcsr"; + reg = <0x1957000 0x100>; + qcom,wifi_noc_memtype_m0_m2 = ; + }; + + usb2@60f8800 { + status = "okay"; + + dwc3@6000000 { + #address-cells = <1>; + #size-cells = <0>; + + usb2_port1: port@1 { + reg = <1>; + #trigger-source-cells = <0>; + }; + }; + }; + + serial@78af000 { + pinctrl-0 = <&serial_0_pins>; + pinctrl-names = "default"; + status = "okay"; + }; + + serial@78b0000 { + pinctrl-0 = <&serial_1_pins>; + pinctrl-names = "default"; + status = "okay"; + }; + + i2c@78b7000 { /* BLSP1 QUP2 */ + pinctrl-0 = <&i2c_0_pins>; + pinctrl-names = "default"; + + status = "okay"; + }; + + usb3: usb3@8af8800 { + status = "okay"; + + dwc3@8a00000 { + #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>; + }; + }; + }; + + crypto@8e3a000 { + status = "okay"; + }; + + watchdog@b017000 { + status = "okay"; + }; + + ess-switch@c000000 { + status = "okay"; + }; + + edma@c080000 { + status = "okay"; + }; + + leds { + compatible = "gpio-leds"; + + power: status { + label = "status"; + gpios = <&tlmm 36 GPIO_ACTIVE_LOW>; + }; + + other: other { + label = "other"; + gpios = <&tlmm 40 GPIO_ACTIVE_LOW>; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&tlmm 68 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&tlmm 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + }; +}; + +&blsp_dma { + status = "okay"; +}; + +&blsp1_spi1 { + pinctrl-0 = <&spi_0_pins>; + pinctrl-names = "default"; + status = "okay"; + cs-gpios = <&tlmm 12 GPIO_ACTIVE_LOW>, + <&tlmm 54 GPIO_ACTIVE_HIGH>; + num-cs = <2>; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "mx25l1606e", "n25q128a11"; + spi-max-frequency = <24000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "0:SBL1"; + reg = < 0x00 0x40000 >; + }; + + partition@40000 { + label = "0:MIBIB"; + reg = < 0x40000 0x20000 >; + }; + + partition@60000 { + label = "0:QSEE"; + reg = < 0x60000 0x60000 >; + }; + + partition@c0000 { + label = "0:CDT"; + reg = < 0xc0000 0x10000 >; + }; + + partition@d0000 { + label = "0:DDRPARAMS"; + reg = < 0xd0000 0x10000 >; + }; + + partition@e0000 { + label = "0:APPSBLENV"; + reg = < 0xe0000 0x10000 >; + }; + + partition@f0000 { + label = "0:APPSBL"; + reg = < 0xf0000 0xc0000 >; + }; + + partition@1b0000 { + label = "0:reserved1"; + reg = < 0x1b0000 0x50000 >; + }; + }; + }; + + spi-nand@1 { + compatible = "spi-nand"; + reg = <1>; + spi-max-frequency = <24000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "fota-flag"; + reg = < 0x00 0xa0000 >; + }; + + partition@a0000 { + label = "0:ART"; + reg = < 0xa0000 0x80000 >; + }; + + partition@120000 { + label = "mac"; + reg = < 0x120000 0x80000 >; + }; + + partition@1a0000 { + label = "reserved2"; + reg = < 0x1a0000 0xc0000 >; + }; + + partition@260000 { + label = "cfg-param"; + reg = < 0x260000 0x400000 >; + }; + + partition@660000 { + label = "log"; + reg = < 0x660000 0x400000 >; + }; + + partition@a60000 { + label = "oops"; + reg = < 0xa60000 0xa0000 >; + }; + + partition@b00000 { + label = "reserved3"; + reg = < 0xb00000 0x500000 >; + }; + + partition@1000000 { + label = "web"; + reg = < 0x1000000 0x800000 >; + }; + + partition@1800000 { + label = "rootfs"; + reg = < 0x1800000 0x1d00000 >; + }; + + partition@3500000 { + label = "data"; + reg = < 0x3500000 0x1900000 >; + }; + + partition@4e00000 { + label = "fota"; + reg = < 0x4e00000 0x3200000 >; + }; + }; + }; +}; + +&cryptobam { + status = "okay"; +}; + +&qpic_bam { + status = "okay"; +}; + +&tlmm { + i2c_0_pins: i2c-0-pinmux { + mux { + pins = "gpio20", "gpio21"; + function = "blsp_i2c0"; + bias-disable; + }; + }; + + mdio_pins: mdio_pinmux { + mux_1 { + pins = "gpio6"; + function = "mdio"; + bias-pull-up; + }; + + mux_2 { + pins = "gpio7"; + function = "mdc"; + bias-pull-up; + }; + }; + + serial_0_pins: serial0-pinmux { + mux { + pins = "gpio16", "gpio17"; + function = "blsp_uart0"; + bias-disable; + }; + }; + + serial_1_pins: serial1_pinmux { + mux { + pins = "gpio8", "gpio9"; + function = "blsp_uart1"; + bias-disable; + }; + }; + + spi_0_pins: spi_0_pinmux { + pinmux { + function = "blsp_spi0"; + pins = "gpio13", "gpio14", "gpio15"; + drive-strength = <12>; + bias-disable; + }; + + pinmux_cs { + function = "gpio"; + pins = "gpio12"; + drive-strength = <2>; + bias-disable; + output-high; + }; + }; +}; + +&usb3_ss_phy { + status = "okay"; +}; + +&usb3_hs_phy { + status = "okay"; +}; + +&usb2_hs_phy { + status = "okay"; +}; + +&wifi0 { + status = "okay"; + qcom,ath10k-calibration-variant = "zte_mf263"; +}; + +&wifi1 { + status = "okay"; + qcom,ath10k-calibration-variant = "zte_mf263"; +}; diff --git a/target/linux/ipq40xx/image/Makefile b/target/linux/ipq40xx/image/Makefile index a22018fe2..c9445deb0 100644 --- a/target/linux/ipq40xx/image/Makefile +++ b/target/linux/ipq40xx/image/Makefile @@ -704,6 +704,20 @@ define Device/p2w_r619ac-128m endef TARGET_DEVICES += p2w_r619ac-128m +define Device/zte_mf263 + $(call Device/FitzImage) + $(call Device/UbiFit) + DEVICE_VENDOR := ZTE + DEVICE_MODEL := MF263 + DEVICE_DTS := qcom-ipq4019-zte-mf263 + BLOCKSIZE := 128k + PAGESIZE := 2048 + IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + DEVICE_PACKAGES := -kmod-ath10k-ct -ath10k-firmware-qca4019-ct kmod-ath10k ath10k-firmware-qca4019 ipq-wifi-zte_mf263 +endef +TARGET_DEVICES += zte_mf263 + define Device/qcom_ap-dk01.1-c1 DEVICE_VENDOR := Qualcomm Atheros DEVICE_MODEL := AP-DK01.1 diff --git a/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch b/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch index 6b6af5865..832d51aa9 100644 --- a/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch +++ b/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch @@ -10,7 +10,7 @@ Signed-off-by: John Crispin --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile -@@ -837,11 +837,58 @@ dtb-$(CONFIG_ARCH_QCOM) += \ +@@ -837,11 +837,59 @@ dtb-$(CONFIG_ARCH_QCOM) += \ qcom-apq8074-dragonboard.dtb \ qcom-apq8084-ifc6540.dtb \ qcom-apq8084-mtp.dtb \ @@ -43,6 +43,7 @@ Signed-off-by: John Crispin + qcom-ipq4019-ea8300.dtb \ + qcom-ipq4019-eap2200.dtb \ + qcom-ipq4019-hugo-ac1200.dtb \ ++ qcom-ipq4019-zte-mf263.dtb \ + qcom-ipq4019-fritzbox-7530.dtb \ + qcom-ipq4019-fritzrepeater-1200.dtb \ + qcom-ipq4019-fritzrepeater-3000.dtb \