ARM: am335x: Changed timer
Subsystems (2)
PATCH v3 2/2 ARM: am335x: Changed timer
The dmtimer0 is too inaccurate to be used for measurements. We switch to the more accurate dmtimer2.
--- arch/arm/mach-omap/Kconfig | 4 +- arch/arm/mach-omap/Makefile | 2 +- arch/arm/mach-omap/dmtimer.c | 112 +++++++++++++++++++++++ arch/arm/mach-omap/dmtimer0.c | 85 ----------------- arch/arm/mach-omap/include/mach/am33xx-silicon.h | 4 + 5 files changed, 119 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 +112 -0
112 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 +4 -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)
@@ -73,6 +76,7 @@/* CTRL */ #define AM33XX_CTRL_BASE (AM33XX_L4_WKUP_BASE + 0x210000)#define AM33XX_IDCODE_REG (AM33XX_CTRL_BASE + 0x600) +#define AM33XX_CTRL_STATUS (AM33XX_CTRL_BASE + 0x40)/* Watchdog Timer */ #define AM33XX_WDT_BASE 0x44E35000
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.
Ah, OK, after looking at the TRM again, the real reason for the inaccuracy seems to be that the 32KiHz for dmtimer0 is *not* derived from the RTC crystal, but from an internal RC oscillator.
The kernel uses dmtimer1 for the clocksource by switching it to the M_OSC in the PRCM.
The dmtimer2 is used for clockevents and runs from M_OSC by default. While we could set the dmtimer1 source to M_OSC in the clock setup, it seems simpler to just use dmtimer2.
The commit message should explain the reasoning behind the switch.
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
Quoted 8 lines · Jan Lübbe
Quoted 2 lines · Daniel Schultz
The dmtimer0 is too inaccurate to be used for measurements. We switch to the more accurate dmtimer2.
Ah, OK, after looking at the TRM again, the real reason for the inaccuracy seems to be that the 32KiHz for dmtimer0 is *not* derived from the RTC crystal, but from an internal RC oscillator.
Quoted 8 lines
The kernel uses dmtimer1 for the clocksource by switching it to the
M_OSCin the PRCM.The dmtimer2 is used for clockevents and runs from
M_OSCby default. While we could set the dmtimer1 source toM_OSCin the clock setup, it seems simpler to just use dmtimer2.The commit message should explain the reasoning behind the switch.
Changed the commit message while applying to:
The 32KHz from dmtimer0 is derived from a SoC internal RC oscillator which is quite inaccurate. Switch to dmtimer2 which is driven from the high frequency oscillator clock.
Sascha
Signature · 9 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