History log of /openbsd-current/sys/dev/ic/athnreg.h
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.25 28-Apr-2020 stsp

Configure Tx interrupt mitigation thresholds on athn(4) devices.
ok kevlo@ mpi@


# 1.24 20-Apr-2020 stsp

Add athn(4) definitions for the block-ack/block-ack-request control register.

Not used yet but may become useful later.


Revision tags: OPENBSD_6_6_BASE
# 1.23 17-May-2019 kevlo

For AR9271, use correct clock control register and add a macro to access it.

ok stsp@


Revision tags: OPENBSD_6_5_BASE
# 1.22 01-Feb-2019 stsp

Complete athn(4) noisefloor calibration code and enable it.
Update default/min/max noisefloor values to those used by Linux ath9k.
Tested by jmc, juanfra, kn, and myself, on 9280 and 9271 devices.


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.21 28-Nov-2017 stsp

The athn(4) PCI driver forgot about adding the default noisefloor to
measured RSSI values. The same is already done for USB devices.
RSSI values shown in ifconfig make sense now.

ok kevlo@


Revision tags: OPENBSD_6_2_BASE
# 1.20 19-May-2017 stsp

Make monitor work with athn(4) on my 3T3R AR9380 device.
This card can now receive packets. Transmit is still broken and
Kevin Lo reports that his 2T2R AR9380 device cannot receive yet.


Revision tags: OPENBSD_6_1_BASE
# 1.19 18-Dec-2016 kettenis

Add cast to mask and shift macros to silence warnings generated by clang.

ok millert@


Revision tags: OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.18 10-Jun-2012 kettenis

Allow a variable number of words for the Serializer/Deserializer programming.
Probably not enought to make the AR9380 chips to work, but at least the kernel
shouldn't crash anymore when we see one.

ok stsp@


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE
# 1.17 06-Jan-2011 damien

"athn* at uhub? port ?"
this adds preliminary support for the Atheros AR9271 chipset and
probably the AR9280+AR7010 and AR9287+AR7010 too though those were
not tested.
scanning still takes a very long time (~1 sec per channel) but
otherwise, operation in STA mode seems stable.
will implement fast channel change soon.

committed over the Ubiquiti WifiStation EXT (AR9271) on i386 with WPA.
requires firmware (see man page for details)

ok deraadt@ (who checked the .h files)


# 1.16 01-Jan-2011 damien

unbreak kernel builds; sorry guys.

pointed out by Benoit Lecocq.


# 1.15 31-Dec-2010 damien

commit some bits that will be required by AR9271/AR7010


# 1.14 31-Dec-2010 damien

Make the athn(4) back-end more bus agnostic by moving read and write
operations to callbacks in the PCI and CardBus front-ends.
This will allow support of other buses like USB.
Assume the following memory model:
- writes are ordered but may be buffered and require explicit flush
- a read always flushes all buffered writes


Revision tags: OPENBSD_4_8_BASE
# 1.13 21-Jun-2010 damien

Implement PA linearization on adapters with digital predistorters
(AR9003 family only).

The power amplifier predistortion state machine works as follows:
1) Disable digital predistorters for all Tx chains
2) Repeat steps 3~7 for all Tx chains
3) Force Tx gain to that of training signal
4) Send training signal (asynchronous)
5) Wait for training signal to complete (asynchronous)
6) Read PA measurements (input power, output power, output phase)
7) Compute the predistortion function that linearizes PA output
8) Write predistortion functions to hardware tables for all Tx chains
9) Enable digital predistorters for all Tx chains

from ath9k (though implementation differs a lot)


# 1.12 03-Jun-2010 damien

enable async fifo for >=AR9287 1.3 only.
from ath9k.


# 1.11 16-May-2010 damien

initial Host AP bits.


# 1.10 16-May-2010 damien

fix athn_updateslot for fast PLL clock and 40MHz CBW


# 1.9 13-May-2010 damien

initialization values for AR9380 2.2.
turns out the Rx gain tables are the same as 2.0 (and the Tx gain
registers too), which saves us a few bytes.


# 1.8 10-May-2010 damien

athn(4) is going to support a new family of Atheros 802.11n
chips (AR9003), which differs from the currently supported
families (AR5008, AR9001 and AR9002).

The main differences (from a driver point of view) are:

* DMA:
Tx and Rx descriptors have changed.
A single Tx descriptor can now reference up to 4 scatter/gather
DMA segments.
There is now a DMA ring for reporting Tx status with separate
Tx status descriptors (this ring is used to report Tx status for
all the Tx FIFOs).
Rx status descriptors are now put at the beginning of Rx buffers
and do not need to be allocated separately from buffers.
There are two Rx FIFOs (low priority and high priority) instead
of one.

* ROM:
The AR9003 family uses OTP-ROM instead of EEPROM.
Reading the ROM is totally insane since vendors can provide only
the chunks of ROM that differ from a default image (and thus the
default image has to be stored in the driver).
This is referenced as "compressed ROM" in the Linux driver, though
there is no real compression involved, at least for the moment.

