Commit Graph

103 Commits

Author SHA1 Message Date
Adrian Chadd
f0949f0cc6 [ath_hal] add USB reset PLL work around for AR9331/AR9344 (Hornet/Wasp.)
It turns out that this is useful on hornet and wasp SoCs but it isn't
enabled in ye olde HAL /unless/ you were using a version from one of the
business units building USB targetted devices.  It eventually got fixed
for all of them as people started wanting to use the USB ports on their
SoCs (eg for flash storage, bluetooth, 4G/LTE widgets, etc.)

This is actually a fix from ath9k but I'm merging it with the available-but-
disabled code in the QCA reference HAL.

Tested:

* AR9331 SoC
2017-06-04 21:21:44 +00:00
Warner Losh
fbbd9655e5 Renumber copyright clause 4
Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by:	Jan Schaumann <jschauma@stevens.edu>
Pull Request:	https://github.com/freebsd/freebsd/pull/96
2017-02-28 23:42:47 +00:00
Adrian Chadd
ea319c839b [ath_hal] [ar9300] link in the CAC enable/diable methods and expose it via the HAL. 2017-02-03 05:15:35 +00:00
Adrian Chadd
c15fdc23c7 [ath_hal] [ar9300] initial radar decode for AR9380 and later chips. 2017-02-03 03:57:06 +00:00
Adrian Chadd
66c73f1d0a [ath_hal] [ar9300] initial radar detection glue.
* flesh out a "get default DFS parameters" routine
* remove the stub that returns NULL
* fix up the enable DFS method to do what FreeBSD does - specifically, allow pe_enabled
  to be set/cleared.

This allows the radar pulse reporting code to function, but it doesn't yet
do anything useful.
2017-02-02 09:19:57 +00:00
Adrian Chadd
be34efe2f3 [ath_hal] [ar9300] initial hacks to make spectral scan working on AR9380 and later NICs.
* add debugging
* disable the manual noise floor calibration and tracking done by the HAL;
  this interferes with the normal calibration path and will lock up the RX
  side
* don't program short report / priority if they're provided as NOVAL.
2017-02-02 05:29:22 +00:00
Bryan Drewery
28323add09 Fix improper use of "its".
Sponsored by:	Dell EMC Isilon
2016-11-08 23:59:41 +00:00
Adrian Chadd
b60cfea4fd [ath_hal] quieten a bit of the boot messages - this stuff has been working for a while. 2016-09-12 04:58:59 +00:00
Adrian Chadd
aebcd3034e [ath_hal] add USB PHY control registers for hornet/AR9330.
Obtained from:	linux ath9k
2016-08-28 05:42:03 +00:00
Adrian Chadd
603e05dbcb [ar9300] don't program a negative readytime. 2016-08-09 01:05:29 +00:00
Adrian Chadd
e6df5ff544 [ath_hal] add in locationing timer support and capabilities.
* add support to read the timer and capability
* add support to enable/disable the location timer.

On AR9380 at least, enabling the location timer is required to make
the timer tick, otherwise location packets return a timestamp of 0.
However, it then makes /all/ RX packets use the RX location timestamp
instead of the TSF timestamp.

So, unless I find another magical way to do location timestamping,
we will have to dynamically switch things on/off and ensure the
TX/RX path handles the "different" timestamps correctly.

Tested:

* AR9380, STA mode
2016-07-08 22:59:15 +00:00
Adrian Chadd
b10add4ea4 [ath_hal] add locationing / tx-beamforming RX status descriptor decoding.
* LOC_INFO is mostly just "did this packet come with a locationing
  timestamp instead of TSF";
* Decode not-sounding, uploaded-data, data-valid, data type and
  number of extension spatial streams.
2016-07-08 22:39:37 +00:00
Adrian Chadd
ada3f60304 [ath_hal] Add setting positioning bit and clear sounding-disable bit.
* If fast_ts is set then the TX timestamp is the fast timestamp, not
  normal TSF.
* If the TX descriptor has the position bit set then request locationing
  and clear sounding-disable.  This way we (a) get the response with
  the TX timestamp from the location side of things, and (b) we get
  a CSI dump of the response ACK, which we will eventually use in the
  locationing path.
2016-07-08 22:37:52 +00:00
Adrian Chadd
515582436a [ath_hal] retire a "long RX desc" flag, store/use the TX/RX timestamp length.
* the code already stored the length of the RX desc, which I never used.
  So, use that and retire the new flag I introduced a while ago.
