From owner-freebsd-net@FreeBSD.ORG  Fri Mar 13 02:58:34 2015
Return-Path: <owner-freebsd-net@FreeBSD.ORG>
Delivered-To: freebsd-net@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id E7713DD8
 for <freebsd-net@freebsd.org>; Fri, 13 Mar 2015 02:58:33 +0000 (UTC)
Received: from mail-pa0-x232.google.com (mail-pa0-x232.google.com
 [IPv6:2607:f8b0:400e:c03::232])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (Client CN "smtp.gmail.com",
 Issuer "Google Internet Authority G2" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id AF14699C
 for <freebsd-net@freebsd.org>; Fri, 13 Mar 2015 02:58:33 +0000 (UTC)
Received: by padet14 with SMTP id et14so25753196pad.0
 for <freebsd-net@freebsd.org>; Thu, 12 Mar 2015 19:58:33 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=from:date:to:cc:subject:message-id:reply-to:references:mime-version
 :content-type:content-disposition:in-reply-to:user-agent;
 bh=o53b+4EwRIC4Nnp89ad7S9CretRBqgaPURq7j1esFqA=;
 b=YWoUwaUwzNwucoe5dsGsAJ/lpwBOkXv8M9IRbBBYj9gra4uO74yMHmGVloittJyaf+
 XGGyxDCDNdG7D4Xgi+BmdUccp9JeLyS1cXNJ/0UFsTIEqPyG/9hM1h8IXIphMuhaxsAO
 JaFnv5CczZPYzOT16jzndGfYf5kG/S2h6X6NGZD8wIQeU8yBhhY8asxjhbBUC/+0INil
 3xhzG8YN64Pz3eRyfiUTqOrvWwzrCdxlZwX2CYF9cBsbqzV+SdGdMduB/eKVVkbsPCz2
 wu4B30rV13waXsqPGXZAzOWwCXI8wM1RPw82bL4OCejSlByQShx+67t8iXWyPcPe+3oI
 +4Ow==
X-Received: by 10.66.129.198 with SMTP id ny6mr63272155pab.67.1426215513349;
 Thu, 12 Mar 2015 19:58:33 -0700 (PDT)
Received: from pyunyh@gmail.com ([106.247.248.2])
 by mx.google.com with ESMTPSA id oq7sm707418pac.32.2015.03.12.19.58.29
 (version=TLSv1 cipher=RC4-SHA bits=128/128);
 Thu, 12 Mar 2015 19:58:31 -0700 (PDT)
From: Yonghyeon PYUN <pyunyh@gmail.com>
X-Google-Original-From: "Yonghyeon PYUN" <yongari@>
Received: by pyunyh@gmail.com (sSMTP sendmail emulation);
 Fri, 13 Mar 2015 11:58:22 +0900
Date: Fri, 13 Mar 2015 11:58:22 +0900
To: Matt Dooner <dclscratch@gmail.com>
Subject: Re: cpsw/atphy network drivers
Message-ID: <20150313025822.GA4447@michelle.fasterthan.com>
Reply-To: pyunyh@gmail.com
References: <CAJi99x3QuM2rh4OZBJMCSB3+U2Gkaqh6EUiax54PV8cR5ZxaWg@mail.gmail.com>
 <20150309061926.GA975@michelle.fasterthan.com>
 <CAJi99x2a-+QRtfq=9utOWpxG1cUZTgiFhTv7Q10zHCMecUGRyg@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <CAJi99x2a-+QRtfq=9utOWpxG1cUZTgiFhTv7Q10zHCMecUGRyg@mail.gmail.com>
User-Agent: Mutt/1.4.2.3i
Cc: freebsd-net@freebsd.org
X-BeenThere: freebsd-net@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: Networking and TCP/IP with FreeBSD <freebsd-net.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/options/freebsd-net>,
 <mailto:freebsd-net-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-net/>
List-Post: <mailto:freebsd-net@freebsd.org>
List-Help: <mailto:freebsd-net-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-net>,
 <mailto:freebsd-net-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 13 Mar 2015 02:58:34 -0000

On Thu, Mar 12, 2015 at 01:17:12PM +0000, Matt Dooner wrote:
> Hello,
> 
> Thank you for your reply. Confirming the link configuration was a good
> exercise, but I think I've been able to rule it out as the issue.
> 100baseTX <half-duplex> appears to be the configuration request by the
> switch the board was plugged into. I have connected the 335x board
> directly to two other systems (windows and freebsd) and the correct
> configuration is negotiated when either or both are set to auto (If I
> change the configuration on one machine the other updates its
> configuration accordingly). I have also tested setting the link
> manually on both systems. I have also confirmed that my two other
> systems can connect with each other and the switch.
> 
> I've connected the 335x board directly to another FreeBSD 10.1
> (desktop) system. The desktop uses the fxp-miibus-inphy driver combo.
> I ifconfig 192.168.0.1 255.255.255.0 and ifconfig 192.168.0.2
> 255.255.255.0 each system respectively. I also setup default routes
> between them. When I create traffic (ping) on either machine I see the
> following incremented on the 335x:
> 
> dev.cpsw.0.stats.GoodTxFrames: 64
> dev.cpsw.0.stats.BroadcastTxFrames: 64
> dev.cpsw.0.stats.RxTx65to127OctetFrames: 64
> 
> and on the desktop:
> 
> dev.fxp.0.status.tx.good_frames: 3
> 
> All other stats on both the 335x and desktop are zero.

Good to know you've solved the issue.

> 
> I am able to follow similar steps to build a working network between
> the desktop and a windows laptop.
> 
> Do you know if atphy(4) has been previously tested to work on the
> AR8033 or even the AR8031? miidevs only has an entry for AR8021. I've

No I'm not aware of that.

> only found limited information about the PHY being used, but its from
> OpenBSD and the wrong cpu type. These is also a note in the change
> logs about this hardware "Added atphy(4) to armv7, for the Atheros
> AR8031 phys in the AM335x starter kit."
> (http://www.openbsd.org/plus57.html)
> 
> openbsd-current
> sys\arch\armv7\imx\imxenet.c:
>  466:     case BOARD_ID_IMX6_WANDBOARD:        /* AR8031 */
>   467          /* disable SmartEEE */
>   468          imxenet_miibus_writereg(dev, phy, 0x0d, 0x0003);
>   ...
>   472          imxenet_miibus_writereg(dev, phy, 0x0e, reg & ~0x0100);
>   473
>   474:         /* enable 125MHz clk output for AR8031 */
>   475          imxenet_miibus_writereg(dev, phy, 0x0d, 0x0007);
>   476          imxenet_miibus_writereg(dev, phy, 0x0e, 0x8016);
> 
> important configure pin mux and work mode to RGMII mode."
> 
> It seems that some additional driver development will likely be required.
> 

I don't have datasheet for AR8031/AR8033 PHYs so I'm not sure
whether it's doable to apply PHY config magic above to atphy(4).
I'm under the impression that AR8031/AR8035 may have some other
special registers that report resolved speed/duplex and it shall
require a new PHY driver.  Linux seems to have slightly better
comment for those PHYs though.