* PHY registers:
All PHY registers have changed.
Some registers offsets do not fit on 16 bits anymore, but
since they are 32-bit aligned, we can still make them fit on
16 bits to save .rodata space in initialization tables.

* MAC registers:
Some MAC registers offsets have changed (GPIO, interrupt masks)
which is quite annoying (though ~98% remain the same.)

* Initialization values:
Initialization values are now split in mac/soc/bb/radio blocks
and pre/core/post phases in the Linux driver. I have chosen to
not go that road and merge these blocks in modal and non-modal
initialization values (similar to the other families).
The initialization order remains exactly the same as the Linux
driver though.

To manage these differences, I have split athn.c in two backends:
ar5008.c contains the bits that are specific to the AR5008,
AR9001 and AR9002 families (used by ar5416.c, ar9280.c,
ar9285.c and ar9287.c) and that were previously in athn.c.

ar9003.c contains the bits that are specific to the new
AR9003 family (used by ar9380.c only for now.)

I have introduced a thin hardware abstraction layer (actually
a set of pointers to functions) that is used in athn.c.
My intent is to keep this abstraction layer as thin as possible
and not to create another ugly pile of abstraction layers a la
MadWifi.

I think I've managed to keep things sane, probably at the expense
of duplicating some code in both ar5008.c and ar9003.c, but at
least we do not have to dig through layers and layers of virtual
descriptors to figure out what is mapped to the hardware.

Tested for non-regression on various AR5416 (sparc64+i386), AR9281
and AR9285 (i386 only) adapters.
AR9380 part is not tested (hardware is not available to the general
public yet).

Committed over my AR9285 2.0.


# 1.7 07-Apr-2010 damien

update initvals and TX gains for AR9285 >=1.2
check result of carrier leakage calibration and redo calibration if needed
add support for newer AR9285 chips (AR9285 XE 2.0).

tested for non-regression on a DNXA-95
"Still seems to work here" kettenis@


Revision tags: OPENBSD_4_7_BASE
# 1.6 24-Feb-2010 damien

Disable Reduced Interframe Space search on AR9160 to workaround
baseband issues.
It would be cleaner to modify directly the initvals for AR9160 but
I want to keep the exact same initvals as the Linux ath9k driver.

from ath9k


# 1.5 24-Feb-2010 damien

fix AR_PHY_TX_DESIRED_SCALE_CCK mask (only affect AR9280 2.0
with ROM rev >= 20)
do some cleanup of phy registers definitions while i'm here.


# 1.4 19-Nov-2009 damien

if a radio switch exists, configure the GPIO pin to which it is
connected to raise an interrupt when the pin goes low (or high
depending on the polarity of the radio switch.)
turn the interface down when the interrupt occurs.
this is the same behaviour as in wpi(4) and iwn(4).

cleanup interrupts processing while i'm here.
remove ATHN_INTR_MITIGATION compile option (it is set by default.)


# 1.3 15-Nov-2009 damien

AR9287 uses GPIO pin 8 for LED, not 1.
Turn link LED on while associated.


# 1.2 14-Nov-2009 damien

translate a comment from french to english.
no binary change.


# 1.1 14-Nov-2009 damien

athn(4), a driver for Atheros 802.11a/g/n devices.
written from scratch based on the vendor driver for Linux (ath9k).
AR9285 and AR9287 parts are 100% untested.
only basic functionnalities are enabled for now.

committed over an AR9281.

"commit" deraadt


# 1.24 20-Apr-2020 stsp

Add athn(4) definitions for the block-ack/block-ack-request control register.

Not used yet but may become useful later.


Revision tags: OPENBSD_6_6_BASE
# 1.23 17-May-2019 kevlo

For AR9271, use correct clock control register and add a macro to access it.

ok stsp@


Revision tags: OPENBSD_6_5_BASE
# 1.22 01-Feb-2019 stsp

Complete athn(4) noisefloor calibration code and enable it.
Update default/min/max noisefloor values to those used by Linux ath9k.
Tested by jmc, juanfra, kn, and myself, on 9280 and 9271 devices.


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.21 28-Nov-2017 stsp

The athn(4) PCI driver forgot about adding the default noisefloor to
measured RSSI values. The same is already done for USB devices.
RSSI values shown in ifconfig make sense now.

ok kevlo@


Revision tags: OPENBSD_6_2_BASE
# 1.20 19-May-2017 stsp

Make monitor work with athn(4) on my 3T3R AR9380 device.
This card can now receive packets. Transmit is still broken and
Kevin Lo reports that his 2T2R AR9380 device cannot receive yet.


Revision tags: OPENBSD_6_1_BASE
# 1.19 18-Dec-2016 kettenis

Add cast to mask and shift macros to silence warnings generated by clang.

ok millert@


Revision tags: OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.18 10-Jun-2012 kettenis

Allow a variable number of words for the Serializer/Deserializer programming.
Probably not enought to make the AR9380 chips to work, but at least the kernel
shouldn't crash anymore when we see one.

ok stsp@


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE
# 1.17 06-Jan-2011 damien

