Skip to content

Commit

Permalink
ipq807x: fix MAC and remove regdomain MX4200
Browse files Browse the repository at this point in the history
  • Loading branch information
testuser7 committed Jan 18, 2024
1 parent 90644fb commit 95a9bdd
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 8 deletions.
45 changes: 45 additions & 0 deletions package/base-files/files/lib/functions/caldata.sh
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,48 @@ ath10k_patch_mac() {

caldata_patch_mac "$mac" 0x6 0x2 "$target"
}

ath11k_patch_mac() {
local mac=$1
# mac_id from 1 to 6
local mac_id=$2
local target=$3

[ -z "$mac_id" ] && return

caldata_patch_mac "$mac" $(printf "0x%x" $(($mac_id * 0x6 + 0x8))) 0xa "$target"
}

caldata_remove_regdomain() {
local code_offset=$(($1))
local chksum_offset=$(($2))
local target=$3
local xor_code="0000"
local xor_fw_code
local xor_fw_chksum

[ -n "$target" ] || target=/lib/firmware/$FIRMWARE

xor_fw_code=$(hexdump -v -n 2 -s $code_offset -e '/1 "%02x"' /lib/firmware/$FIRMWARE)

xor_fw_chksum=$(hexdump -v -n 2 -s $chksum_offset -e '/1 "%02x"' /lib/firmware/$FIRMWARE)
xor_fw_chksum=$(xor $xor_fw_chksum $xor_fw_code $xor_code)

printf "%b" "\x${xor_fw_chksum:0:2}\x${xor_fw_chksum:2:2}" | \
dd of=$target conv=notrunc bs=1 seek=$chksum_offset count=2 || \
caldata_die "failed to write chksum to eeprom file"
printf "%b" "\x${xor_code:0:2}\x${xor_code:2:2}" | \
dd of=$target conv=notrunc bs=1 seek=$code_offset count=2 || \
caldata_die "failed to write regdomain to eeprom file"
}

ath10k_remove_regdomain() {
caldata_remove_regdomain 0xc 0x2 "$target"
}

ath11k_remove_regdomain() {
caldata_remove_regdomain 0x34 0xa "$target"
caldata_remove_regdomain 0x458 0xa "$target"
caldata_remove_regdomain 0x500 0xa "$target"
caldata_remove_regdomain 0x5a8 0xa "$target"
}
8 changes: 4 additions & 4 deletions package/firmware/ipq-wifi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ PKG_NAME:=ipq-wifi
PKG_RELEASE:=1

PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/firmware/qca-wireless.git
PKG_SOURCE_DATE:=2024-01-06
PKG_SOURCE_VERSION:=71f45cff8944405b7cc2bf5c19df2bd8fe7f2421
PKG_MIRROR_HASH:=90c3c1659c54cdb4685d0a71633746c1000230e459801eb8ce12c805a994cc37
PKG_SOURCE_URL=https://github.com/testuser7/firmware_qca-wireless.git
PKG_SOURCE_DATE:=2024-01-12
PKG_SOURCE_VERSION:=78f7e94c5fd171fc69be6e8434eeceacf83ea49b
PKG_MIRROR_HASH:=56175cbfd8d69beb9c07ff5c921d0227bdfc45264322b1c558382c873322478a

PKG_FLAGS:=nonshared

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ ipq807x_setup_macs()
local label_mac=""

case "$board" in
linksys,mx4200v1|\
linksys,mx4200v2)
label_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr)
for i in $(seq 3 5); do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ case "$FIRMWARE" in
dynalink,dl-wrx36|\
edgecore,eap102|\
edimax,cax1800|\
linksys,mx4200v1|\
linksys,mx4200v2|\
netgear,rax120v2|\
netgear,wax218|\
netgear,wax620|\
Expand All @@ -30,6 +28,15 @@ case "$FIRMWARE" in
zyxel,nbg7815)
caldata_extract "0:art" 0x1000 0x20000
;;
linksys,mx4200v1|\
linksys,mx4200v2)
caldata_extract "0:art" 0x1000 0x20000
#label_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr)
#ath11k_patch_mac $(macaddr_add $label_mac 1) 2
#ath11k_patch_mac $(macaddr_add $label_mac 2) 1
#ath11k_patch_mac $(macaddr_add $label_mac 3) 3
#ath11k_remove_regdomain
;;
prpl,haze)
caldata_extract_mmc "0:ART" 0x1000 0x20000
;;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ case "$board" in
[ "$PHYNBR" = "0" ] && macaddr_add $(get_mac_label) 8 > /sys${DEVPATH}/macaddress
[ "$PHYNBR" = "1" ] && macaddr_add $(get_mac_label) 16 > /sys${DEVPATH}/macaddress
;;
linksys,mx4200v1|\
linksys,mx4200v2)
label_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr)
[ "$PHYNBR" = "0" ] && macaddr_add $label_mac 2 > /sys${DEVPATH}/macaddress
Expand Down

0 comments on commit 95a9bdd

Please sign in to comment.