Sat Sep 20 14:53:37 2008 UTC ()
Fix kernel boot issue on cats.

The delay(9) loop, used before the clock device is probed and a hardware timer
is available, was out by a factor of 625.

This wasn't an issue until revision 1.45 of sys/dev/ic/pckbc.c which switched
to using delay(9) when polling the keyboard controller.

Cats attaches the console (and pckbc) before the clock has been probed, and so
the delay loop code is used causing issue with the keyboard polling.


(chris)
diff -r1.24 -r1.25 src/sys/arch/arm/footbridge/footbridge_clock.c

cvs diff -r1.24 -r1.25 src/sys/arch/arm/footbridge/footbridge_clock.c (expand / switch to context diff)
--- src/sys/arch/arm/footbridge/footbridge_clock.c 2007/12/03 15:33:17 1.24
+++ src/sys/arch/arm/footbridge/footbridge_clock.c 2008/09/20 14:53:37 1.25
@@ -1,4 +1,4 @@
-/*	$NetBSD: footbridge_clock.c,v 1.24 2007/12/03 15:33:17 ad Exp $	*/
+/*	$NetBSD: footbridge_clock.c,v 1.25 2008/09/20 14:53:37 chris Exp $	*/
 
 /*
  * Copyright (c) 1997 Mark Brinicombe.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: footbridge_clock.c,v 1.24 2007/12/03 15:33:17 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: footbridge_clock.c,v 1.25 2008/09/20 14:53:37 chris Exp $");
 
 /* Include header files */
 
@@ -375,7 +375,13 @@
 	 */
 	if (!delay_count_per_usec)
 	{
-		int delaycount = 25000;
+		/*
+		 * the loop below has a core of 6 instructions
+		 * StrongArms top out at 233Mhz, so one instruction takes
+		 * 0.004 us, and 6 take 0.025 us, so we need to loop 40
+		 * times to make one usec
+		 */
+		int delaycount = 40;
 		volatile int i;
 
 		while (n-- > 0) {