From owner-svn-src-all@FreeBSD.ORG Wed Feb 19 06:03:59 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 5F3CDDDC; Wed, 19 Feb 2014 06:03:59 +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 2CE2D1C78; Wed, 19 Feb 2014 06:03:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s1J63xLR064156; Wed, 19 Feb 2014 06:03:59 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s1J63xK3064155; Wed, 19 Feb 2014 06:03:59 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201402190603.s1J63xK3064155@svn.freebsd.org> From: Adrian Chadd Date: Wed, 19 Feb 2014 06:03:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r262206 - 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 06:03:59 -0000 Author: adrian Date: Wed Feb 19 06:03:58 2014 New Revision: 262206 URL: http://svnweb.freebsd.org/changeset/base/262206 Log: Turn the port init function into a HAL method and initialise it to the default port init code. This needs to be overridden for the AR8327. Modified: head/sys/dev/etherswitch/arswitch/arswitch.c Modified: head/sys/dev/etherswitch/arswitch/arswitch.c ============================================================================== --- head/sys/dev/etherswitch/arswitch/arswitch.c Wed Feb 19 06:02:47 2014 (r262205) +++ head/sys/dev/etherswitch/arswitch/arswitch.c Wed Feb 19 06:03:58 2014 (r262206) @@ -224,7 +224,7 @@ arswitch_set_vlan_mode(struct arswitch_s } static void -arswitch_port_init(struct arswitch_softc *sc, int port) +arswitch_port_init_8xxx(struct arswitch_softc *sc, int port) { /* Port0 - CPU */ @@ -266,6 +266,9 @@ arswitch_attach(device_t dev) strlcpy(sc->info.es_name, device_get_desc(dev), sizeof(sc->info.es_name)); + /* Default HAL methods */ + sc->hal.arswitch_port_init = arswitch_port_init_8xxx; + /* * Attach switch related functions */ @@ -320,7 +323,7 @@ arswitch_attach(device_t dev) /* Initialize the switch ports. */ for (port = 0; port <= sc->numphys; port++) { - arswitch_port_init(sc, port); + sc->hal.arswitch_port_init(sc, port); } /* @@ -459,8 +462,15 @@ arswitch_miipollstat(struct arswitch_sof if (sc->miibus[i] == NULL) continue; mii = device_get_softc(sc->miibus[i]); - portstatus = arswitch_readreg(sc->sc_dev, - AR8X16_REG_PORT_STS(arswitch_portforphy(i))); + /* XXX This would be nice to have abstracted out to be per-chip */ + /* AR8327/AR8337 has a different register base */ + if (AR8X16_IS_SWITCH(sc, AR8327)) + portstatus = arswitch_readreg(sc->sc_dev, + AR8327_REG_PORT_STATUS(arswitch_portforphy(i))); + else + portstatus = arswitch_readreg(sc->sc_dev, + AR8X16_REG_PORT_STS(arswitch_portforphy(i))); + #if 0 DPRINTF(sc->sc_dev, "p[%d]=%b\n", i,