"athn* at uhub? port ?"
this adds preliminary support for the Atheros AR9271 chipset and
probably the AR9280+AR7010 and AR9287+AR7010 too though those were
not tested.
scanning still takes a very long time (~1 sec per channel) but
otherwise, operation in STA mode seems stable.
will implement fast channel change soon.

committed over the Ubiquiti WifiStation EXT (AR9271) on i386 with WPA.
requires firmware (see man page for details)

ok deraadt@ (who checked the .h files)


# 1.16 01-Jan-2011 damien

unbreak kernel builds; sorry guys.

pointed out by Benoit Lecocq.


# 1.15 31-Dec-2010 damien

commit some bits that will be required by AR9271/AR7010


# 1.14 31-Dec-2010 damien

Make the athn(4) back-end more bus agnostic by moving read and write
operations to callbacks in the PCI and CardBus front-ends.
This will allow support of other buses like USB.
Assume the following memory model:
- writes are ordered but may be buffered and require explicit flush
- a read always flushes all buffered writes


Revision tags: OPENBSD_4_8_BASE
# 1.13 21-Jun-2010 damien

Implement PA linearization on adapters with digital predistorters
(AR9003 family only).

The power amplifier predistortion state machine works as follows:
1) Disable digital predistorters for all Tx chains
2) Repeat steps 3~7 for all Tx chains
3) Force Tx gain to that of training signal
4) Send training signal (asynchronous)
5) Wait for training signal to complete (asynchronous)
6) Read PA measurements (input power, output power, output phase)
7) Compute the predistortion function that linearizes PA output
8) Write predistortion functions to hardware tables for all Tx chains
9) Enable digital predistorters for all Tx chains

from ath9k (though implementation differs a lot)


# 1.12 03-Jun-2010 damien

enable async fifo for >=AR9287 1.3 only.
from ath9k.


# 1.11 16-May-2010 damien

initial Host AP bits.


# 1.10 16-May-2010 damien

fix athn_updateslot for fast PLL clock and 40MHz CBW


# 1.9 13-May-2010 damien

initialization values for AR9380 2.2.
turns out the Rx gain tables are the same as 2.0 (and the Tx gain
registers too), which saves us a few bytes.


# 1.8 10-May-2010 damien

athn(4) is going to support a new family of Atheros 802.11n
chips (AR9003), which differs from the currently supported
families (AR5008, AR9001 and AR9002).

The main differences (from a driver point of view) are:

* DMA:
Tx and Rx descriptors have changed.
A single Tx descriptor can now reference up to 4 scatter/gather
DMA segments.
There is now a DMA ring for reporting Tx status with separate
Tx status descriptors (this ring is used to report Tx status for
all the Tx FIFOs).
Rx status descriptors are now put at the beginning of Rx buffers
and do not need to be allocated separately from buffers.
There are two Rx FIFOs (low priority and high priority) instead
of one.

* ROM:
The AR9003 family uses OTP-ROM instead of EEPROM.
Reading the ROM is totally insane since vendors can provide only
the chunks of ROM that differ from a default image (and thus the
default image has to be stored in the driver).
This is referenced as "compressed ROM" in the Linux driver, though
there is no real compression involved, at least for the moment.

* PHY registers:
All PHY registers have changed.
Some registers offsets do not fit on 16 bits anymore, but
since they are 32-bit aligned, we can still make them fit on
16 bits to save .rodata space in initialization tables.

* MAC registers:
Some MAC registers offsets have changed (GPIO, interrupt masks)
which is quite annoying (though ~98% remain the same.)

* Initialization values:
Initialization values are now split in mac/soc/bb/radio blocks
and pre/core/post phases in the Linux driver. I have chosen to
not go that road and merge these blocks in modal and non-modal
initialization values (similar to the other families).
The initialization order remains exactly the same as the Linux
driver though.

To manage these differences, I have split athn.c in two backends:
ar5008.c contains the bits that are specific to the AR5008,
AR9001 and AR9002 families (used by ar5416.c, ar9280.c,
ar9285.c and ar9287.c) and that were previously in athn.c.

ar9003.c contains the bits that are specific to the new
AR9003 family (used by ar9380.c only for now.)

I have introduced a thin hardware abstraction layer (actually
a set of pointers to functions) that is used in athn.c.
My intent is to keep this abstraction layer as thin as possible
and not to create another ugly pile of abstraction layers a la
MadWifi.

I think I've managed to keep things sane, probably at the expense
of duplicating some code in both ar5008.c and ar9003.c, but at
least we do not have to dig through layers and layers of virtual
descriptors to figure out what is mapped to the hardware.

Tested for non-regression on various AR5416 (sparc64+i386), AR9281
and AR9285 (i386 only) adapters.
AR9380 part is not tested (hardware is not available to the general
public yet).

Committed over my AR9285 2.0.


# 1.7 07-Apr-2010 damien

update initvals and TX gains for AR9285 >=1.2
check result of carrier leakage calibration and redo calibration if needed
add support for newer AR9285 chips (AR9285 XE 2.0).

