From owner-svn-src-all@freebsd.org Fri Oct 30 22:53:31 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E6FCDA2183F; Fri, 30 Oct 2015 22:53:31 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 B1D6A1E50; Fri, 30 Oct 2015 22:53:31 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t9UMrU95095835; Fri, 30 Oct 2015 22:53:30 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t9UMrULs095834; Fri, 30 Oct 2015 22:53:30 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510302253.t9UMrULs095834@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 30 Oct 2015 22:53:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r290210 - 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.20 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: Fri, 30 Oct 2015 22:53:32 -0000 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)