* Introduce a TX timestamp length field and capability.
2016-07-08 21:34:39 +00:00
Adrian Chadd
d304f3093a [ath] implement TX queue configuration extensions for the AR9380 HAL.
Among other things, this introduces the idea of DBA-gated queues that
aren't the CABQ.  The TDMA support requires this.

Tested:

* AR9580 (hostap mode)
* AR9380 (sta mode)

Approved by:	re (gjb)
2016-06-20 16:12:27 +00:00
Adrian Chadd
3648197a1b [ath_hal] modify the xmit code to use temporary variables for setting qmisc/dmisc.
This is in preparation for some other TDMA fixes which will hopefully
end with having working TDMA.

But, it does avoid lots of read/modify/writes in the txq setup path.
2016-06-08 16:26:44 +00:00
Adrian Chadd
dd77085237 [ath_hal] add a _S so FSP (frame scheduling policy) can be set/read via SM/MS macros. 2016-06-08 16:21:38 +00:00
Adrian Chadd
e4eb838ce1 [ath_hal] correctly initialise the CAB queue default value
* Allow readyTime to just be programmed in directly
* The beacon interval and all of the beacon timing sysctl's are in TU,
  not TSF.  So, we were doing the wrong math on the CAB programming
  in the first place.
2016-06-08 16:10:34 +00:00
Adrian Chadd
78b812de40 [ath_hal] initialise ah_beaconInterval when the AP/IBSS/TDMA beacon is setup. 2016-06-08 16:08:05 +00:00
Adrian Chadd
09ff344bba [ath_hal] add AR9462 (jupiter) RX gain / XLNA programming.
This seems to make 5G work better.

It doesn't fix powersave handling though, that still sees the PHY get
stuck during initial calibration and everything goes pear shaped.
I'll look into that later.

Tested:

* QCAFN222 NIC, STA mode, 5GHz

Obtained from:	Linux ath9k
2016-06-05 05:55:27 +00:00
Adrian Chadd
fa63ec5349 [ath_hal] Add Jupiter 2.1 (AR9462 mac 640.3) support.
Turns out I wasn't even initialising or programming a lot of stuff
for the AR9462 2.1 chip.  Oops.

This mostly gets it working. powersave scan results in some pretty
hilarious NFcal hangs and I don't see beacons reliably.
There are still some xlna gain tables missing that ath9k has; I'll
follow up with some fixes and then see if the QCAFN222 NIC I have
tests this path.

Tested:

* QCAFN222 NIC, STA mode, 2GHz and 5GHz
2016-06-05 02:17:51 +00:00
Adrian Chadd
615a867ff2 [ath_hal] teach the reset path(s) about Jupiter 2.1.
This was just .. not programming in things, and thus large chunks
of the radio wouldn't work.  Notably, 5GHz didn't work.
2016-06-05 02:16:16 +00:00
Adrian Chadd
507fc9d5c4 [ath_hal] convert the MCI code over to work on Jupiter 2.1.
(Note: jupiter 1.0 was emulation / test silicon, and was never released
in production.  So, yes, AR_SREV_JUPITER() would really be fine.)
2016-06-05 02:15:29 +00:00
Adrian Chadd
79d0939e3c [ath_hal] Make the AR9462 2.0 initvals from ath9k compile.
The (upcoming) semi-working AR9462 2.1 support uses the 2.0 initvals
where appropriate, and those need to at least compile under freebsd.
2016-06-05 01:42:37 +00:00
Adrian Chadd
8cfcd74fa1 [ath_hal] add STOMP_AUDIO for AR9462/QCA9565.
Obtained from:	Linux ath9k
2016-06-04 07:29:10 +00:00
Adrian Chadd
83e80fe84a [ath_hal] add azimuth timestamp payload marking for AR9380 and later chips. 2016-06-01 15:56:07 +00:00
Adrian Chadd
8e0feaeafa [ath_hal] implement shared PA handling checks, based on ath9k.
These are apparently conditional on there being a shared PA/LNA, which
at least on AR9462/QCA9535 devices I have isn't a thing.

I'm .. not yet sure which devices it /is/ a thing, so I'll come back
to that.

Tested:

* QCA9565 STA + bluetooth

