From owner-svn-src-all@FreeBSD.ORG Mon Feb 2 17:33:01 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C03D35B0; Mon, 2 Feb 2015 17:33:01 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ACF91796; Mon, 2 Feb 2015 17:33:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t12HX1k5087743; Mon, 2 Feb 2015 17:33:01 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t12HX1uG087742; Mon, 2 Feb 2015 17:33:01 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201502021733.t12HX1uG087742@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Mon, 2 Feb 2015 17:33:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r278104 - head/sys/mips/atheros X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Feb 2015 17:33:01 -0000 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)