10-ar922x-led-fix 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/sh
  2. # For AR9220 and AR9223, GPIO JTAG must explicit be disabled
  3. # before LEDs start working. Do this when wifi device is
  4. # detected.
  5. #
  6. # $DEVPATH is not valid for some boards (including WZR-HP-AG300H).
  7. # Manipulate the $DEVPATH to reach the corresponding phyN.
  8. #
  9. devdir=`dirname $DEVPATH`
  10. devdir=`dirname $devdir`
  11. phydir=/sys$devdir/ieee80211
  12. phyname=`cat $phydir/phy*/name`
  13. if [ -z $phyname -o $ACTION != "add" ]; then exit 0; fi
  14. #
  15. # ar922x_disable_gpio_jtag():
  16. #
  17. # Emulate
  18. # REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL, AR_GPIO_JTAG_DISABLE);
  19. # for AR9220 and AR9223.
  20. #
  21. ar922x_disable_gpio_jtag()
  22. {
  23. local regidx=0x4054
  24. [ -f /sys/kernel/debug/ieee80211/$1/ath9k/regidx ] && {
  25. echo $regidx > /sys/kernel/debug/ieee80211/$1/ath9k/regidx
  26. regval=`cat /sys/kernel/debug/ieee80211/$1/ath9k/regval`
  27. regval=$((regval | 0x20000))
  28. echo regval $regval
  29. echo $regval > /sys/kernel/debug/ieee80211/$1/ath9k/regval
  30. }
  31. }
  32. if [ $phyname -a $ACTION = "add" ]; then
  33. . /lib/ar71xx.sh
  34. case $(ar71xx_board_name) in
  35. wzr-hp-ag300h)
  36. ar922x_disable_gpio_jtag $phyname
  37. ;;
  38. esac;
  39. fi
  40. exit 0