tested for non-regression on a DNXA-95
"Still seems to work here" kettenis@


Revision tags: OPENBSD_4_7_BASE
# 1.6 24-Feb-2010 damien

Disable Reduced Interframe Space search on AR9160 to workaround
baseband issues.
It would be cleaner to modify directly the initvals for AR9160 but
I want to keep the exact same initvals as the Linux ath9k driver.

from ath9k


# 1.5 24-Feb-2010 damien

fix AR_PHY_TX_DESIRED_SCALE_CCK mask (only affect AR9280 2.0
with ROM rev >= 20)
do some cleanup of phy registers definitions while i'm here.


# 1.4 19-Nov-2009 damien

if a radio switch exists, configure the GPIO pin to which it is
connected to raise an interrupt when the pin goes low (or high
depending on the polarity of the radio switch.)
turn the interface down when the interrupt occurs.
this is the same behaviour as in wpi(4) and iwn(4).

cleanup interrupts processing while i'm here.
remove ATHN_INTR_MITIGATION compile option (it is set by default.)


# 1.3 15-Nov-2009 damien

AR9287 uses GPIO pin 8 for LED, not 1.
Turn link LED on while associated.


# 1.2 14-Nov-2009 damien

translate a comment from french to english.
no binary change.


# 1.1 14-Nov-2009 damien

athn(4), a driver for Atheros 802.11a/g/n devices.
written from scratch based on the vendor driver for Linux (ath9k).
AR9285 and AR9287 parts are 100% untested.
only basic functionnalities are enabled for now.

committed over an AR9281.

"commit" deraadt


# 1.23 17-May-2019 kevlo

For AR9271, use correct clock control register and add a macro to access it.

ok stsp@


Revision tags: OPENBSD_6_5_BASE
# 1.22 01-Feb-2019 stsp

Complete athn(4) noisefloor calibration code and enable it.
Update default/min/max noisefloor values to those used by Linux ath9k.
Tested by jmc, juanfra, kn, and myself, on 9280 and 9271 devices.


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.21 28-Nov-2017 stsp

The athn(4) PCI driver forgot about adding the default noisefloor to
measured RSSI values. The same is already done for USB devices.
RSSI values shown in ifconfig make sense now.

ok kevlo@


Revision tags: OPENBSD_6_2_BASE
# 1.20 19-May-2017 stsp

Make monitor work with athn(4) on my 3T3R AR9380 device.
This card can now receive packets. Transmit is still broken and
Kevin Lo reports that his 2T2R AR9380 device cannot receive yet.


Revision tags: OPENBSD_6_1_BASE
# 1.19 18-Dec-2016 kettenis

Add cast to mask and shift macros to silence warnings generated by clang.

ok millert@


Revision tags: OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.18 10-Jun-2012 kettenis

Allow a variable number of words for the Serializer/Deserializer programming.
Probably not enought to make the AR9380 chips to work, but at least the kernel
shouldn't crash anymore when we see one.

ok stsp@


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE
# 1.17 06-Jan-2011 damien

"athn* at uhub? port ?"
this adds preliminary support for the Atheros AR9271 chipset and
probably the AR9280+AR7010 and AR9287+AR7010 too though those were
not tested.
scanning still takes a very long time (~1 sec per channel) but
otherwise, operation in STA mode seems stable.
will implement fast channel change soon.

committed over the Ubiquiti WifiStation EXT (AR9271) on i386 with WPA.
requires firmware (see man page for details)

ok deraadt@ (who checked the .h files)


# 1.16 01-Jan-2011 damien

unbreak kernel builds; sorry guys.

pointed out by Benoit Lecocq.


# 1.15 31-Dec-2010 damien

commit some bits that will be required by AR9271/AR7010


# 1.14 31-Dec-2010 damien

Make the athn(4) back-end more bus agnostic by moving read and write
operations to callbacks in the PCI and CardBus front-ends.
This will allow support of other buses like USB.
Assume the following memory model:
- writes are ordered but may be buffered and require explicit flush
- a read always flushes all buffered writes


Revision tags: OPENBSD_4_8_BASE
# 1.13 21-Jun-2010 damien

Implement PA linearization on adapters with digital predistorters
(AR9003 family only).

The power amplifier predistortion state machine works as follows:
1) Disable digital predistorters for all Tx chains
2) Repeat steps 3~7 for all Tx chains
3) Force Tx gain to that of training signal
4) Send training signal (asynchronous)
5) Wait for training signal to complete (asynchronous)
6) Read PA measurements (input power, output power, output phase)
7) Compute the predistortion function that linearizes PA output
8) Write predistortion functions to hardware tables for all Tx chains
9) Enable digital predistorters for all Tx chains

from ath9k (though implementation differs a lot)


# 1.12 03-Jun-2010 damien

enable async fifo for >=AR9287 1.3 only.
from ath9k.


# 1.11 16-May-2010 damien

initial Host AP bits.


# 1.10 16-May-2010 damien

fix athn_updateslot for fast PLL clock and 40MHz CBW


