Skip to content

Fix unused clock disabling on LPC18xx

Joachim Eastwood linux-clk 3 versions – Applied

Status from this message: Applied to clk-next

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest3 patches 3 repliesApplied
  2. v22 patches 6 repliesSuperseded
  3. v12 patches 0 repliesSuperseded

Changes in v3 from the cover letter

- Add clk.h to cgu since it uses clk_get_parent().
- Rebase on clk-next

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/3clk: Add clk_hw_is_enabled() for use by clk providersdrivers/clk/clk.c include/linux/clk-provider.h+6 -01 reply
2/3clk: lpc18xx-ccu: fix potential system hang when disabling unused clocksdrivers/clk/nxp/clk-lpc18xx-ccu.c+15 -21 reply
3/3clk: lpc18xx-cgu: fix potential system hang when disabling unused clocksdrivers/clk/nxp/clk-lpc18xx-cgu.c+39 -31 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH v3 0/3] Fix unused clock disabling on LPC18xx

I have finally managed to track down the reason for the hang that would occur when disabling clocks on lpc18xx under certain conditions. These conditions depend on boot mode used, what the boot loader does and if certain devices are enabled.

One of reasons why it took me a while was that my primary platform was not affected by it and the data sheet has a rather misleading typo.

The hang will occur if the boot rom/loader doesn't setup USB0 clocks and if certain AMBA devices are enabled (PL022 SSP and maybe others).

Cause of the hang is that the CCU registers can not be accessed if the base (parent) clock is not enabled. To make sure the parent is running a check for this has been added to the is_enabled clk_ops callback. Since clocks in the CGU can be cascaded this check must also be added here.

To better understand the clock system on lpc18xx please take the time to look at the diagrams on:
https://github.com/manabian/linux-lpc/wiki/LPC18xx-LPC43xx-clocks

This version address the comments from Stephen Boyd.

Changes since v3:
- add clk_hw_is_enabled
- fix typo on CGU gate enable function
- use clk_hw_get_parent() insted of clk_get_parent()
- rebase on v4.3-rc1

Changes since v2:
- Add clk.h to cgu since it uses clk_get_parent().
- Rebase on clk-next

Joachim Eastwood (3):
clk: Add clk_hw_is_enabled() for use by clk providers
clk: lpc18xx-ccu: fix potential system hang when disabling unused clocks
clk: lpc18xx-cgu: fix potential system hang when disabling unused clocks

 drivers/clk/clk.c                 |  5 +++++
 drivers/clk/nxp/clk-lpc18xx-ccu.c | 17 ++++++++++++++--
 drivers/clk/nxp/clk-lpc18xx-cgu.c | 42 ++++++++++++++++++++++++++++++++++++---
 include/linux/clk-provider.h      |  1 +
 4 files changed, 60 insertions(+), 5 deletions(-)
Signature · 1 line
1.8.0