On Sun, Oct 07, 2012 at 07:41:58PM +0200, Mark Kettenis wrote: > Hmm, the AR9300_GPIO_IN_VAL define you introduce isn't actually used.
Thanks, I forgot about using it. Not sure if it is important though maybe the upper bits of the register aren't always stable? In any case we should just use the bit mask like Linux does. Index: ar9003.c =================================================================== RCS file: /cvs/src/sys/dev/ic/ar9003.c,v retrieving revision 1.23 diff -u -p -r1.23 ar9003.c --- ar9003.c 25 Aug 2012 12:14:31 -0000 1.23 +++ ar9003.c 7 Oct 2012 21:26:18 -0000 @@ -503,7 +503,8 @@ int ar9003_gpio_read(struct athn_softc *sc, int pin) { KASSERT(pin < sc->ngpiopins); - return ((AR_READ(sc, AR_GPIO_IN_OUT) >> pin) & 1); + return (((AR_READ(sc, AR_GPIO_IN) & AR9300_GPIO_IN_VAL) & + (1 << pin)) != 0); } void Index: ar9003reg.h =================================================================== RCS file: /cvs/src/sys/dev/ic/ar9003reg.h,v retrieving revision 1.7 diff -u -p -r1.7 ar9003reg.h --- ar9003reg.h 1 Jan 2011 13:44:42 -0000 1.7 +++ ar9003reg.h 7 Oct 2012 21:26:18 -0000 @@ -25,6 +25,8 @@ #define AR_ISR_S4_S 0x00d8 #define AR_ISR_S5_S 0x00dc #define AR_GPIO_IN_OUT 0x4048 +#define AR_GPIO_IN 0x404c +#define AR9300_GPIO_IN_VAL 0x0001FFFF #define AR_GPIO_OE_OUT 0x4050 #define AR_GPIO_INTR_POL 0x4058 #define AR_GPIO_INPUT_EN_VAL 0x405c Index: ar9380.c =================================================================== RCS file: /cvs/src/sys/dev/ic/ar9380.c,v retrieving revision 1.15 diff -u -p -r1.15 ar9380.c --- ar9380.c 10 Jun 2012 21:23:36 -0000 1.15 +++ ar9380.c 7 Oct 2012 21:26:18 -0000 @@ -148,7 +148,11 @@ ar9380_setup(struct athn_softc *sc) if (base->rfSilent & AR_EEP_RFSILENT_ENABLED) { sc->flags |= ATHN_FLAG_RFSILENT; /* Get GPIO pin used by hardware radio switch. */ - sc->rfsilent_pin = base->wlanDisableGpio; + sc->rfsilent_pin = MS(base->rfSilent, + AR_EEP_RFSILENT_GPIO_SEL); + /* Get polarity of hardware radio switch. */ + if (base->rfSilent & AR_EEP_RFSILENT_POLARITY) + sc->flags |= ATHN_FLAG_RFSILENT_REVERSED; } /* Set the number of HW key cache entries. */ Index: ar9380reg.h =================================================================== RCS file: /cvs/src/sys/dev/ic/ar9380reg.h,v retrieving revision 1.17 diff -u -p -r1.17 ar9380reg.h --- ar9380reg.h 10 Jun 2012 21:23:36 -0000 1.17 +++ ar9380reg.h 7 Oct 2012 21:26:18 -0000 @@ -75,6 +75,8 @@ struct ar9380_base_eep_hdr { uint8_t eepMisc; uint8_t rfSilent; #define AR_EEP_RFSILENT_ENABLED 0x0001 +#define AR_EEP_RFSILENT_GPIO_SEL_M 0x001c +#define AR_EEP_RFSILENT_GPIO_SEL_S 2 #define AR_EEP_RFSILENT_POLARITY 0x0002 uint8_t blueToothOptions;