All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/3] clk: socfpga: register the SP timer clocks early
@ 2026-10-13  7:07 Adrian Ng Ho Yin
  2026-10-13  7:07 ` [PATCH v3 1/3] clk: socfpga: agilex: " Adrian Ng Ho Yin
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Adrian Ng Ho Yin @ 2026-10-13  7:07 UTC (permalink / raw)
  To: Dinh Nguyen, Michael Turquette, Stephen Boyd, linux-clk,
	linux-kernel
  Cc: Adrian Ng Ho Yin

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 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

v2: https://lore.kernel.org/all/cover.1790935401.git.adrian.ho.yin.ng@altera.com/
v1: https://lore.kernel.org/all/cover.1789096458.git.adrian.ho.yin.ng@altera.com/

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
-- 
2.49.GIT

^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: [PATCH v3 1/3] clk: socfpga: agilex: register the SP timer clocks early
@ 2026-10-20 15:40 kernel test robot
  0 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2026-10-20 15:40 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

Unfiltered warning: this smatch report is sent as-is and has not been
reviewed for false positives, so please treat it with due skepticism.

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <1fc28c08edede0f96b5eca860d5c344e185f18da.1791871090.git.adrian.ho.yin.ng@altera.com>
References: <1fc28c08edede0f96b5eca860d5c344e185f18da.1791871090.git.adrian.ho.yin.ng@altera.com>
TO: Adrian Ng Ho Yin <adrian.ho.yin.ng@altera.com>
TO: Dinh Nguyen <dinguyen@kernel.org>
TO: Michael Turquette <mturquette@baylibre.com>
TO: Stephen Boyd <sboyd@kernel.org>
TO: linux-clk@vger.kernel.org
TO: linux-kernel@vger.kernel.org
CC: Adrian Ng Ho Yin <adrian.ho.yin.ng@altera.com>

Hi Adrian,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 1e7f56205813a2c48cdb3e9a4b0a24f49fd9a548]

url:    https://github.com/intel-lab-lkp/linux/commits/Adrian-Ng-Ho-Yin/clk-socfpga-agilex-register-the-SP-timer-clocks-early/20261013-150752
base:   1e7f56205813a2c48cdb3e9a4b0a24f49fd9a548
patch link:    https://lore.kernel.org/r/1fc28c08edede0f96b5eca860d5c344e185f18da.1791871090.git.adrian.ho.yin.ng%40altera.com
patch subject: [PATCH v3 1/3] clk: socfpga: agilex: register the SP timer clocks early
:::::: branch date: 7 days ago
:::::: commit date: 7 days ago
config: arm64-randconfig-r2202-20261020 (https://download.01.org/0day-ci/archive/20261020/202610201741.iarcON9M-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 12.5.0
smatch: v0.5.0-9187-g5189e3fb

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202610201741.iarcON9M-lkp@intel.com/

smatch warnings:
drivers/clk/socfpga/clk-agilex.c:635 agilex_clkmgr_init() warn: 'clk_data' can also be NULL
drivers/clk/socfpga/clk-agilex.c:656 n5x_clkmgr_init() warn: 'clk_data' can also be NULL

vim +/clk_data +635 drivers/clk/socfpga/clk-agilex.c

59988b8a07910f Adrian Ng Ho Yin 2026-10-13  626  
59988b8a07910f Adrian Ng Ho Yin 2026-10-13  627  static int agilex_clkmgr_init(struct platform_device *pdev)
59988b8a07910f Adrian Ng Ho Yin 2026-10-13  628  {
59988b8a07910f Adrian Ng Ho Yin 2026-10-13  629  	struct stratix10_clock_data *clk_data;
59988b8a07910f Adrian Ng Ho Yin 2026-10-13  630  
59988b8a07910f Adrian Ng Ho Yin 2026-10-13  631  	clk_data = agilex_clkmgr_get_clk_data(pdev, agilex_clk_register_early);
59988b8a07910f Adrian Ng Ho Yin 2026-10-13  632  	if (IS_ERR(clk_data))
59988b8a07910f Adrian Ng Ho Yin 2026-10-13  633  		return PTR_ERR(clk_data);
59988b8a07910f Adrian Ng Ho Yin 2026-10-13  634  
59988b8a07910f Adrian Ng Ho Yin 2026-10-13 @635  	agilex_clk_register_c_perip(agilex_main_perip_c_clks,
59988b8a07910f Adrian Ng Ho Yin 2026-10-13  636  				 ARRAY_SIZE(agilex_main_perip_c_clks), clk_data);
59988b8a07910f Adrian Ng Ho Yin 2026-10-13  637  
59988b8a07910f Adrian Ng Ho Yin 2026-10-13  638  	agilex_clk_register_cnt_perip(agilex_main_perip_cnt_clks,
59988b8a07910f Adrian Ng Ho Yin 2026-10-13  639  				   ARRAY_SIZE(agilex_main_perip_cnt_clks),
59988b8a07910f Adrian Ng Ho Yin 2026-10-13  640  				   clk_data);
59988b8a07910f Adrian Ng Ho Yin 2026-10-13  641  
59988b8a07910f Adrian Ng Ho Yin 2026-10-13  642  	agilex_clk_register_gate(agilex_gate_clks, ARRAY_SIZE(agilex_gate_clks),
59988b8a07910f Adrian Ng Ho Yin 2026-10-13  643  			      clk_data);
59988b8a07910f Adrian Ng Ho Yin 2026-10-13  644  
59988b8a07910f Adrian Ng Ho Yin 2026-10-13  645  	return agilex_clkmgr_finish(pdev, clk_data);
59988b8a07910f Adrian Ng Ho Yin 2026-10-13  646  }
59988b8a07910f Adrian Ng Ho Yin 2026-10-13  647  
59988b8a07910f Adrian Ng Ho Yin 2026-10-13  648  static int n5x_clkmgr_init(struct platform_device *pdev)
59988b8a07910f Adrian Ng Ho Yin 2026-10-13  649  {
59988b8a07910f Adrian Ng Ho Yin 2026-10-13  650  	struct stratix10_clock_data *clk_data;
59988b8a07910f Adrian Ng Ho Yin 2026-10-13  651  
59988b8a07910f Adrian Ng Ho Yin 2026-10-13  652  	clk_data = agilex_clkmgr_get_clk_data(pdev, n5x_clk_register_early);
59988b8a07910f Adrian Ng Ho Yin 2026-10-13  653  	if (IS_ERR(clk_data))
59988b8a07910f Adrian Ng Ho Yin 2026-10-13  654  		return PTR_ERR(clk_data);
a0f9819cbe9952 Dinh Nguyen      2021-02-12  655  
a0f9819cbe9952 Dinh Nguyen      2021-02-12 @656  	n5x_clk_register_c_perip(n5x_main_perip_c_clks,
a0f9819cbe9952 Dinh Nguyen      2021-02-12  657  				 ARRAY_SIZE(n5x_main_perip_c_clks), clk_data);
a0f9819cbe9952 Dinh Nguyen      2021-02-12  658  
a0f9819cbe9952 Dinh Nguyen      2021-02-12  659  	agilex_clk_register_cnt_perip(agilex_main_perip_cnt_clks,
a0f9819cbe9952 Dinh Nguyen      2021-02-12  660  				   ARRAY_SIZE(agilex_main_perip_cnt_clks),
a0f9819cbe9952 Dinh Nguyen      2021-02-12  661  				   clk_data);
a0f9819cbe9952 Dinh Nguyen      2021-02-12  662  
a0f9819cbe9952 Dinh Nguyen      2021-02-12  663  	agilex_clk_register_gate(agilex_gate_clks, ARRAY_SIZE(agilex_gate_clks),
a0f9819cbe9952 Dinh Nguyen      2021-02-12  664  			      clk_data);
59988b8a07910f Adrian Ng Ho Yin 2026-10-13  665  
59988b8a07910f Adrian Ng Ho Yin 2026-10-13  666  	return agilex_clkmgr_finish(pdev, clk_data);
a0f9819cbe9952 Dinh Nguyen      2021-02-12  667  }
a0f9819cbe9952 Dinh Nguyen      2021-02-12  668  

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-11-10  0:26 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-13  7:07 [PATCH v3 0/3] clk: socfpga: register the SP timer clocks early Adrian Ng Ho Yin
2026-10-13  7:07 ` [PATCH v3 1/3] clk: socfpga: agilex: " Adrian Ng Ho Yin
2026-10-13  7:18   ` sashiko-bot
2026-11-10  0:24   ` Dinh Nguyen
2026-10-13  7:07 ` [PATCH v3 2/3] clk: socfpga: agilex5: " Adrian Ng Ho Yin
2026-10-13  7:19   ` sashiko-bot
2026-11-10  0:25   ` Dinh Nguyen
2026-10-13  7:07 ` [PATCH v3 3/3] clk: socfpga: stratix10: " Adrian Ng Ho Yin
2026-10-13  7:19   ` sashiko-bot
2026-11-10  0:26   ` Dinh Nguyen
  -- strict thread matches above, loose matches on Subject: below --
2026-10-20 15:40 [PATCH v3 1/3] clk: socfpga: agilex: " kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.