diff mbox series

[1/4] dt-bindings: timer: Add am6 compatible for ti-timer

Message ID 20220407071006.37031-1-tony@atomide.com
State Not Applicable, archived
Headers show
Series [1/4] dt-bindings: timer: Add am6 compatible for ti-timer | expand

Checks

Context Check Description
robh/checkpatch success
robh/patch-applied success

Commit Message

Tony Lindgren April 7, 2022, 7:10 a.m. UTC
Document the dual-mode timers available on am6.

Cc: devicetree@vger.kernel.org
Cc: Keerthy <j-keerthy@ti.com>
Cc: Krzysztof Kozlowski <krzk+dt@kernel.org>
Cc: Nishanth Menon <nm@ti.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Vignesh Raghavendra <vigneshr@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 Documentation/devicetree/bindings/timer/ti,timer.txt | 1 +
 1 file changed, 1 insertion(+)

Comments

Krzysztof Kozlowski April 7, 2022, 7:56 a.m. UTC | #1
On 07/04/2022 09:10, Tony Lindgren wrote:
> Document the dual-mode timers available on am6.
> 
> Cc: devicetree@vger.kernel.org
> Cc: Keerthy <j-keerthy@ti.com>
> Cc: Krzysztof Kozlowski <krzk+dt@kernel.org>
> Cc: Nishanth Menon <nm@ti.com>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Vignesh Raghavendra <vigneshr@ti.com>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
>  Documentation/devicetree/bindings/timer/ti,timer.txt | 1 +
>  1 file changed, 1 insertion(+)
> 


Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>


Best regards,
Krzysztof
Daniel Lezcano April 7, 2022, 8:04 a.m. UTC | #2
On 07/04/2022 09:10, Tony Lindgren wrote:
> We have pwm-omap-dmtimer tagged with COMPILE_TEST, so we need to use the
> ifdefs around the inline functions. Let's add ARCH_K3 to the list of SoCs
> to allow using timer-ti-dm on these SoCs.
> 
> Cc: Keerthy <j-keerthy@ti.com>
> Cc: Nishanth Menon <nm@ti.com>
> Cc: Vignesh Raghavendra <vigneshr@ti.com>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
>   include/clocksource/timer-ti-dm.h | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/include/clocksource/timer-ti-dm.h b/include/clocksource/timer-ti-dm.h
> --- a/include/clocksource/timer-ti-dm.h
> +++ b/include/clocksource/timer-ti-dm.h
> @@ -251,7 +251,8 @@ int omap_dm_timers_active(void);
>    * The below are inlined to optimize code size for system timers. Other code
>    * should not need these at all.
>    */
> -#if defined(CONFIG_ARCH_OMAP1) || defined(CONFIG_ARCH_OMAP2PLUS)
> +#if defined(CONFIG_ARCH_OMAP1) || defined(CONFIG_ARCH_OMAP2PLUS) || \
> +	defined(CONFIG_ARCH_K3)

Why not replace the above by CONFIG_OMAP_DM_TIMER ?

