summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2009-02-24 00:12:16 +0000
committersam <sam@FreeBSD.org>2009-02-24 00:12:16 +0000
commit1bb0a46d4d3d641078dd156c09e9bb7eee07f7d7 (patch)
tree19496777a93bd3390e5b48f15fb3810b0ae68e52
parent0c3d0ae510aa78ad003ce1f556f09cde368067a8 (diff)
downloadFreeBSD-src-1bb0a46d4d3d641078dd156c09e9bb7eee07f7d7.zip
FreeBSD-src-1bb0a46d4d3d641078dd156c09e9bb7eee07f7d7.tar.gz
5416 and later parts mux the gpio outputs; extend the api to include
a signal type that's used to select the appropriate mux
-rw-r--r--sys/dev/ath/ath_hal/ah.h19
-rw-r--r--sys/dev/ath/ath_hal/ah_internal.h4
-rw-r--r--sys/dev/ath/ath_hal/ar5210/ar5210.h3
-rw-r--r--sys/dev/ath/ath_hal/ar5210/ar5210_misc.c2
-rw-r--r--sys/dev/ath/ath_hal/ar5211/ar5211.h3
-rw-r--r--sys/dev/ath/ath_hal/ar5211/ar5211_misc.c2
-rw-r--r--sys/dev/ath/ath_hal/ar5212/ar5212.h3
-rw-r--r--sys/dev/ath/ath_hal/ar5212/ar5212_gpio.c4
-rw-r--r--sys/dev/ath/ath_hal/ar5312/ar5312.h6
-rw-r--r--sys/dev/ath/ath_hal/ar5312/ar5312_gpio.c4
-rw-r--r--sys/dev/ath/ath_hal/ar5312/ar5315_gpio.c4
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar5416.h3
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar5416_gpio.c4
-rw-r--r--sys/dev/ath/if_ath.c12
-rw-r--r--sys/dev/ath/if_athvar.h4
15 files changed, 52 insertions, 25 deletions
diff --git a/sys/dev/ath/ath_hal/ah.h b/sys/dev/ath/ath_hal/ah.h
index 8822d7c..d12c018 100644
--- a/sys/dev/ath/ath_hal/ah.h
+++ b/sys/dev/ath/ath_hal/ah.h
@@ -359,6 +359,22 @@ typedef enum {
} HAL_INT;
typedef enum {
+ HAL_GPIO_MUX_OUTPUT = 0,
+ HAL_GPIO_MUX_PCIE_ATTENTION_LED = 1,
+ HAL_GPIO_MUX_PCIE_POWER_LED = 2,
+ HAL_GPIO_MUX_TX_FRAME = 3,
+ HAL_GPIO_MUX_RX_CLEAR_EXTERNAL = 4,
+ HAL_GPIO_MUX_MAC_NETWORK_LED = 5,
+ HAL_GPIO_MUX_MAC_POWER_LED = 6
+} HAL_GPIO_MUX_TYPE;
+
+typedef enum {
+ HAL_GPIO_INTR_LOW = 0,
+ HAL_GPIO_INTR_HIGH = 1,
+ HAL_GPIO_INTR_DISABLE = 2
+} HAL_GPIO_INTR_TYPE;
+
+typedef enum {
HAL_RFGAIN_INACTIVE = 0,
HAL_RFGAIN_READ_REQUESTED = 1,
HAL_RFGAIN_NEED_CHANGE = 2
@@ -700,7 +716,8 @@ struct ath_hal {
void __ahdecl(*ah_setLedState)(struct ath_hal*, HAL_LED_STATE);
void __ahdecl(*ah_writeAssocid)(struct ath_hal*,
const uint8_t *bssid, uint16_t assocId);
- HAL_BOOL __ahdecl(*ah_gpioCfgOutput)(struct ath_hal *, uint32_t gpio);
+ HAL_BOOL __ahdecl(*ah_gpioCfgOutput)(struct ath_hal *,
+ uint32_t gpio, HAL_GPIO_MUX_TYPE);
HAL_BOOL __ahdecl(*ah_gpioCfgInput)(struct ath_hal *, uint32_t gpio);
uint32_t __ahdecl(*ah_gpioGet)(struct ath_hal *, uint32_t gpio);
HAL_BOOL __ahdecl(*ah_gpioSet)(struct ath_hal *,
diff --git a/sys/dev/ath/ath_hal/ah_internal.h b/sys/dev/ath/ath_hal/ah_internal.h
index 169a28f..3255054 100644
--- a/sys/dev/ath/ath_hal/ah_internal.h
+++ b/sys/dev/ath/ath_hal/ah_internal.h
@@ -311,8 +311,8 @@ struct ath_hal_private {
AH_PRIVATE(_ah)->ah_eepromRead(_ah, _off, _data)
#define ath_hal_eepromWrite(_ah, _off, _data) \
AH_PRIVATE(_ah)->ah_eepromWrite(_ah, _off, _data)
-#define ath_hal_gpioCfgOutput(_ah, _gpio) \
- (_ah)->ah_gpioCfgOutput(_ah, _gpio)
+#define ath_hal_gpioCfgOutput(_ah, _gpio, _type) \
+ (_ah)->ah_gpioCfgOutput(_ah, _gpio, _type)
#define ath_hal_gpioCfgInput(_ah, _gpio) \
(_ah)->ah_gpioCfgInput(_ah, _gpio)
#define ath_hal_gpioGet(_ah, _gpio) \
diff --git a/sys/dev/ath/ath_hal/ar5210/ar5210.h b/sys/dev/ath/ath_hal/ar5210/ar5210.h
index 5156e74..01c1fdc 100644
--- a/sys/dev/ath/ath_hal/ar5210/ar5210.h
+++ b/sys/dev/ath/ath_hal/ar5210/ar5210.h
@@ -207,7 +207,8 @@ extern HAL_BOOL ar5210SetRegulatoryDomain(struct ath_hal *,
extern u_int ar5210GetWirelessModes(struct ath_hal *ah);
extern void ar5210EnableRfKill(struct ath_hal *);
extern HAL_BOOL ar5210GpioCfgInput(struct ath_hal *, uint32_t gpio);
-extern HAL_BOOL ar5210GpioCfgOutput(struct ath_hal *, uint32_t gpio);
+extern HAL_BOOL ar5210GpioCfgOutput(struct ath_hal *, uint32_t gpio,
+ HAL_GPIO_MUX_TYPE);
extern uint32_t ar5210GpioGet(struct ath_hal *, uint32_t gpio);
extern HAL_BOOL ar5210GpioSet(struct ath_hal *, uint32_t gpio, uint32_t);
extern void ar5210Gpio0SetIntr(struct ath_hal *, u_int, uint32_t ilevel);
diff --git a/sys/dev/ath/ath_hal/ar5210/ar5210_misc.c b/sys/dev/ath/ath_hal/ar5210/ar5210_misc.c
index bdd58ac..7339f91 100644
--- a/sys/dev/ath/ath_hal/ar5210/ar5210_misc.c
+++ b/sys/dev/ath/ath_hal/ar5210/ar5210_misc.c
@@ -158,7 +158,7 @@ ar5210EnableRfKill(struct ath_hal *ah)
* Configure GPIO Output lines
*/
HAL_BOOL
-ar5210GpioCfgOutput(struct ath_hal *ah, uint32_t gpio)
+ar5210GpioCfgOutput(struct ath_hal *ah, uint32_t gpio, HAL_GPIO_MUX_TYPE type)
{
HALASSERT(gpio < AR_NUM_GPIO);
diff --git a/sys/dev/ath/ath_hal/ar5211/ar5211.h b/sys/dev/ath/ath_hal/ar5211/ar5211.h
index 01b80c4..223f954 100644
--- a/sys/dev/ath/ath_hal/ar5211/ar5211.h
+++ b/sys/dev/ath/ath_hal/ar5211/ar5211.h
@@ -233,7 +233,8 @@ extern u_int ar5211GetWirelessModes(struct ath_hal *);
extern void ar5211EnableRfKill(struct ath_hal *);
extern uint32_t ar5211GpioGet(struct ath_hal *, uint32_t gpio);
extern void ar5211GpioSetIntr(struct ath_hal *, u_int, uint32_t ilevel);
-extern HAL_BOOL ar5211GpioCfgOutput(struct ath_hal *, uint32_t gpio);
+extern HAL_BOOL ar5211GpioCfgOutput(struct ath_hal *, uint32_t gpio,
+ HAL_GPIO_MUX_TYPE);
extern HAL_BOOL ar5211GpioCfgInput(struct ath_hal *, uint32_t gpio);
extern HAL_BOOL ar5211GpioSet(struct ath_hal *, uint32_t gpio, uint32_t val);
extern void ar5211SetLedState(struct ath_hal *, HAL_LED_STATE);
diff --git a/sys/dev/ath/ath_hal/ar5211/ar5211_misc.c b/sys/dev/ath/ath_hal/ar5211/ar5211_misc.c
index 81d29b8..33b9e21 100644
--- a/sys/dev/ath/ath_hal/ar5211/ar5211_misc.c
+++ b/sys/dev/ath/ath_hal/ar5211/ar5211_misc.c
@@ -192,7 +192,7 @@ ar5211EnableRfKill(struct ath_hal *ah)
* Configure GPIO Output lines
*/
HAL_BOOL
-ar5211GpioCfgOutput(struct ath_hal *ah, uint32_t gpio)
+ar5211GpioCfgOutput(struct ath_hal *ah, uint32_t gpio, HAL_GPIO_MUX_TYPE type)
{
uint32_t reg;
diff --git a/sys/dev/ath/ath_hal/ar5212/ar5212.h b/sys/dev/ath/ath_hal/ar5212/ar5212.h
index 86a8674..0b682ef 100644
--- a/sys/dev/ath/ath_hal/ar5212/ar5212.h
+++ b/sys/dev/ath/ath_hal/ar5212/ar5212.h
@@ -450,7 +450,8 @@ extern HAL_BOOL ar5212SetRegulatoryDomain(struct ath_hal *ah,
uint16_t regDomain, HAL_STATUS *stats);
extern u_int ar5212GetWirelessModes(struct ath_hal *ah);
extern void ar5212EnableRfKill(struct ath_hal *);
-extern HAL_BOOL ar5212GpioCfgOutput(struct ath_hal *, uint32_t gpio);
+extern HAL_BOOL ar5212GpioCfgOutput(struct ath_hal *, uint32_t gpio,
+ HAL_GPIO_MUX_TYPE);
extern HAL_BOOL ar5212GpioCfgInput(struct ath_hal *, uint32_t gpio);
extern HAL_BOOL ar5212GpioSet(struct ath_hal *, uint32_t gpio, uint32_t val);
extern uint32_t ar5212GpioGet(struct ath_hal *ah, uint32_t gpio);
diff --git a/sys/dev/ath/ath_hal/ar5212/ar5212_gpio.c b/sys/dev/ath/ath_hal/ar5212/ar5212_gpio.c
index eb0022f..b2363af 100644
--- a/sys/dev/ath/ath_hal/ar5212/ar5212_gpio.c
+++ b/sys/dev/ath/ath_hal/ar5212/ar5212_gpio.c
@@ -14,7 +14,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $Id: ar5212_gpio.c,v 1.3 2008/11/10 04:08:03 sam Exp $
+ * $FreeBSD$
*/
#include "opt_ah.h"
@@ -36,7 +36,7 @@
* Configure GPIO Output lines
*/
HAL_BOOL
-ar5212GpioCfgOutput(struct ath_hal *ah, uint32_t gpio)
+ar5212GpioCfgOutput(struct ath_hal *ah, uint32_t gpio, HAL_GPIO_MUX_TYPE type)
{
HALASSERT(gpio < AR_NUM_GPIO);
diff --git a/sys/dev/ath/ath_hal/ar5312/ar5312.h b/sys/dev/ath/ath_hal/ar5312/ar5312.h
index 210e744..0fb9b75 100644
--- a/sys/dev/ath/ath_hal/ar5312/ar5312.h
+++ b/sys/dev/ath/ath_hal/ar5312/ar5312.h
@@ -41,14 +41,16 @@
extern HAL_BOOL ar5312IsInterruptPending(struct ath_hal *ah);
/* AR5312 */
-extern HAL_BOOL ar5312GpioCfgOutput(struct ath_hal *, uint32_t gpio);
+extern HAL_BOOL ar5312GpioCfgOutput(struct ath_hal *, uint32_t gpio,
+ HAL_GPIO_MUX_TYPE);
extern HAL_BOOL ar5312GpioCfgInput(struct ath_hal *, uint32_t gpio);
extern HAL_BOOL ar5312GpioSet(struct ath_hal *, uint32_t gpio, uint32_t val);
extern uint32_t ar5312GpioGet(struct ath_hal *ah, uint32_t gpio);
extern void ar5312GpioSetIntr(struct ath_hal *ah, u_int, uint32_t ilevel);
/* AR2315+ */
-extern HAL_BOOL ar5315GpioCfgOutput(struct ath_hal *, uint32_t gpio);
+extern HAL_BOOL ar5315GpioCfgOutput(struct ath_hal *, uint32_t gpio,
+ HAL_GPIO_MUX_TYPE);
extern HAL_BOOL ar5315GpioCfgInput(struct ath_hal *, uint32_t gpio);
extern HAL_BOOL ar5315GpioSet(struct ath_hal *, uint32_t gpio, uint32_t val);
extern uint32_t ar5315GpioGet(struct ath_hal *ah, uint32_t gpio);
diff --git a/sys/dev/ath/ath_hal/ar5312/ar5312_gpio.c b/sys/dev/ath/ath_hal/ar5312/ar5312_gpio.c
index 02ed565..20a575d 100644
--- a/sys/dev/ath/ath_hal/ar5312/ar5312_gpio.c
+++ b/sys/dev/ath/ath_hal/ar5312/ar5312_gpio.c
@@ -14,7 +14,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $Id: ar5312_gpio.c,v 1.3 2008/11/10 04:08:04 sam Exp $
+ * $FreeBSD$
*/
#include "opt_ah.h"
@@ -35,7 +35,7 @@
* Configure GPIO Output lines
*/
HAL_BOOL
-ar5312GpioCfgOutput(struct ath_hal *ah, uint32_t gpio)
+ar5312GpioCfgOutput(struct ath_hal *ah, uint32_t gpio, HAL_GPIO_MUX_TYPE type)
{
uint32_t gpioOffset = (AR5312_GPIO_BASE - ((uint32_t) ah->ah_sh));
diff --git a/sys/dev/ath/ath_hal/ar5312/ar5315_gpio.c b/sys/dev/ath/ath_hal/ar5312/ar5315_gpio.c
index 2aca97a..4c04c86 100644
--- a/sys/dev/ath/ath_hal/ar5312/ar5315_gpio.c
+++ b/sys/dev/ath/ath_hal/ar5312/ar5315_gpio.c
@@ -14,7 +14,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $Id: ar5315_gpio.c,v 1.3 2008/11/10 04:08:04 sam Exp $
+ * $FreeBSD$
*/
#include "opt_ah.h"
@@ -35,7 +35,7 @@
* Configure GPIO Output lines
*/
HAL_BOOL
-ar5315GpioCfgOutput(struct ath_hal *ah, uint32_t gpio)
+ar5315GpioCfgOutput(struct ath_hal *ah, uint32_t gpio, HAL_GPIO_MUX_TYPE type)
{
uint32_t gpioOffset = (AR5315_GPIO_BASE - ((uint32_t) ah->ah_sh));
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416.h b/sys/dev/ath/ath_hal/ar5416/ar5416.h
index 12b0c0b..639b22d 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar5416.h
+++ b/sys/dev/ath/ath_hal/ar5416/ar5416.h
@@ -120,7 +120,8 @@ extern HAL_BOOL ar5416IsInterruptPending(struct ath_hal *ah);
extern HAL_BOOL ar5416GetPendingInterrupts(struct ath_hal *, HAL_INT *masked);
extern HAL_INT ar5416SetInterrupts(struct ath_hal *ah, HAL_INT ints);
-extern HAL_BOOL ar5416GpioCfgOutput(struct ath_hal *, uint32_t gpio);
+extern HAL_BOOL ar5416GpioCfgOutput(struct ath_hal *, uint32_t gpio,
+ HAL_GPIO_MUX_TYPE);
extern HAL_BOOL ar5416GpioCfgInput(struct ath_hal *, uint32_t gpio);
extern HAL_BOOL ar5416GpioSet(struct ath_hal *, uint32_t gpio, uint32_t val);
extern uint32_t ar5416GpioGet(struct ath_hal *ah, uint32_t gpio);
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_gpio.c b/sys/dev/ath/ath_hal/ar5416/ar5416_gpio.c
index 0aa2843..16b4ebe 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar5416_gpio.c
+++ b/sys/dev/ath/ath_hal/ar5416/ar5416_gpio.c
@@ -14,7 +14,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $Id: ar5416_gpio.c,v 1.3 2008/11/10 04:08:04 sam Exp $
+ * $FreeBSD$
*/
#include "opt_ah.h"
@@ -36,7 +36,7 @@
* Configure GPIO Output lines
*/
HAL_BOOL
-ar5416GpioCfgOutput(struct ath_hal *ah, uint32_t gpio)
+ar5416GpioCfgOutput(struct ath_hal *ah, uint32_t gpio, HAL_GPIO_MUX_TYPE type)
{
HALASSERT(gpio < AR_NUM_GPIO);
OS_REG_CLR_BIT(ah, AR_GPIO_INTR_OUT, AR_GPIO_BIT(gpio));
diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c
index a0ebb4a..22bbd3e 100644
--- a/sys/dev/ath/if_ath.c
+++ b/sys/dev/ath/if_ath.c
@@ -559,7 +559,8 @@ ath_attach(u_int16_t devid, struct ath_softc *sc)
*/
sc->sc_softled = (devid == AR5212_DEVID_IBM || devid == AR5211_DEVID);
if (sc->sc_softled) {
- ath_hal_gpioCfgOutput(ah, sc->sc_ledpin);
+ ath_hal_gpioCfgOutput(ah, sc->sc_ledpin,
+ HAL_GPIO_MUX_MAC_NETWORK_LED);
ath_hal_gpioset(ah, sc->sc_ledpin, !sc->sc_ledon);
}
@@ -1218,7 +1219,8 @@ ath_resume(struct ath_softc *sc)
ieee80211_resume_all(ic);
}
if (sc->sc_softled) {
- ath_hal_gpioCfgOutput(ah, sc->sc_ledpin);
+ ath_hal_gpioCfgOutput(ah, sc->sc_ledpin,
+ HAL_GPIO_MUX_MAC_NETWORK_LED);
ath_hal_gpioset(ah, sc->sc_ledpin, !sc->sc_ledon);
}
}
@@ -6653,7 +6655,8 @@ ath_sysctl_softled(SYSCTL_HANDLER_ARGS)
if (softled != sc->sc_softled) {
if (softled) {
/* NB: handle any sc_ledpin change */
- ath_hal_gpioCfgOutput(sc->sc_ah, sc->sc_ledpin);
+ ath_hal_gpioCfgOutput(sc->sc_ah, sc->sc_ledpin,
+ HAL_GPIO_MUX_MAC_NETWORK_LED);
ath_hal_gpioset(sc->sc_ah, sc->sc_ledpin,
!sc->sc_ledon);
}
@@ -6675,7 +6678,8 @@ ath_sysctl_ledpin(SYSCTL_HANDLER_ARGS)
if (ledpin != sc->sc_ledpin) {
sc->sc_ledpin = ledpin;
if (sc->sc_softled) {
- ath_hal_gpioCfgOutput(sc->sc_ah, sc->sc_ledpin);
+ ath_hal_gpioCfgOutput(sc->sc_ah, sc->sc_ledpin,
+ HAL_GPIO_MUX_MAC_NETWORK_LED);
ath_hal_gpioset(sc->sc_ah, sc->sc_ledpin,
!sc->sc_ledon);
}
diff --git a/sys/dev/ath/if_athvar.h b/sys/dev/ath/if_athvar.h
index 6d5a35d..568ad7b 100644
--- a/sys/dev/ath/if_athvar.h
+++ b/sys/dev/ath/if_athvar.h
@@ -700,8 +700,8 @@ void ath_intr(void *);
#define ath_hal_gettxintrtxqs(_ah, _txqs) \
((*(_ah)->ah_getTxIntrQueue)((_ah), (_txqs)))
-#define ath_hal_gpioCfgOutput(_ah, _gpio) \
- ((*(_ah)->ah_gpioCfgOutput)((_ah), (_gpio)))
+#define ath_hal_gpioCfgOutput(_ah, _gpio, _type) \
+ ((*(_ah)->ah_gpioCfgOutput)((_ah), (_gpio), (_type)))
#define ath_hal_gpioset(_ah, _gpio, _b) \
((*(_ah)->ah_gpioSet)((_ah), (_gpio), (_b)))
#define ath_hal_gpioget(_ah, _gpio) \
OpenPOWER on IntegriCloud