Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

clk: ti: Add ti_find_clock_provider() to use clock-output-names

Let's add ti_find_clock_provider() so we can use clock-output-names
to name the clock provider instead of relying on non-standard devicetree
node names.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Link: https://lore.kernel.org/r/20220204071449.16762-5-tony@atomide.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>

authored by

Tony Lindgren and committed by
Stephen Boyd
51f661ef 274d6798

+41 -2
+41 -2
drivers/clk/ti/clk.c
··· 119 119 return 0; 120 120 } 121 121 122 + /* 123 + * Eventually we could standardize to using '_' for clk-*.c files to follow the 124 + * TRM naming and leave out the tmp name here. 125 + */ 126 + static struct device_node *ti_find_clock_provider(struct device_node *from, 127 + const char *name) 128 + { 129 + struct device_node *np; 130 + bool found = false; 131 + const char *n; 132 + char *tmp; 133 + 134 + tmp = kstrdup(name, GFP_KERNEL); 135 + if (!tmp) 136 + return NULL; 137 + strreplace(tmp, '-', '_'); 138 + 139 + /* Node named "clock" with "clock-output-names" */ 140 + for_each_of_allnodes_from(from, np) { 141 + if (of_property_read_string_index(np, "clock-output-names", 142 + 0, &n)) 143 + continue; 144 + 145 + if (!strncmp(n, tmp, strlen(tmp))) { 146 + found = true; 147 + break; 148 + } 149 + } 150 + of_node_put(from); 151 + kfree(tmp); 152 + 153 + if (found) 154 + return np; 155 + 156 + /* Fall back to using old node name base provider name */ 157 + return of_find_node_by_name(from, name); 158 + } 159 + 122 160 /** 123 161 * ti_dt_clocks_register - register DT alias clocks during boot 124 162 * @oclks: list of clocks to register 125 163 * 126 164 * Register alias or non-standard DT clock entries during boot. By 127 - * default, DT clocks are found based on their node name. If any 165 + * default, DT clocks are found based on their clock-output-names 166 + * property, or the clock node name for legacy cases. If any 128 167 * additional con-id / dev-id -> clock mapping is required, use this 129 168 * function to list these. 130 169 */ ··· 207 168 if (num_args && clkctrl_nodes_missing) 208 169 continue; 209 170 210 - node = of_find_node_by_name(NULL, buf); 171 + node = ti_find_clock_provider(NULL, buf); 211 172 if (num_args && compat_mode) { 212 173 parent = node; 213 174 child = of_get_child_by_name(parent, "clock");