From patchwork Tue Feb 21 23:14:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Yang X-Patchwork-Id: 60289 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp281438wrd; Tue, 21 Feb 2023 15:40:41 -0800 (PST) X-Google-Smtp-Source: AK7set9gxKISQC1GUwTbjGt8v3+SQE4aLpovkQcVeZiMvBox7CT6KiFY57777bX+ZWGjxVyKD4C1 X-Received: by 2002:a05:6a20:1443:b0:c7:6088:9bc8 with SMTP id a3-20020a056a20144300b000c760889bc8mr8394636pzi.52.1677022840780; Tue, 21 Feb 2023 15:40:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677022840; cv=none; d=google.com; s=arc-20160816; b=dvixwBwpFWtyY75zk1Um46vofyl6fRj3dG09Rt9qFB9PSjNIfjQczK3CTGTyu1WoI5 HyAhGXVeVPy0LhAJBwod9tm87LOTAyyjDD7RK3Mcj31kzQWIN5tXoZriO5ehjoLnPkBj 58sJfS3SL1idoI5CXFJk/VqDdKaKRkRYp6mDDKe9+/BcaGR41Vwi8dj5ppIGg2CiDkNf KUF3P9c2XJqrCrB6wqDdqsdoLiNT8eqoi7WoXqtcwi8mFWkVC1gB1+7WQaLaBjEmDLwe gbm+tN3uDlmZpZ3HAjx8XuYkiUCXacnPk1F9ItssijLQsFheZF8Y7EdOlNHwbysAEtKr 27pw== 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=GutKIBQGObFw+6lBcXNHMJmtS1/h+JbHB9FUmweuu6GymsxdWaAVOMYxuuA2VUEPK+ Pn7kkFN2rGs7Qp8XR7RUfVZ5C/QJ/3AUlsG+jvQurYEtYW4aVeAVW03AUyTUxZA42htG txhBDpW2eX8Qwo7wg0zU+SoUUXjIXO0sLOofSo/nn/kMw7j5KFswyrq+MA8eiWYlMek7 AYB0l7T5+niv89vltPQ6olhKv2sXEzZ+WZetEUwtJtx5efdL+4vwKTu6eQdFCELty4h3 92LDFEDMpzUVQhFYdAE8u2y88pRaeCBn8/YFv3d8IpK5+i+MoAcrhA//c+P5USF4v3rA m3mg== 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 m1-20020a6545c1000000b004fb8d952110si1369307pgr.468.2023.02.21.15.40.28; Tue, 21 Feb 2023 15:40:40 -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 S230399AbjBUXOg (ORCPT + 99 others); Tue, 21 Feb 2023 18:14:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230339AbjBUXOb (ORCPT ); Tue, 21 Feb 2023 18:14:31 -0500 Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54EA82E80E; Tue, 21 Feb 2023 15:14:29 -0800 (PST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 08CA02008E0; Wed, 22 Feb 2023 00:14:28 +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 888262008EB; Wed, 22 Feb 2023 00:14:27 +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 1E69C4059D; Tue, 21 Feb 2023 16:14:26 -0700 (MST) From: Li Yang To: Andrew Lunn , Heiner Kallweit , Russell King , "David S . Miller" , Jakub Kicinski , Luo Jie Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Li Yang , Viorel Suman , Wei Fang Subject: [PATCH v2 1/2] net: phy: at803x: fix the wol setting functions Date: Tue, 21 Feb 2023 17:14:10 -0600 Message-Id: <20230221231411.7786-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?1758485902296102052?= X-GMAIL-MSGID: =?utf-8?q?1758485902296102052?= 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 Tue Feb 21 23:14:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Yang X-Patchwork-Id: 60288 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp281419wrd; Tue, 21 Feb 2023 15:40:38 -0800 (PST) X-Google-Smtp-Source: AK7set8iNpQHM2lqKpZpnpC1B+V0cpIN/f2jfIktrflwGYlBPBaPPt+2hlqtivMIWuUVbII5sjkY X-Received: by 2002:a05:6a21:338d:b0:bc:333f:b958 with SMTP id yy13-20020a056a21338d00b000bc333fb958mr6353031pzb.30.1677022837856; Tue, 21 Feb 2023 15:40:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677022837; cv=none; d=google.com; s=arc-20160816; b=HQKklrj3A1Hu7Y+gNZYsRqJ5vAla86IJyfqDh9XSbHTwX0sX78ktf/vV5jR4QiCCss hxOrpNSzGZCyc+8p0PT9KcHVCRM/c766qGj0uiPMIIF5QTSPE+tv6u1YLsTARtVn8/La 0MaUkPfol+i/WraqgmlPN/9XhVGL6AGZvHd38tl1N7uk7PAFGwhH3sXrhuFLKdG0tTmo qbbWmq2/JPTWSnyL3oS2SR6sJnMUldQhpH20NfCTQPAkxENgIefNzgj74y9fcseHQser cqUe5t/XVcu/lJ0Ys1J0BFFRiuWxKSOMBp7BReNOAJXsVjJMHz//N13PBlO0RmkDT1cS Pc7A== 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=lwBK8CvbMsN6vk37W0UJGjhkJtDnSHmMbJLrFUoDfYo=; b=q6XdOOwAFKREbHpDnH3rq1TFCJr23yTFo6ncLrNJEN/0gcYQYueUt83ucyDvFtpZQF eVJ4VgapR7GA5NBLs/9oLGU0DnroPHQTBlRghA9F4x1U0U4xvNLaPXKIGGsTImKxzaqw iUsXXbz12wq6raNVp0pz7A5FjFyK4QhJ0aNuI6CbK5O70RZmL17tktza7J5oKK0qJrDo 7py1oIUjsUIUBJhrTk2JdRYkNakTHuN2u8zdAlTrtO3XDphIX54NApmbkNX2x4GUBnHr 16biFuZZku35ZyGWJugoJcULBsVAOz+zFMMv9ZcIRzRJ4me3E5O7zfJLBnOBrIr5whIw OChg== 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 y190-20020a638ac7000000b004fc21b8bd98si19059452pgd.328.2023.02.21.15.40.24; Tue, 21 Feb 2023 15:40:37 -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 S230363AbjBUXOd (ORCPT + 99 others); Tue, 21 Feb 2023 18:14:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230159AbjBUXOb (ORCPT ); Tue, 21 Feb 2023 18:14:31 -0500 Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B85A72E811; Tue, 21 Feb 2023 15:14:29 -0800 (PST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 5B1F61A0924; Wed, 22 Feb 2023 00:14:28 +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 213641A003E; Wed, 22 Feb 2023 00:14:28 +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 1793B4022E; Tue, 21 Feb 2023 16:14:27 -0700 (MST) From: Li Yang To: Andrew Lunn , Heiner Kallweit , Russell King , "David S . Miller" , Jakub Kicinski , Luo Jie Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Li Yang Subject: [PATCH v2 2/2] net: phy: at803x: remove set/get wol callbacks for AR8032 Date: Tue, 21 Feb 2023 17:14:11 -0600 Message-Id: <20230221231411.7786-2-leoyang.li@nxp.com> X-Mailer: git-send-email 2.25.1.377.g2d2118b In-Reply-To: <20230221231411.7786-1-leoyang.li@nxp.com> References: <20230221231411.7786-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?1758485899585618906?= X-GMAIL-MSGID: =?utf-8?q?1758485899585618906?= 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 --- 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 */