PERFORCE change 96073 for review

Warner Losh imp at FreeBSD.org
Tue Apr 25 17:31:49 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=96073

Change 96073 by imp at imp_hammer on 2006/04/25 17:31:12

	OK.  It appears we have to wait for at least 23 SLCK ticks before
	we can try to get the status again.  This corresponds to ~70us.  I
	don't see anything on the datasheet that would suggest why this is
	necessary, but weird shit happens when I don't do this :-(.  22
	or 21 also seem to work mostly , but 20 seems to never work.  We
	may need to bump this value up with experience.

Affected files ...

.. //depot/projects/arm/src/sys/boot/arm/at91/libat91/spi_flash.c#7 edit

Differences ...

==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/spi_flash.c#7 (text+ko) ====

@@ -35,15 +35,11 @@
 static void
 Delay(void)
 {
-#if 0
 	unsigned later;
 
-	later = (AT91C_BASE_ST->ST_CRTR + 10) & AT91C_ST_CRTV;
+	later = (AT91C_BASE_ST->ST_CRTR + 23) & AT91C_ST_CRTV;
 	while (later != AT91C_BASE_ST->ST_CRTR)
 		continue;
-#else
-	printf("V--------");
-#endif
 }
 
 /*
@@ -306,8 +302,9 @@
 	value = pSPI->SPI_RDR;
 	value = pSPI->SPI_SR;
 
+	// Increment real time counter every SLCK
+	AT91C_BASE_ST->ST_RTMR = 1;
+
 	if (((initStatus = GetFlashStatus()) & 0xFC) != 0xBC)
 		printf(" Unexpected SPI flash status: 0x%x\r\n", initStatus);
-	// Increment real time counter every SLCK
-	AT91C_BASE_ST->ST_RTMR = 1;
 }


More information about the p4-projects mailing list