Thread (10 messages) 10 messages, 4 authors, 2021-02-10

Re: [PATCH] clk: at91: sama5d2: Mark device OF_POPULATED after setup

From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: 2021-02-01 10:56:29
Also in: linux-arm-kernel, lkml

Hi Saravana,

On Thu, Jan 28, 2021 at 6:08 PM Saravana Kannan [off-list ref] wrote:
I already accounted for early clocks like this when I designed
fw_devlink. Each driver shouldn't need to set OF_POPULATED.
drivers/clk/clk.c already does this for you.

I think the problem is that your driver is using
CLK_OF_DECLARE_DRIVER() instead of CLK_OF_DECLARE(). The comments for
CLK_OF_DECLARE_DRIVER() says:
/*
 * Use this macro when you have a driver that requires two initialization
 * routines, one at of_clk_init(), and one at platform device probe
 */

In your case, you are explicitly NOT having a driver bind to this
clock later. So you shouldn't be using CLK_OF_DECLARE() instead.
Unless I'm missing something, name##_of_clk_init_driver() clearing
OF_POPULATED again causes consumer driver probing to be postponed by
fw_devlink until the second initialization phase of the provider has been
completed?

This is wrong if the consumer only needs a clock instantiated during the
first phase, and may cause issues if the consumer is a critical device.
E.g. a timer, on ARM SoCs lacking an architecture timer (pre-Cortex
A7/A15) or global timer (pre-Cortex A9, or single-core Cortex A9).
Probably there are more examples.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help