HomeFreeBSD

[ar71xx] add a very simple early boot driver called "caldata" to commit cross…

Description

[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

  1. This enables the ath_ahb driver (when I commit the change!) to
  2. 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.

Details

Provenance
adrianAuthored on
Parents
rS318695: err(3): use `NULL`, aka `(void*)0` per POSIX instead of `(FILE *)0`
Branches
Unknown
Tags
Unknown