ipq60xx: add CMIOT-AX18/ZN-M2 support

This commit is contained in:
coolsnowwolf 2022-10-28 11:43:33 +08:00
parent e9f105edda
commit 8e68a5d788
9 changed files with 453 additions and 5 deletions

View File

@ -0,0 +1,25 @@
#!/bin/sh
#
# Copyright (C) 2015 OpenWrt.org
#
. /lib/functions/uci-defaults.sh
board_config_update
board=$(board_name)
case "$board" in
cmiot,ax18|\
zn,m2)
ucidef_set_led_netdev "wan" "WAN" "blue:wan" "eth0"
ucidef_set_led_netdev "wlan2g" "WLAN2G" "blue:wlan2g" "wlan1"
ucidef_set_led_netdev "wlan5g" "WLAN5G" "blue:wlan5g" "wlan0"
;;
*)
;;
esac
board_config_flush
exit 0

View File

@ -6,6 +6,10 @@ setup_network()
local macaddr local macaddr
case $(board_name) in case $(board_name) in
cmiot,ax18|\
zn,m2)
ucidef_set_interfaces_lan_wan "eth1 eth2 eth3" "eth0"
;;
linksys,mr7350) linksys,mr7350)
ucidef_set_interfaces_lan_wan "eth0 eth1 eth2 eth3" "eth4" ucidef_set_interfaces_lan_wan "eth0 eth1 eth2 eth3" "eth4"
;; ;;

View File

@ -3,11 +3,35 @@
[ -e /lib/firmware/$FIRMWARE ] && exit 0 [ -e /lib/firmware/$FIRMWARE ] && exit 0
. /lib/functions/caldata.sh . /lib/functions/caldata.sh
. /lib/functions/system.sh
board=$(board_name)
ath11k_generate_macs() {
case "$board" in
linksys,mr7350)
eth=$(mtd_get_mac_ascii devinfo hw_mac_addr)
;;
*)
eth=$(cat /sys/class/net/eth0/address)
;;
esac
touch /lib/firmware/ath11k-macs
mac1=$(macaddr_add $eth 2)
mac2=$(macaddr_add $eth 3)
mac3=$(macaddr_add $eth 4)
echo -ne \\x${mac1//:/\\x} >> /lib/firmware/ath11k-macs
echo -ne \\x${mac2//:/\\x} >> /lib/firmware/ath11k-macs
echo -ne \\x${mac3//:/\\x} >> /lib/firmware/ath11k-macs
}
case "$FIRMWARE" in case "$FIRMWARE" in
"ath11k/IPQ6018/hw1.0/cal-ahb-c000000.wifi.bin") "ath11k/IPQ6018/hw1.0/cal-ahb-c000000.wifi.bin")
case $(board_name) in case "$board" in
linksys,mr7350) cmiot,ax18|\
linksys,mr|\
zn,m2)
caldata_extract "0:art" 0x1000 0x10000 caldata_extract "0:art" 0x1000 0x10000
;; ;;
tplink,eap610-outdoor) tplink,eap610-outdoor)
@ -15,8 +39,22 @@ case "$FIRMWARE" in
cp /tmp/factory_data/radio "/lib/firmware/$FIRMWARE" cp /tmp/factory_data/radio "/lib/firmware/$FIRMWARE"
;; ;;
*) *)
caldata_die "Don't know how to read caldata for $(board_name)" caldata_die "Don't know how to read caldata for $board"
;; ;;
esac esac
;; ;;
ath11k-macs)
case "$board" in
cmiot,ax18|\
linksys,mr7350|\
zn,m2)
ath11k_generate_macs
;;
esac
;;
*)
exit 1
;;
esac esac

View File

@ -0,0 +1,22 @@
PART_NAME=firmware
REQUIRE_IMAGE_METADATA=1
RAMFS_COPY_BIN='fw_printenv fw_setenv'
RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
platform_check_image() {
return 0;
}
platform_do_upgrade() {
case "$(board_name)" in
cmiot,ax18|\
zn,m2)
nand_do_upgrade "$1"
;;
*)
default_do_upgrade "$1"
;;
esac
}

View File

@ -0,0 +1,67 @@
// SPDX-License-Identifier: (GPL-2.0+)
/dts-v1/;
#include "ipq6018-cmiot.dtsi"
/ {
model = "CMIOT AX18";
compatible = "cmiot,ax18", "qcom,ipq6018";
aliases {
led-boot = &led_power;
led-failsafe = &led_power;
led-running = &led_power;
led-upgrade = &led_power;
};
leds {
compatible = "gpio-leds";
pinctrl-0 = <&leds_pins>;
pinctrl-names = "default";
led_power: power {
label = "ax18:blue:power";
gpio = <&tlmm 73 GPIO_ACTIVE_HIGH>;
};
wan {
label = "ax18:blue:wan";
gpio = <&tlmm 74 GPIO_ACTIVE_HIGH>;
};
wlan2g {
label = "ax18:blue:wlan2g";
gpio = <&tlmm 37 GPIO_ACTIVE_HIGH>;
};
wlan5g {
label = "ax18:blue:wlan5g";
gpio = <&tlmm 35 GPIO_ACTIVE_HIGH>;
};
wps {
label = "ax18:red:wps";
gpio = <&tlmm 69 GPIO_ACTIVE_HIGH>;
};
};
};
&tlmm {
leds_pins: leds_pins {
mux_0 {
pins = "gpio35", "gpio37",
"gpio69", "gpio74";
function = "gpio";
drive-strength = <8>;
bias-pull-down;
};
mux_1 {
pins = "gpio73";
function = "gpio";
drive-strength = <8>;
bias-pull-up;
};
};
};

