From owner-svn-src-all@FreeBSD.ORG Wed Feb 19 04:23:02 2014 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 78CB3AA1; Wed, 19 Feb 2014 04:23:02 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 62E2A1517; Wed, 19 Feb 2014 04:23:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s1J4N2eG024300; Wed, 19 Feb 2014 04:23:02 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s1J4N2IL024298; Wed, 19 Feb 2014 04:23:02 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201402190423.s1J4N2IL024298@svn.freebsd.org> From: Adrian Chadd Date: Wed, 19 Feb 2014 04:23:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r262200 - head/sys/dev/etherswitch/arswitch 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.17 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: Wed, 19 Feb 2014 04:23:02 -0000 Author: adrian Date: Wed Feb 19 04:23:01 2014 New Revision: 262200 URL: http://svnweb.freebsd.org/changeset/base/262200 Log: Add in a flag to control whether the low or high data word of a register access is latched in first. The AR8327 apparently requires the low data word be latched in first. Obtained from: Linux OpenWRT Modified: head/sys/dev/etherswitch/arswitch/arswitch_reg.c head/sys/dev/etherswitch/arswitch/arswitchvar.h Modified: head/sys/dev/etherswitch/arswitch/arswitch_reg.c ============================================================================== --- head/sys/dev/etherswitch/arswitch/arswitch_reg.c Wed Feb 19 00:35:27 2014 (r262199) +++ head/sys/dev/etherswitch/arswitch/arswitch_reg.c Wed Feb 19 04:23:01 2014 (r262200) @@ -172,10 +172,21 @@ arswitch_readreg(device_t dev, int addr) int arswitch_writereg(device_t dev, int addr, int value) { + struct arswitch_softc *sc; + int r; + + sc = device_get_softc(dev); /* XXX Check the first write too? */ - arswitch_writereg_msb(dev, addr, value); - return (arswitch_writereg_lsb(dev, addr, value)); + if (sc->mii_lo_first) { + r = arswitch_writereg_lsb(dev, addr, value); + r |= arswitch_writereg_msb(dev, addr, value); + } else { + r = arswitch_writereg_msb(dev, addr, value); + r |= arswitch_writereg_lsb(dev, addr, value); + } + + return r; } int Modified: head/sys/dev/etherswitch/arswitch/arswitchvar.h ============================================================================== --- head/sys/dev/etherswitch/arswitch/arswitchvar.h Wed Feb 19 00:35:27 2014 (r262199) +++ head/sys/dev/etherswitch/arswitch/arswitchvar.h Wed Feb 19 04:23:01 2014 (r262200) @@ -53,6 +53,7 @@ struct arswitch_softc { int is_mii; /* PHY mode is MII (XXX which PHY?) */ int page; int is_internal_switch; + int mii_lo_first; ar8x16_switch_type sc_switchtype; char *ifname[AR8X16_NUM_PHYS]; device_t miibus[AR8X16_NUM_PHYS];