Skip to content

Commit 8e68a5d

Browse files
committed
ipq60xx: add CMIOT-AX18/ZN-M2 support
1 parent e9f105e commit 8e68a5d

File tree

9 files changed

+453
-5
lines changed

9 files changed

+453
-5
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/sh
2+
#
3+
# Copyright (C) 2015 OpenWrt.org
4+
#
5+
6+
. /lib/functions/uci-defaults.sh
7+
8+
board_config_update
9+
10+
board=$(board_name)
11+
12+
case "$board" in
13+
cmiot,ax18|\
14+
zn,m2)
15+
ucidef_set_led_netdev "wan" "WAN" "blue:wan" "eth0"
16+
ucidef_set_led_netdev "wlan2g" "WLAN2G" "blue:wlan2g" "wlan1"
17+
ucidef_set_led_netdev "wlan5g" "WLAN5G" "blue:wlan5g" "wlan0"
18+
;;
19+
*)
20+
;;
21+
esac
22+
23+
board_config_flush
24+
25+
exit 0

target/linux/ipq60xx/base-files/etc/board.d/02_network

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ setup_network()
66
local macaddr
77

88
case $(board_name) in
9+
cmiot,ax18|\
10+
zn,m2)
11+
ucidef_set_interfaces_lan_wan "eth1 eth2 eth3" "eth0"
12+
;;
913
linksys,mr7350)
1014
ucidef_set_interfaces_lan_wan "eth0 eth1 eth2 eth3" "eth4"
1115
;;

target/linux/ipq60xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata

+42-4
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,58 @@
33
[ -e /lib/firmware/$FIRMWARE ] && exit 0
44

