ARM: am335x: Changed timer
Subsystems (2)
PATCH v2 2/2 ARM: am335x: Changed timer
The dmtimer0 is too inaccurate to be used for measurements. We switch to the more accurate dmtimer2.
---
Changes:
v2:
- renamed dmtimer2.c in dmtimer.c
- moved base address defines to global variable
arch/arm/mach-omap/Kconfig | 4 +- arch/arm/mach-omap/Makefile | 2 +- arch/arm/mach-omap/dmtimer.c | 91 ++++++++++++++++++++++++ arch/arm/mach-omap/dmtimer0.c | 85 ---------------------- arch/arm/mach-omap/include/mach/am33xx-silicon.h | 3 + 5 files changed, 97 insertions(+), 88 deletions(-) create mode 100644 arch/arm/mach-omap/dmtimer.c delete mode 100644 arch/arm/mach-omap/dmtimer0.c
arch/arm/mach-omap/Kconfig +2 -2
@@ -43,7 +43,7 @@ config ARCH_AM33XX select CPU_V7 select GENERIC_GPIO select OFTREE - select OMAP_CLOCK_SOURCE_DMTIMER0 + select OMAP_CLOCK_SOURCE_DMTIMER help Say Y here if you are using Texas Instrument's AM33xx based platform
@@ -51,7 +51,7 @@ config ARCH_AM33XX config OMAP_CLOCK_SOURCE_S32K bool -config OMAP_CLOCK_SOURCE_DMTIMER0 +config OMAP_CLOCK_SOURCE_DMTIMER bool config OMAP_GPMC
arch/arm/mach-omap/Makefile +1 -1
@@ -18,7 +18,7 @@ obj-$(CONFIG_ARCH_OMAP) += syslib.o omap_devices.o omap_generic.o omap_fb.o pbl-$(CONFIG_ARCH_OMAP) += syslib.o obj-$(CONFIG_OMAP_CLOCK_SOURCE_S32K) += s32k_clksource.o -obj-$(CONFIG_OMAP_CLOCK_SOURCE_DMTIMER0) += dmtimer0.o +obj-$(CONFIG_OMAP_CLOCK_SOURCE_DMTIMER) += dmtimer.o obj-$(CONFIG_ARCH_OMAP3) += omap3_generic.o auxcr.o pbl-$(CONFIG_ARCH_OMAP3) += omap3_generic.o auxcr.o obj-$(CONFIG_ARCH_OMAP4) += omap4_generic.o omap4_clock.o
arch/arm/mach-omap/dmtimer.c new file +91 -0
91 lines not on this page · raw message
arch/arm/mach-omap/dmtimer0.c deleted +0 -85
85 lines not on this page · raw message
arch/arm/mach-omap/include/mach/am33xx-silicon.h +3 -0
@@ -62,6 +62,9 @@/* DTMTimer0 */ #define AM33XX_DMTIMER0_BASE (AM33XX_L4_WKUP_BASE + 0x205000) +/* DMTIimer2 */ +#define AM33XX_DMTIMER2_BASE (AM33XX_L4_PER_BASE + 0x40000) +#define AM33XX_CM_DPLL (AM33XX_L4_WKUP_BASE + 0x200500)/* PRM */ #define AM33XX_PRM_BASE (AM33XX_L4_WKUP_BASE + 0x200000)
Signature · 7 lines
1.9.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Quoted 2 lines · Daniel Schultz
The dmtimer0 is too inaccurate to be used for measurements. We switch to the more accurate dmtimer2.
What are you trying to measure? Is the resolution or the accuracy too low?
arch/arm/mach-omap/dmtimer.c line 87
Quoted 9 lines
arch/arm/mach-omap/dmtimer.c new file +8
-0+#define CLK_M_OSC 25000000 +static int dmtimer_init (void ) +{ + dmtimer_cs.mult =clocksource_hz2mult (CLK_M_OSC , dmtimer_cs.shift); +/* Enable counter */ +writel (0x3 , base +TCLR ); + +return init_clock (&dmtimer_cs);
You use a fixed M_OSC of 25 MHz, but this value actually depends on the the board. The AM335x supports 19.2, 24 and 26 MHz in addition to 25 MHz.
The advantage of using dmtimer0 is that it is always available and runs at 32KiHz on every board.
Regards,
Jan
Signature · 10 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Am 17.07.2015 um 11:16 schrieb Jan Lübbe:
Quoted 6 lines · Daniel Schultz
Quoted 2 lines
The dmtimer0 is too inaccurate to be used for measurements. We switch to the more accurate dmtimer2.
What are you trying to measure? Is the resolution or the accuracy too low?
While testing with dhrystone on our boards, I figured out that the timestamps from dmtimer0 run 20% too quick.
You can also make a quick test on a am335x board with sleep 10
You will notice that the sleep only takes 8 seconds. This quite too inaccurate.
Quoted 14 lines
arch/arm/mach-omap/dmtimer.c line 87
Quoted 10 lines
arch/arm/mach-omap/dmtimer.c new file +8
-0+#define CLK_M_OSC 25000000 +static int dmtimer_init (void ) +{ + dmtimer_cs.mult =clocksource_hz2mult (CLK_M_OSC , dmtimer_cs.shift); +/* Enable counter */ +writel (0x3 , base +TCLR ); + +return init_clock (&dmtimer_cs);You use a fixed
M_OSCof 25 MHz, but this value actually depends on the the board. The AM335x supports 19.2, 24 and 26 MHz in addition to 25 MHz.
see new patch.
Quoted 6 lines
The advantage of using dmtimer0 is that it is always available and runs at 32KiHz on every board.
Regards,
Jan
Kind regards,
Daniel
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox