freebsd-skq/sys/mips/atheros
Adrian Chadd b7d7ad0b90 Begin moving support for board MAC addresses over to being explicitly defined.
A lot of these dinky atheros based MIPS boards don't have a nice, well,
anything consistent defining their MAC addresses for things.

The Atheros reference design boards will happily put MAC addresses
into the wifi module calibration data like they should, and individual
ethernet MAC addresses into the calibration area in flash.
That makes my life easy - "hint.arge.X.eeprommac=<addr>" reads from
that flash address to extract a MAC, and everything works fine.

However, aside from some very well behaved vendors (eg the Carambola 2
board), everyone else does something odd.

eg:

* a MAC address in the environment (eg ubiquiti routerstation/RSPRO)
   that you derive arge0/arge1 MAC addresses from.
* a MAC address in flash that you derive arge0/arge1 MAC addresses from.
* The wifi devices having their own MAC addresses in calibration data,
  like normal.
* The wifi devices having a fixed, default or garbage value for a MAC
  address in calibration data, and it has to be derived from the
  system MAC.

So to support this complete nonsense of a situation, there needs to be
a few hacks:

* The "board" MAC address needs to be derived from somewhere and squirreled
  away.  For now it's either redboot or a MAC address stored in calibration
  flash.

* Then, a "map" set of hints to populate kenv with some MAC addresses
  that are derived/local, based on the board address.  Each board has
  a totally different idea of what you do to derive things, so each
  map entry has an "offset" (+ve or -ve) that's added to the board
  MAC address.

* Then if_arge (and later, if_ath) should check kenv for said hint and
  if it's found, use that rather than the EEPROM MAC address - which may
  be totally garbage and not actually work right.

In order to do this, I've undone some of the custom redboot expecting
hacks in if_arge and the stuff that magically adds one to the MAC
address supplied by the board - instead, as I continue to test this
out on more hardware, I'll update the hints file with a map explaining
(a) where the board MAC should come from, and (b) what offsets to use
for each device.

The aim is to have all of the tplink, dlink and other random hardware
we run on have valid MAC addresses at boot, so (a) people don't get
random B:S:Dx:x ethernet MACs, and (b) the wifi MAC is valid
so it works rather than trying to use an invalid address that
actually upsets systems (think: multicast bit set in BSSID.)

Tested:

* TP-Link TL_WDR3600 - subsequent commits will add the hints map
  and the if_ath support.

TODO:

* Since this is -HEAD, and I'm all for debugging, there's a lot of
  printf()s in here.  They'll eventually go under bootverbose.
* I'd like to turn the macaddr routines into something available
  to all drivers - too many places hand-roll random MAC addresses
  and parser stuff.  I'd rather it just be shared code.
  However, that'll require more formal review.
