Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Dec 2011 06:07:21 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r228889 - head/sys/dev/ath/ath_hal/ar5416
Message-ID:  <201112260607.pBQ67L06092522@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201112260607.pBQ67L06092522>