Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp338475rdb; Tue, 5 Dec 2023 06:58:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IHkRd8swzDe3arVamiEImfjpdbt11r3iiHYjd8U6ziWq4O18TzvlRdHZjW0XiwdZVk9RUVL X-Received: by 2002:a05:6a20:3a8a:b0:18f:97c:3859 with SMTP id d10-20020a056a203a8a00b0018f097c3859mr1710313pzh.51.1701788305977; Tue, 05 Dec 2023 06:58:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701788305; cv=none; d=google.com; s=arc-20160816; b=WYskEye2errkOObgn04lXNIoevbmkQDm/8d27aRs/hu7dsE/wwC/rOpwB5c2I6bYZm 6TtOQ8zT1WtHVzmlZCbWfxXMuwR+laJYQJYBDgKdUDOejrpxq4Gmj9sSvTGUEyyEX5NI 1dsw+gCRRnSIr70VBDkyULk0pk6lDyDNvk4j0kcqwEH7xQGX8Z0x9LDODE63gg+DwTCJ LJrvznLyhDQdDx1xSSS8aDW5SpsgS7UvOQilhzi6jKdHwGOBNHiAhp83V6VcobsNKA7H Gt/DF2KpocUSsRj8eItqc9nORQm9rW05uEBe2UtRv8O/A5w7JNGp7UEIsuZcMZW/4UMB VQkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Niv+uFMMZ47PdYI45Y9AoLriOrLQtx81cAeZSJ25KPY=; fh=uibsN2DE3RZbgiy4GUX1SBLspWpCNSp+Yc/mAurtIJc=; b=0ZA0lStscGV80MwsX2IOKOTC5vuMQfdowHLxH/fvp+INC5ph1M3jnYuuj43NXPIlqz vhJUXG29PlXHcib82HwfIq8dch7LgvSO7G6KaMi7SmmQ8f5cjhCN+lrRqej3SDMGYDL8 DkXWCyXBRxXIkAYIYOapRC4SGQvy5isVwQdDyWnvM70Z3qtEvDw2UfImqzuXC4fdOhbL 3myZ5MmUBWD/s4rhyk4TgL6zt3sPivGjCmbGuORK9OgknE5zBGFUjzJ8s7eCxV7xXlSb +BwmW16Xo9aSHhMEyVkR7BQnOJk0qFbxR9LxzwwynV8ZBdSgIYWc4xE7C9WJ5M30AZiy E/Bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=ECiJfHJr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id eb27-20020a056a004c9b00b006ce63dbd7f4si2139613pfb.142.2023.12.05.06.58.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 06:58:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=ECiJfHJr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 7E9FB8031E1A; Tue, 5 Dec 2023 06:58:24 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345773AbjLEO6O (ORCPT + 99 others); Tue, 5 Dec 2023 09:58:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346023AbjLEO6M (ORCPT ); Tue, 5 Dec 2023 09:58:12 -0500 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 323CA1B6; Tue, 5 Dec 2023 06:58:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Niv+uFMMZ47PdYI45Y9AoLriOrLQtx81cAeZSJ25KPY=; b=ECiJfHJrsr/f0L+71GqdBnpXnC lNdo5YsQfw3YwR5YsupiWzdR/S/Lzz8Oo81W0jeZ/BB+e6wGAQMJBGJUZo/X1Cc3c//0boPlHxrC9 Tds6aGdauv5GLQFy3nLOSw5BH7pHcLIRAaVqF6tV64N7xI3LjkMv7FItwu21vhjhdYvUNeKr2TYme gr78D0OUB2OVMIfP6iBCP6ZKx3FFRFGgg8TsQLLlcB7gL+3eWh/c6/h4iAfxzd/YtJwmVoR1i4fps 01GQ2rAgoeBr8uyA82aCDmza9wcGEEh/GrGnK7oNGfbQeiSK82MFYntbBH6LvVkpTe+NGJispS/4Q CwS1tqWg==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:36310) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1rAWsF-0006vo-0d; Tue, 05 Dec 2023 14:58:11 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1rAWsH-0001nv-2u; Tue, 05 Dec 2023 14:58:13 +0000 Date: Tue, 5 Dec 2023 14:58:13 +0000 From: "Russell King (Oracle)" To: Paolo Abeni Cc: Christian Marangi , Andrew Lunn , Heiner Kallweit , "David S. Miller" , Eric Dumazet , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [net-next PATCH v2 08/12] net: phy: at803x: move specific at8031 WOL bits to dedicated function Message-ID: References: <20231201001423.20989-1-ansuelsmth@gmail.com> <20231201001423.20989-9-ansuelsmth@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Russell King (Oracle) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE, 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 05 Dec 2023 06:58:24 -0800 (PST) On Tue, Dec 05, 2023 at 10:32:55AM +0100, Paolo Abeni wrote: > On Fri, 2023-12-01 at 01:14 +0100, Christian Marangi wrote: > > Move specific at8031 WOL enable/disable to dedicated function to make > > at803x_set_wol more generic. > > > > This is needed in preparation for PHY driver split as qca8081 share the > > same function to toggle WOL settings. > > > > In this new implementation WOL module in at8031 is enabled after the > > generic interrupt is setup. This should not cause any problem as the > > WOL_INT has a separate implementation and only relay on MAC bits. > > > > Signed-off-by: Christian Marangi > > --- > > drivers/net/phy/at803x.c | 42 ++++++++++++++++++++++++---------------- > > 1 file changed, 25 insertions(+), 17 deletions(-) > > > > diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c > > index 02ac71f98466..2de7a59c0faa 100644 > > --- a/drivers/net/phy/at803x.c > > +++ b/drivers/net/phy/at803x.c > > @@ -466,27 +466,11 @@ 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 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 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) > > @@ -1611,6 +1595,30 @@ static int at8031_config_init(struct phy_device *phydev) > > return at803x_config_init(phydev); > > } > > > > +static int at8031_set_wol(struct phy_device *phydev, > > + struct ethtool_wolinfo *wol) > > +{ > > + int ret; > > + > > + /* First setup MAC address and enable WOL interrupt */ > > + ret = at803x_set_wol(phydev, wol); > > + if (ret) > > + return ret; > > + > > + if (wol->wolopts & WAKE_MAGIC) > > + /* Enable WOL function for 1588 */ > > + ret = phy_modify_mmd(phydev, MDIO_MMD_PCS, > > + AT803X_PHY_MMD3_WOL_CTRL, > > + 0, AT803X_WOL_EN); > > + else > > + /* Disable WoL function for 1588 */ > > + ret = phy_modify_mmd(phydev, MDIO_MMD_PCS, > > + AT803X_PHY_MMD3_WOL_CTRL, > > + AT803X_WOL_EN, 0); > > + > > + return ret; > > If I read correctly, the above changes the order of some WoL > initialization steps: now WOL_CTRL is touched after > AT803X_INTR_ENABLE_WOL. Is that correct? It is fine. AT803X_INTR_ENABLE_WOL enables or disables whether the INT pin (which is used for any interrupt from the PHY) is used to signal WOL - it's the interrupt enable for the WoL function. The MMD3 WOL_EN bit controls whether the WoL function is enabled, and thus whether the WOL_INT pin will signal WoL. WOL_EN should not be set until we have initialised the WoL function, and thus that needs to happen _after_ the MAC address has been programmed. Clearing WOL_EN afterwards is not a problem because it will already have been setup, or is in its power-on default state. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!