From patchwork Fri Mar 11 18:31:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Murali Karicheri X-Patchwork-Id: 63763 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp1194922lbc; Fri, 11 Mar 2016 10:31:07 -0800 (PST) X-Received: by 10.66.229.35 with SMTP id sn3mr17741864pac.77.1457721067715; Fri, 11 Mar 2016 10:31:07 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u64si15336211pfa.100.2016.03.11.10.31.07; Fri, 11 Mar 2016 10:31:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751160AbcCKSbD (ORCPT + 4 others); Fri, 11 Mar 2016 13:31:03 -0500 Received: from arroyo.ext.ti.com ([192.94.94.40]:39816 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750787AbcCKSbB (ORCPT ); Fri, 11 Mar 2016 13:31:01 -0500 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id u2BIUwKR005095; Fri, 11 Mar 2016 12:30:58 -0600 Received: from DLEE70.ent.ti.com (dlemailx.itg.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id u2BIUwGP000400; Fri, 11 Mar 2016 12:30:58 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.224.2; Fri, 11 Mar 2016 12:30:58 -0600 Received: from [158.218.102.231] (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id u2BIUwZK012495; Fri, 11 Mar 2016 12:30:58 -0600 Subject: Re: Micrel Phy - Is there a way to configure the Phy not to do 802.3x flow control? To: Florian Fainelli , , "open list:TI NETCP ETHERNET DRIVER" , "Kwok, WingMan" References: <56D8B83E.7000303@ti.com> <56D8D3D7.6070900@gmail.com> <56E1A55F.3090906@ti.com> <56E1B75F.9070100@gmail.com> <56E1CD4D.20405@ti.com> From: Murali Karicheri Organization: Texas Instruments Message-ID: <56E30EE5.4050904@ti.com> Date: Fri, 11 Mar 2016 13:31:01 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <56E1CD4D.20405@ti.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 03/10/2016 02:38 PM, Murali Karicheri wrote: > On 03/10/2016 01:05 PM, Florian Fainelli wrote: >> On 10/03/16 08:48, Murali Karicheri wrote: >>> On 03/03/2016 07:16 PM, Florian Fainelli wrote: >>>> On 03/03/16 14:18, Murali Karicheri wrote: >>>>> Hi, >>>>> >>>>> We are using Micrel Phy in one of our board and wondering if we can force the >>>>> Phy to disable flow control at start. I have a 1G ethernet switch connected >>>>> to Phy and the phy always enable flow control. I would like to configure the >>>>> phy not to flow control. Is that possible and if yes, what should I do in the >>>>> my Ethernet driver to tell the Phy not to enable flow control? >>>> >>>> The PHY is not doing flow control per-se, your pseudo Ethernet MAC in >>>> the switch is doing, along with the link partner advertising support for >>>> it. You would want to make sure that your PHY device interface (provided >>>> that you are using the PHY library) is not starting with Pause >>>> advertised, but it could be supported. >>> >>> Understood that Phy is just advertise FC. The Micrel phy for 9031 advertise >>> by default FC supported. After negotiation, I see that Phylib provide the >>> link status with parameter pause = 1, asym_pause = 1. How do I tell the Phy not >>> to advertise? >>> >>> I call following sequence in the Ethernet driver. >>> >>> of_phy_connect(x,y,hndlr,a,z); >> >> Here you should be able to change phydev->advertising and >> phydev->supported to mask the ADVERTISED_Pause | ADVERTISED_AsymPause >> bits and have phy_start() restart with that which should disable pause >> and asym_pause as seen by your adjust_link handler. >> > Ok. Good point. I will try this. Thanks for your suggestion. > I had to make following changes to the phy_device.c to allow the phy device report maximum common flow control capability to Ethernet driver through handler. My driver code looks like this. slave->phy = of_phy_connect(gbe_intf->ndev, slave->phy_node, hndlr, 0, phy_mode); if (!slave->phy) { dev_err(priv->dev, "phy not found on slave %d\n", slave->slave_num); return -ENODEV; } dev_dbg(priv->dev, "phy found: id is: 0x%s\n", dev_name(&slave->phy->dev)); slave->phy->supported &= ~(SUPPORTED_Pause | SUPPORTED_Asym_Pause); slave->phy->advertising = slave->phy->supported; phy_start(slave->phy); phy_read_status(slave->phy); And then in the phy_device.c, I did to get flow control off reported in handler for link status update. Murali > Murali >>> phy_start() >>> >>> Now in hndlr() I have pause = 1, asym_pause = 1, in phy_device ptr. How can >>> I tell the phy not to advertise initially? > > -- Murali Karicheri Linux Kernel, Keystone diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index d551df6..55412ad 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -1021,8 +1021,8 @@ int genphy_read_status(struct phy_device *phydev) phydev->duplex = DUPLEX_FULL; if (phydev->duplex == DUPLEX_FULL) { - phydev->pause = lpa & LPA_PAUSE_CAP ? 1 : 0; - phydev->asym_pause = lpa & LPA_PAUSE_ASYM ? 1 : 0; + phydev->pause = adv & lpa & LPA_PAUSE_CAP ? 1 : 0; + phydev->asym_pause = adv & lpa & LPA_PAUSE_ASYM ? 1 : 0; Could you explain, why the common maximum capability is not reported to the driver as per standard?? Or Am I understood it wrong?