allwinner: aw_ccu: Add some debug printfs (disabled by default)

Also print information about setting frequency at boot under bootverbose
This commit is contained in:
Emmanuel Vadot 2019-05-23 17:34:33 +00:00
parent 0dd16fd9d1
commit f7e598f60b

View File

@ -64,6 +64,12 @@ __FBSDID("$FreeBSD$");
#include "clkdev_if.h"
#include "hwreset_if.h"
#if 0
#define dprintf(format, arg...) device_printf(dev, "%s: " format, __func__, arg)
#else
#define dprintf(format, arg...)
#endif
static struct resource_spec aw_ccung_spec[] = {
{ SYS_RES_MEMORY, 0, RF_ACTIVE },
{ -1, 0 }
@ -78,6 +84,7 @@ aw_ccung_write_4(device_t dev, bus_addr_t addr, uint32_t val)
struct aw_ccung_softc *sc;
sc = device_get_softc(dev);
dprintf("offset=%lx write %x\n", addr, val);
CCU_WRITE4(sc, addr, val);
return (0);
}
@ -90,6 +97,7 @@ aw_ccung_read_4(device_t dev, bus_addr_t addr, uint32_t *val)
sc = device_get_softc(dev);
*val = CCU_READ4(sc, addr);
dprintf("offset=%lx Read %x\n", addr, *val);
return (0);
}
@ -101,6 +109,7 @@ aw_ccung_modify_4(device_t dev, bus_addr_t addr, uint32_t clr, uint32_t set)
sc = device_get_softc(dev);
dprintf("offset=%lx clr: %x set: %x\n", addr, clr, set);
reg = CCU_READ4(sc, addr);
reg &= ~clr;
reg |= set;
@ -117,6 +126,7 @@ aw_ccung_reset_assert(device_t dev, intptr_t id, bool reset)
sc = device_get_softc(dev);
dprintf("%sassert reset id %ld\n", reset ? "" : "De", id);
if (id >= sc->nresets || sc->resets[id].offset == 0)
return (0);
@ -224,6 +234,11 @@ aw_ccung_init_clocks(struct aw_ccung_softc *sc)
}
}
if (sc->clk_init[i].default_freq != 0) {
if (bootverbose)
device_printf(sc->dev,
"Setting freq %ju for %s\n",
sc->clk_init[i].default_freq,
sc->clk_init[i].name);
error = clknode_set_freq(clknode,
sc->clk_init[i].default_freq, 0 , 0);
if (error != 0) {