Root/target/linux/ar71xx/base-files/etc/hotplug.d/net/10-ar922x-led-fix

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

Archive Download this file



interactive