New package ar922x-led-fix-hotplug. This package includes a hotplug script to disable "JTAG over GPIO pins" function which is currently required for LEDs on AR922x emac GPIO to work.
There is another package ar922x-led-fix-init that performs the same task. Selecting either package will work, and selecting both packages still work. P.S. It is classified as utils/Utilities, but I'm not too sure if this is the correct classification. Signed-off-by: Yoichi Shinoda <shin...@jaist.ac.jp> Index: package/ar922x-led-fix-hotplug/ar922xledfix-hotplug =================================================================== --- package/ar922x-led-fix-hotplug/ar922xledfix-hotplug (revision 0) +++ package/ar922x-led-fix-hotplug/ar922xledfix-hotplug (revision 0) @@ -0,0 +1,51 @@ +#!/bin/sh + +# For AR9220 and AR9223, GPIO JTAG must explicit be disabled +# before LEDs start working. Do this when wifi device is +# detected. + +# +# $DEVPATH is not valid for some boards (including WZR-HP-AG300H). +# Manipulate the $DEVPATH to reach the corresponding phyN. +# + +devdir=`dirname $DEVPATH` +devdir=`dirname $devdir` +phydir=/sys$devdir/ieee80211 +phyname=`cat $phydir/phy*/name` + +if [ -z $phyname -o $ACTION != "add" ]; then exit 0; fi + +# +# ar922x_disable_gpio_jtag(): +# +# Emulate +# REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL, AR_GPIO_JTAG_DISABLE); +# for AR9220 and AR9223. +# + +ar922x_disable_gpio_jtag() +{ + local regidx=0x4054 + + [ -f /sys/kernel/debug/ieee80211/$1/ath9k/regidx ] && { + echo $regidx > /sys/kernel/debug/ieee80211/$1/ath9k/regidx + regval=`cat /sys/kernel/debug/ieee80211/$1/ath9k/regval` + regval=$((regval | 0x20000)) + echo regval $regval + echo $regval > /sys/kernel/debug/ieee80211/$1/ath9k/regval + } +} + +if [ $phyname -a $ACTION = "add" ]; then + + . /lib/ar71xx.sh + + case $(ar71xx_board_name) in + wzr-hp-ag300h) + ar922x_disable_gpio_jtag $phyname + ;; + esac; +fi + +exit 0 Index: package/ar922x-led-fix-hotplug/Makefile =================================================================== --- package/ar922x-led-fix-hotplug/Makefile (revision 0) +++ package/ar922x-led-fix-hotplug/Makefile (revision 0) @@ -0,0 +1,42 @@ +# +# Copyright (C) 2011 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=ar922x-led-fix-hotplug +PKG_RELEASE:=1 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/ar922x-led-fix-hotplug + SECTION:=util + CATEGORY:=Utilities + TITLE:=Make LEDs on AR922x work (hotplug version) + DEPENDS:=+PACKAGE_MAC80211_DEBUGFS +kmod-leds-gpio +endef + +define Package/ar922x-led-fix-hotplug/description + This package contains a hotplug script to make LEDs on AR922x work. +endef + +define Build/Prepare +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/ar922x-led-fix-hotplug/install + $(INSTALL_DIR) $(1)/etc/hotplug.d/net + $(INSTALL_BIN) ./ar922xledfix-hotplug $(1)/etc/hotplug.d/net/10-ar922xledfix-hotplug +endef + +$(eval $(call BuildPackage,ar922x-led-fix-hotplug)) _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel