summaryrefslogtreecommitdiffstats
path: root/sys/dev/ath/if_ath.c
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2011-12-26 07:47:05 +0000
committeradrian <adrian@FreeBSD.org>2011-12-26 07:47:05 +0000
commit41ae7c33b3c6dc7f60f749f91f4a05c4c5297d60 (patch)
tree0ea8a28467939bb27aa82fd557ed5777d22353c7 /sys/dev/ath/if_ath.c
parent122e4872cc81f926fd37e041becea69984548a14 (diff)
downloadFreeBSD-src-41ae7c33b3c6dc7f60f749f91f4a05c4c5297d60.zip
FreeBSD-src-41ae7c33b3c6dc7f60f749f91f4a05c4c5297d60.tar.gz
Flesh out configurable hardware based LED blinking.
The hardware (MAC) LED blinking involves a few things: * Selecting which GPIO pins map to the MAC "power" and "network" lines; * Configuring the MAC LED state (associated, scanning, idle); * Configuring the MAC LED blinking type and speed. The AR5416 HAL configures the normal blinking setup - ie, blink rate based on TX/RX throughput. The default AR5212 HAL doesn't program in any specific blinking type, but the default of 0 is the same. This code introduces a few things: * The hardware led override is configured via sysctl 'hardled'; * The MAC network and power LED GPIO lines can be set, or left at -1 if needed. This is intended to allow only one of the hardware MUX entries to be configured (eg for PCIe cards which only have one LED exposed.) TODO: * For AR2417, the software LED blinking involves software blinking the Network LED. For the AR5416 and later, this can just be configured as a GPIO output line. I'll chase that up with a subsequent commit. * Add another software LED blink for "Link", separate from "activity", which blinks based on the association state. This would make my D-Link DWA-552 have consistent and useful LED behaviour (as they're marked "Link" and "Activity." * Don't expose the hardware LED override unless it's an AR5416 or later, as the previous generation hardware doesn't have this multiplexing setup.
Diffstat (limited to 'sys/dev/ath/if_ath.c')
-rw-r--r--sys/dev/ath/if_ath.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c
index e4d7976..ae785b2 100644
--- a/sys/dev/ath/if_ath.c
+++ b/sys/dev/ath/if_ath.c
@@ -479,11 +479,27 @@ ath_attach(u_int16_t devid, struct ath_softc *sc)
/* Start DFS processing tasklet */
TASK_INIT(&sc->sc_dfstask, 0, ath_dfs_tasklet, sc);
+ /* Configure LED state */
sc->sc_blinking = 0;
sc->sc_ledstate = 1;
sc->sc_ledon = 0; /* low true */
sc->sc_ledidle = (2700*hz)/1000; /* 2.7sec */
callout_init(&sc->sc_ledtimer, CALLOUT_MPSAFE);
+
+ /*
+ * Don't setup hardware-based blinking.
+ *
+ * Although some NICs may have this configured in the
+ * default reset register values, the user may wish
+ * to alter which pins have which function.
+ *
+ * The reference driver attaches the MAC network LED to GPIO1 and
+ * the MAC power LED to GPIO2. However, the DWA-552 cardbus
+ * NIC has these reversed.
+ */
+ sc->sc_hardled = (1 == 0);
+ sc->sc_led_net_pin = -1;
+ sc->sc_led_pwr_pin = -1;
/*
* Auto-enable soft led processing for IBM cards and for
* 5211 minipci cards. Users can also manually enable/disable
OpenPOWER on IntegriCloud