From owner-freebsd-arch@FreeBSD.ORG Wed Jan 4 17:08:16 2012 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2620D1065710; Wed, 4 Jan 2012 17:08:16 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-vx0-f182.google.com (mail-vx0-f182.google.com [209.85.220.182]) by mx1.freebsd.org (Postfix) with ESMTP id A049C8FC12; Wed, 4 Jan 2012 17:08:15 +0000 (UTC) Received: by vcbfk1 with SMTP id fk1so23006136vcb.13 for ; Wed, 04 Jan 2012 09:08:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=Kkz3pSLe347C0i4MJWVuj/d1WVshWqockYSfD2oVf0M=; b=ZF4GueV3eP75LmHkDOb5gtSIWlFsVcj7OfupvezYKWs7qFBzRLQ2RZ85jpwoiqkklf SWzBv3Ed5yyCVF48HXtfvgB4Ub6ewchkblUb9dPPQlcMC1PWX+qE1a7FZ42UW9F3Oroz ZY1nd3ow1GBIKGDiyNexmvfa8/KJjmAZCaM8Q= MIME-Version: 1.0 Received: by 10.220.213.137 with SMTP id gw9mr33087912vcb.3.1325696894732; Wed, 04 Jan 2012 09:08:14 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.52.36.5 with HTTP; Wed, 4 Jan 2012 09:08:14 -0800 (PST) In-Reply-To: <8D025847-4BE4-4B2C-87D7-97E72CC9D325@lassitu.de> References: <8D025847-4BE4-4B2C-87D7-97E72CC9D325@lassitu.de> Date: Wed, 4 Jan 2012 09:08:14 -0800 X-Google-Sender-Auth: 4a9C4B-gj9zvtawsZYYdO9BmStg Message-ID: From: Adrian Chadd To: Stefan Bethke Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-net@freebsd.org, Marius Strobl , freebsd-arch@freebsd.org Subject: Re: Extending sys/dev/mii X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2012 17:08:16 -0000 I'm including -net here so we can try and pull in further feedback from network-cluey people. On 4 January 2012 08:03, Stefan Bethke wrote: > As discussed recently, ray@, adrian@ and myself are trying to get a frame= work and utility into the tree that allows the use and configuration of eth= ernet switch chips. =A0The switch controllers we've looked at so far share = a number of features, in particular they use 802.3 MII, MDIO and PHYs to im= plement and configure the ports they offer. =A0In addition to being a switc= h, some of them also offer one of the built-in PHYs to the ethernet control= ler as a classical PHY. [snip] > I'd like to extend miibus in such a way that the one-to-one mapping betwe= en MDIO and MII is broken up. =A0For that, I propose to add a new bus drive= r "mdiobus" (with appropriate resource management) that uses methods simila= r to miibus_if.m readreg and writereg to access an ethernet controllers' MD= IO master. =A0miibus then attaches to it as a child, claims one or more PHY= addresses and attaches PHYs to itself (as currently implemented). This sounds like a good idea. I wonder what's stopping us from doing that. = :) > There's one issue that I don't have a proposal for yet: in one platform (= AR7241), we have PHY4 of the SoC talking via MII to arge0's MAC, while it i= s being controlled via the switch controller's MDIO master, and the switch = controller being attached to arge1's MDIO. =A0If we want to attach an miibu= s for PHY4, we'd have to defer attachment of arge0 until arge1 has been pro= bed and can provide the MDIO attachment (and transitively the switch and it= 's mdio). =A0Note that we also have boards without a switch, but the two PH= Ys still being attached to only a single MDIO. =A0One possible way would be= for the MDIO driver to be separate from the ethernet driver, so that the n= ormal newbus dependency resolution can be used to ensure that mdio1 is atta= ched before arge0 is probed. =A0For the time being, I've worked around this= through hackery in if_arge.c. juli@ proposed something quite similar a few weeks ago. Now that I'm a little more clued up on this whole area, I now understand why she suggested it. I'm happy with "hacky" being in if_arge for now (I mean, there already _is_ ..) but this work seems like the right path to take to bring sanity to this whole setup in the longer term. Thanks for tackling this! Adrian