lkml.org 
[lkml]   [2022]   [Apr]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC PATCH 0/7] clk: mediatek: Move to struct clk_hw provider APIs
From
Date
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".

\
 
 \ /
  Last update: 2022-04-22 03:41    [W:0.075 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site