Skip to content

Commit 40e308e

Browse files
committed
WIFI-15289 sonicfi_rap630w-211g: import v6.6 kernel + drivers from OpenWrt 24.10
Signed-off-by: jackcybertan <[email protected]>
1 parent 815006f commit 40e308e

File tree

13 files changed

+1415
-107
lines changed

13 files changed

+1415
-107
lines changed

feeds/mediatek/mediatek/dts/mt7981b-sonicfi-rap630w-211g.dts

Lines changed: 556 additions & 0 deletions
Large diffs are not rendered by default.

feeds/mediatek/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7981.dtsi

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,14 @@
176176
#pwm-cells = <2>;
177177
};
178178

179+
hnat: hnat@15000000 {
180+
compatible = "mediatek,mtk-hnat_v4";
181+
reg = <0 0x15100000 0 0x80000>;
182+
resets = <&ethsys 0>;
183+
reset-names = "mtketh";
184+
status = "disabled";
185+
};
186+
179187
sgmiisys0: syscon@10060000 {
180188
compatible = "mediatek,mt7981-sgmiisys_0", "syscon";
181189
reg = <0 0x10060000 0 0x1000>;

feeds/mediatek/mediatek/filogic/base-files/etc/board.d/01_leds

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ edgecore,eap111|\
4646
edgecore,eap112)
4747
ucidef_set_led_netdev "wan" "wan" "orange:indicator" "eth1"
4848
ucidef_set_led_netdev "wlan5g" "WLAN5G" "blue:indicator" "phy1-ap0"
49-
;;
5049
glinet,gl-x3000|\
5150
glinet,gl-xe3000)
5251
ucidef_set_led_default "power" "POWER" "green:power" "1"

feeds/mediatek/mediatek/filogic/base-files/etc/board.d/02_network

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
. /lib/functions.sh
33
. /lib/functions/uci-defaults.sh
44
. /lib/functions/system.sh
5+
. /lib/rap211g-envtools.sh
56

67
mediatek_setup_interfaces()
78
{
@@ -138,9 +139,9 @@ mediatek_setup_interfaces()
138139
xiaomi,redmi-router-ax6000-ubootmod)
139140
ucidef_set_interfaces_lan_wan "lan2 lan3 lan4" wan
140141
;;
141-
emplus,wap588m)
142-
ucidef_set_interfaces_lan_wan "eth0" "eth1"
143-
;;
142+
sonicfi,rap630w-211g)
143+
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" eth1
144+
;;
144145
*)
145146
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" wan
146147
;;
@@ -213,6 +214,45 @@ mediatek_setup_macs()
213214
yuncore,ax835)
214215
label_mac=$(mtd_get_mac_binary "Factory" 0x4)
215216
;;
217+
sonicfi,rap630w-211g)
218+
sysfs="/sys/class/ieee80211"
219+
env_dev=$(get_boot_param "boot_param.env_part")
220+
if [ -n "$env_dev" ]; then
221+
mtdnum="$( find_mtd_index "$CI_UBIPART" )"
222+
if [ ! "$mtdnum" ]; then
223+
echo "cannot find ubi mtd partition $CI_UBIPART"
224+
return 1
225+
fi
226+
227+
ubidev="$( nand_find_ubi "$CI_UBIPART" )"
228+
if [ ! "$ubidev" ]; then
229+
ubiattach -m "$mtdnum"
230+
sync
231+
ubidev="$( nand_find_ubi "$CI_UBIPART" )"
232+
fi
233+
234+
env_ubivol="$( nand_find_volume "${ubidev}" ${env_dev} )"
235+
if [ -n "${env_ubivol}" ]; then
236+
#ubootenv_add_uci_config "/dev/$env_ubivol" "0" "0x80000" "0x80000" 1
237+
echo "/dev/$env_ubivol 0 0x80000 0x80000 1" > /etc/fw_env.config
238+
fi
239+
fi
240+
#echo "/dev/ubi0_0 0 0x80000 0x80000 1" > /etc/fw_env.config
241+
mac=$(fw_printenv | grep ethaddr | cut -d= -f2)
242+
wan_mac=$(macaddr_canonicalize $mac)
243+
[ -z "$mac" ] && return;
244+
wan_mac=$(macaddr_canonicalize $mac)
245+
lan_mac=$(macaddr_add "$wan_mac" 1)
246+
ucidef_set_interface_macaddr "lan" "$lan_mac"
247+
ucidef_set_interface_macaddr "wan" "$wan_mac"
248+
ucidef_set_label_macaddr "$wan_mac"
249+
mac1=$(macaddr_add ${mac} 2)
250+
mac2=$(macaddr_add ${mac} 3)
251+
[ -d ${sysfs}/phy0 ] && echo ${mac1} > ${sysfs}/phy0/macaddress
252+
[ -d ${sysfs}/phy1 ] && echo ${mac2} > ${sysfs}/phy1/macaddress
253+
return
254+
;;
255+
216256
esac
217257

