PERFORCE change 100529 for review

Warner Losh imp at FreeBSD.org
Mon Jul 3 23:02:18 UTC 2006


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

Change 100529 by imp at imp_lighthouse on 2006/07/03 23:01:39

	Mark flags as volatile
	better interface.  need more info to start than is available in the
	start bus interface command...

Affected files ...

.. //depot/projects/arm/src/sys/arm/at91/at91_twi.c#15 edit

Differences ...

==== //depot/projects/arm/src/sys/arm/at91/at91_twi.c#15 (text+ko) ====

@@ -52,7 +52,7 @@
 	struct resource *irq_res;	/* IRQ resource */
 	struct resource	*mem_res;	/* Memory resource */
 	struct mtx sc_mtx;		/* basically a perimeter lock */
-	int flags;
+	volatile int flags;
 #define RXRDY		4
 #define TXRDY		0x10
 	uint32_t cwgr;
@@ -268,8 +268,6 @@
 
 	sc = device_get_softc(dev);
 	WR4(sc, TWI_MMR, TWI_MMR_DADR(slave));
-	WR4(sc, TWI_CR, TWI_CR_START);
-	sc->sc_started = 1;
 	return (0);
 }
 
@@ -283,7 +281,6 @@
 
 	sc = device_get_softc(dev);
 	WR4(sc, TWI_MMR, TWI_MMR_DADR(slave));
-	WR4(sc, TWI_CR, TWI_CR_START);
 	sc->sc_started = 1;
 	return (0);
 }
@@ -297,8 +294,10 @@
 
 	walker = buf;
 	sc = device_get_softc(dev);
+	AT91_TWI_LOCK(sc);
 	WR4(sc, TWI_MMR, TWI_MMR_MWRITE | RD4(sc, TWI_MMR));
-	AT91_TWI_LOCK(sc);
+	WR4(sc, TWI_CR, TWI_CR_START);
+	sc->sc_started = 1;
 	WR4(sc, TWI_IER, TWI_SR_TXRDY);
 	while (len--) {
 		WR4(sc, TWI_THR, *walker++);
@@ -327,6 +326,8 @@
 	sc = device_get_softc(dev);
 	AT91_TWI_LOCK(sc);
 	WR4(sc, TWI_MMR, ~TWI_MMR_MWRITE & RD4(sc, TWI_MMR));
+	WR4(sc, TWI_CR, TWI_CR_START);
+	sc->sc_started = 1;
 	WR4(sc, TWI_IER, TWI_SR_RXRDY);
 	while (len-- > 0) {
 		err = 0;


More information about the p4-projects mailing list