From patchwork Wed Mar 1 03:01:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Yang X-Patchwork-Id: 62734 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp3396840wrd; Tue, 28 Feb 2023 19:08:24 -0800 (PST) X-Google-Smtp-Source: AK7set9Uxe/eMHhj/pcE9hYA6rqpwBAZZqmxRp0EMtN192H9QZyMUq2zD/fmmxiqXM1YCogig0hE X-Received: by 2002:a17:90b:1a8a:b0:237:35f9:655c with SMTP id ng10-20020a17090b1a8a00b0023735f9655cmr5675562pjb.36.1677640104192; Tue, 28 Feb 2023 19:08:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677640104; cv=none; d=google.com; s=arc-20160816; b=L9mb+1pOB7rKSq0bsBtnRUrkqZtZaBdRNAYiIMViX2XZ3NWo/Z56F/XNKCB8w4ndxv RFFzDFXLl6M5PuLKyfP27TSaLiSEvEHT6mRYw7zFrxpg8oAY/U0SyRF9yx/LlUwVLiQV TdCWZcIZywP6TlhkfMlgA8auhsCXNl3Zjdy/9o8VWGWOKFjg1IFxhuy8KdN3C7/vFvWg QBOFWkar2LdcQ/gJoa0CEKGYrYqXGQPip3bKRb4WKpcknYS/ZIVwbSiHsOij8pkPYnHh ZSwtITg65eUvmSZTs4e8WZV8KwwjQurK0oWnbP8d9pbUzHn6BG5+lmgds4s1XFUWEh4h DF3w== 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=Z4J41k3gj9QNRSkt1Hh+3Uw1IiCKob6yIueKPU0gjfo=; b=L4gRBBn7S//+XE0TogyY5iz3hsrStURWX5OA3d9RUJNQ1D3HH/G6re1GlRvwfj5u5E dsq6RmMN/w92/VxzCaeue3DLJvzBhEpVqnNuJZLvEi9yC/EudJiZk9JHg5w80JHlC8xf w+NAc2qVuqjTNPaQzAA8RaQgcFcdv0IzZlfNFULv3PjXDXuuBQvofajhxg2nJjKQh9av U+//lWJZ4hI4MTMT/uAxbMYr8GP3259GUXiPEyrlFLq4TjO0Gt8nZ1EkdibVYYVqQJ76 PrfJMY8b91fAuda18m/kd7Q134nRxsIh1qv0t8xTkpXZwBbXg3a2qA3AMqNF1+eoVnhM fp2A== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v14-20020a17090a6b0e00b00225c475b3d2si15307207pjj.55.2023.02.28.19.08.10; Tue, 28 Feb 2023 19:08:24 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229684AbjCADCM (ORCPT + 99 others); Tue, 28 Feb 2023 22:02:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229511AbjCADCL (ORCPT ); Tue, 28 Feb 2023 22:02:11 -0500 Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16FD438B5D; Tue, 28 Feb 2023 19:01:51 -0800 (PST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 771E92019A4; Wed, 1 Mar 2023 04:01:49 +0100 (CET) Received: from smtp.na-rdc02.nxp.com (usphx01srsp001v.us-phx01.nxp.com [134.27.49.11]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 01E24201999; Wed, 1 Mar 2023 04:01:49 +0100 (CET) Received: from right.am.freescale.net (right.am.freescale.net [10.81.116.134]) by usphx01srsp001v.us-phx01.nxp.com (Postfix) with ESMTP id A59FD4022E; Tue, 28 Feb 2023 20:01:47 -0700 (MST) From: Li Yang To: Andrew Lunn , Heiner Kallweit , Russell King , "David S . Miller" , Jakub Kicinski , David Bauer Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Li Yang , Viorel Suman , Wei Fang Subject: [PATCH RESEND v2 1/2] net: phy: at803x: fix the wol setting functions Date: Tue, 28 Feb 2023 21:01:25 -0600 Message-Id: <20230301030126.18494-1-leoyang.li@nxp.com> X-Mailer: git-send-email 2.25.1.377.g2d2118b MIME-Version: 1.0 X-Virus-Scanned: ClamAV using ClamSMTP X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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?1759133150141738676?= X-GMAIL-MSGID: =?utf-8?q?1759133150141738676?= In 7beecaf7d507 ("net: phy: at803x: improve the WOL feature"), it seems not correct to use a wol_en bit in a 1588 Control Register which is only available on AR8031/AR8033(share the same phy_id) to determine if WoL is enabled. Change it back to use AT803X_INTR_ENABLE_WOL for determining the WoL status which is applicable on all chips supporting wol. Also update the at803x_set_wol() function to only update the 1588 register on chips having it. After this change, disabling wol at probe from d7cd5e06c9dd ("net: phy: at803x: disable WOL at probe") is no longer needed. So that part is removed. Fixes: 7beecaf7d507b ("net: phy: at803x: improve the WOL feature") Signed-off-by: Li Yang Reviewed-by: Viorel Suman Reviewed-by: Wei Fang --- drivers/net/phy/at803x.c | 40 ++++++++++++++++------------------------ 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index 22f4458274aa..2102279b3964 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -461,21 +461,25 @@ static int at803x_set_wol(struct phy_device *phydev, phy_write_mmd(phydev, MDIO_MMD_PCS, offsets[i], mac[(i * 2) + 1] | (mac[(i * 2)] << 8)); - /* Enable WOL function */ - ret = phy_modify_mmd(phydev, MDIO_MMD_PCS, AT803X_PHY_MMD3_WOL_CTRL, - 0, AT803X_WOL_EN); - if (ret) - return ret; + /* Enable WOL function for 1588 */ + if (phydev->drv->phy_id == ATH8031_PHY_ID) { + ret = phy_modify_mmd(phydev, MDIO_MMD_PCS, AT803X_PHY_MMD3_WOL_CTRL, + 0, AT803X_WOL_EN); + if (ret) + return ret; + } /* Enable WOL interrupt */ ret = phy_modify(phydev, AT803X_INTR_ENABLE, 0, AT803X_INTR_ENABLE_WOL); if (ret) return ret; } else { - /* Disable WoL function */ - ret = phy_modify_mmd(phydev, MDIO_MMD_PCS, AT803X_PHY_MMD3_WOL_CTRL, - AT803X_WOL_EN, 0); - if (ret) - return ret; + /* Disable WoL function for 1588 */ + if (phydev->drv->phy_id == ATH8031_PHY_ID) { + ret = phy_modify_mmd(phydev, MDIO_MMD_PCS, AT803X_PHY_MMD3_WOL_CTRL, + AT803X_WOL_EN, 0); + if (ret) + return ret; + } /* Disable WOL interrupt */ ret = phy_modify(phydev, AT803X_INTR_ENABLE, AT803X_INTR_ENABLE_WOL, 0); if (ret) @@ -510,11 +514,8 @@ static void at803x_get_wol(struct phy_device *phydev, wol->supported = WAKE_MAGIC; wol->wolopts = 0; - value = phy_read_mmd(phydev, MDIO_MMD_PCS, AT803X_PHY_MMD3_WOL_CTRL); - if (value < 0) - return; - - if (value & AT803X_WOL_EN) + value = phy_read(phydev, AT803X_INTR_ENABLE); + if (value & AT803X_INTR_ENABLE_WOL) wol->wolopts |= WAKE_MAGIC; } @@ -866,9 +867,6 @@ static int at803x_probe(struct phy_device *phydev) if (phydev->drv->phy_id == ATH8031_PHY_ID) { int ccr = phy_read(phydev, AT803X_REG_CHIP_CONFIG); int mode_cfg; - struct ethtool_wolinfo wol = { - .wolopts = 0, - }; if (ccr < 0) { ret = ccr; @@ -887,12 +885,6 @@ static int at803x_probe(struct phy_device *phydev) break; } - /* Disable WOL by default */ - ret = at803x_set_wol(phydev, &wol); - if (ret < 0) { - phydev_err(phydev, "failed to disable WOL on probe: %d\n", ret); - goto err; - } } return 0; From patchwork Wed Mar 1 03:01:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Yang X-Patchwork-Id: 62733 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp3395608wrd; Tue, 28 Feb 2023 19:05:02 -0800 (PST) X-Google-Smtp-Source: AK7set/DqeryJV2fayu39D72aOfeWTDA1TgASMaKFb55p4b0bcZJhRx2v59Ks48abXa4JTyrsy4q X-Received: by 2002:a05:6402:27cb:b0:4af:63a7:7482 with SMTP id c11-20020a05640227cb00b004af63a77482mr16722124ede.19.1677639902503; Tue, 28 Feb 2023 19:05:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677639902; cv=none; d=google.com; s=arc-20160816; b=Xxc78KTkFHuCOEPpTUMIgG88EhRoCoF+akXA9CCfVvYI0cH2lBLNjYiH6QlUdYBdN2 CQAoywqlLSCMe8UrfQhJzmgFkm5ScUIoYmCCnqbwh5xcuCmjATlZQFDBmqjbhEEs8Dks M/UZ8iWX3e5D1yRrZmS1VKpCCIDccqYclBZqcu1vUYSmLX1F2Gdu7YKFtN9WGRjEAIsK cuOT6Gy9FrdSF+Lgkn0a9TRJQH0TsN7pB17taqFv+rosWjLkt1rJnJNIiPi5c5vFG/ta RYyp6L8r2sAyzwW59FZyXHKeaVF0TYzXAZcLpHiUY0dt0LGFBK7Nsii4KjrdhK0vf6Uq 3LMg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=4x6B/nY273hPFvF+V5ainzAvZL3rg9+tIt351tBC63c=; b=sUgprDEn/YwujUL/ULClV22JOKqgnE1GQmIXGWtpp5uLPS0ltfd4uNi61RDSTK90JA kxifb4qdGXM4MpD/Scg/HRtdwzEhILN82PvdcXTT2LFDwt8kfRhXPRTvm8yjJq7/Rt/J GEOMV6Ui/FoexDyk+tKLkh738OiOLjmZjUgLsTH04BZ481yOW7tSvLTWUmmSisz+idPl 5IlUqWkwCHa2yvh0q5hTcTcf5nwht8ReYzeRj7WzWb+L/84xvA2pgIldcpsBLtQ2D0cT /uV5TI8dq539O2eErjdEkBg80KoH2yABt9RErSawYVgjpFzhurdAHcg97cVsBe8iQx9k QVtg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i19-20020a056402055300b004acbdb25b3bsi13204744edx.628.2023.02.28.19.04.38; Tue, 28 Feb 2023 19:05:02 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229887AbjCADCW (ORCPT + 99 others); Tue, 28 Feb 2023 22:02:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229864AbjCADCT (ORCPT ); Tue, 28 Feb 2023 22:02:19 -0500 Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B30251CAD8; Tue, 28 Feb 2023 19:01:56 -0800 (PST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 523891A1B45; Wed, 1 Mar 2023 04:01:55 +0100 (CET) Received: from smtp.na-rdc02.nxp.com (usphx01srsp001v.us-phx01.nxp.com [134.27.49.11]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 118561A125C; Wed, 1 Mar 2023 04:01:55 +0100 (CET) Received: from right.am.freescale.net (right.am.freescale.net [10.81.116.134]) by usphx01srsp001v.us-phx01.nxp.com (Postfix) with ESMTP id B1DB74058C; Tue, 28 Feb 2023 20:01:53 -0700 (MST) From: Li Yang To: Andrew Lunn , Heiner Kallweit , Russell King , "David S . Miller" , Jakub Kicinski , David Bauer Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Li Yang Subject: [PATCH RESEND v2 2/2] net: phy: at803x: remove set/get wol callbacks for AR8032 Date: Tue, 28 Feb 2023 21:01:26 -0600 Message-Id: <20230301030126.18494-2-leoyang.li@nxp.com> X-Mailer: git-send-email 2.25.1.377.g2d2118b In-Reply-To: <20230301030126.18494-1-leoyang.li@nxp.com> References: <20230301030126.18494-1-leoyang.li@nxp.com> MIME-Version: 1.0 X-Virus-Scanned: ClamAV using ClamSMTP X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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?1759132938531291476?= X-GMAIL-MSGID: =?utf-8?q?1759132938531291476?= Since the AR8032 part does not support wol, remove related callbacks from it. Fixes: 5800091a2061 ("net: phy: at803x: add support for AR8032 PHY") Signed-off-by: Li Yang Cc: David Bauer --- drivers/net/phy/at803x.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index 2102279b3964..ac47a1d681b2 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -2079,8 +2079,6 @@ static struct phy_driver at803x_driver[] = { .flags = PHY_POLL_CABLE_TEST, .config_init = at803x_config_init, .link_change_notify = at803x_link_change_notify, - .set_wol = at803x_set_wol, - .get_wol = at803x_get_wol, .suspend = at803x_suspend, .resume = at803x_resume, /* PHY_BASIC_FEATURES */