Skip to content

clk: socfpga: register the SP timer clocks early

Adrian Ng Ho Yin linux-clk lkml stable 3 versions – Applied

Status from this message: Applied, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest3 patches 1 replyApplied
  2. v33 patches 3 repliesSuperseded
  3. v23 patches 3 repliesSuperseded

Changes in v4 from the cover letter

- Add Fixes tags and Cc: stable on each patch (Dinh)

Patches in v4 Applied

#Subject and filesSizeRepliesApplied
1/3clk: socfpga: agilex: register the SP timer clocks earlydrivers/clk/socfpga/clk-agilex.c+187 -550 replies
2/3clk: socfpga: agilex5: register the SP timer clocks earlydrivers/clk/socfpga/clk-agilex5.c+126 -290 replies
3/3clk: socfpga: stratix10: register the SP timer clocks earlydrivers/clk/socfpga/clk-s10.c+121 -250 replies

Reviews trailers per patch

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

Read the v4 thread

Cover letter [PATCH v4 0/3] clk: socfpga: register the SP timer clocks early

The DW APB timers on Stratix10, Agilex (including eASIC N5X) and Agilex5 are probed through TIMER_OF_DECLARE() from time_init(), but their clock, l4_sp_clk, comes from a clock manager that is a platform driver registered at core_initcall(). The timer's clk_get() returns -EPROBE_DEFER, which timer_probe() does not report, and the timer is never registered because TIMER_OF_DECLARE() callbacks are not retried.

Rather than moving the whole clock manager to CLK_OF_DECLARE() as v1 did, this version keeps the platform driver and, following clk-mt8173-infracfg.c, uses CLK_OF_DECLARE_DRIVER() to register only l4_sp_clk and the clocks its rate depends on from of_clk_init():

Agilex/N5X: boot_clk, main_pll, periph_pll, main_pll_c1, peri_pll_c1,

              noc_free_clk, l4_sp_clk
  Agilex5:    boot_clk, main_pll, periph_pll, main_pll_c3, peri_pll_c1,
              noc_free_clk, l4_sp_clk

Stratix10: boot_clk, main_pll, periph_pll, main_noc_base_clk,
peri_noc_base_clk, noc_free_clk, l4_sp_clk

All other clock IDs return -EPROBE_DEFER until the platform driver probes, registers the remaining clocks into the same provider and turns any unused IDs into -ENOENT. If the early registration fails, probe falls back to registering everything as before.

Boot-tested on Agilex7 (FM61), Stratix10 L-tile and Agilex5 (065B Premium devkit), comparing each board with and without this series:

- with the series, timer1 is registered as a clocksource within 0.5 ms of boot and timer0 as the broadcast clockevent device; without it, neither is registered and bc_hrtimer is used for broadcast instead
- the clock manager still binds as a platform device, no devices are left deferred, and clocks registered at probe (EMAC, SD/MMC, USB, DMA, watchdog) have their expected rates and consumers

eASIC N5X is compile-tested only.

Changes in v4:
- Add Fixes tags and Cc: stable on each patch (Dinh)

Changes in v3:
- Drop redundant #include <linux/io.h>; of_address.h already provides iounmap() (Dinh)
- Always publish clk_data before adding the provider; use of_iomap() for both early and probe-fallback setup so a failed provider add cannot double-register early clocks or leave clocks pointing at a devm-unmapped base

Changes in v2:
- Keep the clock managers as platform drivers instead of converting them to CLK_OF_DECLARE() (Brian)
- Register only l4_sp_clk and its parents early, using CLK_OF_DECLARE_DRIVER() as in clk-mt8173-infracfg.c, instead of the whole controller (Jerome)
- Return the result of of_clk_add_hw_provider() from probe
- Update subjects and commit messages to match the new approach

v3: https://lore.kernel.org/all/[email protected]/
v2: https://lore.kernel.org/all/[email protected]/
v1: https://lore.kernel.org/all/[email protected]/

Adrian Ng Ho Yin (3):
clk: socfpga: agilex: register the SP timer clocks early
clk: socfpga: agilex5: register the SP timer clocks early
clk: socfpga: stratix10: register the SP timer clocks early

 drivers/clk/socfpga/clk-agilex.c  | 242 +++++++++++++++++++++++-------
 drivers/clk/socfpga/clk-agilex5.c | 155 +++++++++++++++----
 drivers/clk/socfpga/clk-s10.c     | 146 +++++++++++++++---
 3 files changed, 434 insertions(+), 109 deletions(-)

base-commit: 1e7f56205813a2c48cdb3e9a4b0a24f49fd9a548

Signature · 1 line
2.49.GIT