Obtained from:	Linux ath9k
2016-06-01 03:49:22 +00:00
Adrian Chadd
193232716d [ath_hal] add MCI bits from ath9k for QCA9565
* Add extra debugging - the weights debugging is really useful to ensure
  things are programmed into the wlan coexistence table.  The weights are
  what traffic priority each of the various modes get (tx, tx-high-priority,
  rx-beacon, etc) if they're all zero, things work very poorly.

* Add in coex init routines from ath9k for AR9462 and QCA9565 1ANT and 2ANT.
  This control things like beacon stomping, ACK handling, antennas, PA/LNA
  shared, etc.

* Some ancillary bits.

TODO:

* There's some conditional stuff around MCI_ANT_ARCH_PA_LNA_SHARED() in ath9k
  which doesn't always enable force-on LNA.  That'll have to be examined
  and merged in as appropriate.

Obtained from:	linux ath9k
2016-06-01 03:27:33 +00:00
Adrian Chadd
3091d36445 [ath_hal] add support for QCA9565 for configuring the bluetooth antenna LNA diversity.
Notably, this also sets AR_BTCOEX_WL_LNADIV to FORCE_ON, so LNA diversity
is always enabled and under control of the wifi chip.

Tested:

* QCA9565, STA + bluetooth mode

Obtained from:	Linux ath9k
2016-06-01 03:24:53 +00:00
Adrian Chadd
b8a74db325 [ath_hal] Allow the BT antenna diversity option to be enabled for QCA9565.
Obtained from:	Linux ath9k
2016-06-01 03:21:23 +00:00
Adrian Chadd
eb800a94c3 [ath_hal] add QCA9565 bluteooth antenna control.
This configures the LNA antenna diversity control, which should be on
if wlan owns the LNA for bluetooth coexistence.  Otherwise, make sure
it's off.

I think this is eventually intended to allow 1-antenna bluetooth +
wifi setups for QCA9565, but I'm not sure where that's actually configured
in ath9k.

Obtained from:	Linux ath9k
2016-06-01 03:20:55 +00:00
Adrian Chadd
ab3b48eaa2 [ath_hal] add extra debugging for MCI interrupts. 2016-06-01 03:17:36 +00:00
Adrian Chadd
d24161cb2a [ath_hal] rename the MCI state info routine.
It's not /really/ "get state".
2016-05-31 16:08:06 +00:00
Adrian Chadd
6bf5e38106 [ath_hal] add QCA9565 and MCI related registers.
This is required for upcoming MCI fixes.

Obtained from:	Linux ath9k
2016-05-31 04:59:00 +00:00
Adrian Chadd
023efcf136 [ath_hal] migrate the bluetooth definitions out from ah.h / ar9300_freebsd_inc.h.
The eventual MCI driver side of things needs the MCI bits to live
in the HAL API so we can get to them.

Tested:

* QCA9565, STA mode + bluetooth
2016-05-31 04:44:00 +00:00
Adrian Chadd
fea8a20d19 [ath] ensure the right methods / options get overridden for MCI bluetooth coex
It turns out that the srev checks can't be done in the early attach
in ar9300_freebsd.c, because the poweron and srev check hasn't yet
happened.

So:

* Re-add the MCI overrides in attach
* Add QCA9565 (Aphrodite) check for the LNA diversity stuff.

Tested:

* QCA9565, STA mode + bluetooth
2016-05-31 04:17:17 +00:00
Adrian Chadd
204c8e00de Add initial ar9300 HAL support for the spectral scan mode. 2015-12-02 05:36:45 +00:00
Adrian Chadd
af4c1f0c95 Adjust a comment; we now support these embedded boards! 2015-12-01 06:11:09 +00:00
Enji Cooper
2451d4dd33 Fix the build
ichan is only used if AH_DEBUG_ALQ if defined

Pointyhat to: adrian
2015-11-30 08:02:52 +00:00
Adrian Chadd
ff066b54ec fix ht/40 configuration for ar9331 (hornet).
The synth programming here requires the real centre frequency,
which for HT20 channels is the normal channel, but HT40 is
/not/ the primary channel.  Everything else was using 'freq',
which is the correct centre frequency, but the hornet config
was using 'ichan' to do the lookup which was also the primary
channel.

So, modify the HAL call that does the mapping to take a frequency
in MHz and return the channel number.

Tested:

