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)
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to