On Thu, 19 Nov 2026 14:40:38 +0100
Geert Uytterhoeven <[email protected]> wrote:

> OMAP2+ clock handling uses of_clk_get_from_provider() to obtain clocks
> used for power management, so the latter show up as "deviceless" in the
> consumer column of the clk_summary file in debugfs.
> 
> Fix this by using dev_clk_get_from_provider() instead, letting us pass
> the consumer device, too.
> 
> Signed-off-by: Geert Uytterhoeven <[email protected]>
> ---
> Compile-tested only.
> 
> The first change is probably OK.  The second change may fail if anything
> in the oh->od->pdev->dev chain is not available yet at this point.

Test on OMAP3:

$ diff -u clk-old clk-new
--- clk-old     2026-11-19 22:44:59.810807920 +0100
+++ clk-new     2026-11-19 22:26:52.862531880 +0100
@@ -1,17 +1,17 @@
                                  enable  prepare  protect                      
          duty  hardware                            connection
    clock                          count    count    count        rate   
accuracy phase  cycle    enable   consumer                         id
 
---------------------------------------------------------------------------------------------------------------------------------------------
- oscillator                          0       0        0        26000000    0   
       0     50000      Y   deviceless                      
of_clk_get_from_provider 
+ oscillator                          0       0        0        26000000    0   
       0     50000      Y   deviceless                      
dev_clk_get_from_provider
                                                                                
                            deviceless                      no_connection_id    
     
- secure_32k_fck                      0       1        0        32768       0   
       0     50000      Y   deviceless                      
of_clk_get_from_provider 
+ secure_32k_fck                      0       1        0        32768       0   
       0     50000      Y   deviceless                      
dev_clk_get_from_provider
                                                                                
                            deviceless                      no_connection_id    
     
-    wdt1_fck                         0       0        0        32768       0   
       0     50000      Y      deviceless                      
of_clk_get_from_provider 
+    wdt1_fck                         0       0        0        32768       0   
       0     50000      Y      deviceless                      
dev_clk_get_from_provider
                                                                                
                               deviceless                      no_connection_id 
        
     gpt12_fck                        0       1        0        32768       0   
       0     50000      Y      48304000.timer                  fck              
        
                                                                                
                               48304000.target-module          fck              
        
-                                                                               
                               deviceless                      
of_clk_get_from_provider 
+                                                                               
                               deviceless                      
dev_clk_get_from_provider
                                                                                
                               deviceless                      no_connection_id 
        
- dummy_ck                            0       0        0        0           0   
       0     50000      Y   deviceless                      
of_clk_get_from_provider 
+ dummy_ck                            0       0        0        0           0   
       0     50000      Y   deviceless                      
dev_clk_get_from_provider
                                                                                
                            deviceless                      no_connection_id    
     
  mcbsp_clks                          0       5        0        0           0   
       0     50000      Y   deviceless                      mcbsp_clks          
     
                                                                                
                            deviceless                      mcbsp_clks          
     
[...]
Regards,
Andreas
> ---
>  arch/arm/mach-omap2/omap_device.c | 2 +-
>  arch/arm/mach-omap2/omap_hwmod.c  | 3 ++-
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/omap_device.c 
> b/arch/arm/mach-omap2/omap_device.c
> index 77a75b0b9ae69c85..5695e0c8f2392eca 100644
> --- a/arch/arm/mach-omap2/omap_device.c
> +++ b/arch/arm/mach-omap2/omap_device.c
> @@ -73,7 +73,7 @@ static void _add_clkdev(struct omap_device *od, const char 
> *clk_alias,
>  
>               clkspec.np = of_find_node_by_name(NULL, clk_name);
>  
> -             r = of_clk_get_from_provider(&clkspec);
> +             r = dev_clk_get_from_provider(&od->pdev->dev, &clkspec);
>  
>               rc = clk_register_clkdev(r, clk_alias,
>                                        dev_name(&od->pdev->dev));
> diff --git a/arch/arm/mach-omap2/omap_hwmod.c 
> b/arch/arm/mach-omap2/omap_hwmod.c
> index 03cd523dff874bb0..5e4123014909d4ac 100644
> --- a/arch/arm/mach-omap2/omap_hwmod.c
> +++ b/arch/arm/mach-omap2/omap_hwmod.c
> @@ -147,6 +147,7 @@
>  #include <asm/system_misc.h>
>  
>  #include "clock.h"
> +#include "omap_device.h"
>  #include "omap_hwmod.h"
>  
>  #include "soc.h"
> @@ -796,7 +797,7 @@ static struct clk *_lookup_clkctrl_clk(struct omap_hwmod 
> *oh)
>                               clkspec.args[0] = addr - provider->addr[0];
>                               clkspec.args[1] = 0;
>  
> -                             clk = of_clk_get_from_provider(&clkspec);
> +                             clk = 
> dev_clk_get_from_provider(&oh->od->pdev->dev, &clkspec);
>  
>                               pr_debug("%s: %s got %p (offset=%x, 
> provider=%pOF)\n",
>                                        __func__, oh->name, clk,

Reply via email to