Re: [PATCH 0/7] add support for clocksource/clockevent DT selection
From: Claudiu.Beznea
Date: Tue Oct 15 2019 - 05:23:51 EST
Hi Daniel,
On 13.10.2019 21:16, Daniel Lezcano wrote:
> Hi Claudiu,
>
> sorry for the delay, I was OoO again.
No problem, thank you for your reply.
>
> On 03/10/2019 12:43, Claudiu.Beznea@xxxxxxxxxxxxx wrote:
>>
>>
>> On 02.10.2019 16:35, Claudiu Beznea wrote:
>>> Hi Daniel,
>>>
>>> Taking into account that Rob doesn't agree with the solution proposed in
>>> this series do you think there is a chance to merge this driver as is?
>>
>> Sorry, I was talking here about the driver at [1].
>>
>> [1] https://lore.kernel.org/lkml/1552580772-8499-1-git-send-email-claudiu.beznea@xxxxxxxxxxxxx/
>
> Damn! 7 months old. I'm truly sorry we do not have progress on this. Let
> fix this once and for all.
>
> In the driver:
>
> ret = of_property_read_u32(node, "clock-frequency", &freq);
>
> It is unclear how is used this property. It should be the frequency
> driving the timer, but can we get from a clk_get_rate() and a fixed divider?
>
The timer could be driven by 2 clock sources, one is called peripheral
clock and is the clock that is also driving the IP itself, and one is
called generic clock (this could drive only the timer itself) and should be
at least 3 times lower than the peripheral clock.
We could choose the clock driving the timer by setting the PIT64B_MR.SGCLK
bit (0 - means the timer itself is driven by peripheral clock, 1 - means
the timer is driven by the generic clock).
The timer clock source could be divided by MR.PRES + 1.
So, I used the clock-frequency DT binding to let user choose the timer's
frequency. Based on the value provided via this DT binding the best clock
source and prescaler is chosen via mchp_pit64b_pres_prepare() function.
As the datasheet for the product that is using this IP is open now, I'm
inserting here a link to it [1].
Thank you,
Claudiu Beznea
[1]
http://ww1.microchip.com/downloads/en/DeviceDoc/SAM9X60-Data-Sheet-DS60001579A.pdf
>