From 179d4315ef6c3228e4ef4ce0412be70b2d75e7fb Mon Sep 17 00:00:00 2001 From: Francisco Gil Date: Tue, 16 Nov 2021 18:12:23 +0100 Subject: [PATCH] wireless: mac: create symbolic links for the wireless macs Before this patch the MAC addresses were read from the device tree in the qualcomm.sh script executed at init, and a creates a file where the MAC where located. In 0a92f5d9e8df644de74e74f152ed6ff3dd8d3369 in the qca driver the support to read these MAC addresses from the filesystem was added. This commits creates the simbolic link between the device tree and the expected path where the MAC addresses where located, and gets rid of the file with the MAC addresses. Signed-off-by: Francisco Gil --- .../firmware-qualcomm/firmware-qualcomm.bb | 7 ++++++ .../kernel-module-qualcomm/qualcomm.sh | 24 ------------------- 2 files changed, 7 insertions(+), 24 deletions(-) diff --git a/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm.bb b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm.bb index 917147706..1117b2dbf 100644 --- a/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm.bb +++ b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm.bb @@ -88,6 +88,13 @@ do_install() { # proprietary 'bdwlan30_US.bin' ln -s bdwlan30_US.bin ${D}${WIFI_FW_PATH}/board.bin else + # Create symbolic links between the mac addresses in the device tree nodes + # and the paths where the driver expect the MAC addresses + install -d ${D}${WIFI_FW_PATH}/wlan/ + ln -s /proc/device-tree/wireless/mac-address ${D}${WIFI_FW_PATH}/wlan/wlan_mac0 + ln -s /proc/device-tree/wireless/mac-address1 ${D}${WIFI_FW_PATH}/wlan/wlan_mac1 + ln -s /proc/device-tree/wireless/mac-address2 ${D}${WIFI_FW_PATH}/wlan/wlan_mac2 + ln -s /proc/device-tree/wireless/mac-address3 ${D}${WIFI_FW_PATH}/wlan/wlan_mac3 if [ "${FW_QUALCOMM_WIFI}" = "${FW_QCA65X4_PCIE_PROPRIETARY}" ]; then ln -s qwlan30.bin ${D}${WIFI_FW_PATH}/athwlan.bin ln -s otp30.bin ${D}${WIFI_FW_PATH}/athsetup.bin diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/qualcomm.sh b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/qualcomm.sh index d196ff416..3d4d2b52b 100644 --- a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/qualcomm.sh +++ b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/qualcomm.sh @@ -55,32 +55,8 @@ set_filesystem_rw_access() { # Do nothing if the module is already loaded grep -qws 'wlan' /proc/modules && exit 0 -FIRMWARE_DIR="/lib/firmware" -MACFILE="${FIRMWARE_DIR}/wlan/wlan_mac.bin" -TMP_MACFILE="$(mktemp -t wlan_mac.XXXXXX)" FS_ORIGINAL_ACCESS="$(get_filesystem_access ${FIRMWARE_DIR})" -# Read the MACs from DeviceTree. We can have up to four wireless interfaces -# The only required one is wlan0 that is mapped with device tree mac address -# without suffix. -for index in $(seq 0 3); do - MAC_ADDR="$(hexdump -ve '1/1 "%02X"' /proc/device-tree/wireless/mac-address${index%0} 2>/dev/null)" - if [ "${index}" = "0" ] && { [ -z "${MAC_ADDR}" ] || [ "${MAC_ADDR}" = "00:00:00:00:00:00" ]; }; then - # Set a default MAC for wlan0 - MAC_ADDR="0004F3FFFFFB" - fi - - # Add the MAC address to the firmware file with the expected format - echo "Intf${index}MacAddress=${MAC_ADDR}" >> ${TMP_MACFILE} -done - -# Override the MAC firmware file only if the MAC file has changed. -if ! cmp -s ${TMP_MACFILE} ${MACFILE}; then - set_filesystem_rw_access ${FIRMWARE_DIR} - cp ${TMP_MACFILE} ${MACFILE} || log "3" "[ERROR] Could not create ${MACFILE}" -fi -rm -f "${TMP_MACFILE}" - # Create symbolic links to the proper FW files depending on the country region # Use a sub-shell here to change to firmware directory (