Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Oct 2015 22:53:30 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r290210 - head/sys/mips/atheros
Message-ID:  <201510302253.t9UMrULs095834@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Fri Oct 30 22:53:30 2015
New Revision: 290210
URL: https://svnweb.freebsd.org/changeset/base/290210

Log:
  arge: do a read-after-write on all arge register writes, not just MDIO writes.
  
  This flushes out the write to the system before anything continues.
  
  The mips74k guide, chapter 3.3.3 (write gathering) notes that writes
  can be buffered in FIFOs - even uncached ones - so we can't guarantee
  the device has felt its effects.  Now, since we're all lazy driver
  authors and don't pepper read/write barriers everywhere, fake it here.
  
  tested:
  
  * mips74k - QCA9558 SoC (AP135 reference board)

Modified:
  head/sys/mips/atheros/if_argevar.h

Modified: head/sys/mips/atheros/if_argevar.h
==============================================================================
--- head/sys/mips/atheros/if_argevar.h	Fri Oct 30 21:32:29 2015	(r290209)
+++ head/sys/mips/atheros/if_argevar.h	Fri Oct 30 22:53:30 2015	(r290210)
@@ -68,6 +68,7 @@
 #define ARGE_WRITE(sc, reg, val)	do {	\
 		bus_write_4(sc->arge_res, (reg), (val)); \
 		ARGE_BARRIER_WRITE((sc)); \
+		ARGE_READ((sc), (reg)); \
 	} while (0)
 #define ARGE_READ(sc, reg)	 bus_read_4(sc->arge_res, (reg))
 
@@ -87,10 +88,7 @@
  * FIFO(s) before we continue issuing MDIO bus updates.
  */
 #define ARGE_MDIO_WRITE(_sc, _reg, _val) \
-	do { \
-		ARGE_WRITE((_sc), (_reg), (_val)); \
-		ARGE_READ((_sc), (_reg)); \
-	} while (0)
+	ARGE_WRITE((_sc), (_reg), (_val))
 #define ARGE_MDIO_READ(_sc, _reg)	\
 	ARGE_READ((_sc), (_reg))
 #define	ARGE_MDIO_BARRIER_READ(_sc)	ARGE_BARRIER_READ(_sc)



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