From patchwork Mon Mar 27 11:59:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 96063 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp1188986qgd; Mon, 27 Mar 2017 05:02:03 -0700 (PDT) X-Received: by 10.84.217.68 with SMTP id e4mr28116677plj.99.1490616123752; Mon, 27 Mar 2017 05:02:03 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k17si305373pfg.249.2017.03.27.05.02.03; Mon, 27 Mar 2017 05:02:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752495AbdC0MAh (ORCPT + 18 others); Mon, 27 Mar 2017 08:00:37 -0400 Received: from fllnx209.ext.ti.com ([198.47.19.16]:9443 "EHLO fllnx209.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752021AbdC0MAZ (ORCPT ); Mon, 27 Mar 2017 08:00:25 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id v2RBxExS016029; Mon, 27 Mar 2017 06:59:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1490615954; bh=KSHv4qwllmheWKo8ICa2UsH5JTqopxP6sl2fgje0y54=; h=Subject:To:References:CC:From:Date:In-Reply-To; b=QAJQCyj8dqmWKsgxchrlYSNHAhCfTP5E2N+C4MaODbmBKiQH9Bg/A9+PrnWqUcaIv fI7vs4fflp0QX4Q0oR/7ud9hc1v4mbLWgsA715/Ze6UsKxTKKSuTFETlnbm0YyT+Bg VevmEbhgzgdM/l2CSKRhoTTpfzSiM2fl80vdJ4cE= Received: from DLEE70.ent.ti.com (dlemailx.itg.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id v2RBx92g005471; Mon, 27 Mar 2017 06:59:09 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.294.0; Mon, 27 Mar 2017 06:59:08 -0500 Received: from [192.168.2.6] (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id v2RBx5BI020778; Mon, 27 Mar 2017 06:59:05 -0500 Subject: [PATCH v3 1/2] net: phy: Fix PHY AN done state machine for interrupt driven PHYs To: References: <1490180524-28675-1-git-send-email-rogerq@ti.com> <1490180524-28675-2-git-send-email-rogerq@ti.com> CC: , , , , , , "stable # v4 . 9+" , Sergei Shtylyov , From: Roger Quadros Message-ID: <078917ad-77a1-a722-1688-6203ae183a46@ti.com> Date: Mon, 27 Mar 2017 14:59:04 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <1490180524-28675-2-git-send-email-rogerq@ti.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The Ethernet link on an interrupt driven PHY was not coming up if the Ethernet cable was plugged before the Ethernet interface was brought up. The PHY state machine seems to be stuck from RUNNING to AN state with no new interrupts from the PHY. So it doesn't know when the PHY Auto-negotiation has been completed and doesn't transition to RUNNING state with ANEG done thus netif_carrier_on() is never called. NOTE: genphy_config_aneg() will not restart PHY Auto-negotiation of advertisement parameters didn't change. Fix this by scheduling the PHY state machine in phy_start_aneg(). There is no way of knowing in phy.c whether auto-negotiation was restarted or not by the PHY driver so we just wait for the next poll/interrupt to update the PHY state machine. Fixes: 3c293f4e08b5 ("net: phy: Trigger state machine on state change and not polling.") Cc: stable # v4.9+ Signed-off-by: Roger Quadros --- v3: Fix typo in commit message drivers/net/phy/phy.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.7.4 diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 1be69d8..49dedf8 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -630,6 +630,10 @@ int phy_start_aneg(struct phy_device *phydev) out_unlock: mutex_unlock(&phydev->lock); + if (!err && phy_interrupt_is_valid(phydev)) + queue_delayed_work(system_power_efficient_wq, + &phydev->state_queue, HZ); + return err; } EXPORT_SYMBOL(phy_start_aneg);