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 <francisco.gilmartinez@digi.com>
This commit is contained in:
Francisco Gil 2021-11-16 18:12:23 +01:00
parent 24063490ea
commit 179d4315ef
2 changed files with 7 additions and 24 deletions

View File

@ -88,6 +88,13 @@ do_install() {
# proprietary 'bdwlan30_US.bin' # proprietary 'bdwlan30_US.bin'
ln -s bdwlan30_US.bin ${D}${WIFI_FW_PATH}/board.bin ln -s bdwlan30_US.bin ${D}${WIFI_FW_PATH}/board.bin
else 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 if [ "${FW_QUALCOMM_WIFI}" = "${FW_QCA65X4_PCIE_PROPRIETARY}" ]; then
ln -s qwlan30.bin ${D}${WIFI_FW_PATH}/athwlan.bin ln -s qwlan30.bin ${D}${WIFI_FW_PATH}/athwlan.bin
ln -s otp30.bin ${D}${WIFI_FW_PATH}/athsetup.bin ln -s otp30.bin ${D}${WIFI_FW_PATH}/athsetup.bin

View File

@ -55,32 +55,8 @@ set_filesystem_rw_access() {
# Do nothing if the module is already loaded # Do nothing if the module is already loaded
grep -qws 'wlan' /proc/modules && exit 0 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})" 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 # Create symbolic links to the proper FW files depending on the country region
# Use a sub-shell here to change to firmware directory # Use a sub-shell here to change to firmware directory
( (