* Carambola 2, AR9331, tested both HT/20 and HT/40 operation.
2015-11-30 06:26:59 +00:00
Adrian Chadd
0bc93f5ad7 add missing initvals.
Sorry y'all.
2015-11-29 18:14:18 +00:00
Adrian Chadd
27e2ad4687 Add initial support for the QCA953x SoC (honeybee) wifi.
This is a 2x2 2GHz 802.11n part.  It works enough at the moment to
bring up, scan and associate.  I haven't started using this as
a day to day AP.

The specifics:

* add honeybee initvals
* add in changes; a mix from the QCA HAL and ath9k;
* fix a bug in AR_SREV_AR9580_10_OR_LATER(), which is only used
  for one capability check and we don't even implement it - so it's
  a big no-op.

Shady things:

* ath9k has the "platform data" define the 25/40MHz clock.
  This HAL .. doesn't.  Honeybee gets hard-coded to 25MHz which
  it likely shouldn't be.  I'll have to go and identify/fix those.

Tested:

* Qualcomm Atheros AP143 reference design board.

Obtained from:	Qualcomm Atheros; Linux ath9k
2015-11-29 05:47:52 +00:00
Adrian Chadd
c56cfc9553 u32 -> uint32_t. 2015-11-29 05:42:18 +00:00
Adrian Chadd
f647fde2e8 [ath_hal] add AR9461 (jupiter) 2.1 support.
Obtained from:	Linux ath9k
2015-11-29 05:34:00 +00:00
Adrian Chadd
f50e4ebf6a ath(4): begin fleshing out a "reset type" extension to force cold/warn resets.
Right now the only way to force a cold reset is:

* The HAL itself detects it's needed, or
* The sysctl, setting all resets to be cold.

Trouble is, cold resets take quite a bit longer than warm resets.

However, there are situations where a cold reset would be nice.
Specifically, after a stuck beacon, BB/MAC hang, stuck calibration results,
etc.

The vendor HAL has a separate method to set the reset reason (which is
how HAL_RESET_BBPANIC gets set) which informs the HAL during the reset path
why it occured.  This is almost but not quite the same; I may eventually
unify both approaches in the future.

This commit just extends HAL_RESET_TYPE to include both status (eg BBPANIC)
and type (eg do COLD.)  None of the HAL code uses it yet though;  that'll
come later.

It also is a big no-op in each HAL - I need to go teach each of the HALs
about cold/warm reset through this path.
2015-11-09 15:59:42 +00:00
Adrian Chadd
dc809fc15f Flip on fast frames support for AR5416 and AR9300 series NICs.
This was off because the net80211 aggregation code was using the same
state pointers for both fast frames and ampdu tx support which led to some
pretty unfortunate panic-y behaviour.

Now that net80211 doesn't panic, let's flip this back on.

It doesn't (yet) do the horrific sounding thing of A-MPDU aggregates
of fast frames; that'll come next.  It's a pre-requisite to supporting
AMSDU + AMPDU anyway, which actually speeds things up quite considerably
(think packing lots of little ACK frames into a single AMSDU.)

Tested:

* QCA955x SoC, AP mode
* AR5416, STA mode
* AR9170, STA mode (with local fast frame patches)
2015-10-10 00:13:45 +00:00
Adrian Chadd
9b11ed5f9d Fix compilation error on gcc-5.2.0 - it now warns on non-paranthen'ed
logical negation when used in this fashion.

Tested:

* compile only
2015-08-30 08:46:50 +00:00
Adrian Chadd
66b870f3cb Add a missing method - ath_hal_settsf64().
This is required for TDMA slave mode.
2015-08-05 21:16:12 +00:00
Adrian Chadd
711b0fa045 Add TXOP enforce support to the AR9300 HAL.
This is required for (more) correct TDMA support.  Without it, the
code tries to calculate the required guard interval based on the
current rate, and since this is an 11n NIC and people try using
11n, it calls ath_hal_computetxtime() on an 11n rate which then
panics.

This doesn't fix TDMA slave mode on AR9300 - it just makes it
have one less bug.

Reported by:	Berislav Purgar <bpurgar@gmail.com>
2015-08-05 19:32:35 +00:00
Adrian Chadd
3e307100f6 Quieten the scorpion SoC/WMAC reset path. Stuff the non-error stuff
under HALDEBUG().
2015-07-04 03:15:42 +00:00