New package ar922x-led-fix-init. This package includes an init.d 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-hotplug 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-init/ar922xledfix.init =================================================================== --- package/ar922x-led-fix-init/ar922xledfix.init (revision 0) +++ package/ar922x-led-fix-init/ar922xledfix.init (revision 0) @@ -0,0 +1,44 @@ +#!/bin/sh /etc/rc.common + +START=12 + +# For AR9220 and AR9223, GPIO JTAG must explicit be disabled +# before LEDs start working. + +# +# 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 + } +} + +ar922x_find_and_fix() +{ + for phycls in /sys/class/ieee80211/* ; do + if [ `cat $phycls/device/vendor` = "0x168c" \ + -a `cat $phycls/device/device` = "0x0029" ]; then + phyname=`basename $phycls` + ar922x_disable_gpio_jtag $phyname + echo ar922xledfix: $phyname fixed + fi + done +} + +start() +{ + ar922x_find_and_fix +} Index: package/ar922x-led-fix-init/Makefile =================================================================== --- package/ar922x-led-fix-init/Makefile (revision 0) +++ package/ar922x-led-fix-init/Makefile (revision 0) @@ -0,0 +1,47 @@ +# +# 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-init +PKG_RELEASE:=1 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/ar922x-led-fix-init + SECTION:=util + CATEGORY:=Utilities + TITLE:=Make LEDs on AR922x work (init.d version) + DEPENDS:=+PACKAGE_MAC80211_DEBUGFS +kmod-leds-gpio +endef + +define Package/ar922x-led-fix-init/description + This package contains an init.d 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-init/postinst +#!/bin/sh +[ -n "$${IPKG_INSTROOT}" ] || /etc/init.d/ar922x-led-fix-init enable || true +endef + +define Package/ar922x-led-fix-init/install + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./ar922xledfix.init $(1)/etc/init.d/ar922xledfix +endef + +$(eval $(call BuildPackage,ar922x-led-fix-init)) _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel