freebsd-dev/sys/mips
Adrian Chadd 57b8f9ca1d [ar71xx] add a very simple early boot driver called "caldata" to commit cross-layer atrocities.
The (eventually) upcoming ath(4) changes will include being able to load
ath(4) devices on the AHB bus (ie the on-die wifi part of the SoC)
as modules.

In order for this to happen, a copy of the calibration data needs to be
copied away before the SPI driver runs or the memory map access hack
won't work.

Now, ideally (!) there'd be some driver that can come up after the MTD
pieces (eg, SPI, NAND, etc) and load into a firmware chunk the calibration
data.

(Or, really really nicely, would be an actual async firmware API that
would lead itself to having a driver schedule a file read - or a raw device
read - to get to the calibration data.)

Now, until all of the above is done - I'm going to perpetuate the layer
breaking atrocity here by simply doing the PCI bus fixup EEPROM/calibration
data hack here.  This will work for any AR71xx (and later on, AR231x/AR531x)
device, as well as the handful of QCA MIPS + QCA9880v2 802.11ac boards with
NOR flash.

To use, this goes into the kernel config:

# Enable EEPROM hacks
options AR71XX_ATH_EEPROM
device ar71xx_caldata
device firmware

# This enables the ath_ahb driver (when I commit the change!) to
# pull data out of the firmware hack.
options ATH_EEPROM_FIRMWARE

In the hints file:

# ART calibration data mapping device
hint.ar71xx_caldata.0.at="nexus0"
hint.ar71xx_caldata.0.order=0

# Where the ART is - last 64k in the first 8MB of flash
hint.ar71xx_caldata.0.map.0.ath_fixup_addr=0x1fff0000
hint.ar71xx_caldata.0.map.0.ath_fixup_size=16384

# And now tell the ath(4) driver where to look!
hint.ath.0.eeprom_firmware="ar71xx_caldata.0.map.0.eeprom_firmware"

Tested:

* carambola2, AR933x SoC, using a set of ath and ath_hal modules to load

TODO:

* unify this bit of firmware loading code, as I will definitely need
  to include both the PCI bus firmware version (for PCI ID fixups too!)
  as well as AHB/on-chip calibration data.

* Commit the ath_ahb bus code

* Convert .. everything over.  That'll take the majority of the time.
2017-05-23 06:20:06 +00:00
..
adm5120 Allow setting access-width for UART registers. 2017-02-27 20:08:42 +00:00
alchemy Allow setting access-width for UART registers. 2017-02-27 20:08:42 +00:00
atheros [ar71xx] add a very simple early boot driver called "caldata" to commit cross-layer atrocities. 2017-05-23 06:20:06 +00:00
beri Switch BERI Programmable Interrupt Controller to INTRNG. 2017-04-18 17:20:03 +00:00
broadcom Add support for dumping bcma/siba EROM tables to the console via a new 2017-04-24 18:35:25 +00:00
cavium Remove register keyword from sys/ and ANSIfy prototypes 2017-05-17 00:34:34 +00:00
conf [mips] [rt2880] Add oldest Ralink MIPS SOC RT2880 support code. 2017-05-06 06:20:34 +00:00
gxemul Allow the use of soft-interrupts for sending IPIs. 2016-09-08 17:37:13 +00:00
idt Allow setting access-width for UART registers. 2017-02-27 20:08:42 +00:00
include Add initial support for the floating point implementation register. 2017-05-09 17:35:16 +00:00
ingenic Add and use a MMC_DECLARE_BRIDGE macro for declaring mmc(4) bridges 2017-03-07 22:42:44 +00:00
malta Allow setting access-width for UART registers. 2017-02-27 20:08:42 +00:00
mediatek [mediatek] [gpio] add PPS / interrupt support. 2017-05-06 06:22:14 +00:00
mips Remove register keyword from sys/ and ANSIfy prototypes 2017-05-17 00:34:34 +00:00
nlm Fix build: include machine/bus.h before uart.h 2017-03-02 17:09:14 +00:00
rmi Allow setting access-width for UART registers. 2017-02-27 20:08:42 +00:00
rt305x Allow setting access-width for UART registers. 2017-02-27 20:08:42 +00:00
sibyte Convert PCIe Hot Plug to using pci_request_feature 2017-02-25 06:11:59 +00:00