mbox series

[00/11] clk: renesas: cpg-mssr: add ignore-unused option

Message ID 1582748897-17374-1-git-send-email-uli+renesas@fpond.eu (mailing list archive)
Headers show
Series clk: renesas: cpg-mssr: add ignore-unused option | expand

Message

Ulrich Hecht Feb. 26, 2020, 8:28 p.m. UTC
Hi!

This series adds the option for declaring clocks as "ignore-unused", i.e. 
clocks that will not be turned on if not used, but also not turned off if
unused. It also enables this option for the RWDT clocks in (almost) all
SoCs.

The point of this is to allow a WDT that has been enabled by the bootloader
to survive these events:

- deferred probing of the WDT device, which can lead the clock driver
  to disable the WDT clock until the WDT is re-probed, giving it a
  blind spot
- probe failure in the WDT driver

There are a number of SoCs that have the RWDT clock already declared as
critical (i.e. turn it on even if it is off _and_ unused). I don't know if
that is because there was no option for ignore-unused before, or if the
behavior of turning the clock on even if neither the bootloader nor anything
in the kernel has asked for it is actually desired. If it's the former,
these SoCs also have to be converted to the new mechanism.

CU
Uli


Ulrich Hecht (11):
  clk: renesas: cpg-mssr: add support for ignore-unused clocks
  clk: renesas: r8a7796: mark RWDT clock as ignore-unused
  clk: renesas: r8a7795: mark RWDT clock as ignore-unused
  clk: renesas: r8a77970: mark RWDT clock as ignore-unused
  clk: renesas: r8a77980: mark RWDT clock as ignore-unused
  clk: renesas: r8a77995: mark RWDT clock as ignore-unused
  clk: renesas: r8a774a1: mark RWDT clock as ignore-unused
  clk: renesas: r8a774b1: mark RWDT clock as ignore-unused
  clk: renesas: r8a774c0: mark RWDT clock as ignore-unused
  clk: renesas: r8a77965: mark RWDT clock as ignore-unused
  clk: renesas: r8a77990: mark RWDT clock as ignore-unused

 drivers/clk/renesas/r8a774a1-cpg-mssr.c | 5 +++++
 drivers/clk/renesas/r8a774b1-cpg-mssr.c | 5 +++++
 drivers/clk/renesas/r8a774c0-cpg-mssr.c | 5 +++++
 drivers/clk/renesas/r8a7795-cpg-mssr.c  | 6 +++++-
 drivers/clk/renesas/r8a7796-cpg-mssr.c  | 6 +++++-
 drivers/clk/renesas/r8a77965-cpg-mssr.c | 5 +++++
 drivers/clk/renesas/r8a77970-cpg-mssr.c | 6 +++++-
 drivers/clk/renesas/r8a77980-cpg-mssr.c | 6 +++++-
 drivers/clk/renesas/r8a77990-cpg-mssr.c | 5 +++++
 drivers/clk/renesas/r8a77995-cpg-mssr.c | 6 +++++-
 drivers/clk/renesas/renesas-cpg-mssr.c  | 7 +++++++
 drivers/clk/renesas/renesas-cpg-mssr.h  | 7 +++++++
 12 files changed, 64 insertions(+), 5 deletions(-)

Comments

Geert Uytterhoeven Feb. 27, 2020, 2:29 p.m. UTC | #1
Hi Uli,

On Wed, Feb 26, 2020 at 9:28 PM Ulrich Hecht <uli+renesas@fpond.eu> wrote:
> This series adds the option for declaring clocks as "ignore-unused", i.e.
> clocks that will not be turned on if not used, but also not turned off if
> unused. It also enables this option for the RWDT clocks in (almost) all
> SoCs.

Thanks for your series!

> The point of this is to allow a WDT that has been enabled by the bootloader
> to survive these events:
>
> - deferred probing of the WDT device, which can lead the clock driver
>   to disable the WDT clock until the WDT is re-probed, giving it a
>   blind spot
> - probe failure in the WDT driver
>
> There are a number of SoCs that have the RWDT clock already declared as
> critical (i.e. turn it on even if it is off _and_ unused). I don't know if
> that is because there was no option for ignore-unused before, or if the
> behavior of turning the clock on even if neither the bootloader nor anything
> in the kernel has asked for it is actually desired. If it's the former,
> these SoCs also have to be converted to the new mechanism.

That was done on all of R-Car Gen2 and RZ/G1, as the SMP bringup code
needs to check the watchdog registers, which can happen at any time, cfr.
commit 58adf1ba0d227754 ("ARM: shmobile: Add watchdog support").

Presumable that was fixed on R-Car Gen3 and RZ/G2, so the watchdog registers
don't have to be checked, and the watchdog doesn't have to run all the
time (holding wood, rabbit legs, and whatever ;-)

> Ulrich Hecht (11):
>   clk: renesas: cpg-mssr: add support for ignore-unused clocks
>   clk: renesas: r8a7796: mark RWDT clock as ignore-unused
>   clk: renesas: r8a7795: mark RWDT clock as ignore-unused
>   clk: renesas: r8a77970: mark RWDT clock as ignore-unused
>   clk: renesas: r8a77980: mark RWDT clock as ignore-unused
>   clk: renesas: r8a77995: mark RWDT clock as ignore-unused
>   clk: renesas: r8a774a1: mark RWDT clock as ignore-unused
>   clk: renesas: r8a774b1: mark RWDT clock as ignore-unused
>   clk: renesas: r8a774c0: mark RWDT clock as ignore-unused
>   clk: renesas: r8a77965: mark RWDT clock as ignore-unused
>   clk: renesas: r8a77990: mark RWDT clock as ignore-unused

I think the SoC-specific parts can be merged safely into two patches,
one for R-Car Gen3, and one for RZ/G2?

Gr{oetje,eeting}s,

                        Geert
Wolfram Sang March 3, 2020, 4:05 p.m. UTC | #2
On Wed, Feb 26, 2020 at 09:28:06PM +0100, Ulrich Hecht wrote:
> Hi!
> 
> This series adds the option for declaring clocks as "ignore-unused", i.e. 
> clocks that will not be turned on if not used, but also not turned off if
> unused. It also enables this option for the RWDT clocks in (almost) all
> SoCs.
> 
> The point of this is to allow a WDT that has been enabled by the bootloader
> to survive these events:
> 
> - deferred probing of the WDT device, which can lead the clock driver
>   to disable the WDT clock until the WDT is re-probed, giving it a
>   blind spot
> - probe failure in the WDT driver

I like the approach in general. Seems to solve both issues nicely. Minor
comments for patch 1 follow. I also agree with Geert about the squashing
of patches, yet in general, I look forward if this could be added.