kernel-module-qualcomm: add script to load the wlan module
In rare cases, the wlan module may fail to load. In this scenario, forcing the MMC driver to rebind the interface resolves the issue, making the WLAN module load more reliably. This only affects to modules where the qca chip is connected through the MMC interface. https://onedigi.atlassian.net/browse/DEL-8361 Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
This commit is contained in:
parent
d76bb3ac2c
commit
c30b947408
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright (C) 2016-2022 Digi International.
|
||||
# Copyright (C) 2016-2023 Digi International.
|
||||
|
||||
SUMMARY = "Qualcomm's wireless driver for qca65xx"
|
||||
DESCRIPTION = "qcacld-2.0 module"
|
||||
|
|
@ -32,6 +32,7 @@ FILES_SDIO_CCX = " \
|
|||
|
||||
FILES_SDIO = " \
|
||||
file://modprobe-qualcomm.conf \
|
||||
file://qualcomm.sh \
|
||||
${@oe.utils.vartrue('QUALCOMM_FW_CCX_TAGS', '${FILES_SDIO_CCX}', '', d)} \
|
||||
"
|
||||
|
||||
|
|
@ -63,10 +64,17 @@ do_compile:prepend() {
|
|||
export BUILD_VER=${PV}
|
||||
}
|
||||
|
||||
|
||||
MMC_NODE ?= "30b40000.mmc"
|
||||
MMC_NODE:ccimx6ul = "2190000.mmc"
|
||||
|
||||
do_install:append() {
|
||||
if [ "${QUALCOMM_WIFI_INTERFACE}" = "sdio" ]; then
|
||||
install -d ${D}${sysconfdir}/modprobe.d
|
||||
install -m 0644 ${WORKDIR}/modprobe-qualcomm.conf ${D}${sysconfdir}/modprobe.d/qualcomm.conf
|
||||
install -d ${D}${sysconfdir}/udev/scripts
|
||||
install -m 0755 ${WORKDIR}/qualcomm.sh ${D}${sysconfdir}/udev/scripts/
|
||||
sed -i -e "s/##NODE##/${MMC_NODE}/g" ${D}${sysconfdir}/udev/scripts/qualcomm.sh
|
||||
fi
|
||||
|
||||
install -d ${D}${base_libdir}/firmware/wlan/
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# Load Qualcomm wireless module (sdio)
|
||||
SUBSYSTEM=="sdio", ACTION=="add", ENV{MODALIAS}=="sdio:c00v0271d050A", RUN="/sbin/modprobe wlan"
|
||||
SUBSYSTEM=="sdio", ACTION=="add", ENV{MODALIAS}=="sdio:c00v0271d050A", RUN="/etc/udev/scripts/qualcomm.sh"
|
||||
# Load Qualcomm wireless module (pci)
|
||||
SUBSYSTEM=="pci", ACTION=="add", ENV{MODALIAS}=="pci:v0000168Cd0000003Esv*sd*bc*sc*i*", RUN="/sbin/modprobe wlan"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,55 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2023 Digi International Inc.
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, you can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
#
|
||||
|
||||
MMC_NODE="##NODE##"
|
||||
|
||||
# At this point of the boot (udev script), the system log (syslog) is not
|
||||
# available yet, so use the kernel log buffer from userspace.
|
||||
log() {
|
||||
printf "<$1>qca65x4: $2\n" >/dev/kmsg
|
||||
}
|
||||
|
||||
# Force re-detection of the mmc node
|
||||
rebind_mmc_node() {
|
||||
DRIVER_NODE=$(find /sys/bus/platform/drivers -name ${MMC_NODE} | xargs dirname 2> /dev/null) || return 1
|
||||
echo ${MMC_NODE} > ${DRIVER_NODE}/unbind
|
||||
# Give some time to the mmc driver to re-detect the MMC node in order to re-initialize it.
|
||||
sleep 2
|
||||
echo ${MMC_NODE} > ${DRIVER_NODE}/bind
|
||||
}
|
||||
|
||||
load_and_check() {
|
||||
modprobe wlan
|
||||
[ -d "/sys/class/net/wlan0" ] && return 0 || return 1
|
||||
}
|
||||
|
||||
# Do nothing if the wireless node does not exist on the device tree
|
||||
[ -d "/proc/device-tree/wireless" ] || exit 0
|
||||
|
||||
# Do nothing if the module is already loaded
|
||||
grep -qws 'wlan' /proc/modules && exit 0
|
||||
|
||||
load_and_check && log "3" "[INFO] wlan module loaded" && exit 0
|
||||
|
||||
# If we are here, the load has failed. Retry.
|
||||
log "3" "[WARN] Loading wlan module failed, retrying..."
|
||||
|
||||
# Try by re-binding the mmc node.
|
||||
rebind_mmc_node && load_and_check && log "3" "[INFO] wlan module loaded" && exit 0
|
||||
|
||||
log "3" "[ERROR] Loading wlan module"
|
||||
exit 1
|
||||
Loading…
Reference in New Issue