# 1.9 13-May-2010 damien

initialization values for AR9380 2.2.
turns out the Rx gain tables are the same as 2.0 (and the Tx gain
registers too), which saves us a few bytes.


# 1.8 10-May-2010 damien

athn(4) is going to support a new family of Atheros 802.11n
chips (AR9003), which differs from the currently supported
families (AR5008, AR9001 and AR9002).

The main differences (from a driver point of view) are:

* DMA:
Tx and Rx descriptors have changed.
A single Tx descriptor can now reference up to 4 scatter/gather
DMA segments.
There is now a DMA ring for reporting Tx status with separate
Tx status descriptors (this ring is used to report Tx status for
all the Tx FIFOs).
Rx status descriptors are now put at the beginning of Rx buffers
and do not need to be allocated separately from buffers.
There are two Rx FIFOs (low priority and high priority) instead
of one.

* ROM:
The AR9003 family uses OTP-ROM instead of EEPROM.
Reading the ROM is totally insane since vendors can provide only
the chunks of ROM that differ from a default image (and thus the
default image has to be stored in the driver).
This is referenced as "compressed ROM" in the Linux driver, though
there is no real compression involved, at least for the moment.

* PHY registers:
All PHY registers have changed.
Some registers offsets do not fit on 16 bits anymore, but
since they are 32-bit aligned, we can still make them fit on
16 bits to save .rodata space in initialization tables.

* MAC registers:
Some MAC registers offsets have changed (GPIO, interrupt masks)
which is quite annoying (though ~98% remain the same.)

* Initialization values:
Initialization values are now split in mac/soc/bb/radio blocks
and pre/core/post phases in the Linux driver. I have chosen to
not go that road and merge these blocks in modal and non-modal
initialization values (similar to the other families).
The initialization order remains exactly the same as the Linux
driver though.

To manage these differences, I have split athn.c in two backends:
ar5008.c contains the bits that are specific to the AR5008,
AR9001 and AR9002 families (used by ar5416.c, ar9280.c,
ar9285.c and ar9287.c) and that were previously in athn.c.

ar9003.c contains the bits that are specific to the new
AR9003 family (used by ar9380.c only for now.)

I have introduced a thin hardware abstraction layer (actually
a set of pointers to functions) that is used in athn.c.
My intent is to keep this abstraction layer as thin as possible
and not to create another ugly pile of abstraction layers a la
MadWifi.

I think I've managed to keep things sane, probably at the expense
of duplicating some code in both ar5008.c and ar9003.c, but at
least we do not have to dig through layers and layers of virtual
descriptors to figure out what is mapped to the hardware.

Tested for non-regression on various AR5416 (sparc64+i386), AR9281
and AR9285 (i386 only) adapters.
AR9380 part is not tested (hardware is not available to the general
public yet).

Committed over my AR9285 2.0.


# 1.7 07-Apr-2010 damien

update initvals and TX gains for AR9285 >=1.2
check result of carrier leakage calibration and redo calibration if needed
add support for newer AR9285 chips (AR9285 XE 2.0).

tested for non-regression on a DNXA-95
"Still seems to work here" kettenis@


Revision tags: OPENBSD_4_7_BASE
# 1.6 24-Feb-2010 damien

Disable Reduced Interframe Space search on AR9160 to workaround
baseband issues.
It would be cleaner to modify directly the initvals for AR9160 but
I want to keep the exact same initvals as the Linux ath9k driver.

from ath9k


# 1.5 24-Feb-2010 damien

fix AR_PHY_TX_DESIRED_SCALE_CCK mask (only affect AR9280 2.0
with ROM rev >= 20)
do some cleanup of phy registers definitions while i'm here.


# 1.4 19-Nov-2009 damien

if a radio switch exists, configure the GPIO pin to which it is
connected to raise an interrupt when the pin goes low (or high
depending on the polarity of the radio switch.)
turn the interface down when the interrupt occurs.
this is the same behaviour as in wpi(4) and iwn(4).

cleanup interrupts processing while i'm here.
remove ATHN_INTR_MITIGATION compile option (it is set by default.)


# 1.3 15-Nov-2009 damien

AR9287 uses GPIO pin 8 for LED, not 1.
Turn link LED on while associated.


# 1.2 14-Nov-2009 damien

translate a comment from french to english.
no binary change.


# 1.1 14-Nov-2009 damien

athn(4), a driver for Atheros 802.11a/g/n devices.
written from scratch based on the vendor driver for Linux (ath9k).
AR9285 and AR9287 parts are 100% untested.
only basic functionnalities are enabled for now.

committed over an AR9281.

"commit" deraadt


# 1.22 01-Feb-2019 stsp

Complete athn(4) noisefloor calibration code and enable it.
Update default/min/max noisefloor values to those used by Linux ath9k.
Tested by jmc, juanfra, kn, and myself, on 9280 and 9271 devices.


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.21 28-Nov-2017 stsp

The athn(4) PCI driver forgot about adding the default noisefloor to
measured RSSI values. The same is already done for USB devices.
RSSI values shown in ifconfig make sense now.

