public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] ARM: dts: am335x-pocketbeagle: choose tick-timer
@ 2023-08-30 15:25 Trevor Woerner
  2023-09-08 16:00 ` Robert Nelson
  2023-09-08 17:36 ` Nishanth Menon
  0 siblings, 2 replies; 5+ messages in thread
From: Trevor Woerner @ 2023-08-30 15:25 UTC (permalink / raw)
  To: U-Boot Mailing List; +Cc: Pierre Lebleu, Andrew Davis

Commit 4b2be78ab66c ("time: Fix get_ticks being non-monotonic")
requires '/chosen/tick-timer' in device-tree. Otherwise we get:

	U-Boot 2023.07.02 (Jul 11 2023 - 15:20:44 +0000)

	CPU  : AM335X-GP rev 2.1
	Model: TI AM335x PocketBeagle
	DRAM:  512 MiB
	Core:  154 devices, 16 uclasses, devicetree: separate
	Could not initialize timer (err -19)

	resetting ...

Suggested-by: Pierre Lebleu <pierre.lebleu@pile-engineering.com>
Signed-off-by: Trevor Woerner <twoerner@gmail.com>
---
 arch/arm/dts/am335x-pocketbeagle.dts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/dts/am335x-pocketbeagle.dts b/arch/arm/dts/am335x-pocketbeagle.dts
