[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220422014044.16530C385A7@smtp.kernel.org>
Date: Thu, 21 Apr 2022 18:40:42 -0700
From: Stephen Boyd <sboyd@...nel.org>
To: AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>,
Chen-Yu Tsai <wenst@...omium.org>
Cc: Michael Turquette <mturquette@...libre.com>,
Chun-Jie Chen <chun-jie.chen@...iatek.com>,
Miles Chen <miles.chen@...iatek.com>,
Rex-BC Chen <rex-bc.chen@...iatek.com>,
Matthias Brugger <matthias.bgg@...il.com>,
linux-clk@...r.kernel.org, linux-mediatek@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 0/7] clk: mediatek: Move to struct clk_hw provider APIs
Quoting Chen-Yu Tsai (2022-04-20 23:05:10)
>
> Not exactly. All the clocks in the MTK drivers are allocated at runtime,
> so we can't use clk_parent_data to point to not-yet-allocated clk_hw-s.
> Instead we'll need to have
>
> struct mtk_clk_parent_data {
> unsigned int clk_id; /* Match CLK_XXX_YYY from dt-binding headers */
> ... /* remaining fields same as mtk_clk_parent_data */
> };
>
> and create the actual clk_parent_data at runtime by looking up clk_id in
> the set of already registered clks:
>
> int mtk_clk_register_XXX(..., struct mtk_clk_parent_data *pdata,
> struct clk_hw_onecell_data *clk_data) {
> struct clk_parent_data data = {
> .hw = clk_data[pdata->clk_id],
> /* copy other fields verbatim */
> };
> ...
> }
>
> Obviously this forces some ordering of how the clks are registered.
> I believe the order is already correct, and if it isn't, it would be
> easy to detect, and we can reorder things to fix it.
If this is a common problem, we may need to come up with a generic
solution that either adds a new clk registration API that fills in the
clk_parent_data hw pointer or add another member to struct
clk_parent_data that says "index into this other array of clk_hw
pointers".
Powered by blists - more mailing lists