All of lore.kernel.org
 help / color / mirror / Atom feed
* Problem: "clk: max77686: Migrate to clk_hw based OF and registration APIs" breaks s3c-rtc on Odroid U3
@ 2016-10-06 10:48 Markus Reichl
  2016-10-06 11:28 ` Tobias Jakobi
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Reichl @ 2016-10-06 10:48 UTC (permalink / raw)
  To: linux-samsung-soc, stephen.boyd, krzk, javier; +Cc: ldewangan

Hi,

since commit

[9b4cac33adc7716bb232b3a82a5ed0806286fe9a] clk: max77686: Migrate to clk_hw based OF and registration APIs

s3-rtc does not get it's source clock and fails:

[    1.963782] of_clk_max77686_get: invalid index 0
[    1.967460] ERROR: could not get clock /rtc@10070000:rtc_src(1)
[    1.973638] s3c-rtc 10070000.rtc: failed to find rtc source clock


Regards,
--
Markus Reichl

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

* Re: Problem: "clk: max77686: Migrate to clk_hw based OF and registration APIs" breaks s3c-rtc on Odroid U3
  2016-10-06 10:48 Problem: "clk: max77686: Migrate to clk_hw based OF and registration APIs" breaks s3c-rtc on Odroid U3 Markus Reichl
@ 2016-10-06 11:28 ` Tobias Jakobi
  2016-10-06 13:44   ` Javier Martinez Canillas
  0 siblings, 1 reply; 5+ messages in thread
From: Tobias Jakobi @ 2016-10-06 11:28 UTC (permalink / raw)
  To: Markus Reichl, linux-samsung-soc, stephen.boyd, krzk, javier; +Cc: ldewangan

Hello,

I quickly went over the commit, and I don't see the 'num_clks' fields
being initialized anywhere. So that's probably the reason why it's
always zero and the check in of_clk_max77686_get() fails.

With best wishes,
Tobias


Markus Reichl wrote:
> Hi,
> 
> since commit
> 
> [9b4cac33adc7716bb232b3a82a5ed0806286fe9a] clk: max77686: Migrate to clk_hw based OF and registration APIs
> 
> s3-rtc does not get it's source clock and fails:
> 
> [    1.963782] of_clk_max77686_get: invalid index 0
> [    1.967460] ERROR: could not get clock /rtc@10070000:rtc_src(1)
> [    1.973638] s3c-rtc 10070000.rtc: failed to find rtc source clock
> 
> 
> Regards,
> --
> Markus Reichl
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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

* Re: Problem: "clk: max77686: Migrate to clk_hw based OF and registration APIs" breaks s3c-rtc on Odroid U3
  2016-10-06 11:28 ` Tobias Jakobi
@ 2016-10-06 13:44   ` Javier Martinez Canillas
  2016-10-06 13:59     ` Markus Reichl
  0 siblings, 1 reply; 5+ messages in thread
From: Javier Martinez Canillas @ 2016-10-06 13:44 UTC (permalink / raw)
  To: Tobias Jakobi, Markus Reichl, linux-samsung-soc, stephen.boyd, krzk
  Cc: ldewangan

Hello,

On 10/06/2016 08:28 AM, Tobias Jakobi wrote:
> Hello,
> 
> I quickly went over the commit, and I don't see the 'num_clks' fields
> being initialized anywhere. So that's probably the reason why it's
> always zero and the check in of_clk_max77686_get() fails.
>

Tobias is correct, that's the issue. I wonder why it worked for me when
I tested the patch, probably because the bootloader enables the clocks
so I didn't see the difference...

Anyways, following is a patch [0] as suggested by Tobias. I don't have
access to my platform now to test but if it fixes the issue I can post
it as a proper patch.

[0]:
>From 93402366eb4b2e39f2885cb11066d90b70f0c1b8 Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <javier@osg.samsung.com>
Date: Thu, 6 Oct 2016 10:20:02 -0300
Subject: [RFT PATCH] clk: max77686: fix number of clocks setup for clk_hw
 based registration