* More boards.
2015-03-28 23:40:29 +00:00
..
apb.c ACK interrupts on the new SoCs. 2015-01-05 02:00:41 +00:00
apbvar.h The AR71xx has APB interrupts in the MISC registers from 0-7, later 2014-03-16 08:39:46 +00:00
ar71xx_bus_space_reversed.c
ar71xx_bus_space_reversed.h
ar71xx_chip.c Add new features - an MDIO clock, WMAC reset, GMAC reset and ethernet 2013-10-15 01:35:48 +00:00
ar71xx_chip.h
ar71xx_cpudef.h Add a GPIO output mux configuration method. 2015-01-03 06:55:58 +00:00
ar71xx_ehci.c [QCA955x] make the USB EHCI interrupts shareable. 2015-03-02 02:08:43 +00:00
ar71xx_fixup.c
ar71xx_fixup.h
ar71xx_gpio.c Add GPIO function mux configuration for AR934x SoCs. 2015-03-21 06:08:35 +00:00
ar71xx_gpiovar.h Implement GPIO_GET_BUS() method for all GPIO drivers. 2015-01-31 19:32:14 +00:00
ar71xx_macaddr.c Begin moving support for board MAC addresses over to being explicitly defined. 2015-03-28 23:40:29 +00:00
ar71xx_macaddr.h Begin moving support for board MAC addresses over to being explicitly defined. 2015-03-28 23:40:29 +00:00
ar71xx_machdep.c Begin moving support for board MAC addresses over to being explicitly defined. 2015-03-28 23:40:29 +00:00
ar71xx_ohci.c Add 64-bit DMA support in the XHCI controller driver. 2015-01-05 20:22:18 +00:00
ar71xx_pci_bus_space.c
ar71xx_pci_bus_space.h
ar71xx_pci.c Devices that rely on hints or identify routines for discovery need to 2013-10-29 14:07:31 +00:00
ar71xx_setup.c Add initial Qualcomm Atheros QCA955x SoC support. 2015-01-05 02:06:26 +00:00
ar71xx_setup.h add QCA955x SoC types. 2015-01-05 01:59:44 +00:00
ar71xx_spi.c Devices that rely on hints or identify routines for discovery need to 2013-10-29 14:07:31 +00:00
ar71xx_wdog.c Devices that rely on hints or identify routines for discovery need to 2013-10-29 14:07:31 +00:00
ar71xxreg.h Add a MII mode for SGMII. 2015-03-02 01:23:59 +00:00
ar91xx_chip.c Add new features - an MDIO clock, WMAC reset, GMAC reset and ethernet 2013-10-15 01:35:48 +00:00
ar91xx_chip.h
ar91xxreg.h
ar724x_chip.c Add new features - an MDIO clock, WMAC reset, GMAC reset and ethernet 2013-10-15 01:35:48 +00:00
ar724x_chip.h
ar724x_pci.c Fix the AR724x PCIe glue to correctly probe the BAR on AR7240 devices. 2014-09-28 07:27:58 +00:00
ar724xreg.h Note that the AR724x PCIe registers are actually from the PCI_CTRL 2015-03-21 05:59:45 +00:00
ar933x_chip.c Update the AR933x SoC support to include a few new knobs: 2013-10-15 03:23:08 +00:00
ar933x_chip.h
ar933x_uart.h
ar933xreg.h Add register definitions for the AR933x SoC GMAC (ie, ethernet MAC) 2013-10-14 23:57:12 +00:00
ar934x_chip.c Add a GPIO output mux configuration method. 2015-01-03 06:55:58 +00:00
ar934x_chip.h Implement some initial AR934x support routines. 2013-07-21 03:56:57 +00:00
ar934x_nfcreg.h Add the AR934x NAND flash controller register definitions. 2014-03-18 12:18:35 +00:00
ar934xreg.h Add AR934x specific GPIO functions and output MUX configuration. 2015-01-03 06:35:53 +00:00
files.ar71xx Start fleshing out some MAC address helper functions. 2015-03-15 21:56:12 +00:00
if_arge.c Begin moving support for board MAC addresses over to being explicitly defined. 2015-03-28 23:40:29 +00:00
if_argevar.h The linux driver code for the MDIO bus does a read-after-write 2015-02-02 17:33:00 +00:00
pcf2123_rtc.c
pcf2123reg.h
qca955x_chip.c Add ethernet MAC DDR flush hookups for QCA955x. 2015-03-04 03:52:50 +00:00
qca955x_chip.h Add initial Qualcomm Atheros QCA955x SoC support. 2015-01-05 02:06:26 +00:00
qca955xreg.h add QCA955x PCIe configuration registers. 2015-03-21 06:00:46 +00:00
std.ar71xx
uart_bus_ar71xx.c Use the UART frequency when programming the UART clock. 2013-07-21 03:54:39 +00:00
uart_bus_ar933x.c Use the UART frequency when programming the UART clock. 2013-07-21 03:54:39 +00:00
uart_cpu_ar71xx.c Use the UART frequency when programming the UART clock. 2013-07-21 03:54:39 +00:00
uart_cpu_ar933x.c Use the UART frequency when programming the UART clock. 2013-07-21 03:54:39 +00:00
uart_dev_ar933x.c Commit some sins in the name of "oh god oh god I don't really want to 2014-07-27 05:44:42 +00:00
uart_dev_ar933x.h