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 <hector.palacios@digi.com>
Reviewed-by: Javier Viguera <javier.viguera@digi.com>

https://jira.digi.com/browse/DEL-820
This commit is contained in:
Hector Palacios 2013-11-13 17:17:20 +01:00
parent 147bef647c
commit 0808c56b7a
1 changed files with 12 additions and 2 deletions

View File

@ -82,8 +82,18 @@ if [ ! -e "${BDATA_LINK}" ] || ! cmp -s "${BDATA_LINK}" "${FIRMWARE_DIR}/${BDATA
fi fi
# ath6kl_sdio.ko # ath6kl_sdio.ko
grep -qs ath6kl_sdio /proc/modules || \ if ! grep -qs ath6kl_sdio /proc/modules; then
modprobe --ignore-install -q ath6kl_sdio || echo "Loading ath6kl_sdio module: [FAILED]" 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. # Delay required for the interface 'wlan0' to settle down before trying to configure it.
sleep 0.5 sleep 0.5