View File

@ -0,0 +1,200 @@
// SPDX-License-Identifier: (GPL-2.0+)
/dts-v1/;
#include "ipq6018.dtsi"
#include "ipq6018-upstreamable.dtsi"
#include "ipq6018-ess.dtsi"
#include <dt-bindings/input/input.h>
#include <dt-bindings/gpio/gpio.h>
/ {
qcom,msm-id = <0x192 0x0>;
aliases {
serial0 = &blsp1_uart3;
/* Aliases as required by u-boot to patch MAC addresses */
ethernet0 = &dp1;
ethernet1 = &dp2;
ethernet2 = &dp3;
ethernet3 = &dp4;
};
chosen {
bootargs-append = " root=/dev/ubiblock0_1 swiotlb=1";
};
keys {
compatible = "gpio-keys";
reset {
label = "reset";
gpios = <&tlmm 60 GPIO_ACTIVE_LOW>;
linux,code = <KEY_RESTART>;
};
wps {
label = "wps";
gpios = <&tlmm 9 GPIO_ACTIVE_LOW>;
linux,code = <KEY_WPS_BUTTON>;
};
};
};
&blsp1_uart3 {
pinctrl-0 = <&serial_3_pins>;
pinctrl-names = "default";
status = "okay";
};
&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;
};
};
button_pins: button_pins {
wps_button {
pins = "gpio9";
function = "gpio";
drive-strength = <8>;
bias-pull-up;
};
reset_button {
pins = "gpio60";
function = "gpio";
drive-strength = <8>;
bias-pull-up;
};
};
};
&soc {
dp1: dp@1 {
compatible = "qcom,nss-dp";
reg = <0x0 0x3a001000 0x0 0x200>;
qcom,mactype = <0>;
qcom,id = <5>;
local-mac-address = [000000000000];
phy-handle = <&phy_0>;
phy-mode = "sgmii";
};
dp2: dp2 {
compatible = "qcom,nss-dp";
reg = <0x0 0x3a001200 0x0 0x200>;
qcom,mactype = <0>;
qcom,id = <1>;
local-mac-address = [000000000000];
phy-handle = <&phy_1>;
phy-mode = "sgmii";
};
dp3: dp3 {
compatible = "qcom,nss-dp";
reg = <0x0 0x3a001400 0x0 0x200>;
qcom,mactype = <0>;
qcom,id = <2>;
local-mac-address = [000000000000];
phy-handle = <&phy_2>;
phy-mode = "sgmii";
};
dp4: dp4 {
compatible = "qcom,nss-dp";
reg = <0x0 0x3a001600 0x0 0x200>;
qcom,mactype = <0>;
qcom,id = <4>;
local-mac-address = [000000000000];
phy-handle = <&phy_3>;
phy-mode = "sgmii";
};
};
&edma {
status = "okay";
};
&mdio {
status = "okay";
pinctrl-0 = <&mdio_pins>;
pinctrl-names = "default";
reset-gpios = <&tlmm 75 GPIO_ACTIVE_LOW>;
phy_0: ethernet-phy@0 {
reg = <4>;
};
phy_1: ethernet-phy@1 {
reg = <0>;
};
phy_2: ethernet-phy@2 {
reg = <1>;
};
phy_3: ethernet-phy@3 {
reg = <3>;
};
};
&switch {
status = "okay";
switch_mac_mode = <0x0>; /* mac mode for uniphy instance0*/
switch_mac_mode1 = <0xff>; /* mac mode for uniphy instance1*/
switch_mac_mode2 = <0xff>; /* mac mode for uniphy instance2*/
qcom,port_phyinfo {
port@0 {
port_id = <0x01>;
phy_address = <0x00>;
};
port@1 {
port_id = <0x02>;
phy_address = <0x01>;
};
port@2 {
port_id = <0x04>;
phy_address = <0x03>;
};
port@3 {
port_id = <0x05>;
phy_address = <0x04>;
};
};
};
&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>;
};
};
&wifi {
status = "okay";
};

View File

