From patchwork Fri Oct 18 06:39:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Furong Xu <0x1207@gmail.com> X-Patchwork-Id: 13841281 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B99D3D3C550 for ; Fri, 18 Oct 2024 06:50:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=XoXtS/KGKf23o7SadlNvmNMchc09V1cBlERiDv3SWtA=; b=vOHQAEYgFFz/yenfKARAbOPsTH h1I8efzu2V9c8pTQwo1vaPWRsXI8gF7TZtKbIdX5uc78IgXyx8d5EZuHOKjj1mV0iSjIzsk+GjFy+ 21jHCuvvv6rOetD3S/Q0OtZ2L7jfdpHVB5r58ZRb3FQ8gaFKFseF0+S0IamcRt8xSAoJQ9PXZ06ms NBz2eNhaZJAmwiJ92aFDkC2dn9NiRdALA2a2L5RqXP5FfTUQt0jQP8j/4hVuaUI5tYkVv+ldBdCKr lrDxVOwflDpLG0S2/G2O76Sk67iTdFUlpe5KFF26nia4yJqSHH+ngZ1Y6tbxg43eFwBg8+tCG91V7 6jrOo3Qg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1goq-0000000HE0w-0cyV; Fri, 18 Oct 2024 06:50:40 +0000 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1gep-0000000HAs1-3J6J for linux-arm-kernel@lists.infradead.org; Fri, 18 Oct 2024 06:40:21 +0000 Received: by mail-pg1-x52c.google.com with SMTP id 41be03b00d2f7-7ea8ecacf16so1281820a12.1 for ; Thu, 17 Oct 2024 23:40:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729233619; x=1729838419; darn=lists.infradead.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=XoXtS/KGKf23o7SadlNvmNMchc09V1cBlERiDv3SWtA=; b=MTOU7YQeUXKTLQjpCwT393sQZucloYs1aQdePF32BpfdH0fM22pY74R3W1oXHOJAIR h495v1hHe30FClbybXSqx2hKmkXy7Rmt1bjO17zhJWorMhH8mbTV8ITv1oCErkNwUmV2 TCzUtMr1j1i/MNjli6Gz+fJTxUTPlxZm7MIJ2SgJVNwLnES5F1ivW/9nNwaog5XRGREn D6Y+qk/egmOPn9fCU/KGXWvRCD9X/Pd2rEMHXwofmy3IHw97e8NjL5PavNplKtRbc/nP /iEew3LTsh1ro9PsMO9e+rYmQiAOgbjyIa/wm0Dqa/lHzLanZk+uYO0z3sMaKm98Tg7d sE3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729233619; x=1729838419; 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=XoXtS/KGKf23o7SadlNvmNMchc09V1cBlERiDv3SWtA=; b=uOwwr7f0RTIgDgtGLqRQZjK1jxyOJnptPpQnA+v8xJuQ4DYA9oy4f4t+GnwxJ6QGeS z8TsEXFO/brxtxH3Yh2EA6Z3tzTLi9xf7qg5NPEZMXGjwZwUXBn82+fXB4TFpLRn8xQe 21B7CrN7UeCdsF/sy8P5SWPl+w9WB74RHPUhlU9NEEjrL35hnO2d/X8QU0Erqt6/MKIx IM+eZf7WdXP6xjiKkCqGBZARKVjmw6GXGBDjPIYPSweCMqQw9bkDtssL1BHjwp8xIGJ9 vF+2455Ho/soIvTpWyGN2o2+AvfyKpOVfEZTppXkjR68XzWMsLv0KO/MSK34bNueIc61 rCUA== X-Forwarded-Encrypted: i=1; AJvYcCWwyKYOO4SRWLxJJNN+9m1H7Zo9sJURT3XqA8xByBQvVGZ3GvcBW0l8NDx7x4xkZY9JtydHNw3SdkG8BKu3xme1@lists.infradead.org X-Gm-Message-State: AOJu0Yy8f2jOvpcEWXMQUuZTmM7MsN7+pE5XXmDdscOXA69qO0CLGZZt 0oLyQDt5mvMWC3NrGI+rBIiuD9K5rVyJgCDFqG8EvtFJDG24SiwE X-Google-Smtp-Source: AGHT+IFFaWqo8s2PogDyWr1TfL5kF7TPRLJZblqmXL/T96wFz/6aJcEDmf7jOlIVt8f2REax0Z2yew== X-Received: by 2002:a05:6a21:3987:b0:1d0:7df2:cf39 with SMTP id adf61e73a8af0-1d92c49fc2bmr1883151637.7.1729233618398; Thu, 17 Oct 2024 23:40:18 -0700 (PDT) Received: from localhost.localdomain ([129.146.253.192]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-20e5a74766fsm6285455ad.73.2024.10.17.23.40.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2024 23:40:17 -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 , Serge Semin , 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 v2 6/8] net: stmmac: xgmac: Switch to common_fpe_configure() Date: Fri, 18 Oct 2024 14:39:12 +0800 Message-Id: <21491b72dfbd0d396425505b6d3e2680caf5a3da.1729233020.git.0x1207@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241017_234019_850937_1844434E X-CRM114-Status: GOOD ( 12.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Drop the redundant code and share the common one. Signed-off-by: Furong Xu <0x1207@gmail.com> --- .../net/ethernet/stmicro/stmmac/dwxgmac2.h | 1 + .../net/ethernet/stmicro/stmmac/stmmac_fpe.c | 28 +++++++------------ 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h index c66fa6040672..e1c54f3a8ee7 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h @@ -96,6 +96,7 @@ #define XGMAC_LPIIS BIT(5) #define XGMAC_PMTIS BIT(4) #define XGMAC_INT_EN 0x000000b4 +#define XGMAC_FPEIE BIT(15) #define XGMAC_TSIE BIT(12) #define XGMAC_LPIIE BIT(5) #define XGMAC_PMTIE BIT(4) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.c index 9245e360109f..dfe911b3f486 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.c @@ -360,25 +360,17 @@ static void dwxgmac3_fpe_configure(void __iomem *ioaddr, u32 num_txq, u32 num_rxq, bool tx_enable, bool pmac_enable) { - u32 value; - - if (!tx_enable) { - value = readl(ioaddr + XGMAC_MAC_FPE_CTRL_STS); - - value &= ~STMMAC_MAC_FPE_CTRL_STS_EFPE; - - writel(value, ioaddr + XGMAC_MAC_FPE_CTRL_STS); - return; - } - - value = readl(ioaddr + XGMAC_RXQ_CTRL1); - value &= ~XGMAC_FPRQ; - value |= (num_rxq - 1) << XGMAC_FPRQ_SHIFT; - writel(value, ioaddr + XGMAC_RXQ_CTRL1); + static const struct stmmac_fpe_configure_info dwxgmac3_fpe_info = { + .rxq_ctrl1_reg = XGMAC_RXQ_CTRL1, + .fprq_mask = XGMAC_FPRQ, + .fprq_shift = XGMAC_FPRQ_SHIFT, + .mac_fpe_reg = XGMAC_MAC_FPE_CTRL_STS, + .int_en_reg = XGMAC_INT_EN, + .int_en_bit = XGMAC_FPEIE, + }; - value = readl(ioaddr + XGMAC_MAC_FPE_CTRL_STS); - value |= STMMAC_MAC_FPE_CTRL_STS_EFPE; - writel(value, ioaddr + XGMAC_MAC_FPE_CTRL_STS); + common_fpe_configure(ioaddr, cfg, num_rxq, tx_enable, pmac_enable, + &dwxgmac3_fpe_info); } const struct stmmac_fpe_ops dwmac5_fpe_ops = {