Skip to contentSkip to conversation

ARM: am335x: Changed timer

PATCH In review Daniel Schultz 3 participants 3 messages Jul 17, 2015 – Jul 20, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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
index af35975..87e8d44 100644
@@ -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
index 65072b9..db2856d 100644
@@ -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
index 7c209ec..e17e609 100644
@@ -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
#1 lore raw
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
#2 lore raw
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_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.

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