ok kevlo@


Revision tags: OPENBSD_6_2_BASE
# 1.20 19-May-2017 stsp

Make monitor work with athn(4) on my 3T3R AR9380 device.
This card can now receive packets. Transmit is still broken and
Kevin Lo reports that his 2T2R AR9380 device cannot receive yet.


Revision tags: OPENBSD_6_1_BASE
# 1.19 18-Dec-2016 kettenis

Add cast to mask and shift macros to silence warnings generated by clang.

ok millert@


Revision tags: OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.18 10-Jun-2012 kettenis

Allow a variable number of words for the Serializer/Deserializer programming.
Probably not enought to make the AR9380 chips to work, but at least the kernel
shouldn't crash anymore when we see one.

ok stsp@


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE
# 1.17 06-Jan-2011 damien

"athn* at uhub? port ?"
this adds preliminary support for the Atheros AR9271 chipset and
probably the AR9280+AR7010 and AR9287+AR7010 too though those were
not tested.
scanning still takes a very long time (~1 sec per channel) but
otherwise, operation in STA mode seems stable.
will implement fast channel change soon.

committed over the Ubiquiti WifiStation EXT (AR9271) on i386 with WPA.
requires firmware (see man page for details)

ok deraadt@ (who checked the .h files)


# 1.16 01-Jan-2011 damien

unbreak kernel builds; sorry guys.

pointed out by Benoit Lecocq.


# 1.15 31-Dec-2010 damien

commit some bits that will be required by AR9271/AR7010


# 1.14 31-Dec-2010 damien

Make the athn(4) back-end more bus agnostic by moving read and write
operations to callbacks in the PCI and CardBus front-ends.
This will allow support of other buses like USB.
Assume the following memory model:
- writes are ordered but may be buffered and require explicit flush
- a read always flushes all buffered writes


Revision tags: OPENBSD_4_8_BASE
# 1.13 21-Jun-2010 damien

Implement PA linearization on adapters with digital predistorters
(AR9003 family only).

The power amplifier predistortion state machine works as follows:
1) Disable digital predistorters for all Tx chains
2) Repeat steps 3~7 for all Tx chains
3) Force Tx gain to that of training signal
4) Send training signal (asynchronous)
5) Wait for training signal to complete (asynchronous)
6) Read PA measurements (input power, output power, output phase)
7) Compute the predistortion function that linearizes PA output
8) Write predistortion functions to hardware tables for all Tx chains
9) Enable digital predistorters for all Tx chains

from ath9k (though implementation differs a lot)


# 1.12 03-Jun-2010 damien

enable async fifo for >=AR9287 1.3 only.
from ath9k.


# 1.11 16-May-2010 damien

initial Host AP bits.


# 1.10 16-May-2010 damien

fix athn_updateslot for fast PLL clock and 40MHz CBW


# 1.9 13-May-2010 damien

initialization values for AR9380 2.2.
turns out the Rx gain tables are the same as 2.0 (and the Tx gain
registers too), which saves us a few bytes.


# 1.8 10-May-2010 damien

athn(4) is going to support a new family of Atheros 802.11n
chips (AR9003), which differs from the currently supported
families (AR5008, AR9001 and AR9002).

The main differences (from a driver point of view) are:

* DMA:
Tx and Rx descriptors have changed.
A single Tx descriptor can now reference up to 4 scatter/gather
DMA segments.
There is now a DMA ring for reporting Tx status with separate
Tx status descriptors (this ring is used to report Tx status for
all the Tx FIFOs).
Rx status descriptors are now put at the beginning of Rx buffers
and do not need to be allocated separately from buffers.
There are two Rx FIFOs (low priority and high priority) instead
of one.

* ROM:
The AR9003 family uses OTP-ROM instead of EEPROM.
Reading the ROM is totally insane since vendors can provide only
the chunks of ROM that differ from a default image (and thus the
default image has to be stored in the driver).
This is referenced as "compressed ROM" in the Linux driver, though
there is no real compression involved, at least for the moment.

* PHY registers:
All PHY registers have changed.
Some registers offsets do not fit on 16 bits anymore, but
since they are 32-bit aligned, we can still make them fit on
16 bits to save .rodata space in initialization tables.

* MAC registers:
Some MAC registers offsets have changed (GPIO, interrupt masks)
which is quite annoying (though ~98% remain the same.)

* Initialization values:
Initialization values are now split in mac/soc/bb/radio blocks
and pre/core/post phases in the Linux driver. I have chosen to
not go that road and merge these blocks in modal and non-modal
initialization values (similar to the other families).
The initialization order remains exactly the same as the Linux
driver though.

To manage these differences, I have split athn.c in two backends:
ar5008.c contains the bits that are specific to the AR5008,
AR9001 and AR9002 families (used by ar5416.c, ar9280.c,
ar9285.c and ar9287.c) and that were previously in athn.c.

ar9003.c contains the bits that are specific to the new
AR9003 family (used by ar9380.c only for now.)