>   static inline u32 __omap_dm_timer_read(struct omap_dm_timer *timer, u32 reg,
>   						int posted)
>   {
> @@ -390,5 +391,5 @@ static inline void __omap_dm_timer_write_status(struct omap_dm_timer *timer,
>   {
>   	writel_relaxed(value, timer->irq_stat);
>   }
> -#endif /* CONFIG_ARCH_OMAP1 || CONFIG_ARCH_OMAP2PLUS */
> +#endif /* CONFIG_ARCH_OMAP1 || CONFIG_ARCH_OMAP2PLUS || CONFIG_ARCH_K3 */
>   #endif /* __CLOCKSOURCE_DMTIMER_H */
Tony Lindgren April 7, 2022, 8:15 a.m. UTC | #3
* Daniel Lezcano <daniel.lezcano@linaro.org> [220407 08:01]:
> On 07/04/2022 09:10, Tony Lindgren wrote:
> > @@ -251,7 +251,8 @@ int omap_dm_timers_active(void);
> >    * The below are inlined to optimize code size for system timers. Other code
> >    * should not need these at all.
> >    */
> > -#if defined(CONFIG_ARCH_OMAP1) || defined(CONFIG_ARCH_OMAP2PLUS)
> > +#if defined(CONFIG_ARCH_OMAP1) || defined(CONFIG_ARCH_OMAP2PLUS) || \
> > +	defined(CONFIG_ARCH_K3)
> 
> Why not replace the above by CONFIG_OMAP_DM_TIMER ?

Hmm that's a good question for why it was not that way earlier.

This series changes things for tristate "OMAP dual-mode timer driver" if
ARCH_K3 || COMPILE_TEST though. So the inline stubs are still needed for
COMPILE_TEST it seems.

Regards,

Tony
Daniel Lezcano April 7, 2022, 8:26 a.m. UTC | #4
On 07/04/2022 10:15, Tony Lindgren wrote:
> * Daniel Lezcano <daniel.lezcano@linaro.org> [220407 08:01]:
>> On 07/04/2022 09:10, Tony Lindgren wrote:
>>> @@ -251,7 +251,8 @@ int omap_dm_timers_active(void);
>>>     * The below are inlined to optimize code size for system timers. Other code
>>>     * should not need these at all.
>>>     */
>>> -#if defined(CONFIG_ARCH_OMAP1) || defined(CONFIG_ARCH_OMAP2PLUS)
>>> +#if defined(CONFIG_ARCH_OMAP1) || defined(CONFIG_ARCH_OMAP2PLUS) || \
>>> +	defined(CONFIG_ARCH_K3)
>>
>> Why not replace the above by CONFIG_OMAP_DM_TIMER ?
> 
> Hmm that's a good question for why it was not that way earlier.
> 
> This series changes things for tristate "OMAP dual-mode timer driver" if
> ARCH_K3 || COMPILE_TEST though. So the inline stubs are still needed for
> COMPILE_TEST it seems.

But if ARCH_K3 or COMPILE_TEST is set, CONFIG_DM_TIMER is also set, no?
Tony Lindgren April 7, 2022, 8:53 a.m. UTC | #5
* Daniel Lezcano <daniel.lezcano@linaro.org> [220407 08:23]:
> On 07/04/2022 10:15, Tony Lindgren wrote:
> > * Daniel Lezcano <daniel.lezcano@linaro.org> [220407 08:01]:
> > > On 07/04/2022 09:10, Tony Lindgren wrote:
> > > > @@ -251,7 +251,8 @@ int omap_dm_timers_active(void);
> > > >     * The below are inlined to optimize code size for system timers. Other code
> > > >     * should not need these at all.
> > > >     */
> > > > -#if defined(CONFIG_ARCH_OMAP1) || defined(CONFIG_ARCH_OMAP2PLUS)
> > > > +#if defined(CONFIG_ARCH_OMAP1) || defined(CONFIG_ARCH_OMAP2PLUS) || \
> > > > +	defined(CONFIG_ARCH_K3)
> > > 
> > > Why not replace the above by CONFIG_OMAP_DM_TIMER ?
> > 
> > Hmm that's a good question for why it was not that way earlier.
> > 
> > This series changes things for tristate "OMAP dual-mode timer driver" if
> > ARCH_K3 || COMPILE_TEST though. So the inline stubs are still needed for
> > COMPILE_TEST it seems.
> 
> But if ARCH_K3 or COMPILE_TEST is set, CONFIG_DM_TIMER is also set, no?

Right but I suspect that COMPILE_TEST will produce a build error on other
architectures. I need to check that though, maybe that is no longer the
case.

Regards,

Tony
Tony Lindgren April 7, 2022, 10:26 a.m. UTC | #6
* Tony Lindgren <tony@atomide.com> [220407 08:50]:
> * Daniel Lezcano <daniel.lezcano@linaro.org> [220407 08:23]:
> > On 07/04/2022 10:15, Tony Lindgren wrote:
> > > * Daniel Lezcano <daniel.lezcano@linaro.org> [220407 08:01]:
> > > > On 07/04/2022 09:10, Tony Lindgren wrote:
> > > > > @@ -251,7 +251,8 @@ int omap_dm_timers_active(void);
> > > > >     * The below are inlined to optimize code size for system timers. Other code
> > > > >     * should not need these at all.
> > > > >     */
> > > > > -#if defined(CONFIG_ARCH_OMAP1) || defined(CONFIG_ARCH_OMAP2PLUS)
> > > > > +#if defined(CONFIG_ARCH_OMAP1) || defined(CONFIG_ARCH_OMAP2PLUS) || \
> > > > > +	defined(CONFIG_ARCH_K3)
> > > > 
> > > > Why not replace the above by CONFIG_OMAP_DM_TIMER ?
> > > 
> > > Hmm that's a good question for why it was not that way earlier.
> > > 
> > > This series changes things for tristate "OMAP dual-mode timer driver" if
> > > ARCH_K3 || COMPILE_TEST though. So the inline stubs are still needed for
> > > COMPILE_TEST it seems.
> > 
> > But if ARCH_K3 or COMPILE_TEST is set, CONFIG_DM_TIMER is also set, no?
> 
> Right but I suspect that COMPILE_TEST will produce a build error on other
> architectures. I need to check that though, maybe that is no longer the
> case.

We could use IS_ENABLED(CONFIG_OMAP_DM_TIMER), but looks like we can now
just move the __omap_dm_timer_* inline functions to timer-ti-dm.c instead.

I'll do that and repost after some testing.

Regards,

Tony
Daniel Lezcano April 7, 2022, 11:48 a.m. UTC | #7
On 07/04/2022 12:26, Tony Lindgren wrote:
> * Tony Lindgren <tony@atomide.com> [220407 08:50]:
>> * Daniel Lezcano <daniel.lezcano@linaro.org> [220407 08:23]:
>>> On 07/04/2022 10:15, Tony Lindgren wrote:
>>>> * Daniel Lezcano <daniel.lezcano@linaro.org> [220407 08:01]:
>>>>> On 07/04/2022 09:10, Tony Lindgren wrote:
>>>>>> @@ -251,7 +251,8 @@ int omap_dm_timers_active(void);
>>>>>>      * The below are inlined to optimize code size for system timers. Other code
>>>>>>      * should not need these at all.
>>>>>>      */
>>>>>> -#if defined(CONFIG_ARCH_OMAP1) || defined(CONFIG_ARCH_OMAP2PLUS)
>>>>>> +#if defined(CONFIG_ARCH_OMAP1) || defined(CONFIG_ARCH_OMAP2PLUS) || \
>>>>>> +	defined(CONFIG_ARCH_K3)
>>>>>
>>>>> Why not replace the above by CONFIG_OMAP_DM_TIMER ?
>>>>
>>>> Hmm that's a good question for why it was not that way earlier.
>>>>
>>>> This series changes things for tristate "OMAP dual-mode timer driver" if
>>>> ARCH_K3 || COMPILE_TEST though. So the inline stubs are still needed for
>>>> COMPILE_TEST it seems.
>>>
>>> But if ARCH_K3 or COMPILE_TEST is set, CONFIG_DM_TIMER is also set, no?
>>
>> Right but I suspect that COMPILE_TEST will produce a build error on other
>> architectures. I need to check that though, maybe that is no longer the
>> case.
> 
> We could use IS_ENABLED(CONFIG_OMAP_DM_TIMER), but looks like we can now
> just move the __omap_dm_timer_* inline functions to timer-ti-dm.c instead.
> 
> I'll do that and repost after some testing.

Even better :)
Nishanth Menon April 7, 2022, 1:31 p.m. UTC | #8
On 10:10-20220407, Tony Lindgren wrote:
> Document the dual-mode timers available on am6.
> 
> Cc: devicetree@vger.kernel.org
> Cc: Keerthy <j-keerthy@ti.com>
> Cc: Krzysztof Kozlowski <krzk+dt@kernel.org>
> Cc: Nishanth Menon <nm@ti.com>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Vignesh Raghavendra <vigneshr@ti.com>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
>  Documentation/devicetree/bindings/timer/ti,timer.txt | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Documentation/devicetree/bindings/timer/ti,timer.txt b/Documentation/devicetree/bindings/timer/ti,timer.txt
> --- a/Documentation/devicetree/bindings/timer/ti,timer.txt
> +++ b/Documentation/devicetree/bindings/timer/ti,timer.txt
> @@ -14,6 +14,7 @@ Required properties:
>  			ti,omap5430-timer (applicable to OMAP543x devices)
>  			ti,am335x-timer	(applicable to AM335x devices)
>  			ti,am335x-timer-1ms (applicable to AM335x devices)
> +			ti,am6-timer (applicable to AM6 devices)
>  
>  - reg:			Contains timer register address range (base address and
>  			length).
> -- 
> 2.35.1


We need to convert this into yaml prior to the dts updates patches :(
Nishanth Menon April 7, 2022, 1:33 p.m. UTC | #9
On 10:10-20220407, Tony Lindgren wrote:
> Document the dual-mode timers available on am6.
> 
> Cc: devicetree@vger.kernel.org
> Cc: Keerthy <j-keerthy@ti.com>
> Cc: Krzysztof Kozlowski <krzk+dt@kernel.org>
> Cc: Nishanth Menon <nm@ti.com>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Vignesh Raghavendra <vigneshr@ti.com>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
>  Documentation/devicetree/bindings/timer/ti,timer.txt | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Documentation/devicetree/bindings/timer/ti,timer.txt b/Documentation/devicetree/bindings/timer/ti,timer.txt
> --- a/Documentation/devicetree/bindings/timer/ti,timer.txt
> +++ b/Documentation/devicetree/bindings/timer/ti,timer.txt
> @@ -14,6 +14,7 @@ Required properties:
>  			ti,omap5430-timer (applicable to OMAP543x devices)
>  			ti,am335x-timer	(applicable to AM335x devices)
>  			ti,am335x-timer-1ms (applicable to AM335x devices)
> +			ti,am6-timer (applicable to AM6 devices)

Suggestion:

Could we call this ti,am65-timer instead? AM6 is a bit nuanced and spans
a couple of sub SoC architectures.

>  
>  - reg:			Contains timer register address range (base address and
>  			length).
> -- 
> 2.35.1
Tony Lindgren April 8, 2022, 4:28 a.m. UTC | #10
* Nishanth Menon <nm@ti.com> [220407 13:28]:
> On 10:10-20220407, Tony Lindgren wrote:
> > Document the dual-mode timers available on am6.
> > 
> > Cc: devicetree@vger.kernel.org
> > Cc: Keerthy <j-keerthy@ti.com>
> > Cc: Krzysztof Kozlowski <krzk+dt@kernel.org>
> > Cc: Nishanth Menon <nm@ti.com>
> > Cc: Rob Herring <robh+dt@kernel.org>
> > Cc: Vignesh Raghavendra <vigneshr@ti.com>
> > Signed-off-by: Tony Lindgren <tony@atomide.com>
> > ---
> >  Documentation/devicetree/bindings/timer/ti,timer.txt | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/timer/ti,timer.txt b/Documentation/devicetree/bindings/timer/ti,timer.txt
> > --- a/Documentation/devicetree/bindings/timer/ti,timer.txt
> > +++ b/Documentation/devicetree/bindings/timer/ti,timer.txt
> > @@ -14,6 +14,7 @@ Required properties:
> >  			ti,omap5430-timer (applicable to OMAP543x devices)
> >  			ti,am335x-timer	(applicable to AM335x devices)
> >  			ti,am335x-timer-1ms (applicable to AM335x devices)
> > +			ti,am6-timer (applicable to AM6 devices)
> >  
> >  - reg:			Contains timer register address range (base address and
> >  			length).
> > -- 
> > 2.35.1
> 
> 
> We need to convert this into yaml prior to the dts updates patches :(

OK I'll convert to yaml and send the binding patch separately.

Regards,

Tony
Tony Lindgren April 8, 2022, 4:38 a.m. UTC | #11
Hi,

* Nishanth Menon <nm@ti.com> [220407 13:31]:
> On 10:10-20220407, Tony Lindgren wrote:
> > diff --git a/Documentation/devicetree/bindings/timer/ti,timer.txt b/Documentation/devicetree/bindings/timer/ti,timer.txt
> > --- a/Documentation/devicetree/bindings/timer/ti,timer.txt
> > +++ b/Documentation/devicetree/bindings/timer/ti,timer.txt
> > @@ -14,6 +14,7 @@ Required properties:
> >  			ti,omap5430-timer (applicable to OMAP543x devices)
> >  			ti,am335x-timer	(applicable to AM335x devices)
> >  			ti,am335x-timer-1ms (applicable to AM335x devices)
> > +			ti,am6-timer (applicable to AM6 devices)
> 
> Suggestion:
> 
> Could we call this ti,am65-timer instead? AM6 is a bit nuanced and spans
> a couple of sub SoC architectures.

I think the timer hardware is the same across am64, am65 and j7. So we
should pick something to represent the am6 timers as it would allow using
shared dtsi files for the 16 - 30 timers there are.

Using shared timer dtsi files should work as long as the clocks are
defined in include/dt-bindings/clock for each SoC, and assuming we can use
the same compatible property for the timers.

Of course if the timers are really different across am64, am65 and j72
then multiple compatible properties are neeeded.

If the timer hardware is the same, then I guess we should just pick the
earliest version, so how about using ti,am64-timer?

Regards,

Tony
Nishanth Menon April 8, 2022, 7:34 a.m. UTC | #12
On 07:38-20220408, Tony Lindgren wrote:
> Hi,
> 
> * Nishanth Menon <nm@ti.com> [220407 13:31]:
> > On 10:10-20220407, Tony Lindgren wrote:
> > > diff --git a/Documentation/devicetree/bindings/timer/ti,timer.txt b/Documentation/devicetree/bindings/timer/ti,timer.txt
> > > --- a/Documentation/devicetree/bindings/timer/ti,timer.txt
> > > +++ b/Documentation/devicetree/bindings/timer/ti,timer.txt
> > > @@ -14,6 +14,7 @@ Required properties:
> > >  			ti,omap5430-timer (applicable to OMAP543x devices)
> > >  			ti,am335x-timer	(applicable to AM335x devices)
> > >  			ti,am335x-timer-1ms (applicable to AM335x devices)
> > > +			ti,am6-timer (applicable to AM6 devices)
> > 
> > Suggestion:
> > 
> > Could we call this ti,am65-timer instead? AM6 is a bit nuanced and spans
> > a couple of sub SoC architectures.
> 
> I think the timer hardware is the same across am64, am65 and j7. So we
> should pick something to represent the am6 timers as it would allow using
> shared dtsi files for the 16 - 30 timers there are.
> 
> Using shared timer dtsi files should work as long as the clocks are
> defined in include/dt-bindings/clock for each SoC, and assuming we can use
> the same compatible property for the timers.

Compatible should work fine, Though I doubt clock and other indices
(base address etc will scale appropriately), but we could give it a
shot, but we can discuss that in the context of the dts patches.

> 
> Of course if the timers are really different across am64, am65 and j72
> then multiple compatible properties are neeeded.
> 
> If the timer hardware is the same, then I guess we should just pick the
> earliest version, so how about using ti,am64-timer?

yep - the oldest version will be ti,am654-timer ( AM65 was the first
K3 device. Unfortunately, the numbering does'nt follow a chronological
order)
Tony Lindgren April 8, 2022, 7:43 a.m. UTC | #13
* Nishanth Menon <nm@ti.com> [220408 07:31]:
> On 07:38-20220408, Tony Lindgren wrote:
> > Hi,
> > 
> > * Nishanth Menon <nm@ti.com> [220407 13:31]:
> > > On 10:10-20220407, Tony Lindgren wrote:
> > > > diff --git a/Documentation/devicetree/bindings/timer/ti,timer.txt b/Documentation/devicetree/bindings/timer/ti,timer.txt
> > > > --- a/Documentation/devicetree/bindings/timer/ti,timer.txt
> > > > +++ b/Documentation/devicetree/bindings/timer/ti,timer.txt
> > > > @@ -14,6 +14,7 @@ Required properties:
> > > >  			ti,omap5430-timer (applicable to OMAP543x devices)
> > > >  			ti,am335x-timer	(applicable to AM335x devices)
> > > >  			ti,am335x-timer-1ms (applicable to AM335x devices)
> > > > +			ti,am6-timer (applicable to AM6 devices)
> > > 
> > > Suggestion:
> > > 
> > > Could we call this ti,am65-timer instead? AM6 is a bit nuanced and spans
> > > a couple of sub SoC architectures.
> > 
> > I think the timer hardware is the same across am64, am65 and j7. So we
> > should pick something to represent the am6 timers as it would allow using
> > shared dtsi files for the 16 - 30 timers there are.
> > 
> > Using shared timer dtsi files should work as long as the clocks are
> > defined in include/dt-bindings/clock for each SoC, and assuming we can use
> > the same compatible property for the timers.
> 
> Compatible should work fine, Though I doubt clock and other indices
> (base address etc will scale appropriately), but we could give it a
> shot, but we can discuss that in the context of the dts patches.

Yeah that's a separate series for sure and can be done later on after we
have am6 timers working first.

> > Of course if the timers are really different across am64, am65 and j72
> > then multiple compatible properties are neeeded.
> > 
> > If the timer hardware is the same, then I guess we should just pick the
> > earliest version, so how about using ti,am64-timer?
> 
> yep - the oldest version will be ti,am654-timer ( AM65 was the first
> K3 device. Unfortunately, the numbering does'nt follow a chronological
> order)

OK great, I will use ti,am654-timer then.

Regards,

Tony
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/timer/ti,timer.txt b/Documentation/devicetree/bindings/timer/ti,timer.txt
--- a/Documentation/devicetree/bindings/timer/ti,timer.txt
+++ b/Documentation/devicetree/bindings/timer/ti,timer.txt
@@ -14,6 +14,7 @@  Required properties:
 			ti,omap5430-timer (applicable to OMAP543x devices)
 			ti,am335x-timer	(applicable to AM335x devices)
 			ti,am335x-timer-1ms (applicable to AM335x devices)
+			ti,am6-timer (applicable to AM6 devices)
 
 - reg:			Contains timer register address range (base address and
 			length).