Add ar5416/9160 init values from Linux

Original source: linux-2.6.34/drivers/net/wireless/ath/ath9k/initvals.h

The file, like the ath9k driver, is dual BSD/GPL licenced.
u32 -> uint32_t
Break out the 9160 PCIe initialisation stuff from ar9160.ini into a separate
include file.

The linux ath9k initvals.h doesn't include this array.
Migrate the AR9160 specific initialisation code to use the linux-named arrays
rather than the FreeBSD HAL named arrays.

The Linux arrays are being left as untouched as possible for now to make it
easier to merge in updates to the ath9k/initvals.h.

Add "bank6tpc" init/setup logic from linux ath9k. I'm not 100% sure that
I've ported the changes over correctly but the code has been tested
on a 9160 in 11b/11g AP mode.

This commit seems to resolve the majority of the "missed beacon" issues
I was seeing when using the AR9160 on the Ubiqiti Routerstation Pro platform.
I'm still able to trigger them by busying the CPU/bus. I haven't yet
tested this in anything resembling heavy/varied production use.
Remove a badly-imported header file. Silly me and patch(1).
Import a virgin initvals.h from linux-2.6.34 drivers/net/wireless/ath/ath9k/ .
An evil, temporary workaround (which should likely be a typedef!) so I can
keep the linux ini file untouched for now.
Merge in ath9k initialisation updates for the AR9160.

This is from linux-9160.h.
Revert my previous change and use the 9160 .ini file. It now has
the updated ini changes.
Fix the calibration logic to correctly clamp the calculated coefficient.

Obtained from: OpenWRT r22123, 521-ath9k_iqcal_fix.patch
Merge in a fix for the power/(gain?) calculation. Apply it to both
the 5416/9160 and 9285 code paths.

Obtained from: OpenWRT r22123, 522-ath9k_pwrcal_fix.patch
Count missed (but not stuck) beacons.
Expose the atheros stats stuff via sysctl.

* Add almost all of the stats from if_athioctl.h into dev.ath.X.stats.
* Add dev.ath.X.clear_stats which clears the if_ath sc_stats area (but not
  the interface statistics!)

The remaining stats are either arrays or non-integer stats and need
some helper functions.

tools/tools/atheros/athstats/ does expose all of this stuff through the
ioctl interface but the tool isn't included by default and sysctl is easier
to just get a snapshot of everything with.
Fix the padding to be correct. The last commit here assumed the padding
array was in bytes, rather than int32's.
Pad out some values to make later diff'ing against the linux ath9k 5416 .ini values easier.
Bring over an NF calibration fix from the latest linux wireless-testing ath9k
code.

The inline comment explains what is going on - on the ar5416 and ar9160
(at least) writing -50 to the CCA registers during Noise Floor calibration can
result in the RX side going deaf.

This has been tested on an SR-71 (AR9160 based) 11n MiniPCI card.
The initial NF calibration on startup takes longer than the initial
CCA register loading. It may be possible this occurs during periodic
recalibrations.

Obtained from:	Linux
Add in a local addition to the 9160 .ini which forces the calibration mode
register (AR_PHY_CALMODE) to 0. It's done for the other chips so I'm doing it
here just in case.
Grab the AR_PHY_CCA and AR_PHY_EXT_CCA initvals from Linux wireless-testing.
Point out that the comment in ar5416InitCal() that NF calibration
is delayed is wrong.

Since it is wrong, and the current code immediately kicks off
one of the periodic calibrations on interface reset, just delay
the rest of the calibration setup until the NF calibration
completes.
The HAL ath_hal_calibrateN() calls the ah_perCalibrationN method with
rxchainmask set to 0x1. This means only the first radio chain is calibrated.

Linux ath9k calibrates all three radio chains and a little investigation
by a friendly atheros developer indicates this is what should occur. So for now,
override what the OS dependant HAL macro does and set the current rxchainmask.

This calibrates all three radio chains on the AR9160. The AR5416 doesn't
do any periodic calibration aside from noise floor by default. I haven't
yet tried it on any other chipsets supported by this code.