From 0808c56b7a0e282fb19dae67690cbfb115a49d37 Mon Sep 17 00:00:00 2001 From: Hector Palacios Date: Wed, 13 Nov 2013 17:17:20 +0100 Subject: [PATCH] atheros: reload the module if it fails during probe The wireless module occasionally fails to load in kernel v3.10. If that is the case, unload the driver and load it again (up to five retries). Notes: - Only the ath6kl_sdio module needs to be unloaded and reloaded. - The chip is not issued a power cycle via CHIP_PWD_L because this demonstrated to cause failure, instead of improving behaviour. - The 2-seconds sleep after unloading the driver is a security measure to avoid other problems seen during test cycle. Signed-off-by: Hector Palacios Reviewed-by: Javier Viguera https://jira.digi.com/browse/DEL-820 --- .../kernel-module-atheros/ccardimx28js/atheros | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/meta-digi-arm/recipes-kernel/kernel-module-atheros/kernel-module-atheros/ccardimx28js/atheros b/meta-digi-arm/recipes-kernel/kernel-module-atheros/kernel-module-atheros/ccardimx28js/atheros index 27e479d84..78bf3ca48 100644 --- a/meta-digi-arm/recipes-kernel/kernel-module-atheros/kernel-module-atheros/ccardimx28js/atheros +++ b/meta-digi-arm/recipes-kernel/kernel-module-atheros/kernel-module-atheros/ccardimx28js/atheros @@ -82,8 +82,18 @@ if [ ! -e "${BDATA_LINK}" ] || ! cmp -s "${BDATA_LINK}" "${FIRMWARE_DIR}/${BDATA fi # ath6kl_sdio.ko -grep -qs ath6kl_sdio /proc/modules || \ - modprobe --ignore-install -q ath6kl_sdio || echo "Loading ath6kl_sdio module: [FAILED]" +if ! grep -qs ath6kl_sdio /proc/modules; then + RETRIES="5" + while [ "${RETRIES}" -gt "0" ]; do + modprobe --ignore-install -q ath6kl_sdio || true + [ -d "/sys/class/net/wlan0" ] && break + RETRIES="$((RETRIES - 1))" + rmmod ath6kl_sdio > /dev/null + echo "Retrying to load wireless" + sleep 2 + done + [ "${RETRIES}" -eq "0" ] && echo "Loading ath6kl_sdio module: [FAILED]" +fi # Delay required for the interface 'wlan0' to settle down before trying to configure it. sleep 0.5