diff mbox

[1/4] ARM: OMAP: dmtimer: check for fixed timers during config

Message ID 1443727960-32232-2-git-send-email-s-anna@ti.com
State New
Headers show

Commit Message

Suman Anna Oct. 1, 2015, 7:32 p.m. UTC
The omap_dm_timer_set_source() function provides a means for client
users to configure the mux parent for a GPTimer's functional clock.
However, not all timers are configurable (Eg: Timer12 on DRA7 is fed
by an internal 32k oscillator clock, and does not have configurable
parent clocks). So, check for such cases and proceed with out throwing
an error.

Signed-off-by: Suman Anna <s-anna@ti.com>
---
 arch/arm/plat-omap/dmtimer.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

kernel test robot Oct. 3, 2015, 5:29 p.m. UTC | #1
Hi Suman,

[auto build test results on v4.3-rc3 -- if it's inappropriate base, please ignore]

config: arm-omap1_defconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm 

All error/warnings (new ones prefixed by >>):

   arch/arm/plat-omap/dmtimer.c: In function 'omap_dm_timer_set_source':
>> arch/arm/plat-omap/dmtimer.c:509:2: error: implicit declaration of function 'clk_hw_get_num_parents' [-Werror=implicit-function-declaration]
     if (!clk_hw_get_num_parents(__clk_get_hw(timer->fclk)))
     ^
>> arch/arm/plat-omap/dmtimer.c:509:2: error: implicit declaration of function '__clk_get_hw' [-Werror=implicit-function-declaration]
   cc1: some warnings being treated as errors

vim +/clk_hw_get_num_parents +509 arch/arm/plat-omap/dmtimer.c

   503			return pdata->set_timer_src(timer->pdev, source);
   504	
   505		if (IS_ERR(timer->fclk))
   506			return -EINVAL;
   507	
   508		/* Check if the clock has parents if not no point checking */
 > 509		if (!clk_hw_get_num_parents(__clk_get_hw(timer->fclk)))
   510			return 0;
   511	
   512		switch (source) {

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Suman Anna Oct. 5, 2015, 4:42 p.m. UTC | #2
Tony,

On 10/03/2015 12:29 PM, kbuild test robot wrote:
> Hi Suman,
> 
> [auto build test results on v4.3-rc3 -- if it's inappropriate base, please ignore]
> 
> config: arm-omap1_defconfig (attached as .config)
> reproduce:
>         wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # save the attached .config to linux build tree
>         make.cross ARCH=arm 
> 
> All error/warnings (new ones prefixed by >>):
> 
>    arch/arm/plat-omap/dmtimer.c: In function 'omap_dm_timer_set_source':
>>> arch/arm/plat-omap/dmtimer.c:509:2: error: implicit declaration of function 'clk_hw_get_num_parents' [-Werror=implicit-function-declaration]
>      if (!clk_hw_get_num_parents(__clk_get_hw(timer->fclk)))
>      ^
>>> arch/arm/plat-omap/dmtimer.c:509:2: error: implicit declaration of function '__clk_get_hw' [-Werror=implicit-function-declaration]
>    cc1: some warnings being treated as errors
> 
> vim +/clk_hw_get_num_parents +509 arch/arm/plat-omap/dmtimer.c
> 
>    503			return pdata->set_timer_src(timer->pdev, source);
>    504	
>    505		if (IS_ERR(timer->fclk))
>    506			return -EINVAL;
>    507	
>    508		/* Check if the clock has parents if not no point checking */
>  > 509		if (!clk_hw_get_num_parents(__clk_get_hw(timer->fclk)))
>    510			return 0;

CONFIG_COMMON_CLK is not defined for OMAP1. So, are you ok if I enclose
this within #ifdef CONFIG_COMMON_CLK?

regards
Suman
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Tony Lindgren Oct. 5, 2015, 4:58 p.m. UTC | #3
* Suman Anna <s-anna@ti.com> [151005 09:47]:
> Tony,
> 
> On 10/03/2015 12:29 PM, kbuild test robot wrote:
> > Hi Suman,
> > 
> > [auto build test results on v4.3-rc3 -- if it's inappropriate base, please ignore]
> > 
> > config: arm-omap1_defconfig (attached as .config)
> > reproduce:
> >         wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
> >         chmod +x ~/bin/make.cross
> >         # save the attached .config to linux build tree
> >         make.cross ARCH=arm 
> > 
> > All error/warnings (new ones prefixed by >>):
> > 
> >    arch/arm/plat-omap/dmtimer.c: In function 'omap_dm_timer_set_source':
> >>> arch/arm/plat-omap/dmtimer.c:509:2: error: implicit declaration of function 'clk_hw_get_num_parents' [-Werror=implicit-function-declaration]
> >      if (!clk_hw_get_num_parents(__clk_get_hw(timer->fclk)))
> >      ^
> >>> arch/arm/plat-omap/dmtimer.c:509:2: error: implicit declaration of function '__clk_get_hw' [-Werror=implicit-function-declaration]
> >    cc1: some warnings being treated as errors
> > 
> > vim +/clk_hw_get_num_parents +509 arch/arm/plat-omap/dmtimer.c
> > 
> >    503			return pdata->set_timer_src(timer->pdev, source);
> >    504	
> >    505		if (IS_ERR(timer->fclk))
> >    506			return -EINVAL;
> >    507	
> >    508		/* Check if the clock has parents if not no point checking */
> >  > 509		if (!clk_hw_get_num_parents(__clk_get_hw(timer->fclk)))
> >    510			return 0;
> 
> CONFIG_COMMON_CLK is not defined for OMAP1. So, are you ok if I enclose
> this within #ifdef CONFIG_COMMON_CLK?

Yes, or maybe you can just clk_get_rate() on the 32k oscillator?

Boards with no 32k oscillator should set the rate for that 0 zero.

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Suman Anna Oct. 5, 2015, 6:33 p.m. UTC | #4
On 10/05/2015 11:58 AM, Tony Lindgren wrote:
> * Suman Anna <s-anna@ti.com> [151005 09:47]:
>> Tony,
>>
>> On 10/03/2015 12:29 PM, kbuild test robot wrote:
>>> Hi Suman,
>>>
>>> [auto build test results on v4.3-rc3 -- if it's inappropriate base, please ignore]
>>>
>>> config: arm-omap1_defconfig (attached as .config)
>>> reproduce:
>>>         wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
>>>         chmod +x ~/bin/make.cross
>>>         # save the attached .config to linux build tree
>>>         make.cross ARCH=arm 
>>>
>>> All error/warnings (new ones prefixed by >>):
>>>
>>>    arch/arm/plat-omap/dmtimer.c: In function 'omap_dm_timer_set_source':
>>>>> arch/arm/plat-omap/dmtimer.c:509:2: error: implicit declaration of function 'clk_hw_get_num_parents' [-Werror=implicit-function-declaration]
>>>      if (!clk_hw_get_num_parents(__clk_get_hw(timer->fclk)))
>>>      ^
>>>>> arch/arm/plat-omap/dmtimer.c:509:2: error: implicit declaration of function '__clk_get_hw' [-Werror=implicit-function-declaration]
>>>    cc1: some warnings being treated as errors
>>>
>>> vim +/clk_hw_get_num_parents +509 arch/arm/plat-omap/dmtimer.c
>>>
>>>    503			return pdata->set_timer_src(timer->pdev, source);
>>>    504	
>>>    505		if (IS_ERR(timer->fclk))
>>>    506			return -EINVAL;
>>>    507	
>>>    508		/* Check if the clock has parents if not no point checking */
>>>  > 509		if (!clk_hw_get_num_parents(__clk_get_hw(timer->fclk)))
>>>    510			return 0;
>>
>> CONFIG_COMMON_CLK is not defined for OMAP1. So, are you ok if I enclose
>> this within #ifdef CONFIG_COMMON_CLK?
> 
> Yes, or maybe you can just clk_get_rate() on the 32k oscillator?
> 
> Boards with no 32k oscillator should set the rate for that 0 zero.

Well, this API is about setting the timer clk's mux source, and not
really dealing with the clk rate or just setting it to the 32k
oscillator. A 32k is usually one of the mux parents (if the timer has
them). If there is a way to find if the clk is a mux clock, then that
check would be ideal. But since no such thing exists, so I will go ahead
and fix this by adding the #ifdef check.

regards
Suman
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index 8ca94d379bc3..25693e722f1f 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -36,6 +36,7 @@ 
  */
 
 #include <linux/clk.h>
+#include <linux/clk-provider.h>
 #include <linux/module.h>
 #include <linux/io.h>
 #include <linux/device.h>
@@ -504,6 +505,10 @@  int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source)
 	if (IS_ERR(timer->fclk))
 		return -EINVAL;
 
+	/* Check if the clock has parents if not no point checking */
+	if (!clk_hw_get_num_parents(__clk_get_hw(timer->fclk)))
+		return 0;
+
 	switch (source) {
 	case OMAP_TIMER_SRC_SYS_CLK:
 		parent_name = "timer_sys_ck";