summaryrefslogtreecommitdiffstats
path: root/sys/mips/atheros/uart_bus_ar71xx.c
diff options
context:
space:
mode:
authorgonzo <gonzo@FreeBSD.org>2009-07-09 20:11:26 +0000
committergonzo <gonzo@FreeBSD.org>2009-07-09 20:11:26 +0000
commitd3fc9cc82bf32e8dbf6a2bfc47d3b61031d63b1a (patch)
treee0abfec54865386903f58dfdd15661c0c5ddd27e /sys/mips/atheros/uart_bus_ar71xx.c
parent4516fd717d6c64161c976803c8bc71609efea432 (diff)
downloadFreeBSD-src-d3fc9cc82bf32e8dbf6a2bfc47d3b61031d63b1a.zip
FreeBSD-src-d3fc9cc82bf32e8dbf6a2bfc47d3b61031d63b1a.tar.gz
- Move CPU/AHB frequency calculations to functions to
prevent code duplication
Diffstat (limited to 'sys/mips/atheros/uart_bus_ar71xx.c')
-rw-r--r--sys/mips/atheros/uart_bus_ar71xx.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/sys/mips/atheros/uart_bus_ar71xx.c b/sys/mips/atheros/uart_bus_ar71xx.c
index 380c3da..8d83291 100644
--- a/sys/mips/atheros/uart_bus_ar71xx.c
+++ b/sys/mips/atheros/uart_bus_ar71xx.c
@@ -67,20 +67,9 @@ static int
uart_ar71xx_probe(device_t dev)
{
struct uart_softc *sc;
- uint32_t pll_config, div;
uint64_t freq;
- /* PLL freq */
- pll_config = ATH_READ_REG(AR71XX_PLL_CPU_CONFIG);
- div = ((pll_config >> PLL_FB_SHIFT) & PLL_FB_MASK) + 1;
- freq = div * AR71XX_BASE_FREQ;
- /* CPU freq */
- div = ((pll_config >> PLL_CPU_DIV_SEL_SHIFT) & PLL_CPU_DIV_SEL_MASK)
- + 1;
- freq = freq / div;
- /* AHB freq */
- div = (((pll_config >> PLL_AHB_DIV_SHIFT) & PLL_AHB_DIV_MASK) + 1) * 2;
- freq = freq / div;
+ freq = ar71xx_ahb_freq();
sc = device_get_softc(dev);
sc->sc_sysdev = SLIST_FIRST(&uart_sysdevs);
OpenPOWER on IntegriCloud