Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp2554858rwi; Fri, 21 Oct 2022 05:21:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7d7aRjcs5oCCWIzpYTQpFn5PsmrA6mALNypX+rgDZ5CyaJ7B9oxjEinhCXBt/T5o2071D7 X-Received: by 2002:a17:906:db0e:b0:77b:82cf:54a6 with SMTP id xj14-20020a170906db0e00b0077b82cf54a6mr15055028ejb.691.1666354889588; Fri, 21 Oct 2022 05:21:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666354889; cv=none; d=google.com; s=arc-20160816; b=c1kkMw/5S/c2ETYtU6sP8RTDHacijzLg71iR++UEK5S9eWpj2MdashrQ8OIVH6akeZ rCx4xPT/bLEhQHyr41Py6oZVqPlTBU0eCLj1Q18xtZ5YCR78eHYLPibVPiBsdn3uPyCo riZ9GXTRk5n2JaU4e2SZNbLsSW0BAqmmmQvDAT4gqfnshUXKnAIkemVgMPdHvpMijWLH 94d/9gly45t21CHhNh8IVV3f7ypZQ9Qf0xVpwR3YTZYVnPdJO87gCiRs4mh7DlPmiZ68 mG3mrIyLwLLMkrBKXC1Cp979uRgqerXSz7aysM8NeYRPY26EJbU6i92Qy9heCdw/L65C 8Tzw== 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=eo7v2XpMJF4gtv1nLx6LNm55I3cDwEAWMHivvxK9wBs=; b=VdIJYBYHc36ZJ6/X5frfkBWjlM9xnO1UqZCw/rvNc0vQ4FabtiwjRh5XCK5AZC4toJ ptzrclB9+Rti0vxI3vyUgeKLWdS+zOfTKeK+298EWXio5IHP3RrBezs42IfzZFBaURTB 52leeC5Ju6NcmEk6NbxxrYeChaQd7set0+iUdiC+mDn6wtC6qvOOzHp1twE6Jx9ywKQJ //t+djHRHdDmKOsrZkKERV7WlebEip08ykgJXRnfuB4jag4fRTqS3ju0Ln9NDN/qpuLi DlOtas2qmrlk4RR/m5cwnY290ygA53Go96ohXQuxX5H+sm8ukXCYZOA39P+ah/kRfe1E eKag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=loxhvW5S; 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=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i13-20020a1709064fcd00b00780def41dc4si21443586ejw.527.2022.10.21.05.21.04; Fri, 21 Oct 2022 05:21:29 -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=@intel.com header.s=Intel header.b=loxhvW5S; 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=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229832AbiJUL4o (ORCPT + 99 others); Fri, 21 Oct 2022 07:56:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230070AbiJUL4l (ORCPT ); Fri, 21 Oct 2022 07:56:41 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3ED65262DFD; Fri, 21 Oct 2022 04:56:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666353393; x=1697889393; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=X4ReGExCC4IsU35G/nCfB0MLcAh4NzfBpvMtiQxP8CQ=; b=loxhvW5SOviAIKBj3efLMWmGt3uWx0KRTW0gDh2/WsNNdEmzHeSQk9k4 /EQPj4igUi9nLiJIMZyyMdcpDqh6k0cyeh2W86KxlMaN/n2inznnDe1jr Y0UONI27XfwUpWmhpYrqtpocHqJvBOo9cHkg2Cr3cwp3jSegpLlDYsTH7 1ET06XLmsqGjNRDVpu7EGjCF0XjJ97O0tmf8ImxXTmzffgC6go5zCj5lE SZxjLpXujSmQRqIb8vQODZiObZ0vUog+SlwhG5Esq8mDGoL5hz5mVjkSz ftb/l+7wyycuFWMsKKpIjfKvi5ht5BLbGn87VsPkh1b5j/vgdZzb3cDDU A==; X-IronPort-AV: E=McAfee;i="6500,9779,10506"; a="393286605" X-IronPort-AV: E=Sophos;i="5.95,200,1661842800"; d="scan'208";a="393286605" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 04:56:32 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10506"; a="632891131" X-IronPort-AV: E=Sophos;i="5.95,200,1661842800"; d="scan'208";a="632891131" Received: from junxiaochang.bj.intel.com ([10.238.135.52]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 04:56:28 -0700 From: Junxiao Chang To: peppe.cavallaro@st.com, alexandre.torgue@foss.st.com, joabreu@synopsys.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, mcoquelin.stm32@gmail.com, Joao.Pinto@synopsys.com, netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: junxiao.chang@intel.com Subject: [PATCH net-next 2/2] net: stmmac: remove duplicate dma queue channel macros Date: Fri, 21 Oct 2022 19:47:11 +0800 Message-Id: <20221021114711.1610797-2-junxiao.chang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221021114711.1610797-1-junxiao.chang@intel.com> References: <20221021114711.1610797-1-junxiao.chang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED 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 It doesn't need extra macros for queue 0 & 4. Same macro could be used for all 8 queues. Signed-off-by: Junxiao Chang --- drivers/net/ethernet/stmicro/stmmac/dwmac4.h | 2 -- drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 11 ++++------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4.h b/drivers/net/ethernet/stmicro/stmmac/dwmac4.h index 3c1490408a1c3..ccd49346d3b30 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4.h +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4.h @@ -331,8 +331,6 @@ enum power_event { #define MTL_RXQ_DMA_MAP0 0x00000c30 /* queue 0 to 3 */ #define MTL_RXQ_DMA_MAP1 0x00000c34 /* queue 4 to 7 */ -#define MTL_RXQ_DMA_Q04MDMACH_MASK GENMASK(3, 0) -#define MTL_RXQ_DMA_Q04MDMACH(x) ((x) << 0) #define MTL_RXQ_DMA_QXMDMACH_MASK(x) (0xf << 8 * (x)) #define MTL_RXQ_DMA_QXMDMACH(chan, q) ((chan) << (8 * (q))) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c index c25bfecb4a2df..64b916728bdd4 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c @@ -219,15 +219,12 @@ static void dwmac4_map_mtl_dma(struct mac_device_info *hw, u32 queue, u32 chan) else value = readl(ioaddr + MTL_RXQ_DMA_MAP1); - if (queue == 0 || queue == 4) { - value &= ~MTL_RXQ_DMA_Q04MDMACH_MASK; - value |= MTL_RXQ_DMA_Q04MDMACH(chan); - } else if (queue > 4) { - value &= ~MTL_RXQ_DMA_QXMDMACH_MASK(queue - 4); - value |= MTL_RXQ_DMA_QXMDMACH(chan, queue - 4); - } else { + if (queue < 4) { value &= ~MTL_RXQ_DMA_QXMDMACH_MASK(queue); value |= MTL_RXQ_DMA_QXMDMACH(chan, queue); + } else { + value &= ~MTL_RXQ_DMA_QXMDMACH_MASK(queue - 4); + value |= MTL_RXQ_DMA_QXMDMACH(chan, queue - 4); } if (queue < 4) -- 2.25.1