From: Serge Semin <Sergey.Semin@baikalelectronics.ru>
To: Giuseppe Cavallaro <peppe.cavallaro@st.com>,
Alexandre Torgue <alexandre.torgue@st.com>,
Jose Abreu <joabreu@synopsys.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Joao Pinto <Joao.Pinto@synopsys.com>,
Jose Abreu <Jose.Abreu@synopsys.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Serge Semin <Sergey.Semin@baikalelectronics.ru>,
Serge Semin <fancer.lancer@gmail.com>,
Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>,
Pavel Parkhomenko <Pavel.Parkhomenko@baikalelectronics.ru>,
Vyacheslav Mitrofanov
<Vyacheslav.Mitrofanov@baikalelectronics.ru>,
Russell King <linux@armlinux.org.uk>,
Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>, <netdev@vger.kernel.org>,
<linux-stm32@st-md-mailman.stormreply.com>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH 13/20] net: stmmac: Move DMA Tx/Rx init methods to DW MAC lib
Date: Mon, 8 Feb 2021 17:03:34 +0300 [thread overview]
Message-ID: <20210208140341.9271-14-Sergey.Semin@baikalelectronics.ru> (raw)
In-Reply-To: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru>
These methods are identical for both DW MAC100 and DW MAC1000 cores, so
their implementation can be moved to the common for the core library.
Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
---
.../ethernet/stmicro/stmmac/dwmac1000_dma.c | 20 ++-----------------
.../ethernet/stmicro/stmmac/dwmac100_dma.c | 20 ++-----------------
.../net/ethernet/stmicro/stmmac/dwmac_dma.h | 4 ++++
.../net/ethernet/stmicro/stmmac/dwmac_lib.c | 14 +++++++++++++
4 files changed, 22 insertions(+), 36 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c
index 2bac49b49f73..2a04d9d45160 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c
@@ -110,22 +110,6 @@ static void dwmac1000_dma_init(void __iomem *ioaddr,
writel(DMA_INTR_DEFAULT_MASK, ioaddr + DMA_INTR_ENA);
}
-static void dwmac1000_dma_init_rx(void __iomem *ioaddr,
- struct stmmac_dma_cfg *dma_cfg,
- dma_addr_t dma_rx_phy, u32 chan)
-{
- /* RX descriptor base address list must be written into DMA CSR3 */
- writel(lower_32_bits(dma_rx_phy), ioaddr + DMA_RCV_BASE_ADDR);
-}
-
-static void dwmac1000_dma_init_tx(void __iomem *ioaddr,
- struct stmmac_dma_cfg *dma_cfg,
- dma_addr_t dma_tx_phy, u32 chan)
-{
- /* TX descriptor base address list must be written into DMA CSR4 */
- writel(lower_32_bits(dma_tx_phy), ioaddr + DMA_TX_BASE_ADDR);
-}
-
static u32 dwmac1000_configure_fc(u32 csr6, int rxfifosz)
{
csr6 &= ~DMA_CONTROL_RFA_MASK;
@@ -263,8 +247,8 @@ static void dwmac1000_rx_watchdog(void __iomem *ioaddr, u32 riwt,
const struct stmmac_dma_ops dwmac1000_dma_ops = {
.reset = dwmac_dma_reset,
.init = dwmac1000_dma_init,
- .init_rx_chan = dwmac1000_dma_init_rx,
- .init_tx_chan = dwmac1000_dma_init_tx,
+ .init_rx_chan = dwmac_dma_init_rx,
+ .init_tx_chan = dwmac_dma_init_tx,
.axi = dwmac1000_dma_axi,
.dump_regs = dwmac1000_dump_dma_regs,
.dma_rx_mode = dwmac1000_dma_operation_mode_rx,
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c
index 8f0d9bc7cab5..ad51a7949a42 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c
@@ -29,22 +29,6 @@ static void dwmac100_dma_init(void __iomem *ioaddr,
writel(DMA_INTR_DEFAULT_MASK, ioaddr + DMA_INTR_ENA);
}
-static void dwmac100_dma_init_rx(void __iomem *ioaddr,
- struct stmmac_dma_cfg *dma_cfg,
- dma_addr_t dma_rx_phy, u32 chan)
-{
- /* RX descriptor base addr lists must be written into DMA CSR3 */
- writel(lower_32_bits(dma_rx_phy), ioaddr + DMA_RCV_BASE_ADDR);
-}
-
-static void dwmac100_dma_init_tx(void __iomem *ioaddr,
- struct stmmac_dma_cfg *dma_cfg,
- dma_addr_t dma_tx_phy, u32 chan)
-{
- /* TX descriptor base addr lists must be written into DMA CSR4 */
- writel(lower_32_bits(dma_tx_phy), ioaddr + DMA_TX_BASE_ADDR);
-}
-
/* Store and Forward capability is not used at all.
*
* The transmit threshold can be programmed by setting the TTC bits in the DMA
@@ -111,8 +95,8 @@ static void dwmac100_dma_diagnostic_fr(void *data, struct stmmac_extra_stats *x,
const struct stmmac_dma_ops dwmac100_dma_ops = {
.reset = dwmac_dma_reset,
.init = dwmac100_dma_init,
- .init_rx_chan = dwmac100_dma_init_rx,
- .init_tx_chan = dwmac100_dma_init_tx,
+ .init_rx_chan = dwmac_dma_init_rx,
+ .init_tx_chan = dwmac_dma_init_tx,
.dump_regs = dwmac100_dump_dma_regs,
.dma_tx_mode = dwmac100_dma_operation_mode_tx,
.dma_diagnostic_fr = dwmac100_dma_diagnostic_fr,
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h b/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h
index e5dbd0bc257e..fa919bf75e19 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h
@@ -134,8 +134,12 @@
void dwmac_enable_dma_transmission(void __iomem *ioaddr);
void dwmac_enable_dma_irq(void __iomem *ioaddr, u32 chan, bool rx, bool tx);
void dwmac_disable_dma_irq(void __iomem *ioaddr, u32 chan, bool rx, bool tx);
+void dwmac_dma_init_tx(void __iomem *ioaddr, struct stmmac_dma_cfg *dma_cfg,
+ dma_addr_t dma_tx_phy, u32 chan);
void dwmac_dma_start_tx(void __iomem *ioaddr, u32 chan);
void dwmac_dma_stop_tx(void __iomem *ioaddr, u32 chan);
+void dwmac_dma_init_rx(void __iomem *ioaddr, struct stmmac_dma_cfg *dma_cfg,
+ dma_addr_t dma_rx_phy, u32 chan);
void dwmac_dma_start_rx(void __iomem *ioaddr, u32 chan);
void dwmac_dma_stop_rx(void __iomem *ioaddr, u32 chan);
int dwmac_dma_interrupt(void __iomem *ioaddr, struct stmmac_extra_stats *x,
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c b/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c
index 57a53a600aa5..6ddfc689e77b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c
@@ -56,6 +56,13 @@ void dwmac_disable_dma_irq(void __iomem *ioaddr, u32 chan, bool rx, bool tx)
writel(value, ioaddr + DMA_INTR_ENA);
}
+void dwmac_dma_init_tx(void __iomem *ioaddr, struct stmmac_dma_cfg *dma_cfg,
+ dma_addr_t dma_tx_phy, u32 chan)
+{
+ /* TX descriptor base address list must be written into DMA CSR4 */
+ writel(lower_32_bits(dma_tx_phy), ioaddr + DMA_TX_BASE_ADDR);
+}
+
void dwmac_dma_start_tx(void __iomem *ioaddr, u32 chan)
{
u32 value = readl(ioaddr + DMA_CONTROL);
@@ -70,6 +77,13 @@ void dwmac_dma_stop_tx(void __iomem *ioaddr, u32 chan)
writel(value, ioaddr + DMA_CONTROL);
}
+void dwmac_dma_init_rx(void __iomem *ioaddr, struct stmmac_dma_cfg *dma_cfg,
+ dma_addr_t dma_rx_phy, u32 chan)
+{
+ /* RX descriptor base address list must be written into DMA CSR3 */
+ writel(lower_32_bits(dma_rx_phy), ioaddr + DMA_RCV_BASE_ADDR);
+}
+
void dwmac_dma_start_rx(void __iomem *ioaddr, u32 chan)
{
u32 value = readl(ioaddr + DMA_CONTROL);
--
2.29.2
next prev parent reply other threads:[~2021-02-08 14:28 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-08 14:03 [PATCH 00/20] net: stmmac: Obvious cleanups and several fixes Serge Semin
2021-02-08 14:03 ` [PATCH 01/20] net: phy: realtek: Fix events detection failure in LPI mode Serge Semin
2021-02-08 15:27 ` Andrew Lunn
2021-02-08 17:44 ` Serge Semin
2021-02-08 19:03 ` Andrew Lunn
2021-02-08 20:14 ` Heiner Kallweit
2021-02-09 10:15 ` Serge Semin
2021-02-09 10:37 ` Heiner Kallweit
2021-02-09 10:56 ` Russell King - ARM Linux admin
2021-02-10 16:47 ` Serge Semin
2021-02-11 10:39 ` Russell King - ARM Linux admin
2021-02-11 10:52 ` Serge Semin
2021-02-20 9:02 ` Serge Semin
2021-02-20 12:51 ` Heiner Kallweit
2021-02-20 15:49 ` Andrew Lunn
2021-02-21 13:51 ` Serge Semin
2021-02-09 10:54 ` Russell King - ARM Linux admin
2021-02-08 14:03 ` [PATCH 02/20] net: stmmac: Free Rx descs on Tx allocation failure Serge Semin
2021-02-08 14:03 ` [PATCH 03/20] net: stmmac: Fix false MTL RX overflow handling for higher queues Serge Semin
2021-02-08 14:03 ` [PATCH 04/20] net: stmmac: Assert reset control after MDIO de-registration Serge Semin
2021-02-08 14:03 ` [PATCH 05/20] net: stmmac: Use dwmac410_disable_dma_irq for DW MAC v4.10 DMA Serge Semin
2021-02-08 14:03 ` [PATCH 06/20] net: stmmac: Use LPI IRQ status-related macro in DW MAC1000 isr Serge Semin
2021-02-08 14:03 ` [PATCH 07/20] net: stmmac: Clear descriptors before initializing them Serge Semin
2021-02-08 14:03 ` [PATCH 08/20] net: stmmac: Fix typo in the XGMAC_L3_ADDR3 macro name Serge Semin
2021-02-08 14:03 ` [PATCH 09/20] net: stmmac: Discard mii_irq array from private data Serge Semin
2021-02-08 19:13 ` Andrew Lunn
2021-02-08 14:03 ` [PATCH 10/20] net: stmmac: Discard Rx copybreak ethtool setting Serge Semin
2021-02-08 14:03 ` [PATCH 11/20] net: stmmac: Discard index usage in the dirty_rx init Serge Semin
2021-02-08 14:03 ` [PATCH 12/20] net: stmmac: Discard dwmac1000_dma_ops declaration from dwmac100.h Serge Semin
2021-02-08 14:03 ` Serge Semin [this message]
2021-02-08 14:03 ` [PATCH 14/20] net: stmmac: Add DW GMAC disable LPI IRQ mask macro Serge Semin
2021-02-08 14:03 ` [PATCH 15/20] net: stmmac: Discard STMMAC_RESETING flag Serge Semin
2021-02-08 14:03 ` [PATCH 16/20] net: stmmac: Discard conditional service task execution Serge Semin
2021-02-08 14:03 ` [PATCH 17/20] net: stmmac: Add 'cause' arg to the service task executioner Serge Semin
2021-02-08 14:03 ` [PATCH 18/20] net: stmmac: Move PTP clock enabling to PTP-init method Serge Semin
2021-02-08 14:03 ` [PATCH 19/20] net: stmmac: Move DMA stop procedure to HW-setup antagonist Serge Semin
2021-02-08 14:03 ` [PATCH 20/20] net: stmmac: Move MAC Tx/Rx disabling " Serge Semin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210208140341.9271-14-Sergey.Semin@baikalelectronics.ru \
--to=sergey.semin@baikalelectronics.ru \
--cc=Alexey.Malahov@baikalelectronics.ru \
--cc=Joao.Pinto@synopsys.com \
--cc=Jose.Abreu@synopsys.com \
--cc=Pavel.Parkhomenko@baikalelectronics.ru \
--cc=Vyacheslav.Mitrofanov@baikalelectronics.ru \
--cc=alexandre.torgue@st.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=fancer.lancer@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=joabreu@synopsys.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=linux@armlinux.org.uk \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=peppe.cavallaro@st.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®