Replace the apmixedsys, topckgen and infrasys dump callbacks with one mtk_clk_dump() that prints every table the clock tree defines.
This changes the output in one way: devices using the infrasys ops now print the rate of each fixed factor, mux and gate, as the other devices already do. The infrasys dump left the rates out, but nothing prevents reading them, as get_rate handles every ID these trees define. Signed-off-by: David Lechner <[email protected]> --- drivers/clk/mediatek/clk-mtk.c | 85 +++++++----------------------------------- 1 file changed, 14 insertions(+), 71 deletions(-) diff --git a/drivers/clk/mediatek/clk-mtk.c b/drivers/clk/mediatek/clk-mtk.c index 6fb329ef7c6..a18512287c2 100644 --- a/drivers/clk/mediatek/clk-mtk.c +++ b/drivers/clk/mediatek/clk-mtk.c @@ -649,34 +649,6 @@ static int mtk_pll_disable(struct mtk_clk_priv *priv, return 0; } -#if CONFIG_IS_ENABLED(CMD_CLK) -static void mtk_apmixedsys_dump(struct udevice *dev) -{ - struct mtk_clk_priv *priv = dev_get_priv(dev); - const struct mtk_clk_tree *tree = priv->tree; - u32 i; - - for (i = 0; i < tree->num_plls; i++) { - const struct mtk_pll_data *pll = &tree->plls[i]; - - printf("[PLL%u] DT: %u", i, pll->id); - mtk_clk_print_mapped_id(pll->id, i, tree->id_offs_map); - mtk_clk_print_rate(dev, i); - printf("\n"); - } - - for (i = 0; i < tree->num_gates; i++) { - const struct mtk_gate *gate = &tree->gates[i]; - - printf("[GATE%u] DT: %u", i, gate->id); - mtk_clk_print_mapped_id(gate->id, i + tree->gates_offs, tree->id_offs_map); - mtk_clk_print_rate(dev, i + tree->gates_offs); - mtk_clk_print_single_parent(gate->parent, gate->flags); - printf("\n"); - } -} -#endif - /* topckgen functions */ static ulong mtk_factor_recalc_rate(const struct mtk_fixed_factor *fdiv, @@ -840,12 +812,21 @@ static int mtk_common_clk_set_parent(struct clk *clk, struct clk *parent) } #if CONFIG_IS_ENABLED(CMD_CLK) -static void mtk_topckgen_dump(struct udevice *dev) +static void mtk_clk_dump(struct udevice *dev) { struct mtk_clk_priv *priv = dev_get_priv(dev); const struct mtk_clk_tree *tree = priv->tree; u32 i; + for (i = 0; i < tree->num_plls; i++) { + const struct mtk_pll_data *pll = &tree->plls[i]; + + printf("[PLL%u] DT: %u", i, pll->id); + mtk_clk_print_mapped_id(pll->id, i, tree->id_offs_map); + mtk_clk_print_rate(dev, i); + printf("\n"); + } + for (i = 0; i < tree->num_fclks; i++) { const struct mtk_fixed_clk *fclk = &tree->fclks[i]; @@ -888,44 +869,6 @@ static void mtk_topckgen_dump(struct udevice *dev) } #endif -/* infrasys functions */ - -#if CONFIG_IS_ENABLED(CMD_CLK) -static void mtk_infrasys_dump(struct udevice *dev) -{ - struct mtk_clk_priv *priv = dev_get_priv(dev); - const struct mtk_clk_tree *tree = priv->tree; - u32 i; - - for (i = 0; i < tree->num_fdivs; i++) { - const struct mtk_fixed_factor *fdiv = &tree->fdivs[i]; - - printf("[FDIV%u] DT: %u", i, fdiv->id); - mtk_clk_print_mapped_id(fdiv->id, i + tree->fdivs_offs, tree->id_offs_map); - mtk_clk_print_single_parent(fdiv->parent, fdiv->flags); - printf(", Mult: %u, Div: %u\n", fdiv->mult, fdiv->div); - } - - for (i = 0; i < tree->num_muxes; i++) { - const struct mtk_composite *mux = &tree->muxes[i]; - - printf("[MUX%u] DT: %u", i, mux->id); - mtk_clk_print_mapped_id(mux->id, i + tree->muxes_offs, tree->id_offs_map); - mtk_clk_print_mux_parents(priv, mux); - printf("\n"); - } - - for (i = 0; i < tree->num_gates; i++) { - const struct mtk_gate *gate = &tree->gates[i]; - - printf("[GATE%u] DT: %u", i, gate->id); - mtk_clk_print_mapped_id(gate->id, i + tree->gates_offs, tree->id_offs_map); - mtk_clk_print_single_parent(gate->parent, gate->flags); - printf("\n"); - } -} -#endif - const struct clk_ops mtk_clk_apmixedsys_ops = { .of_xlate = mtk_clk_of_xlate, .enable = mtk_clk_enable, @@ -933,7 +876,7 @@ const struct clk_ops mtk_clk_apmixedsys_ops = { .set_rate = mtk_apmixedsys_set_rate, .get_rate = mtk_clk_get_rate, #if CONFIG_IS_ENABLED(CMD_CLK) - .dump = mtk_apmixedsys_dump, + .dump = mtk_clk_dump, #endif }; @@ -943,7 +886,7 @@ const struct clk_ops mtk_clk_fixed_pll_ops = { .disable = mtk_clk_disable, .get_rate = mtk_clk_get_rate, #if CONFIG_IS_ENABLED(CMD_CLK) - .dump = mtk_topckgen_dump, + .dump = mtk_clk_dump, #endif }; @@ -954,7 +897,7 @@ const struct clk_ops mtk_clk_topckgen_ops = { .get_rate = mtk_clk_get_rate, .set_parent = mtk_common_clk_set_parent, #if CONFIG_IS_ENABLED(CMD_CLK) - .dump = mtk_topckgen_dump, + .dump = mtk_clk_dump, #endif }; @@ -965,7 +908,7 @@ const struct clk_ops mtk_clk_infrasys_ops = { .get_rate = mtk_clk_get_rate, .set_parent = mtk_common_clk_set_parent, #if CONFIG_IS_ENABLED(CMD_CLK) - .dump = mtk_infrasys_dump, + .dump = mtk_clk_dump, #endif }; -- 2.43.0
