Skip to contentSkip to conversation

generic-time: add clocksource based upon scx200's 27 MHz hires timer

PATCH New Jim Cromie 1 participant 1 message May 19, 2006

Subsystems (2)
lore
Share & tools
lore

Jim Cromie

author maintainer
#0 lore raw

PATCH 1/1 generic-time: add clocksource based upon scx200's 27 MHz hires timer

This patch adds a clocksource driver for the Generic Time Subsystem which uses the Hi-Res Timer hardware on Geode SCx200 integrated CPU. against 17-rc3-mm1 + clocksource-mask patch which has since been added to the generic-time patch-set, C2 rev.

It is a rework of previously sent patch:
http://marc.theaimsgroup.com/?l=linux-kernel&m=114588665115350&w=2

Ive been testing it for most of the time since I 1st posted, Ive been unable to replicate the hang-on-boot on a fresh tree. I'm blaming it on a bad build tree, and other developer errors.

New patch is also compile tested on rc4-mm1, and previously tested with allmod, allno + scx200-* builtins and loadable modules. Ive had no response to my call-for-testers message to soekris-tech@, perhaps I'll have more success getting testers once its in -mm.

Mod-Params

- ppm clock tweak

Allows tuning clocksource to match XTAL freq. arg is unclamped, so you could adjust the clock by + 1MHz, sensible if youve got a different XTAL, not great otherwise. I used this to verify that ntpq -pcrv's frequency=<number> changed in relation to the ppm=<complement> I started the test with.

The modparam has some value for rough adjustment of a free-running clocksource, but since XTALs (sample 1) have manufacturing tolerance and temp-stability of +-30ppm and +-50ppm respectively, you cannot expect to correct for temps, but you can normalize error for your crystal.

This mod-param can only be set during initialization, and the module cannot be unloaded, so changing this param requires a reboot; it is not a mechanism to track corrections, ntpd is far better for that.

- mhz27

This flag determines count speed, hence timer rollover rate. At 27mhz, timer rolls every 2.6 min. I almost dumped this option, and hardcoded the timer for 27mhz operation, but that loses some flexibility.

Its not clear to me why the circuit is desiged for a 27 MHz crystal instead of an on-chip derived clock, but I suspect theres some reason for it. TV/video ?

wrt the Todos:
- kconfig entry now immediately after SCx200
- module on built-in (no)
- platform_driver (irrelevant?)

Please consider for -mmNext

Im trying to do the thunderbird shuffle here, perhaps it will work. will resend final version w fixes as attachment if necessary.

thanks

---

Add new GTOD-clocksource driver for the High Resolution Timer on the Geode SC-1100 and family. Driver is dependent on scx200. When scx200_hrt is loaded, GTOD chooses it over the unstable and de-rated TSC, unless idle=poll is given on boot-line (the workaround)

$ diffstat time-clksrc-add-scx200-hrt.patch
arch/i386/Kconfig                |   24 ++++++---
drivers/clocksource/Makefile     |    5 +
drivers/clocksource/scx200_hrt.c |  101 +++++++++++++++++++++++++++++++++++++++
localversion                     |    1 (trimmed from patch)
localversion-clk                 |    1
5 files changed, 122 insertions(+), 10 deletions(-)

---

arch/i386/Kconfig +0 -0
diff -ruNp -X dontdiff -X exclude-diffs clksrc-mask/arch/i386/Kconfig hrt-tune/arch/i386/Kconfig
@@ -1049,13 +1049,23 @@ config SCx200

tristate "NatSemi SCx200 support"
depends on !X86_VOYAGER
help
- This provides basic support for the National Semiconductor SCx200
- processor. Right now this is just a driver for the GPIO pins.
-
- If you don't know what to do here, say N.
-

-	  This support is also available as a module.  If compiled as a
-	  module, it will be called scx200.
+	  This provides basic support for National Semiconductor's
+	  (now AMD's) Geode processors.  The driver probes for the
+	  PCI-IDs of several on-chip devices, so its a good dependency
+	  for other scx200_* drivers.

+
+ If compiled as a module, the driver is named scx200.
+
+config SCx200HR_TIMER
+ tristate "NatSemi SCx200 27MHz High-Resolution Timer Support"
+ depends on SCx200 && GENERIC_TIME
+ default y
+ help

+	  This driver provides a clocksource built upon the on-chip
+	  27MHz high-resolution timer.  Its also a workaround for
+	  NSC Geode SC-1100's buggy TSC, which loses time when the
+	  processor goes idle (as is done by the scheduler).  The
+	  other workaround is idle=poll boot option.

config K8_NB
def_bool y

drivers/clocksource/Makefile +3 -2
diff -ruNp -X dontdiff -X exclude-diffs clksrc-mask/drivers/clocksource/Makefile hrt-tune/drivers/clocksource/Makefile
@@ -1,2 +1,3 @@
-obj-$(CONFIG_X86_CYCLONE_TIMER) += cyclone.o
-obj-$(CONFIG_X86_PM_TIMER) += acpi_pm.o
+obj-$(CONFIG_X86_CYCLONE_TIMER)	+= cyclone.o
+obj-$(CONFIG_X86_PM_TIMER)	+= acpi_pm.o
+obj-$(CONFIG_SCx200HR_TIMER)	+= scx200_hrt.o
drivers/clocksource/scx200_hrt.c +101 -0

101 lines not on this page · raw message