From d71ea9933e5a81069ff8cdd08bf915c0b9a90342 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Sat, 9 Mar 2024 11:22:05 +0100 Subject: [PATCH] qualcommax: ipq807x: add WLAN device path migration Kernel 6.6 has changed the path of WLAN devices as the soc node was updated to include an adress as well because according to spec it needed one: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/arch/arm64/boot/dts/qcom/ipq8074.dtsi?h=v6.6.21&id=da6aa1111a17db11367817ddc10c5a6c188cdc44 So, this will break existing configuration as device path was changed for example: "platform/soc/c000000.wifi" to "platform/soc@0/c000000.wifi" "platform/soc/c000000.wifi+1" to "platform/soc@0/c000000.wifi+1" PCIe attached devices also have their path changed, so lets add a script that will migrate all of them so that configuration does not break when upgrading to 6.6 kernel. Signed-off-by: Robert Marko --- .../etc/hotplug.d/ieee80211/05-wifi-migrate | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/ieee80211/05-wifi-migrate diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/ieee80211/05-wifi-migrate b/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/ieee80211/05-wifi-migrate new file mode 100644 index 00000000000000..8927cf5358063d --- /dev/null +++ b/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/ieee80211/05-wifi-migrate @@ -0,0 +1,73 @@ +#!/bin/sh + +# This must run before 10-wifi-detect + + +[ "${ACTION}" = "add" ] || return + + +. /lib/functions.sh + + +check_radio() +{ + local cfg="$1" to="$2" + + config_get path "$cfg" path + + [ "$path" = "$to" ] && PATH_EXISTS=true +} + +do_migrate_radio() +{ + local cfg="$1" from="$2" to="$3" + + config_get path "$cfg" path + + [ "$path" = "$from" ] || return + + uci set "wireless.${cfg}.path=${to}" + WIRELESS_CHANGED=true + + logger -t wifi-migrate "Updated path of wireless.${cfg} from '${from}' to '${to}'" +} + +migrate_radio() +{ + local from="$1" to="$2" + + config_load wireless + + # Check if there is already a section with the target path: In this case, the system + # was already upgraded to a version without this migration script before; better bail out, + # as we can't be sure we don't break more than we fix. + PATH_EXISTS=false + config_foreach check_radio wifi-device "$to" + $PATH_EXISTS && return + + config_foreach do_migrate_radio wifi-device "$from" "$to" +} + + +WIRELESS_CHANGED=false + +case "$(board_name)" in +*) + migrate_radio 'platform/soc/c000000.wifi' 'platform/soc@0/c000000.wifi' + migrate_radio 'platform/soc/c000000.wifi+1' 'platform/soc@0/c000000.wifi+1' + + case "$(board_name)" in + linksys,mx5300) + migrate_radio 'soc/10000000.pci/pci0001:00/0001:00:00.0/0001:01:00.0' 'soc@0/10000000.pci/pci0001:00/0001:00:00.0/0001:01:00.0' + ;; + xiaomi,ax9000) + migrate_radio 'soc/10000000.pci/pci0001:00/0001:00:00.0/0001:01:00.0' 'soc@0/10000000.pci/pci0001:00/0001:00:00.0/0001:01:00.0' + migrate_radio 'soc/20000000.pci/pci0000:00/0000:00:00.0/0000:01:00.0' 'soc@0/20000000.pci/pci0000:00/0000:00:00.0/0000:01:00.0' + ;; + esac + ;; +esac + +$WIRELESS_CHANGED && uci commit wireless + +exit 0