Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Feb 2015 17:33:01 +0000 (UTC)
From:      Sean Bruno <sbruno@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r278104 - head/sys/mips/atheros
Message-ID:  <201502021733.t12HX1uG087742@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sbruno
Date: Mon Feb  2 17:33:00 2015
New Revision: 278104
URL: https://svnweb.freebsd.org/changeset/base/278104

Log:
  The linux driver code for the MDIO bus does a read-after-write
  which seems to be required on MIPS74k platforms for correct
  behaviour.
  
  Reviewed by:	adrian

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

Modified: head/sys/mips/atheros/if_argevar.h
==============================================================================
--- head/sys/mips/atheros/if_argevar.h	Mon Feb  2 17:32:50 2015	(r278103)
+++ head/sys/mips/atheros/if_argevar.h	Mon Feb  2 17:33:00 2015	(r278104)
@@ -74,8 +74,20 @@
 #define ARGE_CLEAR_BITS(sc, reg, bits)	\
 	ARGE_WRITE(sc, reg, ARGE_READ(sc, (reg)) & ~(bits))
 
-#define ARGE_MDIO_WRITE(_sc, _reg, _val)	\
-	ARGE_WRITE((_sc), (_reg), (_val))
+/*
+ * The linux driver code for the MDIO bus does a read-after-write
+ * which seems to be required on MIPS74k platforms for correct
+ * behaviour.
+ *
+ * So, ARGE_WRITE() does the write + barrier, and the following
+ * ARGE_READ() seems to flush the thing all the way through the device
+ * 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)
 #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?201502021733.t12HX1uG087742>