218258
[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
#
2+
# Copyright (C) 2021 OpenWrt.org
3+
#
4+
5+
. /lib/uboot-envtools.sh
6+
. /lib/functions.sh
7+
. /lib/functions/uci-defaults.sh
8+
. /lib/functions/system.sh
9+
10+
CI_UBIPART=ubi
11+
12+
ubi_mknod() {
13+
local dir="$1"
14+
local dev="/dev/$(basename $dir)"
15+
16+
[ -e "$dev" ] && return 0
17+
18+
local devid="$(cat $dir/dev)"
19+
local major="${devid%%:*}"
20+
local minor="${devid##*:}"
21+
mknod "$dev" c $major $minor
22+
}
23+
24+
get_boot_param()
25+
{
26+
local cmdline_param=$(cat /proc/cmdline)
27+
local name
28+
for var in $cmdline_param
29+
do
30+
#echo "aaa---$var"
31+
if [ $var == $1 ];
32+
then
33+
echo "Y"
34+
return
35+
else
36+
name=$(echo $var | awk -F '=' '{print $1}')
37+
#echo "$name"
38+
if [ $name == $1 ];
39+
then
40+
echo $(echo $var | awk -F '=' '{print $2}')
41+
return
42+
fi
43+
fi
44+
done
45+
echo "N"
46+
}
47+
48+
block_dev_path() {
49+
local dev_path
50+
51+
case "$1" in
52+
/dev/mmcblk*)
53+
dev_path="$1"
54+
;;
55+
PARTLABEL=* | PARTUUID=*)
56+
dev_path=$(blkid -t "$1" -o device)
57+
[ -z "${dev_path}" -o $? -ne 0 ] && return 1
58+
;;
59+
*)
60+
return 1;
61+
;;
62+
esac
63+
64+
echo "${dev_path}"
65+
return 0
66+
}
67+
68+
nand_find_volume() {
69+
local ubidevdir ubivoldir
70+
ubidevdir="/sys/class/ubi/$1"
71+
[ ! -d "$ubidevdir" ] && return 1
72+
for ubivoldir in $ubidevdir/${1}_*; do
73+
[ ! -d "$ubivoldir" ] && continue
74+
if [ "$( cat $ubivoldir/name )" = "$2" ]; then
75+
basename $ubivoldir
76+
ubi_mknod "$ubivoldir"
77+
return 0
78+
fi
79+
done
80+
}
81+
82+
nand_find_ubi() {
83+
local ubidevdir ubidev mtdnum
84+
mtdnum="$( find_mtd_index $1 )"
85+
[ ! "$mtdnum" ] && return 1
86+
for ubidevdir in /sys/class/ubi/ubi*; do
87+
[ ! -d "$ubidevdir" ] && continue
88+
cmtdnum="$( cat $ubidevdir/mtd_num )"
89+
[ ! "$mtdnum" ] && continue
90+
if [ "$mtdnum" = "$cmtdnum" ]; then
91+
ubidev=$( basename $ubidevdir )
92+
ubi_mknod "$ubidevdir"
93+
echo $ubidev
94+
return 0
95+
fi
96+
done
97+
}
98+
99+

feeds/mediatek/mediatek/filogic/base-files/lib/upgrade/platform.sh

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
11
REQUIRE_IMAGE_METADATA=1
22
RAMFS_COPY_BIN='fitblk fw_setenv'
33

4-
swap_wap588m_active_fw() {
5-
echo "Doing swap active_fw" > /dev/console
6-
tmp_active_fw=$(fw_printenv | grep active_fw | awk -F= {'print $2'})
7-
if [ $tmp_active_fw == "0" ]; then
8-
fw_setenv active_fw 1
9-
fw_setenv mtdparts nmbm0:1024k\(bl2\),512k\(u-boot-env\),2048k\(factory\),2048k\(fip\),56320k\(ubi_1\),56320k\(ubi\),384k\(cert\),640k\(userconfig\),384k\(crashdump\)
10-
else
11-
fw_setenv active_fw 0
12-
fw_setenv mtdparts nmbm0:1024k\(bl2\),512k\(u-boot-env\),2048k\(factory\),2048k\(fip\),56320k\(ubi\),56320k\(ubi_1\),384k\(cert\),640k\(userconfig\),384k\(crashdump\)
13-
fi
14-
}
15-
16-
174
asus_initial_setup()
185
{
196
# initialize UBI if it's running on initramfs
@@ -213,10 +200,11 @@ platform_do_upgrade() {
213200
fi
214201
nand_do_upgrade "$1"
215202
;;
216-
emplus,wap588m)
217-
CI_UBIPART="ubi_1"
218-
nand_do_upgrade "$1"
203+
sonicfi,rap630w-211g)
204+
chmod +x /tmp/root/lib/upgrade/sonicfi/nand_sonicfi_rap630w_211g.sh
205+
/tmp/root/lib/upgrade/sonicfi/nand_sonicfi_rap630w_211g.sh "$1"
219206
;;
207+
220208
*)
221209
nand_do_upgrade "$1"
222210
;;
@@ -243,6 +231,13 @@ platform_check_image() {
243231
}
244232
return 0
245233
;;
234+
sonicfi,rap630w-211g)
235+
[ "$magic" != "73797375" ] && {
236+
echo "Invalid image type."
237+
return 1
238+
}
239+
return 0
240+
;;
246241
*)
247242
nand_do_platform_check "$board" "$1"
248243
return $?
@@ -303,12 +298,3 @@ platform_pre_upgrade() {
303298
;;
304299
esac
305300
}
306-
307-
platform_post_upgrade_success() {
308-
local board=$(board_name)
309-
case "$board" in
310-
emplus,wap588m)
311-
swap_wap588m_active_fw
312-
;;
313-
esac
314-
}

0 commit comments

Comments
 (0)