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

clk: mvebu: dove: maintain clock init order

Init order of CLK_OF_DECLARE'd drivers depends on compile order.
Unfortunately, clk_of_init does not allow drivers to return errors,
e.g. -EPROBE_DEFER if parent clocks have not been registered, yet.

To avoid init order woes for MVEBU clock drivers, we take care of
proper init order ourselves. This patch joins core-clk and gating-clk
init to maintain proper init order.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Tested-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>

authored by

Sebastian Hesselbarth and committed by
Jason Cooper
8f7fc545 0a11a6ae

+9 -10
+9 -10
drivers/clk/mvebu/dove.c
··· 154 154 .num_ratios = ARRAY_SIZE(dove_coreclk_ratios), 155 155 }; 156 156 157 - static void __init dove_coreclk_init(struct device_node *np) 158 - { 159 - mvebu_coreclk_setup(np, &dove_coreclks); 160 - } 161 - CLK_OF_DECLARE(dove_core_clk, "marvell,dove-core-clock", dove_coreclk_init); 162 - 163 157 /* 164 158 * Clock Gating Control 165 159 */ ··· 180 186 { } 181 187 }; 182 188 183 - static void __init dove_clk_gating_init(struct device_node *np) 189 + static void __init dove_clk_init(struct device_node *np) 184 190 { 185 - mvebu_clk_gating_setup(np, dove_gating_desc); 191 + struct device_node *cgnp = 192 + of_find_compatible_node(NULL, NULL, "marvell,dove-gating-clock"); 193 + 194 + mvebu_coreclk_setup(np, &dove_coreclks); 195 + 196 + if (cgnp) 197 + mvebu_clk_gating_setup(cgnp, dove_gating_desc); 186 198 } 187 - CLK_OF_DECLARE(dove_clk_gating, "marvell,dove-gating-clock", 188 - dove_clk_gating_init); 199 + CLK_OF_DECLARE(dove_clk, "marvell,dove-core-clock", dove_clk_init);