From patchwork Mon Jul 7 21:43:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Machek X-Patchwork-Id: 4498051 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C7B589F1C4 for ; Mon, 7 Jul 2014 21:47:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 050C32024C for ; Mon, 7 Jul 2014 21:47:29 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D1DBF20221 for ; Mon, 7 Jul 2014 21:47:26 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X4Ghh-0005hB-2J; Mon, 07 Jul 2014 21:44:05 +0000 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X4Ghe-0005fZ-2f for linux-arm-kernel@lists.infradead.org; Mon, 07 Jul 2014 21:44:03 +0000 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id D415581B1D; Mon, 7 Jul 2014 23:43:40 +0200 (CEST) Date: Mon, 7 Jul 2014 23:43:40 +0200 From: Pavel Machek To: Dinh Nguyen Subject: Re: socfpga/sockit ethernet problems Message-ID: <20140707214340.GA29061@amd.pavel.ucw.cz> References: <20140507104518.GB18139@amd.pavel.ucw.cz> <20140703093548.GA9937@amd.pavel.ucw.cz> <1404764751.14294.3.camel@linux-builds1> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1404764751.14294.3.camel@linux-builds1> User-Agent: Mutt/1.5.20 (2009-06-14) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140707_144402_315238_B0EE871C X-CRM114-Status: GOOD ( 20.49 ) X-Spam-Score: 0.0 (/) Cc: dzu@denx.de, netdev@vger.kernel.org, gsi@denx.de, peppe.cavallaro@st.com, s.trumtrar@pengutronix.de, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi! > > I made this, but ethernet problems I currently see are not frequent > > enough to allow easy debugging. If link takes long to estabilish for > > you, could you test the patch below? > > +static int ksz9021rn_phy_fixup(struct phy_device *phydev) > > +{ > > + if (IS_BUILTIN(CONFIG_PHYLIB)) { > > + printk("------------- running phy fixup\n"); > > + > > + /* min rx data delay */ > > + phy_write(phydev, MICREL_KSZ9021_EXTREG_CTRL, > > + 0x8000 | MICREL_KSZ9021_RGMII_RX_DATA_PAD_SKEW); > > + phy_write(phydev, MICREL_KSZ9021_EXTREG_DATA_WRITE, 0x0000); > > + > > + phy_write(phydev, MICREL_KSZ9021_EXTREG_CTRL, > > + 0x8000 | MICREL_KSZ9021_RGMII_TX_DATA_PAD_SKEW); > > + phy_write(phydev, MICREL_KSZ9021_EXTREG_DATA_WRITE, 0x0000); > > + > > + /* max rx/tx clock delay, min rx/tx control delay */ > > + phy_write(phydev, MICREL_KSZ9021_EXTREG_CTRL, > > + 0x8000 | MICREL_KSZ9021_RGMII_CLK_CTRL_PAD_SKEW); > > + phy_write(phydev, MICREL_KSZ9021_EXTREG_DATA_WRITE, 0xf0f0); > > + phy_write(phydev, MICREL_KSZ9021_EXTREG_CTRL, > > + MICREL_KSZ9021_RGMII_CLK_CTRL_PAD_SKEW); > > + } > > + > > + return 0; > > +} > > + > > All of this stuff is not needed as it's already taken care of by the > Micrel phy driver. The clock skew values are now represented in the DTS. > Please look at: > > Documentation/devicetree/bindings/net/micrel-ksz90x1.txt Aah, thanks for the pointer. At least socfpga_cyclone5_socrates.dts is in the mainline, but it does not have any skew configuration. That may explain why the board seems to have problems with ethernet... (or not). Are there suitable default values? u-boot uses these defaults: include/configs/socfpga_common.h:#define CONFIG_KSZ9021_CLK_SKEW_VAL 0xf0f0 include/configs/socfpga_common.h:#define CONFIG_KSZ9021_DATA_SKEW_VAL 0x0 ...that should correspond to txc-skew-ps == rxc-skew-ps == 3000, all other skew values == 0? Could someone with socrates board and network problems test if this makes any difference? Signed-off-by: Pavel Machek diff --git a/arch/arm/boot/dts/socfpga_cyclone5_socrates.dts b/arch/arm/boot/dts/socfpga_cyclone5_socrates.dts index a1814b4..eba8eea 100644 --- a/arch/arm/boot/dts/socfpga_cyclone5_socrates.dts +++ b/arch/arm/boot/dts/socfpga_cyclone5_socrates.dts @@ -34,6 +34,16 @@ &gmac1 { status = "okay"; + phy-mode = "rgmii"; + + rxd0-skew-ps = <0>; + rxd1-skew-ps = <0>; + rxd2-skew-ps = <0>; + rxd3-skew-ps = <0>; + txen-skew-ps = <0>; + txc-skew-ps = <3000>; + rxdv-skew-ps = <0>; + rxc-skew-ps = <3000>; }; &i2c0 {