[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <drybpdss7gr5rgeuxfph5rghqymxzbqqysjbnbu6llvr4njrjn@nwqxhfiu4ttl>
Date: Fri, 27 Dec 2024 09:29:58 +0100
From: Krzysztof Kozlowski <krzk@...nel.org>
To: Kever Yang <kever.yang@...k-chips.com>
Cc: heiko@...ech.de, linux-rockchip@...ts.infradead.org,
Finley Xiao <finley.xiao@...k-chips.com>, Tao Huang <huangtao@...k-chips.com>,
Sugar Zhang <sugar.zhang@...k-chips.com>, Michael Turquette <mturquette@...libre.com>,
Stephen Boyd <sboyd@...nel.org>, linux-kernel@...r.kernel.org, linux-clk@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH v2 3/3] clk: rockchip: Add clock controller for the RK3562
On Tue, Dec 24, 2024 at 05:23:10PM +0800, Kever Yang wrote:
> + /* PD_VO */
> + COMPOSITE(ACLK_VO_PRE, "aclk_vo_pre", gpll_cpll_vpll_dmyhpll_p, 0,
> + RK3562_CLKSEL_CON(28), 6, 2, MFLAGS, 0, 5, DFLAGS,
> + RK3562_CLKGATE_CON(13), 0, GFLAGS),
> + COMPOSITE_NOMUX(HCLK_VO_PRE, "hclk_vo_pre", "aclk_vo", 0,
> + RK3562_CLKSEL_CON(29), 0, 5, DFLAGS,
> + RK3562_CLKGATE_CON(13), 1, GFLAGS),
> + GATE(ACLK_VOP, "aclk_vop", "aclk_vo", 0,
> + RK3562_CLKGATE_CON(13), 6, GFLAGS),
> + GATE(HCLK_VOP, "hclk_vop", "hclk_vo_pre", 0,
> + RK3562_CLKGATE_CON(13), 7, GFLAGS),
> + COMPOSITE(DCLK_VOP, "dclk_vop", gpll_dmyhpll_vpll_apll_p, CLK_SET_RATE_NO_REPARENT,
> + RK3562_CLKSEL_CON(30), 14, 2, MFLAGS, 0, 8, DFLAGS,
> + RK3562_CLKGATE_CON(13), 8, GFLAGS),
> + COMPOSITE(DCLK_VOP1, "dclk_vop1", gpll_dmyhpll_vpll_apll_p, CLK_SET_RATE_NO_REPARENT,
> + RK3562_CLKSEL_CON(31), 14, 2, MFLAGS, 0, 8, DFLAGS,
> + RK3562_CLKGATE_CON(13), 9, GFLAGS),
> +};
> +
> +static void __iomem *rk3562_cru_base;
Drop, not used.
> +
> +static void __init rk3562_clk_init(struct device_node *np)
> +{
> + struct rockchip_clk_provider *ctx;
> + unsigned long clk_nr_clks;
> + void __iomem *reg_base;
> +
> + clk_nr_clks = rockchip_clk_find_max_clk_id(rk3562_clk_branches,
> + ARRAY_SIZE(rk3562_clk_branches)) + 1;
> +
> + reg_base = of_iomap(np, 0);
> + if (!reg_base) {
> + pr_err("%s: could not map cru region\n", __func__);
> + return;
> + }
> +
> + rk3562_cru_base = reg_base;
> +
> + ctx = rockchip_clk_init(np, reg_base, clk_nr_clks);
> + if (IS_ERR(ctx)) {
> + pr_err("%s: rockchip clk init failed\n", __func__);
> + iounmap(reg_base);
> + return;
> + }
> +
> + rockchip_clk_register_plls(ctx, rk3562_pll_clks,
> + ARRAY_SIZE(rk3562_pll_clks),
> + RK3562_GRF_SOC_STATUS0);
> +
> + rockchip_clk_register_branches(ctx, rk3562_clk_branches,
> + ARRAY_SIZE(rk3562_clk_branches));
> +
> + rk3562_rst_init(np, reg_base);
> +
> + rockchip_register_restart_notifier(ctx, RK3562_GLB_SRST_FST, NULL);
> +
> + rockchip_clk_of_add_provider(np, ctx);
> +}
> +
> +CLK_OF_DECLARE(rk3562_cru, "rockchip,rk3562-cru", rk3562_clk_init);
> +
> +#ifdef MODULE
> +struct clk_rk3562_inits {
> + void (*inits)(struct device_node *np);
> +};
> +
> +static const struct clk_rk3562_inits clk_3562_cru_init = {
> + .inits = rk3562_clk_init,
> +};
> +
> +static const struct of_device_id clk_rk3562_match_table[] = {
> + {
> + .compatible = "rockchip,rk3562-cru",
> + .data = &clk_3562_cru_init,
> + },
> + { }
> +};
> +MODULE_DEVICE_TABLE(of, clk_rk3562_match_table);
> +
> +static int clk_rk3562_probe(struct platform_device *pdev)
> +{
> + struct device_node *np = pdev->dev.of_node;
> + const struct of_device_id *match;
> + const struct clk_rk3562_inits *init_data;
> +
> + match = of_match_device(clk_rk3562_match_table, &pdev->dev);
> + if (!match || !match->data)
> + return -EINVAL;
> +
> + init_data = match->data;
> + if (init_data->inits)
> + init_data->inits(np);
> +
> + return 0;
> +}
> +
> +static struct platform_driver clk_rk3562_driver = {
> + .probe = clk_rk3562_probe,
> + .driver = {
> + .name = "clk-rk3562",
> + .of_match_table = clk_rk3562_match_table,
> + .suppress_bind_attrs = true,
> + },
> +};
> +module_platform_driver(clk_rk3562_driver);
> +
> +MODULE_DESCRIPTION("Rockchip RK3562 Clock Driver");
> +MODULE_LICENSE("GPL");
> +MODULE_ALIAS("platform:clk-rk3562");
You should not need MODULE_ALIAS() in normal cases. If you need it,
usually it means your device ID table is wrong (e.g. misses either
entries or MODULE_DEVICE_TABLE()). MODULE_ALIAS() is not a substitute
for incomplete ID table.
Best regards,
Krzysztof
Powered by blists - more mailing lists