From owner-svn-src-head@freebsd.org Mon Nov 21 19:26:24 2016 Return-Path: Delivered-To: svn-src-head@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 60324C4D7A4; Mon, 21 Nov 2016 19:26:24 +0000 (UTC) (envelope-from mizhka@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 0A88832A; Mon, 21 Nov 2016 19:26:23 +0000 (UTC) (envelope-from mizhka@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uALJQN6A014340; Mon, 21 Nov 2016 19:26:23 GMT (envelope-from mizhka@FreeBSD.org) Received: (from mizhka@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uALJQNQK014339; Mon, 21 Nov 2016 19:26:23 GMT (envelope-from mizhka@FreeBSD.org) Message-Id: <201611211926.uALJQNQK014339@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mizhka set sender to mizhka@FreeBSD.org using -f From: Michael Zhilin Date: Mon, 21 Nov 2016 19:26:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308937 - head/sys/dev/etherswitch/ukswitch X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Nov 2016 19:26:24 -0000 Author: mizhka Date: Mon Nov 21 19:26:22 2016 New Revision: 308937 URL: https://svnweb.freebsd.org/changeset/base/308937 Log: [etherswitch] add ukswitch hint that is phy offset at mdio register This patch allows to specify PHY register offset for ukswitch. For instance, switch MAICREL KS8995XA connected via MDIO to SoC, but PHY register starts at 1. So hint for this case is: hint.ukswitch.0.phyoffset=1 No change/effect if hint is not set. Submitted by: Hiroki Mori Reviewed by: adrian, mizhka Approved by: adrian(mentor) Differential Revision: https://reviews.freebsd.org/D8584 Modified: head/sys/dev/etherswitch/ukswitch/ukswitch.c Modified: head/sys/dev/etherswitch/ukswitch/ukswitch.c ============================================================================== --- head/sys/dev/etherswitch/ukswitch/ukswitch.c Mon Nov 21 19:14:46 2016 (r308936) +++ head/sys/dev/etherswitch/ukswitch/ukswitch.c Mon Nov 21 19:26:22 2016 (r308937) @@ -67,6 +67,7 @@ struct ukswitch_softc { int media; /* cpu port media */ int cpuport; /* which PHY is connected to the CPU */ int phymask; /* PHYs we manage */ + int phyoffset; /* PHYs register offset */ int numports; /* number of ports */ int ifpport[MII_NPHY]; int *portphy; @@ -133,7 +134,7 @@ ukswitch_attach_phys(struct ukswitch_sof M_WAITOK | M_ZERO); err = mii_attach(sc->sc_dev, sc->miibus[port], sc->ifp[port], ukswitch_ifmedia_upd, ukswitch_ifmedia_sts, \ - BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, 0); + BMSR_DEFCAPMASK, phy + sc->phyoffset, MII_OFFSET_ANY, 0); DPRINTF(sc->sc_dev, "%s attached to pseudo interface %s\n", device_get_nameunit(*sc->miibus[port]), sc->ifp[port]->if_xname); @@ -166,6 +167,7 @@ ukswitch_attach(device_t dev) /* XXX Defaults */ sc->numports = 6; sc->phymask = 0x0f; + sc->phyoffset = 0; sc->cpuport = -1; sc->media = 100; @@ -174,6 +176,8 @@ ukswitch_attach(device_t dev) (void) resource_int_value(device_get_name(dev), device_get_unit(dev), "phymask", &sc->phymask); (void) resource_int_value(device_get_name(dev), device_get_unit(dev), + "phyoffset", &sc->phyoffset); + (void) resource_int_value(device_get_name(dev), device_get_unit(dev), "cpuport", &sc->cpuport); (void) resource_int_value(device_get_name(dev), device_get_unit(dev), "media", &sc->media);