allwinner: clk: prediv_mux: Init the current parent

Do not init the first parent but read the clock register to find
it's current parent and init this one.
This commit is contained in:
manu 2019-05-11 15:02:20 +00:00
parent 808fd9148f
commit f9aad20413

View File

@ -75,7 +75,19 @@ struct aw_clk_prediv_mux_sc {
static int
aw_clk_prediv_mux_init(struct clknode *clk, device_t dev)
{
clknode_init_parent_idx(clk, 0);
struct aw_clk_prediv_mux_sc *sc;
uint32_t val;
sc = clknode_get_softc(clk);
DEVICE_LOCK(clk);
READ4(clk, sc->offset, &val);
DEVICE_UNLOCK(clk);
/* Init the current parent */
val = (val & sc->mux_mask) >> sc->mux_shift;
clknode_init_parent_idx(clk, val);
return (0);
}