55
. /lib/functions/caldata.sh
6+
. /lib/functions/system.sh
7+
8+
board=$(board_name)
9+
10+
ath11k_generate_macs() {
11+
case "$board" in
12+
linksys,mr7350)
13+
eth=$(mtd_get_mac_ascii devinfo hw_mac_addr)
14+
;;
15+
*)
16+
eth=$(cat /sys/class/net/eth0/address)
17+
;;
18+
esac
19+
20+
touch /lib/firmware/ath11k-macs
21+
mac1=$(macaddr_add $eth 2)
22+
mac2=$(macaddr_add $eth 3)
23+
mac3=$(macaddr_add $eth 4)
24+
echo -ne \\x${mac1//:/\\x} >> /lib/firmware/ath11k-macs
25+
echo -ne \\x${mac2//:/\\x} >> /lib/firmware/ath11k-macs
26+
echo -ne \\x${mac3//:/\\x} >> /lib/firmware/ath11k-macs
27+
}
628

729
case "$FIRMWARE" in
830
"ath11k/IPQ6018/hw1.0/cal-ahb-c000000.wifi.bin")
9-
case $(board_name) in
10-
linksys,mr7350)
31+
case "$board" in
32+
cmiot,ax18|\
33+
linksys,mr|\
34+
zn,m2)
1135
caldata_extract "0:art" 0x1000 0x10000
1236
;;
1337
tplink,eap610-outdoor)
1438
# /tmp/factory_data should be mounted by preinit
1539
cp /tmp/factory_data/radio "/lib/firmware/$FIRMWARE"
1640
;;
1741
*)
18-
caldata_die "Don't know how to read caldata for $(board_name)"
19-
;;
42+
caldata_die "Don't know how to read caldata for $board"
43+
;;
2044
esac
2145
;;
46+
47+
ath11k-macs)
48+
case "$board" in
49+
cmiot,ax18|\
50+
linksys,mr7350|\
51+
zn,m2)
52+
ath11k_generate_macs
53+
;;
54+
esac
55+
;;
56+
57+
*)
58+
exit 1
59+
;;
2260
esac
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
PART_NAME=firmware
3+
REQUIRE_IMAGE_METADATA=1
4+
5+
RAMFS_COPY_BIN='fw_printenv fw_setenv'
6+
RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
7+
8+
platform_check_image() {
9+
return 0;
10+
}
11+
12+
platform_do_upgrade() {
13+
case "$(board_name)" in
14+
cmiot,ax18|\
15+
zn,m2)
16+
nand_do_upgrade "$1"
17+
;;
18+
*)
19+
default_do_upgrade "$1"
20+
;;
21+
esac
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// SPDX-License-Identifier: (GPL-2.0+)
2+
3+
/dts-v1/;
4+
5+
#include "ipq6018-cmiot.dtsi"
6+
7+
/ {
8+
model = "CMIOT AX18";
9+
compatible = "cmiot,ax18", "qcom,ipq6018";
10+
11+
aliases {
12+
led-boot = &led_power;
13+
led-failsafe = &led_power;
14+
led-running = &led_power;
15+
led-upgrade = &led_power;
16+
};
17+
18+
leds {
19+
compatible = "gpio-leds";
20+
pinctrl-0 = <&leds_pins>;
21+
pinctrl-names = "default";
22+
23+
led_power: power {
24+
label = "ax18:blue:power";
25+
gpio = <&tlmm 73 GPIO_ACTIVE_HIGH>;
26+
};
27+
28+
wan {
29+
label = "ax18:blue:wan";
30+
gpio = <&tlmm 74 GPIO_ACTIVE_HIGH>;
31+
};
32+
33+
wlan2g {
34+
label = "ax18:blue:wlan2g";
35+
gpio = <&tlmm 37 GPIO_ACTIVE_HIGH>;
36+
};
37+
38+
wlan5g {
39+
label = "ax18:blue:wlan5g";
40+
gpio = <&tlmm 35 GPIO_ACTIVE_HIGH>;
41+
};
42+
43+
wps {
44+
label = "ax18:red:wps";
45+
gpio = <&tlmm 69 GPIO_ACTIVE_HIGH>;
46+
};
47+
};
48+
};
49+
50+
&tlmm {
51+
leds_pins: leds_pins {
52+
mux_0 {
53+
pins = "gpio35", "gpio37",
54+
"gpio69", "gpio74";
55+
function = "gpio";
56+
drive-strength = <8>;
57+
bias-pull-down;
58+
};
59+
60+
mux_1 {
61+
pins = "gpio73";
62+
function = "gpio";
63+
drive-strength = <8>;
64+
bias-pull-up;
65+
};
66+
};
67+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
// SPDX-License-Identifier: (GPL-2.0+)
2+
3+
/dts-v1/;
4+
5+
#include "ipq6018.dtsi"
6+
#include "ipq6018-upstreamable.dtsi"
7+
#include "ipq6018-ess.dtsi"
8+
9+
#include <dt-bindings/input/input.h>
10+
#include <dt-bindings/gpio/gpio.h>
11+
12+
/ {
13+
qcom,msm-id = <0x192 0x0>;
14+
15+
aliases {
16+
serial0 = &blsp1_uart3;
17+
18+
/* Aliases as required by u-boot to patch MAC addresses */
19+
ethernet0 = &dp1;
20+
ethernet1 = &dp2;
21+
ethernet2 = &dp3;
22+
ethernet3 = &dp4;
23+
};
24+
25+
chosen {
26+
bootargs-append = " root=/dev/ubiblock0_1 swiotlb=1";
27+
};
28+
29+
keys {
30+
compatible = "gpio-keys";
31+
32+
reset {
33+
label = "reset";
34+
gpios = <&tlmm 60 GPIO_ACTIVE_LOW>;
35+
linux,code = <KEY_RESTART>;
36+
};
37+
38+
wps {
39+
label = "wps";
40+
gpios = <&tlmm 9 GPIO_ACTIVE_LOW>;
41+
linux,code = <KEY_WPS_BUTTON>;
42+
};
43+
};
44+
};
45+
46+
&blsp1_uart3 {
47+
pinctrl-0 = <&serial_3_pins>;
48+
pinctrl-names = "default";
49+
status = "okay";
50+
};
51+
52+
&tlmm {
53+
mdio_pins: mdio-pins {
54+
mdc {
55+
pins = "gpio64";
56+
function = "mdc";
57+
drive-strength = <8>;
58+
bias-pull-up;
59+
};
60+
61+
mdio {
62+
pins = "gpio65";
63+
function = "mdio";
64+
drive-strength = <8>;
65+
bias-pull-up;
66+
};
67+
};
68+
69+
button_pins: button_pins {
70+
wps_button {
71+
pins = "gpio9";
72+
function = "gpio";
73+
drive-strength = <8>;
74+
bias-pull-up;
75+
};
76+
77+
reset_button {
78+
pins = "gpio60";
79+
function = "gpio";
80+
drive-strength = <8>;
81+
bias-pull-up;
82+
};
83+
};
84+
};
85+
86+
&soc {
87+
dp1: dp@1 {
88+
compatible = "qcom,nss-dp";
89+
reg = <0x0 0x3a001000 0x0 0x200>;
90+
qcom,mactype = <0>;
91+
qcom,id = <5>;
92+
local-mac-address = [000000000000];
93+
phy-handle = <&phy_0>;
94+
phy-mode = "sgmii";
95+
};
96+
97+
dp2: dp2 {
98+
compatible = "qcom,nss-dp";
99+
reg = <0x0 0x3a001200 0x0 0x200>;
100+
qcom,mactype = <0>;
101+
qcom,id = <1>;
102+
local-mac-address = [000000000000];
103+
phy-handle = <&phy_1>;
104+
phy-mode = "sgmii";
105+
};
106+
107+
dp3: dp3 {
108+
compatible = "qcom,nss-dp";
109+
reg = <0x0 0x3a001400 0x0 0x200>;
110+
qcom,mactype = <0>;
111+
qcom,id = <2>;
112+
local-mac-address = [000000000000];
113+
phy-handle = <&phy_2>;
114+
phy-mode = "sgmii";
115+
};
116+
117+
dp4: dp4 {
118+
compatible = "qcom,nss-dp";
119+
reg = <0x0 0x3a001600 0x0 0x200>;
120+
qcom,mactype = <0>;
121+
qcom,id = <4>;
122+
local-mac-address = [000000000000];
123+
phy-handle = <&phy_3>;
124+
phy-mode = "sgmii";
125+
};
126+
};
127+
128+
&edma {
129+
status = "okay";
130+
};
131+
132+
&mdio {
133+
status = "okay";
134+
pinctrl-0 = <&mdio_pins>;
135+
pinctrl-names = "default";
136+
reset-gpios = <&tlmm 75 GPIO_ACTIVE_LOW>;
137+
138+
phy_0: ethernet-phy@0 {
139+
reg = <4>;
140+
};
141+
142+
phy_1: ethernet-phy@1 {
143+
reg = <0>;
144+
};
145+
146+
phy_2: ethernet-phy@2 {
147+
reg = <1>;
148+
};
149+
150+
phy_3: ethernet-phy@3 {
151+
reg = <3>;
152+
};
153+
};
154+
155+
&switch {
156+
status = "okay";
157+
158+
switch_mac_mode = <0x0>; /* mac mode for uniphy instance0*/
159+
switch_mac_mode1 = <0xff>; /* mac mode for uniphy instance1*/
160+
switch_mac_mode2 = <0xff>; /* mac mode for uniphy instance2*/
161+
162+
qcom,port_phyinfo {
163+
port@0 {
164+
port_id = <0x01>;
165+
phy_address = <0x00>;
166+
};
167+
port@1 {
168+
port_id = <0x02>;
169+
phy_address = <0x01>;
170+
};
171+
port@2 {
172+
port_id = <0x04>;
173+
phy_address = <0x03>;
174+
};
175+
port@3 {
176+
port_id = <0x05>;
177+
phy_address = <0x04>;
178+
};
179+
};
180+
};
181+
182+
&qpic_bam {
183+
status = "okay";
184+
};
185+
186+
&qpic_nand {
187+
status = "okay";
188+
189+
nand@0 {
190+
reg = <0>;
191+
192+
nand-ecc-strength = <4>;
193+
nand-ecc-step-size = <512>;
194+
nand-bus-width = <8>;
195+
};
196+
};
197+
198+
&wifi {
199+
status = "okay";
200+
};

0 commit comments

Comments
 (0)