@ -0,0 +1,66 @@
// SPDX-License-Identifier: (GPL-2.0+)
/dts-v1/;
#include "ipq6018-cmiot.dtsi"
/ {
model = "ZN M2";
compatible = "zn,m2", "qcom,ipq6018";
aliases {
led-boot = &led_power;
led-failsafe = &led_power;
led-running = &led_power;
led-upgrade = &led_power;
};
leds {
compatible = "gpio-leds";
pinctrl-0 = <&leds_pins>;
pinctrl-names = "default";
led_power: power {
label = "m2:blue:power";
gpio = <&tlmm 58 GPIO_ACTIVE_HIGH>;
};
mesh {
label = "m2:blue:mesh";
gpio = <&tlmm 73 GPIO_ACTIVE_HIGH>;
};
lan {
label = "m2:blue:lan";
gpio = <&tlmm 74 GPIO_ACTIVE_HIGH>;
};
wan {
label = "m2:blue:wan";
gpio = <&tlmm 37 GPIO_ACTIVE_HIGH>;
};
wlan5g {
label = "m2:blue:wlan5g";
gpio = <&tlmm 35 GPIO_ACTIVE_HIGH>;
};
wlan2g {
label = "m2:blue:wlan2g";
gpio = <&tlmm 70 GPIO_ACTIVE_HIGH>;
};
};
};
&tlmm {
leds_pins: leds_pins {
mux {
pins = "gpio35", "gpio37",
"gpio58", "gpio70",
"gpio73", "gpio74";
function = "gpio";
drive-strength = <8>;
bias-pull-down;
};
};
};

View File

@ -23,6 +23,18 @@ define Device/UbiFit
IMAGE/nand-sysupgrade.bin := sysupgrade-tar | append-metadata IMAGE/nand-sysupgrade.bin := sysupgrade-tar | append-metadata
endef endef
define Device/cmiot_ax18
$(call Device/FitImage)
$(call Device/UbiFit)
DEVICE_VENDOR := CMIOT
DEVICE_MODEL := AX18
BLOCKSIZE := 128k
PAGESIZE := 2048
DEVICE_DTS_CONFIG := config@cp03-c1
SOC := ipq6018
endef
TARGET_DEVICES += cmiot_ax18
define Device/mr7350 define Device/mr7350
$(call Device/FitImage) $(call Device/FitImage)
DEVICE_VENDOR := Linksys DEVICE_VENDOR := Linksys
@ -51,3 +63,15 @@ define Device/eap610-outdoor
IMAGE/nand-factory.ubi := append-ubi | qsdk-ipq-factory-nand IMAGE/nand-factory.ubi := append-ubi | qsdk-ipq-factory-nand
endef endef
TARGET_DEVICES += eap610-outdoor TARGET_DEVICES += eap610-outdoor
define Device/zn_m2
$(call Device/FitImage)
$(call Device/UbiFit)
DEVICE_VENDOR := ZN
DEVICE_MODEL := M2
BLOCKSIZE := 128k
PAGESIZE := 2048
DEVICE_DTS_CONFIG := config@cp03-c1
SOC := ipq6018
endef
TARGET_DEVICES += zn_m2

View File

@ -16,12 +16,14 @@ diff --git a/arch/arm64/boot/dts/qcom/Makefile b/arch/arm64/boot/dts/qcom/Makefi
index 70516508be56..27a7e3f98465 100644 index 70516508be56..27a7e3f98465 100644
--- a/arch/arm64/boot/dts/qcom/Makefile --- a/arch/arm64/boot/dts/qcom/Makefile
+++ b/arch/arm64/boot/dts/qcom/Makefile +++ b/arch/arm64/boot/dts/qcom/Makefile
@@ -4,6 +4,8 @@ dtb-$(CONFIG_ARCH_QCOM) += apq8094-sony-xperia-kitakami-karin_windy.dtb @@ -4,6 +4,10 @@ dtb-$(CONFIG_ARCH_QCOM) += apq8094-sony-xperia-kitakami-karin_windy.dtb
dtb-$(CONFIG_ARCH_QCOM) += apq8096-db820c.dtb dtb-$(CONFIG_ARCH_QCOM) += apq8096-db820c.dtb
dtb-$(CONFIG_ARCH_QCOM) += apq8096-ifc6640.dtb dtb-$(CONFIG_ARCH_QCOM) += apq8096-ifc6640.dtb
dtb-$(CONFIG_ARCH_QCOM) += ipq6018-cp01-c1.dtb dtb-$(CONFIG_ARCH_QCOM) += ipq6018-cp01-c1.dtb
+dtb-$(CONFIG_ARCH_QCOM) += ipq6018-eap610-outdoor.dtb +dtb-$(CONFIG_ARCH_QCOM) += ipq6018-eap610-outdoor.dtb
+dtb-$(CONFIG_ARCH_QCOM) += ipq6018-mr7350.dtb +dtb-$(CONFIG_ARCH_QCOM) += ipq6018-mr7350.dtb
+dtb-$(CONFIG_ARCH_QCOM) += ipq6018-ax18.dtb
+dtb-$(CONFIG_ARCH_QCOM) += ipq6018-m2.dtb
dtb-$(CONFIG_ARCH_QCOM) += ipq8074-hk01.dtb dtb-$(CONFIG_ARCH_QCOM) += ipq8074-hk01.dtb
dtb-$(CONFIG_ARCH_QCOM) += ipq8074-hk10-c1.dtb dtb-$(CONFIG_ARCH_QCOM) += ipq8074-hk10-c1.dtb
dtb-$(CONFIG_ARCH_QCOM) += ipq8074-hk10-c2.dtb dtb-$(CONFIG_ARCH_QCOM) += ipq8074-hk10-c2.dtb