Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Apr 2006 17:31:44 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 96073 for review
Message-ID:  <200604251731.k3PHViBv049807@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=96073

Change 96073 by imp@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;
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200604251731.k3PHViBv049807>