From owner-svn-src-all@FreeBSD.ORG Mon Dec 26 06:07:21 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3A97106566C; Mon, 26 Dec 2011 06:07:21 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A7C668FC0A; Mon, 26 Dec 2011 06:07:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBQ67L49092524; Mon, 26 Dec 2011 06:07:21 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBQ67L06092522; Mon, 26 Dec 2011 06:07:21 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201112260607.pBQ67L06092522@svn.freebsd.org> From: Adrian Chadd Date: Mon, 26 Dec 2011 06:07:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228889 - head/sys/dev/ath/ath_hal/ar5416 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Dec 2011 06:07:21 -0000 Author: adrian Date: Mon Dec 26 06:07:21 2011 New Revision: 228889 URL: http://svn.freebsd.org/changeset/base/228889 Log: Update the hardware LED blinking code to do something useful rather than relying on what the register defaults are. This forces the blink mode to be proportional to the TX and RX frames which match the RX filter. This (along with a few tweaks to if_ath_led.c to configure the correct GPIO pins) allows my DWA-552 AR5416 NIC to blink the LEDs in a useful fashion, however those LEDs are marked "Link" and "Act(ivity)", which don't really map well to the "power" / "network" LED interface which the MAC provides. Some further tinkering is needed to see what other useful operating modes are possible. Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Mon Dec 26 05:46:22 2011 (r228888) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Mon Dec 26 06:07:21 2011 (r228889) @@ -73,34 +73,29 @@ ar5416SetLedState(struct ath_hal *ah, HA AR_MAC_LED_ASSOC_NONE, AR_MAC_LED_ASSOC_NONE, }; -#if 0 - uint32_t bits; -#endif if (AR_SREV_HOWL(ah)) return; + /* + * Set the blink operating mode. + */ OS_REG_RMW_FIELD(ah, AR_MAC_LED, AR_MAC_LED_ASSOC, ledbits[state & 0x7]); + /* XXX Blink slow mode? */ + /* XXX Blink threshold? */ + /* XXX Blink sleep hystersis? */ + /* - * For now, don't override the power/network LED - * "on" bits. The reference driver notes that some - * devices connect the LED pins to other functionality - * so we can't just leave this on by default. + * Set the LED blink configuration to be proportional + * to the current TX and RX filter bytes. (Ie, RX'ed + * frames that don't match the filter are ignored.) + * This means that higher TX/RX throughput will result + * in the blink rate increasing. */ -#if 0 - bits = OS_REG_READ(ah, AR_MAC_LED); - bits = (bits &~ AR_MAC_LED_MODE) - | SM(AR_MAC_LED_MODE_POWON, AR_MAC_LED_MODE) -#if 1 - | SM(AR_MAC_LED_MODE_NETON, AR_MAC_LED_MODE) -#endif - ; - bits = (bits &~ AR_MAC_LED_ASSOC) - | SM(ledbits[state & 0x7], AR_MAC_LED_ASSOC); - OS_REG_WRITE(ah, AR_MAC_LED, bits); -#endif + OS_REG_RMW_FIELD(ah, AR_MAC_LED, AR_MAC_LED_MODE, + AR_MAC_LED_MODE_PROP); } /*