The commit 9b4cac33adc7 ("clk: max77686: Migrate to clk_hw based OF and
registration APIs") converted the driver to use the new provider API to
register clocks using clk_hw.

But unfortunately, in the conversion it missed to set the num_clks value
which lead to the following error when trying to register a clk provider:

[    1.963782] of_clk_max77686_get: invalid index 0
[    1.967460] ERROR: could not get clock /rtc@10070000:rtc_src(1)
[    1.973638] s3c-rtc 10070000.rtc: failed to find rtc source clock

Fix it by correctly set the max77686_clk_driver_data .num_clks member.

Fixes: 9b4cac33adc7 ("clk: max77686: Migrate to clk_hw based OF and registration APIs")
Reported-by: Markus Reichl <m.reichl@fivetechno.de>
Suggested-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
---
 drivers/clk/clk-max77686.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/clk-max77686.c b/drivers/clk/clk-max77686.c
index b637f5979023..eb953d3b0b69 100644
--- a/drivers/clk/clk-max77686.c
+++ b/drivers/clk/clk-max77686.c
@@ -216,6 +216,7 @@ static int max77686_clk_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
+	drv_data->num_clks = num_clks;
 	drv_data->max_clk_data = devm_kcalloc(dev, num_clks,
 					      sizeof(*drv_data->max_clk_data),
 					      GFP_KERNEL);
-- 
2.7.4

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America

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

* Re: Problem: "clk: max77686: Migrate to clk_hw based OF and registration APIs" breaks s3c-rtc on Odroid U3
  2016-10-06 13:44   ` Javier Martinez Canillas
@ 2016-10-06 13:59     ` Markus Reichl
  2016-10-06 15:02       ` Javier Martinez Canillas
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Reichl @ 2016-10-06 13:59 UTC (permalink / raw)
  To: Javier Martinez Canillas, Tobias Jakobi, linux-samsung-soc,
	stephen.boyd, krzk
  Cc: ldewangan

Hi Javier,

Am 06.10.2016 um 15:44 schrieb Javier Martinez Canillas:
> Hello,
> 
> On 10/06/2016 08:28 AM, Tobias Jakobi wrote:
>> Hello,
>>
>> I quickly went over the commit, and I don't see the 'num_clks' fields
>> being initialized anywhere. So that's probably the reason why it's
>> always zero and the check in of_clk_max77686_get() fails.
>>
> 
> Tobias is correct, that's the issue. I wonder why it worked for me when
> I tested the patch, probably because the bootloader enables the clocks
> so I didn't see the difference...
> 
> Anyways, following is a patch [0] as suggested by Tobias. I don't have
> access to my platform now to test but if it fixes the issue I can post
> it as a proper patch.

Thanks, this fixes the issue on Odroid U3.

Tested-by: Markus Reichl <m.reichl@fivetechno.de>

> 
> [0]:
>>From 93402366eb4b2e39f2885cb11066d90b70f0c1b8 Mon Sep 17 00:00:00 2001
> From: Javier Martinez Canillas <javier@osg.samsung.com>
> Date: Thu, 6 Oct 2016 10:20:02 -0300
> Subject: [RFT PATCH] clk: max77686: fix number of clocks setup for clk_hw
>  based registration
> 
> The commit 9b4cac33adc7 ("clk: max77686: Migrate to clk_hw based OF and
> registration APIs") converted the driver to use the new provider API to
> register clocks using clk_hw.
> 
> But unfortunately, in the conversion it missed to set the num_clks value
> which lead to the following error when trying to register a clk provider:
> 
> [    1.963782] of_clk_max77686_get: invalid index 0
> [    1.967460] ERROR: could not get clock /rtc@10070000:rtc_src(1)
> [    1.973638] s3c-rtc 10070000.rtc: failed to find rtc source clock
> 
> Fix it by correctly set the max77686_clk_driver_data .num_clks member.
> 
> Fixes: 9b4cac33adc7 ("clk: max77686: Migrate to clk_hw based OF and registration APIs")
> Reported-by: Markus Reichl <m.reichl@fivetechno.de>
> Suggested-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
> ---
>  drivers/clk/clk-max77686.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/clk/clk-max77686.c b/drivers/clk/clk-max77686.c
> index b637f5979023..eb953d3b0b69 100644
> --- a/drivers/clk/clk-max77686.c
> +++ b/drivers/clk/clk-max77686.c
> @@ -216,6 +216,7 @@ static int max77686_clk_probe(struct platform_device *pdev)
>  		return -EINVAL;
>  	}
>  
> +	drv_data->num_clks = num_clks;
>  	drv_data->max_clk_data = devm_kcalloc(dev, num_clks,
>  					      sizeof(*drv_data->max_clk_data),
>  					      GFP_KERNEL);
> 


--
Markus Reichl

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

* Re: Problem: "clk: max77686: Migrate to clk_hw based OF and registration APIs" breaks s3c-rtc on Odroid U3
  2016-10-06 13:59     ` Markus Reichl
@ 2016-10-06 15:02       ` Javier Martinez Canillas
  0 siblings, 0 replies; 5+ messages in thread
From: Javier Martinez Canillas @ 2016-10-06 15:02 UTC (permalink / raw)
  To: Markus Reichl, Tobias Jakobi, linux-samsung-soc, stephen.boyd, krzk
  Cc: ldewangan

Hello Markus,

On 10/06/2016 10:59 AM, Markus Reichl wrote:
> Hi Javier,
> 
> Am 06.10.2016 um 15:44 schrieb Javier Martinez Canillas:
>> Hello,
>>
>> On 10/06/2016 08:28 AM, Tobias Jakobi wrote:
>>> Hello,
>>>
>>> I quickly went over the commit, and I don't see the 'num_clks' fields
>>> being initialized anywhere. So that's probably the reason why it's
>>> always zero and the check in of_clk_max77686_get() fails.
>>>
>>
>> Tobias is correct, that's the issue. I wonder why it worked for me when
>> I tested the patch, probably because the bootloader enables the clocks
>> so I didn't see the difference...
>>
>> Anyways, following is a patch [0] as suggested by Tobias. I don't have
>> access to my platform now to test but if it fixes the issue I can post
>> it as a proper patch.
> 
> Thanks, this fixes the issue on Odroid U3.
>
> Tested-by: Markus Reichl <m.reichl@fivetechno.de>
>

Thanks for testing. I've posted as a proper patch with your Tested-by tag.

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America

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

end of thread, other threads:[~2016-10-06 15:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-06 10:48 Problem: "clk: max77686: Migrate to clk_hw based OF and registration APIs" breaks s3c-rtc on Odroid U3 Markus Reichl
2016-10-06 11:28 ` Tobias Jakobi
2016-10-06 13:44   ` Javier Martinez Canillas
2016-10-06 13:59     ` Markus Reichl
2016-10-06 15:02       ` Javier Martinez Canillas

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.