From: Jerome Brunet <jbrunet@baylibre.com>
To: Stephen Boyd <sboyd@kernel.org>,
Alexandre Mergnat <amergnat@baylibre.com>,
mturquette@baylibre.com
Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
baylibre-upstreaming@groups.io
Subject: Re: [PATCH] clk: fix clock global name usage.
Date: Fri, 24 May 2019 17:00:08 +0200 [thread overview]
Message-ID: <c89ecb6f328014ce22ae5d6c634e5337dbbf3ea2.camel@baylibre.com> (raw)
In-Reply-To: <20190524143355.5586D2133D@mail.kernel.org>
On Fri, 2019-05-24 at 07:33 -0700, Stephen Boyd wrote:
> Do you set the index to 0 in this clk's parent_data? We purposefully set
> the index to -1 in clk_core_populate_parent_map() so that the fw_name
> can be NULL but the index can be something >= 0 and then we'll use that
> to lookup the clk from DT. We need to support that combination.
>
> fw_name | index | DT lookup?
> ----------+---------+------------
> NULL | >= 0 | Y
> NULL | -1 | N
> non-NULL | -1 | ?
> non-NULL | >= 0 | Y
>
> Maybe we should support the ? case, because right now it will fail to do
> the DT lookup when the index is -1.
Hi Stephen,
We are trying to migrate all meson clocks to the new parent structure.
There is a little quirk which forces us to continue to use legacy names
for a couple of clocks.
We heavily use static data which init everything to 0.
Here is an example:
static struct clk_regmap g12a_aoclk_cts_rtc_oscin = {
[...]
.hw.init = &(struct clk_init_data){
.name = "g12a_ao_cts_rtc_oscin",
.ops = &clk_regmap_mux_ops,
- .parent_names = (const char *[]){ "g12a_ao_32k_by_oscin",
- IN_PREFIX "ext_32k-0" },
+ .parent_data = (const struct clk_parent_data []) {
+ { .name = "g12a_ao_32k_by_oscin" },
+ { .fw_name = "ext-32k-0", },
+ },
.num_parents = 2,
.flags = CLK_SET_RATE_PARENT,
},
};
With this, instead of taking name = "g12a_ao_32k_by_oscin" for entry #0
it takes DT names at index 0 which is not what we intended.
If I understand correctly we should put
+ { .name = "g12a_ao_32k_by_oscin", index = -1, },
And would be alright ?
While I understand it, it is not very obvious or nice to look at.
Plus it is a bit weird that this -1 is required for .name and not .hw.
Do you think we could come up with a priority order which makes the first
example work ?
Something like:
if (hw) {
/* use pointer */
} else if (name) {
/* use legacy global names */
} else if (fw_name) {
/* use DT names */
} else if (index >= 0)
/* use DT index */
} else {
return -EINVAL;
}
The last 2 clause could be removed if we make index an unsigned.
Cheers
Jerome
>
> So this patch instead?
next prev parent reply other threads:[~2019-05-24 15:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-24 7:27 Alexandre Mergnat
2019-05-24 14:33 ` Stephen Boyd
2019-05-24 15:00 ` Jerome Brunet [this message]
2019-05-24 17:44 ` Stephen Boyd
2019-05-24 18:12 ` Jerome Brunet
2019-06-06 22:54 ` Stephen Boyd
2019-06-10 9:37 ` Jerome Brunet
2019-06-11 6:46 ` wens Tsai
2019-06-12 23:00 ` Stephen Boyd
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c89ecb6f328014ce22ae5d6c634e5337dbbf3ea2.camel@baylibre.com \
--to=jbrunet@baylibre.com \
--cc=amergnat@baylibre.com \
--cc=baylibre-upstreaming@groups.io \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=sboyd@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®