Index: Config.in
===================================================================
--- Config.in	(revision 5039)
+++ Config.in	(working copy)
@@ -53,6 +53,14 @@
 	depends on TARGET_I386
 	default y
 
+config USE_TSC
+	bool "CPU has TSC (time stamp counter)"
+	depends on TARGET_I386
+	default y
+	help
+	  Uncheck this if your CPU doesn't have the RDTSC instruction.
+	  This will be the case for some embedded 486 cores like the RDC3210.
+
 endmenu
 
 menu "Standard Libraries"
Index: arch/i386/Makefile.inc
===================================================================
--- arch/i386/Makefile.inc	(revision 5039)
+++ arch/i386/Makefile.inc	(working copy)
@@ -28,8 +28,15 @@
 ##
 
 TARGETS-y += arch/i386/head.S.o arch/i386/main.o arch/i386/sysinfo.o
-TARGETS-y += arch/i386/timer.o arch/i386/coreboot.o arch/i386/util.S.o
+TARGETS-y += arch/i386/coreboot.o arch/i386/util.S.o
 TARGETS-y += arch/i386/exec.S.o arch/i386/virtual.o
 
 # Multiboot support is configurable
 TARGETS-$(CONFIG_MULTIBOOT) += arch/i386/multiboot.o
+
+# TSC support is configurable
+ifeq ($(CONFIG_USE_TSC),y) 
+TARGETS-y += arch/i386/timer.o
+else
+TARGETS-y += arch/i386/timer_notsc.o
+endif
Index: arch/i386/timer_notsc.c
===================================================================
--- arch/i386/timer_notsc.c	(revision 0)
+++ arch/i386/timer_notsc.c	(revision 0)
@@ -0,0 +1,136 @@
+/*
+ * This file is part of the libpayload project.
+ *
+ * Copyright (C) 2008 Advanced Micro Devices, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/**
+ * @file i386/timer_notsc.c
+ * i386 timer routines for CPUs without TSC, e.g. RDC3210
+ */
+
+#include <libpayload.h>
+
+#define TIMER_VAL2 0x40
+#define TIMER_CTRL 0x43
+
+
+/**
+ * Sets the timer to 0xffff (max value)
+ *
+ */
+static void timer_set_max()
+{
+  outb(0x34,TIMER_CTRL);
+  outb(0xff,TIMER_VAL2);   // LSB
+  outb(0xff,TIMER_VAL2);   // MSB
+}
+
+
+/**
+ * Read the timer to check time elapsed
+ *
+ * @return The count remaining
+ */
+static unsigned short timer_read()
+{
+  unsigned short out;
+  // latch timer 2
+  outb(0x04, TIMER_CTRL);
+  // Read LSB
+  out = inb(TIMER_VAL2);
+  out |= (inb(TIMER_VAL2) << 8);
+  return out;
+}
+                    
+
+
+/**
+ * Calculate the speed of the processor for use in delays.
+ *
+ * @return The CPU speed in kHz.
+ */
+unsigned int get_cpu_speed(void)
+{
+	return 150000;
+}
+
+/**
+ * Delay for a specified number of nanoseconds.
+ * Note: Without TSC this is going to be grossly inaccurate
+ * so just count it.
+ *
+ * @param n Number of nanoseconds to delay for.
+ */
+void ndelay(unsigned int n)
+{
+	while (n) n--;
+}
+
+/**
+ * Delay for a specified number of microseconds.
+ * Assume reading from port 80 takes a microsecond
+ * or so.
+ *
+ * @param n Number of microseconds to delay for.
+ */
+void udelay(unsigned int u)
+{
+	while (u)
+	{
+		inb(0x80);
+		u--;
+	}
+}
+
+/**
+ * Delay for a specified number of milliseconds.
+ *
+ * @param m Number of milliseconds to delay for.
+ */
+void mdelay(unsigned int m)
+{
+	while (m)
+	{
+		timer_set_max();
+		while (timer_read() > 0xfbbb);
+		m--;
+	}
+}
+
+/**
+ * Delay for a specified number of seconds.
+ *
+ * @param s Number of seconds to delay for.
+ */
+void delay(unsigned int s)
+{
+	while (s)
+	{
+		mdelay(1000);
+		s--;
+	}
+}
