From nobody Sun Nov 24 23:41:54 2024 Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 262B31A0BCF; Fri, 1 Nov 2024 13:32:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730467927; cv=none; b=oaYGtF/NC/rPBgDlUSe9hywRCMemwWO/STQBS+CrFfjLEIyEg4ZTP5PUi5FoptTb+uZecgU0JyRlzt8vv3SqHdFvk6B84OMeeM+MCoEJeBS2DnioYydR2SVZeVBPoA426SpCuDpn4/ZbCpaviw7oN4ANV3BwqKgbEwUoSYp+0iw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730467927; c=relaxed/simple; bh=dfOLfBBU74cC4vT9wJca+dQwQegohMGuBcog2Rmlu2w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=LzuBlvyws74V2Src/fq/DfOiABNpYcE7mF1qw1swltwRe/PHcW3L1BJfv5F8nLrMQxGIf2GfjLKjfrDTmK4L4YT/YWt7ZB54dH+8sGJX1QRWx5HZ1AK0xJjb/5lrpUtnl6YZxBLSlCIAOCQYVbd7vxjjtsUQR3E9pLStFzjmIYo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=KOUKYx49; arc=none smtp.client-ip=209.85.210.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KOUKYx49" Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-71e953f4e7cso1578263b3a.3; Fri, 01 Nov 2024 06:32:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730467924; x=1731072724; darn=vger.kernel.org; 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=KgCiEVGz8klvzwcS+QkKtoh9xYbmOE1HGElbvRznKis=; b=KOUKYx49gmqbsa9MMTvj68coF96Ia9tqyllbZbzg9sy5/ayqfaK1YhmdaAQQgTgJq1 R0xGZak3WTs1YrPh83tsaOOnjjLYG6neBILd6fke8SEPewx3KNYFQTuvTqW/uS1iEMk1 YBtLWnYARC5HiX4ZrAwQzrq/zAyFhdkpMoxUyhaV/N84o66KXxsEYwYUwtd/eF7pM3W7 7SWZpE/wD4h0L89FzqqodmIvxsAgEB9FpEuJTGSGZ7EtJMWBMCRgzQrRu6CCWRAdwnQg aiqugk5P/krc1HC1Fp+oKWk8br0qYE5bOZtj+ZfQ/+tTOI8urn0Qx+9nZbxjXt8EzjN4 scpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730467924; x=1731072724; 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=KgCiEVGz8klvzwcS+QkKtoh9xYbmOE1HGElbvRznKis=; b=bKUm6yebzLSAast6Gxq307Jay6Uata8CIRvau4iKFuaaimDzaxOiJZMyMiaoImm7Ga hxbTA/V+o8tI+1StLGiNe7IIqLrJ8o90A9NK8byUg6OEmsxtUJBHGK/N/b9M3ekMJiY6 8OLi+Jll2tzA7862G2I4iXs7r9dDEJh6IUYVGwXCG3jQBRmAyeRwtT3ew4Z7sOyQK4Vf jLcoxUp2WZ7W6mvuzsyfzfSLows/NCV8wfaaC27hmGjI3VXJojSR4650/TwMyD9b1M2F HM5fNxpoGZoJT6Lpwi+ZEbWU+3N/OT9IADQQsIBQx4eK3Pmuj2DxGuOP6YT2T4Lzs7r7 /BEQ== X-Forwarded-Encrypted: i=1; AJvYcCViATvud8hvUlUwiwEyOCxFwjNSKihaMCsFCeE2jZHBnpg6JgKFg6+8GevI9btgrRCp22OVK4z2zEh+CEw=@vger.kernel.org X-Gm-Message-State: AOJu0YyVkPL0jKIisQVuA21+Q6TiiMYe19EhKmSddCdE8lxsLUtNiJoF fTa2iVy0YP9LYqfWI8vtnwHyy3hcTqWcTY3SmTNx88VCc/m1hFd6cp1Rpw== X-Google-Smtp-Source: AGHT+IFVGLBQ7WFySkSoLUs1iM7bD8sevl+nqGIEWdG3RTihTRQmex9k6gFT4/m/RVQUWsys/PDh8Q== X-Received: by 2002:a05:6a21:a24b:b0:1d9:ac9:3587 with SMTP id adf61e73a8af0-1dba52aad00mr4018425637.14.1730467923806; Fri, 01 Nov 2024 06:32:03 -0700 (PDT) Received: from localhost.localdomain ([129.146.253.192]) by smtp.googlemail.com with ESMTPSA id 41be03b00d2f7-7ee452ac4ffsm2425552a12.25.2024.11.01.06.31.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2024 06:32:03 -0700 (PDT) From: Furong Xu <0x1207@gmail.com> To: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Vladimir Oltean , Andrew Lunn , Simon Horman , andrew+netdev@lunn.ch, Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , xfr@outlook.com, Furong Xu <0x1207@gmail.com> Subject: [PATCH net-next v8 2/8] net: stmmac: Rework macro definitions for gmac4 and xgmac Date: Fri, 1 Nov 2024 21:31:29 +0800 Message-Id: <510b85288b13aa2cce5adf849291009c6f29a84a.1730449003.git.0x1207@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Rename and add macro definitions to better reuse them in common code. Signed-off-by: Furong Xu <0x1207@gmail.com> Reviewed-by: Simon Horman --- .../net/ethernet/stmicro/stmmac/stmmac_fpe.c | 77 ++++++++++--------- 1 file changed, 39 insertions(+), 38 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.c b/drivers/net= /ethernet/stmicro/stmmac/stmmac_fpe.c index 8cfb5bccfa52..41c9cccfb5de 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.c @@ -9,23 +9,23 @@ #include "dwmac5.h" #include "dwxgmac2.h" =20 -#define MAC_FPE_CTRL_STS 0x00000234 -#define TRSP BIT(19) -#define TVER BIT(18) -#define RRSP BIT(17) -#define RVER BIT(16) -#define SRSP BIT(2) -#define SVER BIT(1) -#define EFPE BIT(0) - -#define MTL_FPE_CTRL_STS 0x00000c90 +#define GMAC5_MAC_FPE_CTRL_STS 0x00000234 +#define XGMAC_MAC_FPE_CTRL_STS 0x00000280 + +#define GMAC5_MTL_FPE_CTRL_STS 0x00000c90 +#define XGMAC_MTL_FPE_CTRL_STS 0x00001090 /* Preemption Classification */ -#define DWMAC5_PREEMPTION_CLASS GENMASK(15, 8) +#define FPE_MTL_PREEMPTION_CLASS GENMASK(15, 8) /* Additional Fragment Size of preempted frames */ -#define DWMAC5_ADD_FRAG_SZ GENMASK(1, 0) +#define FPE_MTL_ADD_FRAG_SZ GENMASK(1, 0) =20 -#define XGMAC_FPE_CTRL_STS 0x00000280 -#define XGMAC_EFPE BIT(0) +#define STMMAC_MAC_FPE_CTRL_STS_TRSP BIT(19) +#define STMMAC_MAC_FPE_CTRL_STS_TVER BIT(18) +#define STMMAC_MAC_FPE_CTRL_STS_RRSP BIT(17) +#define STMMAC_MAC_FPE_CTRL_STS_RVER BIT(16) +#define STMMAC_MAC_FPE_CTRL_STS_SRSP BIT(2) +#define STMMAC_MAC_FPE_CTRL_STS_SVER BIT(1) +#define STMMAC_MAC_FPE_CTRL_STS_EFPE BIT(0) =20 void dwmac5_fpe_configure(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg, u32 num_txq, u32 num_rxq, @@ -34,7 +34,7 @@ void dwmac5_fpe_configure(void __iomem *ioaddr, struct st= mmac_fpe_cfg *cfg, u32 value; =20 if (tx_enable) { - cfg->fpe_csr =3D EFPE; + cfg->fpe_csr =3D STMMAC_MAC_FPE_CTRL_STS_EFPE; value =3D readl(ioaddr + GMAC_RXQ_CTRL1); value &=3D ~GMAC_RXQCTRL_FPRQ; value |=3D (num_rxq - 1) << GMAC_RXQCTRL_FPRQ_SHIFT; @@ -42,14 +42,14 @@ void dwmac5_fpe_configure(void __iomem *ioaddr, struct = stmmac_fpe_cfg *cfg, } else { cfg->fpe_csr =3D 0; } - writel(cfg->fpe_csr, ioaddr + MAC_FPE_CTRL_STS); + writel(cfg->fpe_csr, ioaddr + GMAC5_MAC_FPE_CTRL_STS); =20 value =3D readl(ioaddr + GMAC_INT_EN); =20 if (pmac_enable) { if (!(value & GMAC_INT_FPE_EN)) { /* Dummy read to clear any pending masked interrupts */ - readl(ioaddr + MAC_FPE_CTRL_STS); + readl(ioaddr + GMAC5_MAC_FPE_CTRL_STS); =20 value |=3D GMAC_INT_FPE_EN; } @@ -66,11 +66,11 @@ void dwmac5_fpe_send_mpacket(void __iomem *ioaddr, stru= ct stmmac_fpe_cfg *cfg, u32 value =3D cfg->fpe_csr; =20 if (type =3D=3D MPACKET_VERIFY) - value |=3D SVER; + value |=3D STMMAC_MAC_FPE_CTRL_STS_SVER; else if (type =3D=3D MPACKET_RESPONSE) - value |=3D SRSP; + value |=3D STMMAC_MAC_FPE_CTRL_STS_SRSP; =20 - writel(value, ioaddr + MAC_FPE_CTRL_STS); + writel(value, ioaddr + GMAC5_MAC_FPE_CTRL_STS); } =20 void stmmac_fpe_event_status(struct stmmac_priv *priv, int status) @@ -112,24 +112,24 @@ int dwmac5_fpe_irq_status(void __iomem *ioaddr, struc= t net_device *dev) /* Reads from the MAC_FPE_CTRL_STS register should only be performed * here, since the status flags of MAC_FPE_CTRL_STS are "clear on read" */ - value =3D readl(ioaddr + MAC_FPE_CTRL_STS); + value =3D readl(ioaddr + GMAC5_MAC_FPE_CTRL_STS); =20 - if (value & TRSP) { + if (value & STMMAC_MAC_FPE_CTRL_STS_TRSP) { status |=3D FPE_EVENT_TRSP; netdev_dbg(dev, "FPE: Respond mPacket is transmitted\n"); } =20 - if (value & TVER) { + if (value & STMMAC_MAC_FPE_CTRL_STS_TVER) { status |=3D FPE_EVENT_TVER; netdev_dbg(dev, "FPE: Verify mPacket is transmitted\n"); } =20 - if (value & RRSP) { + if (value & STMMAC_MAC_FPE_CTRL_STS_RRSP) { status |=3D FPE_EVENT_RRSP; netdev_dbg(dev, "FPE: Respond mPacket is received\n"); } =20 - if (value & RVER) { + if (value & STMMAC_MAC_FPE_CTRL_STS_RVER) { status |=3D FPE_EVENT_RVER; netdev_dbg(dev, "FPE: Verify mPacket is received\n"); } @@ -261,16 +261,17 @@ void stmmac_fpe_link_state_handle(struct stmmac_priv = *priv, bool is_up) =20 int dwmac5_fpe_get_add_frag_size(const void __iomem *ioaddr) { - return FIELD_GET(DWMAC5_ADD_FRAG_SZ, readl(ioaddr + MTL_FPE_CTRL_STS)); + return FIELD_GET(FPE_MTL_ADD_FRAG_SZ, + readl(ioaddr + GMAC5_MTL_FPE_CTRL_STS)); } =20 void dwmac5_fpe_set_add_frag_size(void __iomem *ioaddr, u32 add_frag_size) { u32 value; =20 - value =3D readl(ioaddr + MTL_FPE_CTRL_STS); - writel(u32_replace_bits(value, add_frag_size, DWMAC5_ADD_FRAG_SZ), - ioaddr + MTL_FPE_CTRL_STS); + value =3D readl(ioaddr + GMAC5_MTL_FPE_CTRL_STS); + writel(u32_replace_bits(value, add_frag_size, FPE_MTL_ADD_FRAG_SZ), + ioaddr + GMAC5_MTL_FPE_CTRL_STS); } =20 #define ALG_ERR_MSG "TX algorithm SP is not suitable for one-to-many mappi= ng" @@ -321,9 +322,9 @@ int dwmac5_fpe_map_preemption_class(struct net_device *= ndev, } =20 update_mapping: - val =3D readl(priv->ioaddr + MTL_FPE_CTRL_STS); - writel(u32_replace_bits(val, preemptible_txqs, DWMAC5_PREEMPTION_CLASS), - priv->ioaddr + MTL_FPE_CTRL_STS); + val =3D readl(priv->ioaddr + GMAC5_MTL_FPE_CTRL_STS); + writel(u32_replace_bits(val, preemptible_txqs, FPE_MTL_PREEMPTION_CLASS), + priv->ioaddr + GMAC5_MTL_FPE_CTRL_STS); =20 return 0; } @@ -335,11 +336,11 @@ void dwxgmac3_fpe_configure(void __iomem *ioaddr, str= uct stmmac_fpe_cfg *cfg, u32 value; =20 if (!tx_enable) { - value =3D readl(ioaddr + XGMAC_FPE_CTRL_STS); + value =3D readl(ioaddr + XGMAC_MAC_FPE_CTRL_STS); =20 - value &=3D ~XGMAC_EFPE; + value &=3D ~STMMAC_MAC_FPE_CTRL_STS_EFPE; =20 - writel(value, ioaddr + XGMAC_FPE_CTRL_STS); + writel(value, ioaddr + XGMAC_MAC_FPE_CTRL_STS); return; } =20 @@ -348,7 +349,7 @@ void dwxgmac3_fpe_configure(void __iomem *ioaddr, struc= t stmmac_fpe_cfg *cfg, value |=3D (num_rxq - 1) << XGMAC_RQ_SHIFT; writel(value, ioaddr + XGMAC_RXQ_CTRL1); =20 - value =3D readl(ioaddr + XGMAC_FPE_CTRL_STS); - value |=3D XGMAC_EFPE; - writel(value, ioaddr + XGMAC_FPE_CTRL_STS); + value =3D readl(ioaddr + XGMAC_MAC_FPE_CTRL_STS); + value |=3D STMMAC_MAC_FPE_CTRL_STS_EFPE; + writel(value, ioaddr + XGMAC_MAC_FPE_CTRL_STS); } --=20 2.34.1