From owner-freebsd-hackers@FreeBSD.ORG Wed May 11 20:41:58 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E5A4106564A; Wed, 11 May 2011 20:41:58 +0000 (UTC) (envelope-from raj@semihalf.com) Received: from smtp.semihalf.com (smtp.semihalf.com [213.17.239.109]) by mx1.freebsd.org (Postfix) with ESMTP id 1A68E8FC18; Wed, 11 May 2011 20:41:57 +0000 (UTC) Received: from localhost (unknown [213.17.239.109]) by smtp.semihalf.com (Postfix) with ESMTP id 8EC0DC3834; Wed, 11 May 2011 22:26:21 +0200 (CEST) X-Virus-Scanned: by amavisd-new at semihalf.com Received: from smtp.semihalf.com ([213.17.239.109]) by localhost (smtp.semihalf.com [213.17.239.109]) (amavisd-new, port 10024) with ESMTP id pQhEH6hCJBIC; Wed, 11 May 2011 22:26:20 +0200 (CEST) Received: from [10.0.0.112] (nat3-133.ghnet.pl [91.150.222.133]) by smtp.semihalf.com (Postfix) with ESMTPSA id 99358C3832; Wed, 11 May 2011 22:26:20 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Rafal Jaworowski In-Reply-To: <84255DD0-2593-4F24-8536-2C015CE11DC4@gmail.com> Date: Wed, 11 May 2011 22:26:19 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <65747DF5-AAE5-446C-A162-7AE167D992A0@semihalf.com> References: <34CF3ED0-52BC-4D0E-922A-FE26F624E77F@gmail.com> <84255DD0-2593-4F24-8536-2C015CE11DC4@gmail.com> To: Damjan Marion X-Mailer: Apple Mail (2.1084) Cc: freebsd-hackers@freebsd.org, Adrian Chadd Subject: Re: Embedded switch instead of stadard PHY X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 May 2011 20:41:58 -0000 On 2011-05-08, at 11:36, Damjan Marion wrote: >=20 > On May 8, 2011, at 9:58 AM, Adrian Chadd wrote: >=20 >> On 8 May 2011 01:22, Damjan Marion wrote: >>=20 >>> I would like to implement support for embedded switch on WRT350Nv2 = router which is based on 88F5181L SoC (ARM). FreeBSD already have = support for embedded gigabit card (if_mge) but in case if this router = MAC is connected directly to 8-port ethernet chip (88E6131). If I use = MII_PHY_ANY scan founds following PHYs on miibus: >>=20 >> There's been some discussions in the past about how to implement a >> switch PHY API for use by the variety of embedded switch devices out >> there. >>=20 >> There's been a few attempts at it too. >>=20 >> What I think may just be a good first step is to port over the Linux >> driver for it and instead of trying to make it appear as a multi-PHY >> device, just export a programming and status interface via sysctl. >> That at least gets the thing in the tree and functioning. Once we = have >> a few devices in the tree and functioning, we'll be in a better >> position to have a discussion about how to represent it. >>=20 >> There's a couple of dissenting views about how it should be >> implemented. I'd like to see some working code in the tree so some >> discussion can occur, rather than lots of dissent and no discussion. >> :) >>=20 >> (The switch phy is the last remaining bit of the board support for a >> handful of boards too, so I'd really like to see it completed. :) >=20 > Hi Adrian, >=20 > I agree with your approach. At this point my concern is how to change = existing code to support switch PHY. In my case problem is that = mii_attach as it is today cannot be used detect this device as device is = not using standard registers. >=20 > I can see 2 possible options: > 1. Modifying eth driver in the way that if switch phy is detected then = it avoids calling mii_attach. Drawback of this approach is that it will = need applying same code for each pair of MAC-switch PHY >=20 > 2. Modifying mii_attach in the way that it is more flexible in = detecting such devices. This looks challenging to me to do this in = flexible way. >=20 > What do you think? FWIW, there's a couple of items already available for the 88E6xxx switch = support, which you can try to use as a base for further work: * Juli Mallet's driver, which is currently in HEAD (used by Cavium = MIPS): - http://fxr.watson.org/fxr/source/mips/cavium/octe/mv88e61xxphy.c - http://fxr.watson.org/fxr/source/mips/cavium/octe/mv88e61xxphyreg.h * My team's early experimental work: - http://people.freebsd.org/~raj/misc/e6000sw.c - http://people.freebsd.org/~raj/misc/e6000swreg.h Rafal