From patchwork Wed Jun 21 18:25:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 111262 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp4566158vqr; Wed, 21 Jun 2023 11:38:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7UPQ53o0Chwe1JMf6I53d2zVODHeYS78nwM65+E+mbv8ciric9Pnw+B2w/qhdwCe5qUfFp X-Received: by 2002:a05:6808:ec3:b0:39e:b58c:13d5 with SMTP id q3-20020a0568080ec300b0039eb58c13d5mr15828386oiv.17.1687372733016; Wed, 21 Jun 2023 11:38:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687372732; cv=none; d=google.com; s=arc-20160816; b=eHGpl6BQTMg4Uk0aPLECeXnWEJh5BF32jmRKZrI8BKZjKjpKUSoK09CXj1Li/LGQ9V 1s6BQgUJmGm9guZS/YzL1VfUSItlFW10uZo8OIYqNXOZMvHoynci0QRtIZEyeeGnD1Df 3R9oe9ybtMwIt8bDcdtD4PIyVfjQPNVJnIrrXovcdSgyFkVjE1LoYGKe8/Djv13Lsnek 1nfq/HP4/pcyQNKlGxp4+LJkxPsWNv9rALfyPLmsyYDR8T3Ze0u1uYt8CmGHo0vM2o/m WGr9v9RDcXwK3URgxF2JYhLJp0j8+mP7QJGwg1qNbAFb4U8g8ok05phq6HEId+SbJ4nB aZpQ== 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 :dkim-signature; bh=lNP6LkxylJsTZb04Lj9SoU8dCYBcHfZtyvvvsQ9AlHo=; b=g9vme54Xv+dbaFsw7z8Ds620zaMZjSqOp/7tB0uOX6XNYI5QR1MmAggRwfTfADGmdv bMchk3a8hh9iv9vCtfwbf/Vi8xusf0q3x0YJHnfI8J2K003Ev8V7H1QAZR8/Eww1C3yG Xi3HAZ7ceheflQVVv5R5nKXcSQBZ4us6CFYMszIhw9jrKDTOmXgozYkQSJF7nvoZEEbZ 3ZqTGuAjVuT3kRFosXsmzafnMt+HPm+UGiRImeLJIah6eVqxLMDcdlbB72tjyTNq0YlA KICjXCx0VgsGI5a5/hlrt3veSicAjJCjGUPlnsFuLCHkB1N6zcj6lD02oL0oRVMkymvO qmxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20221208.gappssmtp.com header.s=20221208 header.b=Rg+Bb+ML; 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 m8-20020a638c08000000b0055397816fc1si4337432pgd.758.2023.06.21.11.38.37; Wed, 21 Jun 2023 11:38:52 -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; dkim=pass header.i=@bgdev-pl.20221208.gappssmtp.com header.s=20221208 header.b=Rg+Bb+ML; 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 S231294AbjFUS0l (ORCPT + 99 others); Wed, 21 Jun 2023 14:26:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230367AbjFUS0W (ORCPT ); Wed, 21 Jun 2023 14:26:22 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51B58172C for ; Wed, 21 Jun 2023 11:26:21 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-30fbf253dc7so5156073f8f.0 for ; Wed, 21 Jun 2023 11:26:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1687371980; x=1689963980; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lNP6LkxylJsTZb04Lj9SoU8dCYBcHfZtyvvvsQ9AlHo=; b=Rg+Bb+MLsFTmBNxnLDtdRie8ZGj4jTuLI/dFep5lH5WU8TXD5G3EWoTWZzwjjVhWxI i+zAdLcYv/Bjxm5hgDDbdAsNtzdOoMTllxb/7/A1j8YcnC4XkIfOenypAWD9VDpcmwDC 80hjUoKWLzzUVbfSCQvZ4jtN6GT86xalg1UYf1Ti0Y1qV1ov5ac0MA+hodpy9wHTtfBE KYvmNnueyZxvLyqx+rIoBHnxnkfGE4M9CDpO32r1ikF1/mz/NvnddFaKHOpSFQD6UVuc Ttbvr56A+YSnin2aHa+ogToq4wVLcKVI6Z7bsF+1WlWVhoW1t8v4TAT/pqI7vHaeG3ap 4TJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687371980; x=1689963980; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lNP6LkxylJsTZb04Lj9SoU8dCYBcHfZtyvvvsQ9AlHo=; b=cmDuXfPkvjZTBrjj7wBeFj5q0W/X7OO/rDPqwZEt/gEidBfSSMSXRwoaGxwtqLHzhE YxUNJdSSkyh5+RjDTNoR9BnDDhTzsXi9/0b2Do51ooOylicjlzcL/qkXrEZDv5YDkgI6 6iUh1YfLza1vP04FHVS/erjdj4KlTPMCHpUQEJP2RfyHomcI6GMWNS5UUzxqAUz1K1h8 +wXKUcSzTRKiLUyF2w6NdIHCPBCiPPjHEyQJo4Eenkp5g2ND+6QpsYvmdmYofifA+ZyA hUYVLKB9lr0XRx+ihDo38hWDjwwsDAGae49If/eJ75BxkuH9D3UMSlWszXF1fDW13h50 hKQw== X-Gm-Message-State: AC+VfDyQfHLfPnD7wg1l6e9SDTPtFiIdxeEqsmC30hDunMbrsN36b08N elWdPEoqhVQHrrpk7OeS4f48BA== X-Received: by 2002:a05:6000:12c8:b0:311:2888:9f95 with SMTP id l8-20020a05600012c800b0031128889f95mr13417832wrx.23.1687371979554; Wed, 21 Jun 2023 11:26:19 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:a69f:8ee3:6907:ccdf]) by smtp.gmail.com with ESMTPSA id z13-20020adff74d000000b0030af15d7e41sm5176994wrp.4.2023.06.21.11.26.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jun 2023 11:26:19 -0700 (PDT) From: Bartosz Golaszewski To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Vinod Koul , Bhupesh Sharma , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Thierry Reding , Jonathan Hunter , Richard Cochran , Matthias Brugger , AngeloGioacchino Del Regno Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-mediatek@lists.infradead.org, Bartosz Golaszewski Subject: [PATCH net-next 06/12] net: stmmac: replace the serdes_up_after_phy_linkup field with a flag Date: Wed, 21 Jun 2023 20:25:52 +0200 Message-Id: <20230621182558.544417-7-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230621182558.544417-1-brgl@bgdev.pl> References: <20230621182558.544417-1-brgl@bgdev.pl> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769338550895568533?= X-GMAIL-MSGID: =?utf-8?q?1769338550895568533?= From: Bartosz Golaszewski Drop the boolean field of the plat_stmmacenet_data structure in favor of a simple bitfield flag. Signed-off-by: Bartosz Golaszewski --- drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c | 2 +- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 9 ++++++--- include/linux/stmmac.h | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c index 5e8aa03cffae..99e2e5a5cd60 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c @@ -337,7 +337,7 @@ static int tegra_mgbe_probe(struct platform_device *pdev) /* Program SID */ writel(MGBE_SID, mgbe->hv + MGBE_WRAP_AXI_ASID0_CTRL); - plat->serdes_up_after_phy_linkup = 1; + plat->flags |= STMMAC_FLAG_SERDES_UP_AFTER_PHY_LINKUP; err = stmmac_dvr_probe(&pdev->dev, plat, &res); if (err < 0) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 73002ed923aa..d444514db07e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -991,7 +991,8 @@ static void stmmac_mac_link_up(struct phylink_config *config, struct stmmac_priv *priv = netdev_priv(to_net_dev(config->dev)); u32 old_ctrl, ctrl; - if (priv->plat->serdes_up_after_phy_linkup && priv->plat->serdes_powerup) + if ((priv->plat->flags & STMMAC_FLAG_SERDES_UP_AFTER_PHY_LINKUP) && + priv->plat->serdes_powerup) priv->plat->serdes_powerup(priv->dev, priv->plat->bsp_priv); old_ctrl = readl(priv->ioaddr + MAC_CTRL_REG); @@ -3838,7 +3839,8 @@ static int __stmmac_open(struct net_device *dev, stmmac_reset_queues_param(priv); - if (!priv->plat->serdes_up_after_phy_linkup && priv->plat->serdes_powerup) { + if (!(priv->plat->flags & STMMAC_FLAG_SERDES_UP_AFTER_PHY_LINKUP) && + priv->plat->serdes_powerup) { ret = priv->plat->serdes_powerup(dev, priv->plat->bsp_priv); if (ret < 0) { netdev_err(priv->dev, "%s: Serdes powerup failed\n", @@ -7623,7 +7625,8 @@ int stmmac_resume(struct device *dev) stmmac_mdio_reset(priv->mii); } - if (!priv->plat->serdes_up_after_phy_linkup && priv->plat->serdes_powerup) { + if (!(priv->plat->flags & STMMAC_FLAG_SERDES_UP_AFTER_PHY_LINKUP) && + priv->plat->serdes_powerup) { ret = priv->plat->serdes_powerup(ndev, priv->plat->bsp_priv); diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index 47ae29a98835..aeb3e75dc748 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -209,6 +209,7 @@ struct dwmac4_addrs { #define STMMAC_FLAG_USE_PHY_WOL BIT(2) #define STMMAC_FLAG_HAS_SUN8I BIT(3) #define STMMAC_FLAG_TSO_EN BIT(4) +#define STMMAC_FLAG_SERDES_UP_AFTER_PHY_LINKUP BIT(5) struct plat_stmmacenet_data { int bus_id; @@ -293,7 +294,6 @@ struct plat_stmmacenet_data { int msi_sfty_ue_vec; int msi_rx_base_vec; int msi_tx_base_vec; - bool serdes_up_after_phy_linkup; const struct dwmac4_addrs *dwmac4_addrs; unsigned int flags; };