From patchwork Mon Jan 9 22:38:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Murali Karicheri X-Patchwork-Id: 90592 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp309299qgi; Mon, 9 Jan 2017 14:39:15 -0800 (PST) X-Received: by 10.98.101.71 with SMTP id z68mr78497467pfb.165.1484001555721; Mon, 09 Jan 2017 14:39:15 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u23si14486201plk.250.2017.01.09.14.39.15; Mon, 09 Jan 2017 14:39:15 -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; dmarc=fail (p=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933584AbdAIWjM (ORCPT + 5 others); Mon, 9 Jan 2017 17:39:12 -0500 Received: from fllnx209.ext.ti.com ([198.47.19.16]:47604 "EHLO fllnx209.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933050AbdAIWjM (ORCPT ); Mon, 9 Jan 2017 17:39:12 -0500 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id v09MchCR000416; Mon, 9 Jan 2017 16:38:43 -0600 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v09Mcbxe011469; Mon, 9 Jan 2017 16:38:37 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.294.0; Mon, 9 Jan 2017 16:38:37 -0600 Received: from [158.218.103.178] (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id v09McbNp004126; Mon, 9 Jan 2017 16:38:37 -0600 To: Andrew Lunn , From: Murali Karicheri Subject: Marvell Phy (1510) issue since v4.7 kernel Organization: Texas Instruments CC: "Kwok, WingMan" Message-ID: <587410EF.5090607@ti.com> Date: Mon, 9 Jan 2017 17:38:39 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Hello Charles-Antoine, Andrew, We have recently upgraded our kernel to v4.9 and started seeing an issue on our Keystone EVMs (K2E/L) that uses Marvel Phy 1510. The issue is that when we do a reboot command from the Linux console or do a SoC reset, the DHCP times out at U-Boot due to Phy auto negotiation failure. This works fine when the board is power cycled. This is traced back to v4.7 where following commits were introduced:- 3758be3dc162b56ea Marvell phy: add functions to suspend and resume both interfaces: fiber and copper links. 78301ebe9b5a2645d Marvell phy: add configuration of autonegociation for fiber link. 2170fef78a400ca3c Marvell phy: add field to get errors from fiber link. 6cfb3bcc064110995 Marvell phy: check link status in case of fiber link Specifically the commit 6cfb3bcc0641109951a124019cd2e0623107d18d which changed the marvell_read_status() behavior Once we add the below HACK, this works fine. commit e5bd8bfe7f544df03772c094331bb27e1a5a5600 Author: Murali Karicheri Date: Fri Jan 6 12:22:13 2017 -0500 TEMP: work around in marvel Phy driver for u-boot dhcp timeout Signed-off-by: Murali Karicheri Also we see comments/logic in the code that contradicts with each other For example in marvell_read_status(), it says "Check the fiber mode first and uses the logic if (phydev->supported & SUPPORTED_FIBRE) Where as in marvell_resume() comment says 'Resume the fiber mode first' and uses the logic if (!(phydev->supported & SUPPORTED_FIBRE)) Both are not symmetrical. Could you please explain? -- Murali Karicheri Linux Kernel, Keystone diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index c2dcf02..e91bdd3 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c @@ -1194,7 +1194,7 @@ static int marvell_read_status(struct phy_device *phydev) int err; /* Check the fiber mode first */ - if (phydev->supported & SUPPORTED_FIBRE) { + if (!(phydev->supported & SUPPORTED_FIBRE)) { err = phy_write(phydev, MII_MARVELL_PHY_PAGE, MII_M1111_FIBER); if (err < 0) goto error;