I have introduced a thin hardware abstraction layer (actually
a set of pointers to functions) that is used in athn.c.
My intent is to keep this abstraction layer as thin as possible
and not to create another ugly pile of abstraction layers a la
MadWifi.

I think I've managed to keep things sane, probably at the expense
of duplicating some code in both ar5008.c and ar9003.c, but at
least we do not have to dig through layers and layers of virtual
descriptors to figure out what is mapped to the hardware.

Tested for non-regression on various AR5416 (sparc64+i386), AR9281
and AR9285 (i386 only) adapters.
AR9380 part is not tested (hardware is not available to the general
public yet).

Committed over my AR9285 2.0.


# 1.7 07-Apr-2010 damien

update initvals and TX gains for AR9285 >=1.2
check result of carrier leakage calibration and redo calibration if needed
add support for newer AR9285 chips (AR9285 XE 2.0).

tested for non-regression on a DNXA-95
"Still seems to work here" kettenis@


Revision tags: OPENBSD_4_7_BASE
# 1.6 24-Feb-2010 damien

Disable Reduced Interframe Space search on AR9160 to workaround
baseband issues.
It would be cleaner to modify directly the initvals for AR9160 but
I want to keep the exact same initvals as the Linux ath9k driver.

from ath9k


# 1.5 24-Feb-2010 damien

fix AR_PHY_TX_DESIRED_SCALE_CCK mask (only affect AR9280 2.0
with ROM rev >= 20)
do some cleanup of phy registers definitions while i'm here.


# 1.4 19-Nov-2009 damien

if a radio switch exists, configure the GPIO pin to which it is
connected to raise an interrupt when the pin goes low (or high
depending on the polarity of the radio switch.)
turn the interface down when the interrupt occurs.
this is the same behaviour as in wpi(4) and iwn(4).

cleanup interrupts processing while i'm here.
remove ATHN_INTR_MITIGATION compile option (it is set by default.)


# 1.3 15-Nov-2009 damien

AR9287 uses GPIO pin 8 for LED, not 1.
Turn link LED on while associated.


# 1.2 14-Nov-2009 damien

translate a comment from french to english.
no binary change.


# 1.1 14-Nov-2009 damien

athn(4), a driver for Atheros 802.11a/g/n devices.
written from scratch based on the vendor driver for Linux (ath9k).
AR9285 and AR9287 parts are 100% untested.
only basic functionnalities are enabled for now.

committed over an AR9281.

"commit" deraadt


# 1.21 28-Nov-2017 stsp

The athn(4) PCI driver forgot about adding the default noisefloor to
measured RSSI values. The same is already done for USB devices.
RSSI values shown in ifconfig make sense now.

ok kevlo@


Revision tags: OPENBSD_6_2_BASE
# 1.20 19-May-2017 stsp

Make monitor work with athn(4) on my 3T3R AR9380 device.
This card can now receive packets. Transmit is still broken and
Kevin Lo reports that his 2T2R AR9380 device cannot receive yet.


Revision tags: OPENBSD_6_1_BASE
# 1.19 18-Dec-2016 kettenis

Add cast to mask and shift macros to silence warnings generated by clang.

ok millert@


Revision tags: OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.18 10-Jun-2012 kettenis

Allow a variable number of words for the Serializer/Deserializer programming.
Probably not enought to make the AR9380 chips to work, but at least the kernel
shouldn't crash anymore when we see one.

ok stsp@


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE
# 1.17 06-Jan-2011 damien

"athn* at uhub? port ?"
this adds preliminary support for the Atheros AR9271 chipset and
probably the AR9280+AR7010 and AR9287+AR7010 too though those were
not tested.
scanning still takes a very long time (~1 sec per channel) but
otherwise, operation in STA mode seems stable.
will implement fast channel change soon.

committed over the Ubiquiti WifiStation EXT (AR9271) on i386 with WPA.
requires firmware (see man page for details)

ok deraadt@ (who checked the .h files)


# 1.16 01-Jan-2011 damien

unbreak kernel builds; sorry guys.

pointed out by Benoit Lecocq.


# 1.15 31-Dec-2010 damien

commit some bits that will be required by AR9271/AR7010


# 1.14 31-Dec-2010 damien

Make the athn(4) back-end more bus agnostic by moving read and write
operations to callbacks in the PCI and CardBus front-ends.
This will allow support of other buses like USB.
Assume the following memory model:
- writes are ordered but may be buffered and require explicit flush
- a read always flushes all buffered writes


Revision tags: OPENBSD_4_8_BASE
# 1.13 21-Jun-2010 damien

Implement PA linearization on adapters with digital predistorters
(AR9003 family only).

The power amplifier predistortion state machine works as follows:
1) Disable digital predistorters for all Tx chains
2) Repeat steps 3~7 for all Tx chains
3) Force Tx gain to that of training signal
4) Send training signal (asynchronous)
5) Wait for training signal to complete (asynchronous)
6) Read PA measurements (input power, output power, output phase)
7) Compute the predistortion function that linearizes PA output
8) Write predistortion functions to hardware tables for all Tx chains
9) Enable digital predistorters for all Tx chains

