From patchwork Mon Oct 24 07:22:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kunihiko Hayashi X-Patchwork-Id: 8183 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp301051wru; Mon, 24 Oct 2022 00:25:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7lJh+JEI9mxojWcgI0XPzeuX7AQt6Za98n/yODCu0dzI881bzlqll7Rg7oMhi7R7GwFiH+ X-Received: by 2002:a17:906:8451:b0:78d:d467:55a4 with SMTP id e17-20020a170906845100b0078dd46755a4mr26070613ejy.352.1666596307663; Mon, 24 Oct 2022 00:25:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666596307; cv=none; d=google.com; s=arc-20160816; b=kciu6ZnCYoanLn4Lt3SnxiMSp6EzhQ8o87HOIcc3PvtIfltST2q4Irq5hsiQKFmQlx 1AyzYCFTV19r7KjrlLMugRKFqnwl69LdaDMT6BZHHts0YHckSP5g5P1TchE3/JlefpHJ quZk3ubQoEpTAQq0zFNbZoFFqwsH9Ps1tpxQp9oEPIuHNu9oOrep1Qy5lWSP0AOHqOIM JcbWMnaEqZHL+q9UY3BdrzFPTtCdOOJYynd+5qbjjC6WZ+JIoEzOn8JsvQLwWQRhAuNa 9GMUisyjWKB3XO0paUVD0xFPYFEki1F739Ww6g8Ag1BHx60O4uH2PFzd0tbGoflyqI6j J/VA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=4WDmMRRLlp1jmmjeRkD7U9z33xMSGkLn2RbOZQXyhzQ=; b=SF5IcIj2kR75yKpsA1mb1695CmvHXpEsc9QqP3evV5+hFTAIgKnamXhGpW098EqZdM R/QO/pbJ2l5tGCPhv/z0RXfnY8vptlgsRgKZYHdK3PBWl2rdAA0iIBB322dJPZmMSX+J 0gA/0FG4rrII8OHek4x2O7Bk6USq9i/TJgrLdKntpVmFszBWaHkx3eF9SSnSWkcdytxK MyszHRBSfxF5HbPTVWad/yT8X+JUF8pMy9D0gSr1OnRfdedFnV/zaKGUsxp8px3WicSv WWqMRWFbGv0zBK4gLOvpubBTn7sHjMdEnVaTm+sru5R6ullrS95s3O2GeGDAg0WV8uVd 24WQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h16-20020a05640250d000b0045a1e2373dbsi30944139edb.44.2022.10.24.00.24.43; Mon, 24 Oct 2022 00:25:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230093AbiJXHWu (ORCPT + 99 others); Mon, 24 Oct 2022 03:22:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230046AbiJXHWr (ORCPT ); Mon, 24 Oct 2022 03:22:47 -0400 Received: from mx.socionext.com (mx.socionext.com [202.248.49.38]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8AD9A5D13A; Mon, 24 Oct 2022 00:22:43 -0700 (PDT) Received: from unknown (HELO iyokan2-ex.css.socionext.com) ([172.31.9.54]) by mx.socionext.com with ESMTP; 24 Oct 2022 16:22:41 +0900 Received: from mail.mfilter.local (m-filter-2 [10.213.24.62]) by iyokan2-ex.css.socionext.com (Postfix) with ESMTP id 7078F20584CE; Mon, 24 Oct 2022 16:22:41 +0900 (JST) Received: from 172.31.9.51 (172.31.9.51) by m-FILTER with ESMTP; Mon, 24 Oct 2022 16:22:41 +0900 Received: from plum.e01.socionext.com (unknown [10.212.243.119]) by kinkan2.css.socionext.com (Postfix) with ESMTP id C1CA7B62A4; Mon, 24 Oct 2022 16:22:40 +0900 (JST) From: Kunihiko Hayashi To: Heiner Kallweit , "David S . Miller " , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Russell King Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Kunihiko Hayashi Subject: [PATCH net] net: ethernet: ave: Fix MAC to be in charge of PHY PM Date: Mon, 24 Oct 2022 16:22:27 +0900 Message-Id: <20221024072227.24769-1-hayashi.kunihiko@socionext.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747552889793554246?= X-GMAIL-MSGID: =?utf-8?q?1747552889793554246?= The phylib callback is called after MAC driver's own resume callback is called. For AVE driver, after resuming immediately, PHY state machine is in PHY_NOLINK because there is a time lag from link-down to link-up due to autoneg. The result is WARN_ON() dump in mdio_bus_phy_resume(). Since ave_resume() itself calls phy_resume(), AVE driver should manage PHY PM. To indicate that MAC driver manages PHY PM, set phydev->mac_managed_pm to true to avoid the unnecessary phylib call and add missing phy_init_hw() to ave_resume(). Suggested-by: Heiner Kallweit Fixes: fba863b81604 ("net: phy: make PHY PM ops a no-op if MAC driver manages PHY PM") Signed-off-by: Kunihiko Hayashi --- drivers/net/ethernet/socionext/sni_ave.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/ethernet/socionext/sni_ave.c b/drivers/net/ethernet/socionext/sni_ave.c index 1fa09b49ba7f..d2c6a5dfdc0e 100644 --- a/drivers/net/ethernet/socionext/sni_ave.c +++ b/drivers/net/ethernet/socionext/sni_ave.c @@ -1229,6 +1229,8 @@ static int ave_init(struct net_device *ndev) phy_support_asym_pause(phydev); + phydev->mac_managed_pm = true; + phy_attached_info(phydev); return 0; @@ -1756,6 +1758,10 @@ static int ave_resume(struct device *dev) ave_global_reset(ndev); + ret = phy_init_hw(ndev->phydev); + if (ret) + return ret; + ave_ethtool_get_wol(ndev, &wol); wol.wolopts = priv->wolopts; __ave_ethtool_set_wol(ndev, &wol);