[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <58956ebc474b993e6da1d6689ecb9324.sboyd@kernel.org>
Date: Thu, 11 Apr 2024 22:55:05 -0700
From: Stephen Boyd <sboyd@...nel.org>
To: Chen Wang <unicorn_wang@...look.com>, Chen Wang <unicornxw@...il.com>, aou@...s.berkeley.edu, chao.wei@...hgo.com, conor@...nel.org, devicetree@...r.kernel.org, guoren@...nel.org, haijiao.liu@...hgo.com, inochiama@...look.com, jszhang@...nel.org, krzysztof.kozlowski+dt@...aro.org, linux-clk@...r.kernel.org, linux-kernel@...r.kernel.org, linux-riscv@...ts.infradead.org, mturquette@...libre.com, palmer@...belt.com, paul.walmsley@...ive.com, richardcochran@...il.com, robh+dt@...nel.org, samuel.holland@...ive.com, xiaoguang.xing@...hgo.com
Subject: Re: [PATCH v13 4/5] clk: sophgo: Add SG2042 clock driver
Quoting Chen Wang (2024-04-11 05:58:05)
>
> On 2024/4/11 12:11, Stephen Boyd wrote:
> > Quoting Chen Wang (2024-03-28 23:21:40)
> >> +static const u32 sg2042_mux_table[] = {1, 0};
> >> +
> >> +static const char *const clk_mux_ddr01_p[] = {
> >> + "clk_div_ddr01_0", "clk_div_ddr01_1"};
> >> +static const char *const clk_mux_ddr23_p[] = {
> >> + "clk_div_ddr23_0", "clk_div_ddr23_1"};
> >> +static const char *const clk_mux_rp_cpu_normal_p[] = {
> >> + "clk_div_rp_cpu_normal_0", "clk_div_rp_cpu_normal_1"};
> >> +static const char *const clk_mux_axi_ddr_p[] = {
> >> + "clk_div_axi_ddr_0", "clk_div_axi_ddr_1"};
> >> +
> >> +static struct sg2042_mux_clock sg2042_mux_clks[] = {
> >> + SG2042_MUX(MUX_CLK_DDR01, "clk_mux_ddr01", clk_mux_ddr01_p,
> > Please use struct clk_parent_data or struct clk_hw directly instead of
> > string names.
>
> Hi, Stephen,
>
> I understand that for clk_init_data, parent_names/parent_data/parent_hws
> are all acceptable. Why do you only suggest me to use
> parent_data/parent_hws here? Can you please explain?
Using parent_names requires a global string search for that clk. Using
clk_parent_data or parent_hws reduces that search significantly,
speeding things up. Not using any strings furthermore speeds it up, i.e.
using an index when the clk is external to the device and a clk_hw
pointer when the clk is internal to the device. We speed things up by
removing string comparisons, of which there are many. Any new code
should be using direct pointers or an index, no strings.
Powered by blists - more mailing lists