freebsd-dev/sys/mips/atheros
Adrian Chadd c572da7f10 Allow the MDIO bus frequency to be selected.
The MDIO bus frequency is configured as a divisor off of the MDIO bus
reference clock.  For the AR9344 and later, the MDIO bus frequency can
be faster than normal (ie, up to 100MHz) and thus a static divisor may
not be very applicable.

So, for those boards that may require an actual frequency to be selected
regardless of what crazy stuff the vendor throws in uboot, one can now
set the MDIO bus frequency.  It uses the MDIO frequency and the target
frequency to choose a divisor that doesn't exceed the target frequency.

By default it will choose:

* DIV_28 on everything; except
* DIV_58 on the AR9344 to be conservative.

Whilst I'm here, add some comments about the defaults being not quite
right.  For the other internal switch devices (like the AR933x, AR724x)
the divisor can be higher - it's internal and the reference MDIO clock
is much lower than 100MHz.

The divisor tables and loop code is inspired from Linux/OpenWRT.  It's very
simple; I didn't feel that reimplementing it would yield a substantially
different solution.

Tested:

* AR9331 (mips24k)
* AR9344 (mips74k)

Obtained from:	Linux/OpenWRT
2013-10-16 19:36:50 +00:00
..
apb.c Fix interrupt handling from the APB periperals (ie, UART) - it 2013-10-09 02:01:20 +00:00
apbvar.h
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 new features - an MDIO clock, WMAC reset, GMAC reset and ethernet 2013-10-15 01:35:48 +00:00
ar71xx_ehci.c
ar71xx_fixup.c
ar71xx_fixup.h
ar71xx_gpio.c Remove the hardcoded limit for the number of gpio_pins that can be used. 2013-09-06 23:47:50 +00:00
ar71xx_gpiovar.h Remove the hardcoded limit for the number of gpio_pins that can be used. 2013-09-06 23:47:50 +00:00
ar71xx_machdep.c Fix the Atheros MIPS startup path a little. 2013-10-15 01:37:00 +00:00
ar71xx_ohci.c
ar71xx_pci_bus_space.c
ar71xx_pci_bus_space.h
ar71xx_pci.c
ar71xx_setup.c Implement some initial AR934x support routines. 2013-07-21 03:56:57 +00:00
ar71xx_setup.h
ar71xx_spi.c Add bus space barriers to the AR71xx SPI code. 2013-10-16 02:10:35 +00:00
ar71xx_wdog.c
ar71xxreg.h Add some missing AR934x register definitions. 2013-10-09 03:19:05 +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
ar724xreg.h
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 Update the AR934x SoC support. 2013-10-15 03:28:32 +00:00
ar934x_chip.h Implement some initial AR934x support routines. 2013-07-21 03:56:57 +00:00
ar934xreg.h Add the rest of the AR934x SoC reset register definitions. 2013-10-14 23:58:52 +00:00
files.ar71xx Implement some initial AR934x support routines. 2013-07-21 03:56:57 +00:00
if_arge.c Allow the MDIO bus frequency to be selected. 2013-10-16 19:36:50 +00:00
if_argevar.h Allow the MDIO bus frequency to be selected. 2013-10-16 19:36:50 +00:00
pcf2123_rtc.c
pcf2123reg.h
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
uart_dev_ar933x.h