From owner-freebsd-net@FreeBSD.ORG Mon Jan 2 13:20:48 2012 Return-Path: Delivered-To: freebsd-net@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 31AEA1065677; Mon, 2 Jan 2012 13:20:48 +0000 (UTC) (envelope-from stb@lassitu.de) Received: from gilb.zs64.net (gilb.zs64.net [IPv6:2001:470:1f0b:105e::1ea]) by mx1.freebsd.org (Postfix) with ESMTP id EBD9F8FC1B; Mon, 2 Jan 2012 13:20:47 +0000 (UTC) Received: by gilb.zs64.net (Postfix, from stb@lassitu.de) id 3B939117BE6; Mon, 2 Jan 2012 13:20:46 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1084) From: Stefan Bethke In-Reply-To: <20111210140540.6301dfa9.ray@freebsd.org> Date: Mon, 2 Jan 2012 14:20:45 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <865DC2D7-F7EF-4314-8745-19466D2DA83C@lassitu.de> References: <20111210140540.6301dfa9.ray@freebsd.org> To: Aleksandr Rybalko , FreeBSD Net X-Mailer: Apple Mail (2.1084) Cc: Subject: Re: "float PHYs", communication between indirect attached devices X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jan 2012 13:20:48 -0000 Am 10.12.2011 um 13:05 schrieb Aleksandr Rybalko: > Hi net@ subscribers, >=20 > Simple explanation of problem:=20 > real situation, device with two NICs (arge0 and arge1) > arge0 attached to PHY w/o direct access to it. > arge1 attached to switch MII port (and have access to MDIO bus). >=20 > switch have child MDIO bus for all Physical ports. > One of this ports (or his PHY) must be controlled by arge0. >=20 > I will do pseudo PHY driver that must communicate with real one on > switch MDIO bus. >=20 > Question: how to communicate, since newbus can't handle two parents: > 1) sysctl > 2) events > 3) kenv > 4) something better > globals is not a solution, because it is possible that we will have > some device with more than one "float PHYs" >=20 > please, help me to find best way! >=20 > Wait for your suggestions, comments, hints, etc. I'll trx to explain with a bit more detail what the situation is, and = what variations we're encountering with the various embedded systems = that have a switch connected to one or more ethernet ports of the SoC. Right now Adrian, Aleksadr and I are trying to add configuration support = for the switch controllers in small WLAN routers based on the various = Atheros SoC and a variety of switch controllers. As different as they = might be, they are usually attached in one of these ways: - the ethernet interface is connected via MII, RGMII or GMII to one of = the MACs on the switch (back to back, no PHY). The switch might have = PHYs attached to its other ports, but as far as the SoC ethernet = interfaces are concerned, there's nothing to be configured. - the interface is connected to a PHY via MII, but the PHYs MDIO slave = is not connected to the ethernet interface's MDIO master. Both can exist at the same time; e.g in many wlan routers, arge0 is = connected to a PHY in the switch chip, while arge1 is connected to one = of the switch port MACs. The switch controller can be connected to the SoC via I2C (e.g. RTL83XX = series), or through an MDIO interface (AR8x16, RTL830x). The switch controller has its own MDIO master, controlled through the = switch register set, to communicate with the built-in PHYs. To further confuse things: the PHY that arge0 is connected to can only = be controlled by talking to the switch that is connected to arge1's MDIO = master, in turn talking to the switch's MDIO master to talk to the PHY. This poses a number of challenges: - ethernet switches that are attached via MDIO may not look like PHYs, = in particular, they might not have a BMSR or ID1 and ID2. This is the = case with the Atheros AR8x16 series. The miibus code assumes that all = possible children of an miibus are PHYs, and will not easily accept = non-PHY children. - attach hierarchy and sequence, e.g. for the PHY in the switch chip, = where the switch chip is attached to arge1, but the PHY needs to be at = arge0. - creating miibus'ses that are not associated with an interface. The = miibus code assumes that any PHY is attached to an MII connected to an = ethernet interfaces MAC. The switch ports are not part of the ethernet = interfaces, and their MAC configuration doesn't change when one of the = switch ports negotiate a different media setting. Stefan --=20 Stefan Bethke Fon +49 151 14070811