Lines Matching +full:rfkill +full:- +full:gpio
1 /*-
2 * SPDX-License-Identifier: ISC
4 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
5 * Copyright (c) 2002-2004 Atheros Communications, Inc.
30 #define AR_NUM_GPIO 6 /* 6 GPIO bits */
31 #define AR_GPIOD_MASK 0x2f /* 6-bit mask */
38 OS_MEMCPY(mac, ahp->ah_macaddr, IEEE80211_ADDR_LEN); in ar5210GetMacAddress()
46 OS_MEMCPY(ahp->ah_macaddr, mac, IEEE80211_ADDR_LEN); in ar5210SetMacAddress()
101 if (AH_PRIVATE(ah)->ah_currentRD == regDomain) { in ar5210SetRegulatoryDomain()
108 * permit re-writing that segment of the EEPROM. in ar5210SetRegulatoryDomain()
136 * Called if RfKill is supported (according to EEPROM). Set the interrupt and
137 * GPIO values so the ISR and can disable RF on a switch signal
142 uint16_t rfsilent = AH_PRIVATE(ah)->ah_rfsilent; in ar5210EnableRfKill()
147 * If radio disable switch connection to GPIO bit 0 is enabled in ar5210EnableRfKill()
148 * program GPIO interrupt. in ar5210EnableRfKill()
149 * If rfkill bit on eeprom is 1, setupeeprommap routine has already in ar5210EnableRfKill()
151 * rfkill bit and it is set to 1, indicating that GPIO bit 0 hardware in ar5210EnableRfKill()
158 * Configure GPIO Output lines
161 ar5210GpioCfgOutput(struct ath_hal *ah, uint32_t gpio, HAL_GPIO_MUX_TYPE type) in ar5210GpioCfgOutput() argument
163 HALASSERT(gpio < AR_NUM_GPIO); in ar5210GpioCfgOutput()
166 (OS_REG_READ(ah, AR_GPIOCR) &~ AR_GPIOCR_ALL(gpio)) in ar5210GpioCfgOutput()
167 | AR_GPIOCR_OUT1(gpio)); in ar5210GpioCfgOutput()
173 * Configure GPIO Input lines
176 ar5210GpioCfgInput(struct ath_hal *ah, uint32_t gpio) in ar5210GpioCfgInput() argument
178 HALASSERT(gpio < AR_NUM_GPIO); in ar5210GpioCfgInput()
181 (OS_REG_READ(ah, AR_GPIOCR) &~ AR_GPIOCR_ALL(gpio)) in ar5210GpioCfgInput()
182 | AR_GPIOCR_IN(gpio)); in ar5210GpioCfgInput()
188 * Once configured for I/O - set output lines
191 ar5210GpioSet(struct ath_hal *ah, uint32_t gpio, uint32_t val) in ar5210GpioSet() argument
195 HALASSERT(gpio < AR_NUM_GPIO); in ar5210GpioSet()
198 reg &= ~(1 << gpio); in ar5210GpioSet()
199 reg |= (val&1) << gpio; in ar5210GpioSet()
206 * Once configured for I/O - get input lines
209 ar5210GpioGet(struct ath_hal *ah, uint32_t gpio) in ar5210GpioGet() argument
211 if (gpio < AR_NUM_GPIO) { in ar5210GpioGet()
213 val = ((val & AR_GPIOD_MASK) >> gpio) & 0x1; in ar5210GpioGet()
221 * Set the GPIO 0 Interrupt
224 ar5210Gpio0SetIntr(struct ath_hal *ah, u_int gpio, uint32_t ilevel) in ar5210Gpio0SetIntr() argument
229 val &= ~(AR_GPIOCR_INT_SEL(gpio) | AR_GPIOCR_INT_SELH | AR_GPIOCR_INT_ENA | in ar5210Gpio0SetIntr()
230 AR_GPIOCR_ALL(gpio)); in ar5210Gpio0SetIntr()
232 val |= AR_GPIOCR_INT_SEL(gpio) | AR_GPIOCR_INT_ENA; in ar5210Gpio0SetIntr()
240 ar5210SetInterrupts(ah, AH5210(ah)->ah_maskReg | HAL_INT_GPIO); in ar5210Gpio0SetIntr()
316 /* XXX save bssid for possible re-use on reset */ in ar5210WriteAssocid()
317 OS_MEMCPY(ahp->ah_bssid, bssid, IEEE80211_ADDR_LEN); in ar5210WriteAssocid()
318 ahp->ah_associd = assocId; in ar5210WriteAssocid()
319 OS_REG_WRITE(ah, AR_BSS_ID0, LE_READ_4(ahp->ah_bssid)); in ar5210WriteAssocid()
320 OS_REG_WRITE(ah, AR_BSS_ID1, LE_READ_2(ahp->ah_bssid+4) | in ar5210WriteAssocid()
336 /* sync multi-word read */ in ar5210GetTsf64()
343 * then we re-reading AR_TSF_U32 does no good as the in ar5210GetTsf64()
346 * to check for rollover doesn't help if preempted--so in ar5210GetTsf64()
377 * Grab a semi-random value from hardware registers - may not
387 nf = 0 - ((nf ^ 0x1ff) + 1); in ar5210GetRandomSeed()
403 return (AH_PRIVATE(ah)->ah_macRev == (OS_REG_READ(ah, AR_SREV) & 0xff)); in ar5210DetectCardPresent()
412 stats->ackrcv_bad += OS_REG_READ(ah, AR_ACK_FAIL); in ar5210UpdateMibCounters()
413 stats->rts_bad += OS_REG_READ(ah, AR_RTS_FAIL); in ar5210UpdateMibCounters()
414 stats->fcs_bad += OS_REG_READ(ah, AR_FCS_FAIL); in ar5210UpdateMibCounters()
415 stats->rts_good += OS_REG_READ(ah, AR_RTS_OK); in ar5210UpdateMibCounters()
416 stats->beacons += OS_REG_READ(ah, AR_BEACON_CNT); in ar5210UpdateMibCounters()
427 ahp->ah_sifstime = (u_int) -1; /* restore default handling */ in ar5210SetSifsTime()
433 ahp->ah_sifstime = us; in ar5210SetSifsTime()
453 ahp->ah_slottime = (u_int) -1; /* restore default handling */ in ar5210SetSlotTime()
458 ahp->ah_slottime = us; in ar5210SetSlotTime()
478 ahp->ah_acktimeout = (u_int) -1; /* restore default handling */ in ar5210SetAckTimeout()
484 ahp->ah_acktimeout = us; in ar5210SetAckTimeout()
499 return ((AH5210(ah)->ah_staId1Defaults & AR_STA_ID1_ACKCTS_6MB) == 0); in ar5210GetAckCTSRate()
509 ahp->ah_staId1Defaults &= ~AR_STA_ID1_ACKCTS_6MB; in ar5210SetAckCTSRate()
512 ahp->ah_staId1Defaults |= AR_STA_ID1_ACKCTS_6MB; in ar5210SetAckCTSRate()
525 ahp->ah_ctstimeout = (u_int) -1; /* restore default handling */ in ar5210SetCTSTimeout()
531 ahp->ah_ctstimeout = us; in ar5210SetCTSTimeout()
617 AH_PRIVATE(ah)->ah_diagreg = setting; in ar5210SetCapability()
619 AH_PRIVATE(ah)->ah_diagreg = setting & 0x6; /* ACK+CTS */ in ar5210SetCapability()
621 ar5210UpdateDiagReg(ah, AH_PRIVATE(ah)->ah_diagreg); in ar5210SetCapability()