diff --git a/root/package/firmware/ipq-wifi/Makefile b/root/package/firmware/ipq-wifi/Makefile index 8bf3b414..ec01e76b 100644 --- a/root/package/firmware/ipq-wifi/Makefile +++ b/root/package/firmware/ipq-wifi/Makefile @@ -37,6 +37,7 @@ ALLWIFIBOARDS:= \ ezviz_cs-w3-wd1200g-eup \ glinet_gl-s1300 \ linksys_ea8300 \ + pangu_l1000 \ p2w_r619ac \ mobipromo_cm520-79f \ qxwlan_e2600ac @@ -114,6 +115,7 @@ $(eval $(call generate-ipq-wifi-package,glinet_gl-s1300,GL.iNet GL-S1300)) $(eval $(call generate-ipq-wifi-package,linksys_ea8300,Linksys EA8300)) $(eval $(call generate-ipq-wifi-package,mobipromo_cm520-79f,MobiPromo CM520-79F)) $(eval $(call generate-ipq-wifi-package,qxwlan_e2600ac,Qxwlan E2600AC)) +$(eval $(call generate-ipq-wifi-package,pangu_l1000,PANGU L1000)) $(eval $(call generate-ipq-wifi-package,p2w_r619ac,P&W R619AC)) $(foreach PACKAGE,$(ALLWIFIPACKAGES),$(eval $(call BuildPackage,$(PACKAGE)))) diff --git a/root/package/firmware/ipq-wifi/board-pangu_l1000.qca4019 b/root/package/firmware/ipq-wifi/board-pangu_l1000.qca4019 new file mode 100755 index 00000000..f61f4f52 Binary files /dev/null and b/root/package/firmware/ipq-wifi/board-pangu_l1000.qca4019 differ diff --git a/root/package/firmware/wireless-regdb/patches/501-CN-regd.patch b/root/package/firmware/wireless-regdb/patches/501-CN-regd.patch new file mode 100644 index 00000000..198d1978 --- /dev/null +++ b/root/package/firmware/wireless-regdb/patches/501-CN-regd.patch @@ -0,0 +1,24 @@ +diff -uprN a/db.txt b/db.txt +--- a/db.txt 2020-01-06 19:33:27.707188000 +0800 ++++ b/db.txt 2020-01-06 19:39:28.663199594 +0800 +@@ -291,15 +291,15 @@ country CL: DFS-JP + (5735 - 5835 @ 80), (20) + + country CN: DFS-FCC +- (2402 - 2482 @ 40), (20) +- (5170 - 5250 @ 80), (23), AUTO-BW +- (5250 - 5330 @ 80), (23), DFS, AUTO-BW ++ (2402 - 2482 @ 40), (30) ++ (5170 - 5250 @ 80), (30), AUTO-BW ++ (5250 - 5330 @ 80), (30), DFS, AUTO-BW + (5735 - 5835 @ 80), (30) + # 60 GHz band channels 1,4: 28dBm, channels 2,3: 44dBm + # ref: http://www.miit.gov.cn/n11293472/n11505629/n11506593/n11960250/n11960606/n11960700/n12330791.files/n12330790.pdf +- (57240 - 59400 @ 2160), (28) ++ (57240 - 59400 @ 2160), (30) + (59400 - 63720 @ 2160), (44) +- (63720 - 65880 @ 2160), (28) ++ (63720 - 65880 @ 2160), (30) + + country CO: DFS-FCC + (2402 - 2482 @ 40), (20) diff --git a/root/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/root/package/kernel/mac80211/files/lib/wifi/mac80211.sh new file mode 100644 index 00000000..bf1dddd5 --- /dev/null +++ b/root/package/kernel/mac80211/files/lib/wifi/mac80211.sh @@ -0,0 +1,127 @@ +#!/bin/sh +. /lib/netifd/mac80211.sh + +append DRIVERS "mac80211" + +lookup_phy() { + [ -n "$phy" ] && { + [ -d /sys/class/ieee80211/$phy ] && return + } + + local devpath + config_get devpath "$device" path + [ -n "$devpath" ] && { + phy="$(mac80211_path_to_phy "$devpath")" + [ -n "$phy" ] && return + } + + local macaddr="$(config_get "$device" macaddr | tr 'A-Z' 'a-z')" + [ -n "$macaddr" ] && { + for _phy in /sys/class/ieee80211/*; do + [ -e "$_phy" ] || continue + + [ "$macaddr" = "$(cat ${_phy}/macaddress)" ] || continue + phy="${_phy##*/}" + return + done + } + phy= + return +} + +find_mac80211_phy() { + local device="$1" + + config_get phy "$device" phy + lookup_phy + [ -n "$phy" -a -d "/sys/class/ieee80211/$phy" ] || { + echo "PHY for wifi device $1 not found" + return 1 + } + config_set "$device" phy "$phy" + + config_get macaddr "$device" macaddr + [ -z "$macaddr" ] && { + config_set "$device" macaddr "$(cat /sys/class/ieee80211/${phy}/macaddress)" + } + + return 0 +} + +check_mac80211_device() { + config_get phy "$1" phy + [ -z "$phy" ] && { + find_mac80211_phy "$1" >/dev/null || return 0 + config_get phy "$1" phy + } + [ "$phy" = "$dev" ] && found=1 +} + +detect_mac80211() { + devidx=0 + config_load wireless + while :; do + config_get type "radio$devidx" type + [ -n "$type" ] || break + devidx=$(($devidx + 1)) + done + + for _dev in /sys/class/ieee80211/*; do + [ -e "$_dev" ] || continue + + dev="${_dev##*/}" + + found=0 + config_foreach check_mac80211_device wifi-device + [ "$found" -gt 0 ] && continue + + mode_band="g" + channel="13" + htmode="" + ht_capab="" + + iw phy "$dev" info | grep -q 'Capabilities:' && htmode=HT40 + + iw phy "$dev" info | grep -q '\* 5... MHz \[' && { + mode_band="a" + channel=$(iw phy "$dev" info | grep '\* 5... MHz \[' | grep '(disabled)' -v -m 1 | sed 's/[^[]*\[\|\].*//g') + iw phy "$dev" info | grep -q 'VHT Capabilities' && htmode="VHT80" + } + + [ -n "$htmode" ] && ht_capab="set wireless.radio${devidx}.htmode=$htmode" + + path="$(mac80211_phy_to_path "$dev")" + if [ -n "$path" ]; then + dev_id="set wireless.radio${devidx}.path='$path'" + else + dev_id="set wireless.radio${devidx}.macaddr=$(cat /sys/class/ieee80211/${dev}/macaddress)" + fi + if [ x$mode_band == x"a" ]; then + ssid_5ghz="-5G" + else + ssid_5ghz="-2.4G" + fi + + uci -q batch <<-EOF + set wireless.radio${devidx}=wifi-device + set wireless.radio${devidx}.type=mac80211 + set wireless.radio${devidx}.channel=${channel} + set wireless.radio${devidx}.hwmode=11${mode_band} + set wireless.radio${devidx}.txpower=22 + set wireless.radio${devidx}.country=CN + ${dev_id} + ${ht_capab} + set wireless.radio${devidx}.disabled=0 + + set wireless.default_radio${devidx}=wifi-iface + set wireless.default_radio${devidx}.device=radio${devidx} + set wireless.default_radio${devidx}.network=lan + set wireless.default_radio${devidx}.mode=ap + set wireless.default_radio${devidx}.ssid=OpenWrt${ssid_5ghz}-$(cat /sys/class/ieee80211/${dev}/macaddress | awk -F ":" '{print $4""$5""$6 }'| tr a-z A-Z) + set wireless.default_radio${devidx}.encryption=none +EOF + uci -q commit wireless + + devidx=$(($devidx + 1)) + done +} diff --git a/root/target/linux/ipq40xx/base-files/etc/board.d/01_leds b/root/target/linux/ipq40xx/base-files/etc/board.d/01_leds index 4aeeba46..5a9a05cd 100644 --- a/root/target/linux/ipq40xx/base-files/etc/board.d/01_leds +++ b/root/target/linux/ipq40xx/base-files/etc/board.d/01_leds @@ -53,6 +53,12 @@ engenius,ens620ext) ucidef_set_led_netdev "lan1" "LAN1" "${boardname}:green:lan1" "eth0" ucidef_set_led_netdev "lan2" "LAN2" "${boardname}:green:lan2" "eth1" ;; +pangu,l1000) +ucidef_set_led_default "power" "POWER" "${boardname}:blue:power" "1" +ucidef_set_led_wlan "wlan2g" "WLAN2G" "${boardname}:blue:wlan2g" "phy0tpt" +ucidef_set_led_wlan "wlan5g" "WLAN5G" "${boardname}:blue:wlan5g" "phy1tpt" +ucidef_set_led_switch "wan" "WAN" "${boardname}:blue:wan" "switch0" "0x20" + ;; mobipromo,cm520-79f) ucidef_set_led_netdev "wan" "WAN" "${boardname}:blue:wan" "eth1" ucidef_set_led_switch "lan1" "LAN1" "${boardname}:blue:lan1" "switch0" "0x10" diff --git a/root/target/linux/ipq40xx/base-files/etc/board.d/02_network b/root/target/linux/ipq40xx/base-files/etc/board.d/02_network index 0ac8b59a..f49f224e 100755 --- a/root/target/linux/ipq40xx/base-files/etc/board.d/02_network +++ b/root/target/linux/ipq40xx/base-files/etc/board.d/02_network @@ -52,6 +52,7 @@ ipq40xx_setup_interfaces() ;; avm,fritzbox-4040|\ linksys,ea6350v3|\ + pangu,l1000|\ linksys,ea8300) ucidef_set_interfaces_lan_wan "eth0" "eth1" ucidef_add_switch "switch0" \ diff --git a/root/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/root/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 4b69c79f..22fbf2db 100644 --- a/root/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/root/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -124,6 +124,10 @@ case "$FIRMWARE" in caldata_extract "ART" 0x1000 0x2f20 ath10k_patch_mac $(macaddr_add "$(cat /sys/class/net/eth0/address)" 2) ;; + pangu,l1000) + caldata_extract "ART" 0x1000 0x2f20 + ath10k_patch_mac $(macaddr_add "$(cat /sys/class/net/eth0/address)" 2) + ;; meraki,mr33) caldata_extract_ubi "ART" 0x1000 0x2f20 caldata_valid "202f" || caldata_extract "ART" 0x1000 0x2f20 @@ -219,6 +223,10 @@ case "$FIRMWARE" in caldata_extract "ART" 0x5000 0x2f20 ath10k_patch_mac $(macaddr_add "$(cat /sys/class/net/eth0/address)" 3) ;; + pangu,l1000) + caldata_extract "ART" 0x5000 0x2f20 + th10k_patch_mac $(macaddr_add "$(cat /sys/class/net/eth0/address)" 3) + ;; meraki,mr33) caldata_extract_ubi "ART" 0x5000 0x2f20 caldata_valid "202f" || caldata_extract "ART" 0x5000 0x2f20 diff --git a/root/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh b/root/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh index 9daa7768..66fd2c50 100644 --- a/root/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh +++ b/root/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh @@ -170,6 +170,7 @@ zyxel_do_upgrade() { platform_do_upgrade() { case "$(board_name)" in + pangu,l1000 |\ 8dev,jalapeno |\ aruba,ap-303 |\ aruba,ap-303h |\ diff --git a/root/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-l1000.dts b/root/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-l1000.dts new file mode 100644 index 00000000..1dfdf582 --- /dev/null +++ b/root/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-l1000.dts @@ -0,0 +1,388 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later OR MIT + * + * Copyright (c) 2018 Peng Zhang + * + */ + +#include "qcom-ipq4019.dtsi" +#include +#include +#include + +/ { + + model = "PANGU L1000"; + compatible = "pangu,l1000", "qcom,ipq4019"; + + + memory { + device_type = "memory"; + reg = <0x80000000 0x20000000>; /* 512MB */ + }; + + aliases { + sdhc1 = &sdhci; + led-boot = &power; + led-failsafe = &power; + led-running = &power; + led-upgrade = &power; + }; + + chosen { + bootargs-append = " root=/dev/ubiblock0_1 rootfstype=squashfs"; + }; + + soc { + rng@22000 { + status = "okay"; + }; + + mdio@90000 { + status = "okay"; + pinctrl-0 = <&mdio_pins>; + pinctrl-names = "default"; + reset-gpios = <&tlmm 47 GPIO_ACTIVE_LOW>; + reset-delay-us = <2000>; + }; + + 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"; + }; + + usb3@8af8800 { + status = "okay"; + }; + + crypto@8e3a000 { + status = "okay"; + }; + + watchdog@b017000 { + status = "okay"; + }; + + ess-switch@c000000 { + status = "okay"; + switch_lan_bmp = <0x18>; + switch_wan_bmp = <0x20>; + }; + + i2c@78b7000 { /* BLSP1 QUP2 */ + pinctrl-0 = <&i2c_0_pins>; + pinctrl-names = "default"; + + status = "okay"; + }; + + edma@c080000 { + status = "okay"; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&tlmm 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + power: status { + label = "l1000:blue:status"; + gpios = <&tlmm 3 GPIO_ACTIVE_LOW>; + }; + + wlan2g { + label = "l1000:blue:wlan2g"; + gpios = <&tlmm 1 GPIO_ACTIVE_LOW>; + }; + + wlan5g { + label = "l1000:bule:wlan5g"; + gpios = <&tlmm 2 GPIO_ACTIVE_LOW>; + }; + + wan: wan { + label = "l1000:bule:usb"; + gpios = <&tlmm 4 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&vqmmc { + status = "okay"; +}; + +&sdhci { + status = "okay"; + pinctrl-0 = <&sd_pins>; + pinctrl-names = "default"; + cd-gpios = <&tlmm 22 GPIO_ACTIVE_LOW>; + vqmmc-supply = <&vqmmc>; +}; + +&blsp_dma { + status = "okay"; +}; + +&cryptobam { + status = "okay"; +}; + +&blsp1_spi1 { + pinctrl-0 = <&spi_0_pins>; + pinctrl-names = "default"; + status = "okay"; + cs-gpios = <&tlmm 12 GPIO_ACTIVE_HIGH>; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <24000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + SBL1@0 { + label = "SBL1"; + reg = <0x0 0x40000>; + read-only; + }; + + MIBIB@40000 { + label = "MIBIB"; + reg = <0x40000 0x20000>; + }; + + QSEE@60000 { + label = "QSEE"; + reg = <0x60000 0x60000>; + read-only; + }; + + CDT@c0000 { + label = "CDT"; + reg = <0xc0000 0x10000>; + read-only; + }; + + DDRPARAMS@d0000 { + label = "DDRPARAMS"; + reg = <0xd0000 0x10000>; + read-only; + }; + + APPSBLENV@e0000 { + label = "APPSBLENV"; + reg = <0xe0000 0x10000>; + }; + + APPSBL@f0000 { + label = "APPSBL"; + reg = <0xf0000 0x80000>; + }; + + ART@170000 { + label = "ART"; + reg = <0x170000 0x10000>; + }; + }; + }; +}; + +&nand { + pinctrl-0 = <&nand_pins>; + pinctrl-names = "default"; + status = "okay"; + + nand@0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + rootfs@0 { + label = "rootfs"; + reg = <0x0 0x8000000>; + }; + }; + }; +}; + +&qpic_bam { + status = "okay"; +}; + +&blsp1_uart1 { + pinctrl-0 = <&serial_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&blsp1_uart2 { + pinctrl-0 = <&serial_1_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&tlmm { + serial_pins: serial_pinmux { + mux { + pins = "gpio16", "gpio17"; + function = "blsp_uart0"; + 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_1_pins: serial1_pinmux { + mux { + pins = "gpio8", "gpio9", + "gpio10", "gpio11"; + function = "blsp_uart1"; + bias-disable; + }; + }; + + i2c_0_pins: i2c-0-pinmux { + mux { + pins = "gpio20", "gpio21"; + function = "blsp_i2c0"; + bias-disable; + }; + }; + + spi_0_pins: spi_0_pinmux { + pinmux { + function = "blsp_spi0"; + pins = "gpio13", "gpio14", "gpio15"; + }; + pinmux_cs { + function = "gpio"; + pins = "gpio12"; + }; + pinconf { + pins = "gpio13", "gpio14", "gpio15"; + drive-strength = <12>; + bias-disable; + }; + pinconf_cs { + pins = "gpio12"; + drive-strength = <2>; + bias-disable; + output-high; + }; + }; + + nand_pins: nand_pins { + pullups { + pins = "gpio52", "gpio53", "gpio58", + "gpio59"; + function = "qpic"; + bias-pull-up; + }; + + pulldowns { + pins = "gpio54", "gpio55", "gpio56", + "gpio57", "gpio60", "gpio61", + "gpio62", "gpio63", "gpio64", + "gpio65", "gpio66", "gpio67", + "gpio68", "gpio69"; + function = "qpic"; + bias-pull-down; + }; + }; + + sd_pins: sd_pins { + pinmux { + function = "sdio"; + pins = "gpio23", "gpio24", "gpio25", "gpio26", + "gpio28", "gpio29", "gpio30", "gpio31"; + drive-strength = <10>; + }; + + pinmux_sd_clk { + function = "sdio"; + pins = "gpio27"; + drive-strength = <16>; + }; + + pinmux_sd7 { + function = "sdio"; + pins = "gpio32"; + drive-strength = <10>; + bias-disable; + }; + }; +}; + +&usb2_hs_phy { + status = "okay"; +}; + +&usb3_hs_phy { + status = "okay"; +}; + +&usb3_ss_phy { + status = "okay"; +}; + +&wifi0 { + status = "okay"; + qcom,ath10k-calibration-variant = "PANGU-L1000"; +}; + +&wifi1 { + status = "okay"; + qcom,ath10k-calibration-variant = "PANGU-L1000"; +}; diff --git a/root/target/linux/ipq40xx/image/Makefile b/root/target/linux/ipq40xx/image/Makefile index 44b6da6d..9074aeef 100644 --- a/root/target/linux/ipq40xx/image/Makefile +++ b/root/target/linux/ipq40xx/image/Makefile @@ -627,6 +627,20 @@ define Device/qcom_ap-dk04.1-c1 endef TARGET_DEVICES += qcom_ap-dk04.1-c1 + $(call Device/FitImage) + $(call Device/UbiFit) + DEVICE_VENDOR := PANGU + DEVICE_MODEL := L1000 + SOC := qcom-ipq4019 + DEVICE_DTS := qcom-ipq4019-l1000 + KERNEL_INSTALL := 1 + BLOCKSIZE := 128k + PAGESIZE := 2048 + BOARD_NAME := l1000 + DEVICE_PACKAGES := ipq-wifi-pangu_l1000 ++endef ++TARGET_DEVICES += pangu_l1000 + define Device/p2w_r619ac $(call Device/FitzImage) $(call Device/UbiFit) diff --git a/root/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch b/root/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch index ade7a675..5aa9be3b 100644 --- a/root/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch +++ b/root/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,52 @@ dtb-$(CONFIG_ARCH_QCOM) += \ +@@ -837,11 +837,53 @@ dtb-$(CONFIG_ARCH_QCOM) += \ qcom-apq8074-dragonboard.dtb \ qcom-apq8084-ifc6540.dtb \ qcom-apq8084-mtp.dtb \ @@ -44,6 +44,7 @@ Signed-off-by: John Crispin + qcom-ipq4019-fritzrepeater-1200.dtb \ + qcom-ipq4019-fritzrepeater-3000.dtb \ + qcom-ipq4019-r619ac.dtb \ ++ qcom-ipq4019-l1000.dtb \ + qcom-ipq4019-r619ac-128m.dtb \ + qcom-ipq4019-map-ac2200.dtb \ + qcom-ipq4019-e2600ac-c1.dtb \