Spread-spectrum clock adjust support

The ixp4xx can be driven from a 2% down spread-spectrum clock.  Doing so
however will cause your UART timing and system clock timing to be 2% slow.
This patch adds a kernel built-time configuration to adjust those clocks
so that running on boards with a spread-spectrum clock do not show clock drift
or UART issues.

Signed-off-by: Tim Harvey <thar...@gateworks.com>

 target/linux/ixp4xx/config-3.3                                   |    1 
 target/linux/ixp4xx/patches-3.3/700-spread-spectrum-adjust.patch |   45 
++++++++++
 2 files changed, 46 insertions(+)

Index: trunk/target/linux/ixp4xx/patches-3.3/700-spread-spectrum-adjust.patch
===================================================================
--- trunk/target/linux/ixp4xx/patches-3.3/700-spread-spectrum-adjust.patch      
(revision 0)
+++ trunk/target/linux/ixp4xx/patches-3.3/700-spread-spectrum-adjust.patch      
(working copy)
@@ -0,0 +1,45 @@
+--- a/arch/arm/mach-ixp4xx/Kconfig
++++ b/arch/arm/mach-ixp4xx/Kconfig
+@@ -296,6 +296,12 @@ config MACH_MI424WR
+ 
+ comment "IXP4xx Options"
+ 
++config IXP4XX_SPREAD_SPECTRUM_CLK
++      bool "Adjust clocks for 2% Down Spread Spectrum source"
++      help
++        Say 'Y' here if you want your kernel to adjust clocks for a
++        2% down spread-spectrum oscillator used as the CPU clock.
++
+ config IXP4XX_INDIRECT_PCI
+       bool "Use indirect PCI memory access"
+       depends on PCI
+--- a/arch/arm/mach-ixp4xx/include/mach/platform.h
++++ b/arch/arm/mach-ixp4xx/include/mach/platform.h
+@@ -73,7 +73,12 @@ extern unsigned long ixp4xx_exp_bus_size
+  * Clock Speed Definitions.
+  */
+ #define IXP4XX_PERIPHERAL_BUS_CLOCK   (66) /* 66Mhzi APB BUS   */
++#ifdef CONFIG_IXP4XX_SPREAD_SPECTRUM_CLK
++// Adjusted for 2% down spread-spectrum osciallator
++#define IXP4XX_UART_XTAL              14598144
++#else
+ #define IXP4XX_UART_XTAL              14745600
++#endif
+ 
+ /*
+  * This structure provide a means for the board setup code
+--- a/arch/arm/mach-ixp4xx/include/mach/timex.h
++++ b/arch/arm/mach-ixp4xx/include/mach/timex.h
+@@ -10,7 +10,12 @@
+  * 66.66... MHz. We do a convulted calculation of CLOCK_TICK_RATE b/c the
+  * timer register ignores the bottom 2 bits of the LATCH value.
+  */
++#ifdef CONFIG_IXP4XX_SPREAD_SPECTRUM_CLK
++// Adjusted for 2% down spread-spectrum osciallator
++#define IXP4XX_TIMER_FREQ 65999340
++#else
+ #define IXP4XX_TIMER_FREQ 66666000
++#endif
+ #define CLOCK_TICK_RATE \
+       (((IXP4XX_TIMER_FREQ / HZ & ~IXP4XX_OST_RELOAD_MASK) + 1) * HZ)
+ 
Index: trunk/target/linux/ixp4xx/config-3.3
===================================================================
--- trunk/target/linux/ixp4xx/config-3.3        (revision 33620)
+++ trunk/target/linux/ixp4xx/config-3.3        (working copy)
@@ -109,6 +109,7 @@
 # CONFIG_IXP4XX_INDIRECT_PCI is not set
 CONFIG_IXP4XX_NPE=y
 CONFIG_IXP4XX_QMGR=y
+# CONFIG_IXP4XX_SPREAD_SPECTRUM_CLK is not set
 CONFIG_IXP4XX_WATCHDOG=y
 CONFIG_KTIME_SCALAR=y
 CONFIG_LEDS_FSG=y
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to