[PATCH v13 4/5] clk: sophgo: Add SG2042 clock driver

Stephen Boyd sboyd at kernel.org
Thu Apr 11 22:55:05 PDT 2024


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.



More information about the linux-riscv mailing list