from ath9k (though implementation differs a lot)


# 1.12 03-Jun-2010 damien

enable async fifo for >=AR9287 1.3 only.
from ath9k.


# 1.11 16-May-2010 damien

initial Host AP bits.


# 1.10 16-May-2010 damien

fix athn_updateslot for fast PLL clock and 40MHz CBW


# 1.9 13-May-2010 damien

initialization values for AR9380 2.2.
turns out the Rx gain tables are the same as 2.0 (and the Tx gain
registers too), which saves us a few bytes.


# 1.8 10-May-2010 damien

athn(4) is going to support a new family of Atheros 802.11n
chips (AR9003), which differs from the currently supported
families (AR5008, AR9001 and AR9002).

The main differences (from a driver point of view) are:

* DMA:
Tx and Rx descriptors have changed.
A single Tx descriptor can now reference up to 4 scatter/gather
DMA segments.
There is now a DMA ring for reporting Tx status with separate
Tx status descriptors (this ring is used to report Tx status for
all the Tx FIFOs).
Rx status descriptors are now put at the beginning of Rx buffers
and do not need to be allocated separately from buffers.
There are two Rx FIFOs (low priority and high priority) instead
of one.

* ROM:
The AR9003 family uses OTP-ROM instead of EEPROM.
Reading the ROM is totally insane since vendors can provide only
the chunks of ROM that differ from a default image (and thus the
default image has to be stored in the driver).
This is referenced as "compressed ROM" in the Linux driver, though
there is no real compression involved, at least for the moment.

* PHY registers:
All PHY registers have changed.
Some registers offsets do not fit on 16 bits anymore, but
since they are 32-bit aligned, we can still make them fit on
16 bits to save .rodata space in initialization tables.

* MAC registers:
Some MAC registers offsets have changed (GPIO, interrupt masks)
which is quite annoying (though ~98% remain the same.)

* Initialization values:
Initialization values are now split in mac/soc/bb/radio blocks
and pre/core/post phases in the Linux driver. I have chosen to
not go that road and merge these blocks in modal and non-modal
initialization values (similar to the other families).
The initialization order remains exactly the same as the Linux
driver though.

To manage these differences, I have split athn.c in two backends:
ar5008.c contains the bits that are specific to the AR5008,
AR9001 and AR9002 families (used by ar5416.c, ar9280.c,
ar9285.c and ar9287.c) and that were previously in athn.c.

ar9003.c contains the bits that are specific to the new
AR9003 family (used by ar9380.c only for now.)

I have introduced a thin hardware abstraction layer (actually
a set of pointers to functions) that is used in athn.c.
My intent is to keep this abstraction layer as thin as possible
and not to create another ugly pile of abstraction layers a la
MadWifi.

I think I've managed to keep things sane, probably at the expense
of duplicating some code in both ar5008.c and ar9003.c, but at
least we do not have to dig through layers and layers of virtual
descriptors to figure out what is mapped to the hardware.

Tested for non-regression on various AR5416 (sparc64+i386), AR9281
and AR9285 (i386 only) adapters.
AR9380 part is not tested (hardware is not available to the general
public yet).

Committed over my AR9285 2.0.


# 1.7 07-Apr-2010 damien

update initvals and TX gains for AR9285 >=1.2
check result of carrier leakage calibration and redo calibration if needed
add support for newer AR9285 chips (AR9285 XE 2.0).

tested for non-regression on a DNXA-95
"Still seems to work here" kettenis@


Revision tags: OPENBSD_4_7_BASE
# 1.6 24-Feb-2010 damien

Disable Reduced Interframe Space search on AR9160 to workaround
baseband issues.
It would be cleaner to modify directly the initvals for AR9160 but
I want to keep the exact same initvals as the Linux ath9k driver.

from ath9k


# 1.5 24-Feb-2010 damien

fix AR_PHY_TX_DESIRED_SCALE_CCK mask (only affect AR9280 2.0
with ROM rev >= 20)
do some cleanup of phy registers definitions while i'm here.


# 1.4 19-Nov-2009 damien

if a radio switch exists, configure the GPIO pin to which it is
connected to raise an interrupt when the pin goes low (or high
depending on the polarity of the radio switch.)
turn the interface down when the interrupt occurs.
this is the same behaviour as in wpi(4) and iwn(4).

cleanup interrupts processing while i'm here.
remove ATHN_INTR_MITIGATION compile option (it is set by default.)


# 1.3 15-Nov-2009 damien

AR9287 uses GPIO pin 8 for LED, not 1.
Turn link LED on while associated.


# 1.2 14-Nov-2009 damien

translate a comment from french to english.
no binary change.


# 1.1 14-Nov-2009 damien

athn(4), a driver for Atheros 802.11a/g/n devices.
written from scratch based on the vendor driver for Linux (ath9k).
AR9285 and AR9287 parts are 100% untested.
only basic functionnalities are enabled for now.

committed over an AR9281.

"commit" deraadt