index b379e3a5570d..02e3aac56064 100644
--- a/arch/arm/dts/am335x-pocketbeagle.dts
+++ b/arch/arm/dts/am335x-pocketbeagle.dts
@@ -15,6 +15,7 @@
 
 	chosen {
 		stdout-path = &uart0;
+		tick-timer = &timer2;
 	};
 
 	leds {
-- 
2.41.0.327.gaa9166bcc0ba


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

* Re: [PATCH] ARM: dts: am335x-pocketbeagle: choose tick-timer
  2023-08-30 15:25 [PATCH] ARM: dts: am335x-pocketbeagle: choose tick-timer Trevor Woerner
@ 2023-09-08 16:00 ` Robert Nelson
  2023-09-08 17:36 ` Nishanth Menon
  1 sibling, 0 replies; 5+ messages in thread
From: Robert Nelson @ 2023-09-08 16:00 UTC (permalink / raw)
  To: Trevor Woerner; +Cc: U-Boot Mailing List, Pierre Lebleu, Andrew Davis

On Wed, Aug 30, 2023 at 10:26 AM Trevor Woerner <twoerner@gmail.com> wrote:
>
> Commit 4b2be78ab66c ("time: Fix get_ticks being non-monotonic")
> requires '/chosen/tick-timer' in device-tree. Otherwise we get:
>
>         U-Boot 2023.07.02 (Jul 11 2023 - 15:20:44 +0000)
>
>         CPU  : AM335X-GP rev 2.1
>         Model: TI AM335x PocketBeagle
>         DRAM:  512 MiB
>         Core:  154 devices, 16 uclasses, devicetree: separate
>         Could not initialize timer (err -19)
>
>         resetting ...
>
> Suggested-by: Pierre Lebleu <pierre.lebleu@pile-engineering.com>
> Signed-off-by: Trevor Woerner <twoerner@gmail.com>

Tested-by: Robert Nelson <robertcnelson@gmail.com>

> ---
>  arch/arm/dts/am335x-pocketbeagle.dts | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/arch/arm/dts/am335x-pocketbeagle.dts b/arch/arm/dts/am335x-pocketbeagle.dts
> index b379e3a5570d..02e3aac56064 100644
> --- a/arch/arm/dts/am335x-pocketbeagle.dts
> +++ b/arch/arm/dts/am335x-pocketbeagle.dts
> @@ -15,6 +15,7 @@
>
>         chosen {
>                 stdout-path = &uart0;
> +               tick-timer = &timer2;
>         };
>
>         leds {
> --
> 2.41.0.327.gaa9166bcc0ba

Thanks for posting this Trevor, I'm also running with this change..

Regards,

-- 
Robert Nelson
https://rcn-ee.com/

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

* Re: [PATCH] ARM: dts: am335x-pocketbeagle: choose tick-timer
  2023-08-30 15:25 [PATCH] ARM: dts: am335x-pocketbeagle: choose tick-timer Trevor Woerner
  2023-09-08 16:00 ` Robert Nelson
@ 2023-09-08 17:36 ` Nishanth Menon
  2023-09-09 13:27   ` Trevor Woerner
  1 sibling, 1 reply; 5+ messages in thread
From: Nishanth Menon @ 2023-09-08 17:36 UTC (permalink / raw)
  To: Trevor Woerner; +Cc: U-Boot Mailing List, Pierre Lebleu, Andrew Davis

On 11:25-20230830, Trevor Woerner wrote:
> Commit 4b2be78ab66c ("time: Fix get_ticks being non-monotonic")
> requires '/chosen/tick-timer' in device-tree. Otherwise we get:
> 
> 	U-Boot 2023.07.02 (Jul 11 2023 - 15:20:44 +0000)
> 
> 	CPU  : AM335X-GP rev 2.1
> 	Model: TI AM335x PocketBeagle
> 	DRAM:  512 MiB
> 	Core:  154 devices, 16 uclasses, devicetree: separate
> 	Could not initialize timer (err -19)
> 
> 	resetting ...
> 
> Suggested-by: Pierre Lebleu <pierre.lebleu@pile-engineering.com>
> Signed-off-by: Trevor Woerner <twoerner@gmail.com>
> ---
>  arch/arm/dts/am335x-pocketbeagle.dts | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm/dts/am335x-pocketbeagle.dts b/arch/arm/dts/am335x-pocketbeagle.dts
> index b379e3a5570d..02e3aac56064 100644
> --- a/arch/arm/dts/am335x-pocketbeagle.dts
> +++ b/arch/arm/dts/am335x-pocketbeagle.dts
> @@ -15,6 +15,7 @@
>  
>  	chosen {
>  		stdout-path = &uart0;
> +		tick-timer = &timer2;
>  	};
>  
>  	leds {
> -- 
> 2.41.0.327.gaa9166bcc0ba
> 

Does enabling CONFIG_SYS_ARCH_TIMER solve this?


-- 
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D

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

* Re: [PATCH] ARM: dts: am335x-pocketbeagle: choose tick-timer
  2023-09-08 17:36 ` Nishanth Menon
@ 2023-09-09 13:27   ` Trevor Woerner
  2023-09-11 11:06     ` Nishanth Menon
  0 siblings, 1 reply; 5+ messages in thread
From: Trevor Woerner @ 2023-09-09 13:27 UTC (permalink / raw)
  To: Nishanth Menon; +Cc: U-Boot Mailing List, Pierre Lebleu, Andrew Davis

On Fri 2023-09-08 @ 12:36:17 PM, Nishanth Menon wrote:
> On 11:25-20230830, Trevor Woerner wrote:
> > Commit 4b2be78ab66c ("time: Fix get_ticks being non-monotonic")
> > requires '/chosen/tick-timer' in device-tree. Otherwise we get:
> > 
> > 	U-Boot 2023.07.02 (Jul 11 2023 - 15:20:44 +0000)
> > 
> > 	CPU  : AM335X-GP rev 2.1
> > 	Model: TI AM335x PocketBeagle
> > 	DRAM:  512 MiB
> > 	Core:  154 devices, 16 uclasses, devicetree: separate
> > 	Could not initialize timer (err -19)
> > 
> > 	resetting ...
> > 
> > Suggested-by: Pierre Lebleu <pierre.lebleu@pile-engineering.com>
> > Signed-off-by: Trevor Woerner <twoerner@gmail.com>
> > ---
> >  arch/arm/dts/am335x-pocketbeagle.dts | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/arch/arm/dts/am335x-pocketbeagle.dts b/arch/arm/dts/am335x-pocketbeagle.dts
> > index b379e3a5570d..02e3aac56064 100644
> > --- a/arch/arm/dts/am335x-pocketbeagle.dts
> > +++ b/arch/arm/dts/am335x-pocketbeagle.dts
> > @@ -15,6 +15,7 @@
> >  
> >  	chosen {
> >  		stdout-path = &uart0;
> > +		tick-timer = &timer2;
> >  	};
> >  
> >  	leds {
> > -- 
> > 2.41.0.327.gaa9166bcc0ba
> > 
> 
> Does enabling CONFIG_SYS_ARCH_TIMER solve this?

Enabling CONFIG_SYS_ARCH_TIMER causes the following compile error:

	| arm-oe-linux-gnueabi-ld.bfd: arch/arm/cpu/armv7/arch_timer.o: in function `timer_init':
	| /z/build-master/pocketbeagle/build/tmp-glibc/work/pocketbeagle-oe-linux-gnueabi/u-boot/2023.07.02/git/arch/arm/cpu/armv7/arch_timer.c:29: multiple definition of `timer_init'; arch/arm/mach-omap2/timer.o:/z/build-master/pocketbeagle/build/tmp-glibc/work/pocketbeagle-oe-linux-gnueabi/u-boot/2023.07.02/git/arch/arm/mach-omap2/timer.c:44: first defined here
	| arm-oe-linux-gnueabi-ld.bfd: arch/arm/cpu/armv7/arch_timer.o: in function `get_ticks':
	| /z/build-master/pocketbeagle/build/tmp-glibc/work/pocketbeagle-oe-linux-gnueabi/u-boot/2023.07.02/git/arch/arm/cpu/armv7/arch_timer.c:44: multiple definition of `get_ticks'; arch/arm/mach-omap2/timer.o:/z/build-master/pocketbeagle/build/tmp-glibc/work/pocketbeagle-oe-linux-gnueabi/u-boot/2023.07.02/git/arch/arm/mach-omap2/timer.c:97: first defined here
	| arm-oe-linux-gnueabi-ld.bfd: arch/arm/cpu/armv7/arch_timer.o: in function `get_tbclk':
	| /z/build-master/pocketbeagle/build/tmp-glibc/work/pocketbeagle-oe-linux-gnueabi/u-boot/2023.07.02/git/arch/arm/cpu/armv7/arch_timer.c:63: multiple definition of `get_tbclk'; arch/arm/mach-omap2/timer.o:/z/build-master/pocketbeagle/build/tmp-glibc/work/pocketbeagle-oe-linux-gnueabi/u-boot/2023.07.02/git/arch/arm/mach-omap2/timer.c:108: first defined here

Without CONFIG_SYS_ARCH_TIMER, the functions timer_init(), get_ticks(), and
get_tbclk() are defined in arch/arm/mach-omap2/timer.c. When
CONFIG_SYS_ARCH_TIMER is defined, it also pulls in the file
arch/arm/cpu/armv7/arch_timer.c.

There is a config option, CONFIG_TIMER, that controls the inclusion of
arch/arm/mach-omap2/timer.c, but it is unconditional during SPL:

	arch/arm/mach-omap2/Makefile
	...
	 12 ifeq ($(CONFIG_TIMER),)
	 13 obj-y   += timer.o
	 14 else
	 15 ifdef CONFIG_SPL_BUILD
	 16 obj-y   += timer.o
	 17 endif
	 18 endif
	...

So whether CONFIG_TIMER is defined or not, a compile error will result if
CONFIG_SYS_ARCH_TIMER is also defined.

Getting the code to compile with CONFIG_SYS_ARCH_TIMER would require a deeper
reworking of the configuration/Make logic in order to swap out the functions
in arch/arm/mach-omap2/timer.c for the ones in
arch/arm/cpu/armv7/arch_timer.c. The definitions of those functions in both
those locations are quite different, so even after getting the build to work
there's no guarantee the arch functions would work.

Best regards,
	Trevor

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

* Re: [PATCH] ARM: dts: am335x-pocketbeagle: choose tick-timer
  2023-09-09 13:27   ` Trevor Woerner
@ 2023-09-11 11:06     ` Nishanth Menon
  0 siblings, 0 replies; 5+ messages in thread
From: Nishanth Menon @ 2023-09-11 11:06 UTC (permalink / raw)
  To: Trevor Woerner; +Cc: U-Boot Mailing List, Pierre Lebleu, Andrew Davis

On 09:27-20230909, Trevor Woerner wrote:
> On Fri 2023-09-08 @ 12:36:17 PM, Nishanth Menon wrote:
> > On 11:25-20230830, Trevor Woerner wrote:
> > > Commit 4b2be78ab66c ("time: Fix get_ticks being non-monotonic")
> > > requires '/chosen/tick-timer' in device-tree. Otherwise we get:
> > > 
> > > 	U-Boot 2023.07.02 (Jul 11 2023 - 15:20:44 +0000)
> > > 
> > > 	CPU  : AM335X-GP rev 2.1
> > > 	Model: TI AM335x PocketBeagle
> > > 	DRAM:  512 MiB
> > > 	Core:  154 devices, 16 uclasses, devicetree: separate
> > > 	Could not initialize timer (err -19)
> > > 
> > > 	resetting ...
> > > 
> > > Suggested-by: Pierre Lebleu <pierre.lebleu@pile-engineering.com>
> > > Signed-off-by: Trevor Woerner <twoerner@gmail.com>
> > > ---
> > >  arch/arm/dts/am335x-pocketbeagle.dts | 1 +
> > >  1 file changed, 1 insertion(+)
> > > 
> > > diff --git a/arch/arm/dts/am335x-pocketbeagle.dts b/arch/arm/dts/am335x-pocketbeagle.dts
> > > index b379e3a5570d..02e3aac56064 100644
> > > --- a/arch/arm/dts/am335x-pocketbeagle.dts
> > > +++ b/arch/arm/dts/am335x-pocketbeagle.dts
> > > @@ -15,6 +15,7 @@
> > >  
> > >  	chosen {
> > >  		stdout-path = &uart0;
> > > +		tick-timer = &timer2;
> > >  	};
> > >  
> > >  	leds {
> > > -- 
> > > 2.41.0.327.gaa9166bcc0ba
> > > 
> > 
> > Does enabling CONFIG_SYS_ARCH_TIMER solve this?

[...]

> Getting the code to compile with CONFIG_SYS_ARCH_TIMER would require a deeper
> reworking of the configuration/Make logic in order to swap out the functions
> in arch/arm/mach-omap2/timer.c for the ones in
> arch/arm/cpu/armv7/arch_timer.c. The definitions of those functions in both
> those locations are quite different, so even after getting the build to work
> there's no guarantee the arch functions would work.

The difference is using SoC level dmtimer vs cpu level arch timer.
Either way, it will be good to send this upstream kernel.org.

Looking at the trm[1], it looks like arch timer isn't there for
cortex-a8?

[1] https://developer.arm.com/documentation/ddi0344/latest/

-- 
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D

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

end of thread, other threads:[~2023-09-11 11:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-30 15:25 [PATCH] ARM: dts: am335x-pocketbeagle: choose tick-timer Trevor Woerner
2023-09-08 16:00 ` Robert Nelson
2023-09-08 17:36 ` Nishanth Menon
2023-09-09 13:27   ` Trevor Woerner
2023-09-11 11:06     ` Nishanth Menon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox