From patchwork Wed Aug 2 19:13:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Yang X-Patchwork-Id: 130131 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp712387vqx; Wed, 2 Aug 2023 13:37:16 -0700 (PDT) X-Google-Smtp-Source: APBJJlFP3bD6diGWZ6j0U63nA/1i++gYW0MqcRpIWLTdN7VOlAHTOFATTiIh9C30xVAnGm4rGkwa X-Received: by 2002:a17:902:d4c3:b0:1b8:a936:1915 with SMTP id o3-20020a170902d4c300b001b8a9361915mr19205803plg.22.1691008636115; Wed, 02 Aug 2023 13:37:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691008636; cv=none; d=google.com; s=arc-20160816; b=s7/38VyDayTTetWmWdiJ3ulJr09t/Vs1h9BnGB5fhdv6RwcEK7JDzOTSUMD5UeAFTr F3eTpJqALeBEt0rTjBUEblPzSPLIBIPZXHqh2GNL+cV8Q9xVJYYQQoqZ96hezH+g6TYt iD8JTF9HgbxluZALGVGsxB9CipKFkuAcQco3u2SOdguceXqGYtLqyrTv6SN7ACSfh7t3 H3YR/wtY/KXbpaTrPuYMHwbhiAjII+wzy4oHvcZ2cLj+PfgHmCQNC1txHLvLvuzDrcGW nNO1PlKDyd5L8/BvHuxlER+MJVHqMmthiQDkt9p7CH6IA9eln2VzipQszUu0bTFDZYTb Hg1Q== 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=BYDM9A4urlwCIXRNO69rK1sCK2m7UAOklU4uR4i8MJc=; fh=6wQ8A3cuGJr8eY6k+/6q/5O1FDi6YEtB8qDQlwYXszE=; b=xupCvzPLePpU/0H2A55ZKcYsBRfVgv5sJQfvshSraT/bYhpP6ZjX+IDw9FhhAWouxW ToAPeexQ1Z/ILsRJ6LfSeoSgLvHWxiXhY9AEbuxhwe8Z2bM/iHQ441//wKQ879+nEfzY 06mrQR6K4l2wUNHlsVEzOKOpW1XefZE6ZG+Xhnm/0oDyKHzdpeOy/+FfvsvvqzRBtrLv Y0IBXLkWw4p7qFoDhW/7LxYLKZ2cEag4H0xmgPmD6M1lr4apleBw+BAy+8jakVqolh9d wQKGbeMhmoNhlxHbpo/VQ0EjaKCXYq5tuKVjehkE+rijQtttZcDnfRaPiUfZVl9TjrU5 eqAg== 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 kv13-20020a17090328cd00b001b9eb5d1ea2si3483539plb.198.2023.08.02.13.37.01; Wed, 02 Aug 2023 13:37:16 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232495AbjHBTOC (ORCPT + 99 others); Wed, 2 Aug 2023 15:14:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230494AbjHBTNz (ORCPT ); Wed, 2 Aug 2023 15:13:55 -0400 Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AECB426A6; Wed, 2 Aug 2023 12:13:53 -0700 (PDT) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 670111A105F; Wed, 2 Aug 2023 21:13:52 +0200 (CEST) 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 F17BE1A105C; Wed, 2 Aug 2023 21:13:51 +0200 (CEST) Received: from right.am.freescale.net (right.am.freescale.net [10.81.116.134]) by usphx01srsp001v.us-phx01.nxp.com (Postfix) with ESMTP id B8DCA4058C; Wed, 2 Aug 2023 12:13:50 -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 v4 1/2] net: phy: at803x: fix the wol setting functions Date: Wed, 2 Aug 2023 14:13:46 -0500 Message-Id: <20230802191347.6886-2-leoyang.li@nxp.com> X-Mailer: git-send-email 2.25.1.377.g2d2118b In-Reply-To: <20230802191347.6886-1-leoyang.li@nxp.com> References: <20230802191347.6886-1-leoyang.li@nxp.com> MIME-Version: 1.0 X-Virus-Scanned: ClamAV using ClamSMTP X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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: INBOX X-GMAIL-THRID: 1773151071546806574 X-GMAIL-MSGID: 1773151071546806574 In commit 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 commit d7cd5e06c9dd ("net: phy: at803x: disable WOL at probe") is no longer needed. Change it to just disable the WoL bit in 1588 register for AR8031/AR8033 to be aligned with AT803X_INTR_ENABLE_WOL in probe. Fixes: 7beecaf7d507 ("net: phy: at803x: improve the WOL feature") Signed-off-by: Li Yang Reviewed-by: Viorel Suman Reviewed-by: Wei Fang Reviewed-by: Russell King (Oracle) --- drivers/net/phy/at803x.c | 45 ++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index c1f307d90518..9c2c2e2ee94b 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -459,21 +459,27 @@ 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) @@ -508,11 +514,11 @@ 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); + value = phy_read(phydev, AT803X_INTR_ENABLE); if (value < 0) return; - if (value & AT803X_WOL_EN) + if (value & AT803X_INTR_ENABLE_WOL) wol->wolopts |= WAKE_MAGIC; } @@ -858,9 +864,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) return ccr; @@ -877,12 +880,14 @@ 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); + /* Disable WoL in 1588 register which is enabled + * by default + */ + ret = phy_modify_mmd(phydev, MDIO_MMD_PCS, + AT803X_PHY_MMD3_WOL_CTRL, + AT803X_WOL_EN, 0); + if (ret) return ret; - } } return 0; From patchwork Wed Aug 2 19:13:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Yang X-Patchwork-Id: 130115 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp685232vqx; Wed, 2 Aug 2023 12:41:19 -0700 (PDT) X-Google-Smtp-Source: APBJJlFt0N0smWem7tAiJKVflwO10h2A9N9rDopbCTLeF6q9aKNhxBhdInwBPtMEsmG+Na6Kn9Aj X-Received: by 2002:a17:903:120a:b0:1bb:9bc8:d230 with SMTP id l10-20020a170903120a00b001bb9bc8d230mr18222883plh.23.1691005278486; Wed, 02 Aug 2023 12:41:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691005278; cv=none; d=google.com; s=arc-20160816; b=FdLZC0rNLZnzHl3CD8IwbofEmzPx30k0yKUAsKubrtViio8ePOvsatIZmZqyZSFUKS Ua5Y8b0UQ/cUY7V9LiLP8QLxqzaTwZ6/7k/hWpiJCyNENzV2wEiphF5hLU66l0qDaccw UKcaSbdRUsKwCeECTrVC186GB93R9KB6Z/1NT2iO9V4kaIfUuSeVFtnRhNKm03yhtHKr /lQr0Qsx9ZwTgS4S1cMD/Izm6pgIxxnVqGNA+4sSHOXhzoJUA7AeWi6vGscOacNKsfcU pVWP+cNdD5ONUNYKrBGyXSmkqJxQP89C9l7mNFlYrAQIaj5cCZhjVYDXdsPh+uU4LGOs X9GQ== 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=R6WAtEYzuvINLfYQnCauAnErR12Eh9Etc69VQOWBLDs=; fh=NZATeoRc2Ji2IGzBzvRT3RGgKso7U7iQnY4+E4XtHEM=; b=vTdHM3B/ic4U0PxKkX5YuMdN8GdXcNjd2C8UP0nxtnVXEEY1MPlAAl/dL39qGlq29j gULyUPwskgwWMGTzRtX9UrrpWrx01kzxfBiG+VZPLRuBj4CIsKRq/JLv30yk4cLKqE0t XSvnvD4zEo4a5HTnZpT1ft0XE+ROudTv0J6Nm0kXyU8ksU1S3UEa/UjX0yJqhwKhH8Pw eBbaPxioQQ8yhxFAupbOAhgCBfe0MGKLEOreCShsprbFTasFRu7XQwq2/yiHYJ9w19oB xFHboBwgukjsw0XtHLs0cDN10dWUOPx8vGcGQewQ9QpnNrQ0yD+izhtCGtEgQxh+rV8z 7qNQ== 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 u5-20020a17090282c500b001bb3499d8besi658976plz.478.2023.08.02.12.41.05; Wed, 02 Aug 2023 12:41:18 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232904AbjHBTOF (ORCPT + 99 others); Wed, 2 Aug 2023 15:14:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231159AbjHBTNz (ORCPT ); Wed, 2 Aug 2023 15:13:55 -0400 Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89F9B26AB; Wed, 2 Aug 2023 12:13:54 -0700 (PDT) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 0EAB1201074; Wed, 2 Aug 2023 21:13:53 +0200 (CEST) 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 C247E201B1B; Wed, 2 Aug 2023 21:13:52 +0200 (CEST) Received: from right.am.freescale.net (right.am.freescale.net [10.81.116.134]) by usphx01srsp001v.us-phx01.nxp.com (Postfix) with ESMTP id B7BF0405DF; Wed, 2 Aug 2023 12:13:51 -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 v4 2/2] net: phy: at803x: remove set/get wol callbacks for AR8032 Date: Wed, 2 Aug 2023 14:13:47 -0500 Message-Id: <20230802191347.6886-3-leoyang.li@nxp.com> X-Mailer: git-send-email 2.25.1.377.g2d2118b In-Reply-To: <20230802191347.6886-1-leoyang.li@nxp.com> References: <20230802191347.6886-1-leoyang.li@nxp.com> MIME-Version: 1.0 X-Virus-Scanned: ClamAV using ClamSMTP X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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: INBOX X-GMAIL-THRID: 1773147550828110259 X-GMAIL-MSGID: 1773147550828110259 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 9c2c2e2ee94b..8a77ec33b417 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -2064,8 +2064,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 */