linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] clk: Export __clk_lookup()
@ 2020-07-22  2:32 Elaine Zhang
  2020-07-22 18:26 ` Heiko Stuebner
  0 siblings, 1 reply; 6+ messages in thread
From: Elaine Zhang @ 2020-07-22  2:32 UTC (permalink / raw)
  To: heiko
  Cc: mturquette, sboyd, linux-clk, linux-rockchip, linux-kernel, xxx,
	xf, huangtao, kever.yang, Elaine Zhang

Export __clk_lookup() to support user built as module.

ERROR:
drivers/clk/rockchip/clk.ko: In function
`rockchip_clk_protect_critical':
drivers/clk/rockchip/clk.c:741:
undefined reference to `__clk_lookup'

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
---
 drivers/clk/clk.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 3f588ed06ce3..600284fbb257 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -618,6 +618,7 @@ struct clk *__clk_lookup(const char *name)
 
 	return !core ? NULL : core->hw->clk;
 }
+EXPORT_SYMBOL_GPL(__clk_lookup);
 
 static void clk_core_get_boundaries(struct clk_core *core,
 				    unsigned long *min_rate,
-- 
2.17.1




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

* Re: [PATCH v1] clk: Export __clk_lookup()
  2020-07-22  2:32 [PATCH v1] clk: Export __clk_lookup() Elaine Zhang
@ 2020-07-22 18:26 ` Heiko Stuebner
  2020-07-23  0:51   ` Stephen Boyd
  2020-07-23  3:36   ` elaine.zhang
  0 siblings, 2 replies; 6+ messages in thread
From: Heiko Stuebner @ 2020-07-22 18:26 UTC (permalink / raw)
  To: Elaine Zhang
  Cc: mturquette, sboyd, linux-clk, linux-rockchip, linux-kernel, xxx,
	xf, huangtao, kever.yang

Hi Elaine,

Am Mittwoch, 22. Juli 2020, 04:32:30 CEST schrieb Elaine Zhang:
> Export __clk_lookup() to support user built as module.
> 
> ERROR:
> drivers/clk/rockchip/clk.ko: In function
> `rockchip_clk_protect_critical':
> drivers/clk/rockchip/clk.c:741:
> undefined reference to `__clk_lookup'

can you elaborate a bit more on why this would be needed?

Because right now the Rockchip clocks are of course built into
the main kernel image (especially due to them being needed during early
boot) and __clk_lookup actually is a pretty deep part of the clock-
framework itself, as probably also denoted by the "__" in the function
name.


Heiko

> Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
> ---
>  drivers/clk/clk.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index 3f588ed06ce3..600284fbb257 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -618,6 +618,7 @@ struct clk *__clk_lookup(const char *name)
>  
>  	return !core ? NULL : core->hw->clk;
>  }
> +EXPORT_SYMBOL_GPL(__clk_lookup);
>  
>  static void clk_core_get_boundaries(struct clk_core *core,
>  				    unsigned long *min_rate,
> 





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

* Re: [PATCH v1] clk: Export __clk_lookup()
  2020-07-22 18:26 ` Heiko Stuebner
@ 2020-07-23  0:51   ` Stephen Boyd
  2020-07-23  1:42     ` elaine.zhang
  2020-07-23  3:36   ` elaine.zhang
  1 sibling, 1 reply; 6+ messages in thread
From: Stephen Boyd @ 2020-07-23  0:51 UTC (permalink / raw)
  To: Elaine Zhang, Heiko Stuebner
  Cc: mturquette, linux-clk, linux-rockchip, linux-kernel, xxx, xf,
	huangtao, kever.yang

Quoting Heiko Stuebner (2020-07-22 11:26:50)
> Hi Elaine,
> 
> Am Mittwoch, 22. Juli 2020, 04:32:30 CEST schrieb Elaine Zhang:
> > Export __clk_lookup() to support user built as module.
> > 
> > ERROR:
> > drivers/clk/rockchip/clk.ko: In function
> > `rockchip_clk_protect_critical':
> > drivers/clk/rockchip/clk.c:741:
> > undefined reference to `__clk_lookup'
> 
> can you elaborate a bit more on why this would be needed?
> 
> Because right now the Rockchip clocks are of course built into
> the main kernel image (especially due to them being needed during early
> boot) and __clk_lookup actually is a pretty deep part of the clock-
> framework itself, as probably also denoted by the "__" in the function
> name.
> 

Can you stop using __clk_lookup()? The plan is to remove it.

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

* Re: [PATCH v1] clk: Export __clk_lookup()
  2020-07-23  0:51   ` Stephen Boyd
@ 2020-07-23  1:42     ` elaine.zhang
  2020-07-23  1:49       ` elaine.zhang
  0 siblings, 1 reply; 6+ messages in thread
From: elaine.zhang @ 2020-07-23  1:42 UTC (permalink / raw)
  To: Stephen Boyd, Heiko Stuebner
  Cc: mturquette, linux-clk, linux-rockchip, linux-kernel, xxx, xf,
	huangtao, kever.yang


在 2020/7/23 上午8:51, Stephen Boyd 写道:
> Quoting Heiko Stuebner (2020-07-22 11:26:50)
>> Hi Elaine,
>>
>> Am Mittwoch, 22. Juli 2020, 04:32:30 CEST schrieb Elaine Zhang:
>>> Export __clk_lookup() to support user built as module.
>>>
>>> ERROR:
>>> drivers/clk/rockchip/clk.ko: In function
>>> `rockchip_clk_protect_critical':
>>> drivers/clk/rockchip/clk.c:741:
>>> undefined reference to `__clk_lookup'
>> can you elaborate a bit more on why this would be needed?
>>
>> Because right now the Rockchip clocks are of course built into
>> the main kernel image (especially due to them being needed during early
>> boot) and __clk_lookup actually is a pretty deep part of the clock-
>> framework itself, as probably also denoted by the "__" in the function
>> name.
>>
> Can you stop using __clk_lookup()? The plan is to remove it.

Rk use  __clk_lookup() as:

drivers/clk/rockchip/clk.c

void __init rockchip_clk_protect_critical(const char *const clocks[],
                                           int nclocks)
{
         int i;

         /* Protect the clocks that needs to stay on */
         for (i = 0; i < nclocks; i++) {
                 struct clk *clk = __clk_lookup(clocks[i]);

                 if (clk)
                         clk_prepare_enable(clk);
         }
}
e.g:

drivers/clk/rockchip/clk-rk3328.c

static const char *const rk3328_critical_clocks[] __initconst = {
         "aclk_bus",
         "aclk_bus_niu",
         "pclk_bus",
         "pclk_bus_niu",
         "hclk_bus",
         "hclk_bus_niu",
         "aclk_peri",
............

};

If have plan to remove the __clk_lookup, I need to replace the 
rockchip_clk_protect_critical, and use the flag CLK_IS_CRITICAL.(but use 
flag CLK_IS_CRITICAL, the enable count is always "0")

>
>



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

* Re: [PATCH v1] clk: Export __clk_lookup()
  2020-07-23  1:42     ` elaine.zhang
@ 2020-07-23  1:49       ` elaine.zhang
  0 siblings, 0 replies; 6+ messages in thread
From: elaine.zhang @ 2020-07-23  1:49 UTC (permalink / raw)
  To: Stephen Boyd, Heiko Stuebner
  Cc: mturquette, linux-clk, linux-rockchip, linux-kernel, xxx, xf,
	huangtao, kever.yang


在 2020/7/23 上午9:42, elaine.zhang 写道:
>
> 在 2020/7/23 上午8:51, Stephen Boyd 写道:
>> Quoting Heiko Stuebner (2020-07-22 11:26:50)
>>> Hi Elaine,
>>>
>>> Am Mittwoch, 22. Juli 2020, 04:32:30 CEST schrieb Elaine Zhang:
>>>> Export __clk_lookup() to support user built as module.
>>>>
>>>> ERROR:
>>>> drivers/clk/rockchip/clk.ko: In function
>>>> `rockchip_clk_protect_critical':
>>>> drivers/clk/rockchip/clk.c:741:
>>>> undefined reference to `__clk_lookup'
>>> can you elaborate a bit more on why this would be needed?
>>>
>>> Because right now the Rockchip clocks are of course built into
>>> the main kernel image (especially due to them being needed during early
>>> boot) and __clk_lookup actually is a pretty deep part of the clock-
>>> framework itself, as probably also denoted by the "__" in the function
>>> name.
>>>
>> Can you stop using __clk_lookup()? The plan is to remove it.
>
> Rk use  __clk_lookup() as:
>
> drivers/clk/rockchip/clk.c
>
> void __init rockchip_clk_protect_critical(const char *const clocks[],
>                                           int nclocks)
> {
>         int i;
>
>         /* Protect the clocks that needs to stay on */
>         for (i = 0; i < nclocks; i++) {
>                 struct clk *clk = __clk_lookup(clocks[i]);
>
>                 if (clk)
>                         clk_prepare_enable(clk);
>         }
> }
> e.g:
>
> drivers/clk/rockchip/clk-rk3328.c
>
> static const char *const rk3328_critical_clocks[] __initconst = {
>         "aclk_bus",
>         "aclk_bus_niu",
>         "pclk_bus",
>         "pclk_bus_niu",
>         "hclk_bus",
>         "hclk_bus_niu",
>         "aclk_peri",
> ............
>
> };
>
> If have plan to remove the __clk_lookup, I need to replace the 
> rockchip_clk_protect_critical, and use the flag CLK_IS_CRITICAL.(but 
> use flag CLK_IS_CRITICAL, the enable count is always "0")
Use the CLK_IS_CRITICAL, there is no guarantee that the parent clk is 
enabled, So the flag CLK_IS_CRITICAL need to be added to all special 
clks according to the clk tree.
>
>>
>>



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

* Re: [PATCH v1] clk: Export __clk_lookup()
  2020-07-22 18:26 ` Heiko Stuebner
  2020-07-23  0:51   ` Stephen Boyd
@ 2020-07-23  3:36   ` elaine.zhang
  1 sibling, 0 replies; 6+ messages in thread
From: elaine.zhang @ 2020-07-23  3:36 UTC (permalink / raw)
  To: Heiko Stuebner
  Cc: mturquette, sboyd, linux-clk, linux-rockchip, linux-kernel, xxx,
	xf, huangtao, kever.yang


在 2020/7/23 上午2:26, Heiko Stuebner 写道:
> Hi Elaine,
>
> Am Mittwoch, 22. Juli 2020, 04:32:30 CEST schrieb Elaine Zhang:
>> Export __clk_lookup() to support user built as module.
>>
>> ERROR:
>> drivers/clk/rockchip/clk.ko: In function
>> `rockchip_clk_protect_critical':
>> drivers/clk/rockchip/clk.c:741:
>> undefined reference to `__clk_lookup'
> can you elaborate a bit more on why this would be needed?
>
> Because right now the Rockchip clocks are of course built into
> the main kernel image (especially due to them being needed during early
> boot) and __clk_lookup actually is a pretty deep part of the clock-
> framework itself, as probably also denoted by the "__" in the function
> name.

Rockchip clocks are of course support to built as module(to support GKI),These changes will be pushed soon.
In drivers/clk/rockchip/clk.c and drivers/clk/rockchip/clk-cpu.c use the __clk_lookup.

>
>
> Heiko
>
>> Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
>> ---
>>   drivers/clk/clk.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
>> index 3f588ed06ce3..600284fbb257 100644
>> --- a/drivers/clk/clk.c
>> +++ b/drivers/clk/clk.c
>> @@ -618,6 +618,7 @@ struct clk *__clk_lookup(const char *name)
>>   
>>   	return !core ? NULL : core->hw->clk;
>>   }
>> +EXPORT_SYMBOL_GPL(__clk_lookup);
>>   
>>   static void clk_core_get_boundaries(struct clk_core *core,
>>   				    unsigned long *min_rate,
>>
>
>
>
>
>



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

end of thread, other threads:[~2020-07-23  3:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-22  2:32 [PATCH v1] clk: Export __clk_lookup() Elaine Zhang
2020-07-22 18:26 ` Heiko Stuebner
2020-07-23  0:51   ` Stephen Boyd
2020-07-23  1:42     ` elaine.zhang
2020-07-23  1:49       ` elaine.zhang
2020-07-23  3:36   ` elaine.zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).