[PATCH net-next 08/14] net: bcmgenet: remove dma_ctrl argument

Doug Berger
2025-03-06T19:27:41Z

Since the individual queues manage their own DMA enables there
is no need to return dma_ctrl from bcmgenet_dma_disable() and
pass it back to bcmgenet_enable_dma().

Signed-off-by: Doug Berger <opendmb@gmail.com>
---
.../net/ethernet/broadcom/genet/bcmgenet.c | 21 +++++++------------
1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index ea575e5ae499..56fe4526c479 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -3165,8 +3165,7 @@ static void bcmgenet_get_hw_addr(struct bcmgenet_priv *priv,
put_unaligned_be16(addr_tmp, &addr[4]);
}

-/* Returns a reusable dma control register value */
-static u32 bcmgenet_dma_disable(struct bcmgenet_priv *priv, bool flush_rx)
+static void bcmgenet_dma_disable(struct bcmgenet_priv *priv, bool flush_rx)
{
unsigned int i;
u32 reg;
@@ -3198,20 +3197,18 @@ static u32 bcmgenet_dma_disable(struct bcmgenet_priv *priv, bool flush_rx)
bcmgenet_rbuf_ctrl_set(priv, reg);
udelay(10);
}
-
- return dma_ctrl;
}

-static void bcmgenet_enable_dma(struct bcmgenet_priv *priv, u32 dma_ctrl)
+static void bcmgenet_enable_dma(struct bcmgenet_priv *priv)
{
u32 reg;

reg = bcmgenet_rdma_readl(priv, DMA_CTRL);
- reg |= dma_ctrl;
+ reg |= DMA_EN;
bcmgenet_rdma_writel(priv, reg, DMA_CTRL);

reg = bcmgenet_tdma_readl(priv, DMA_CTRL);
- reg |= dma_ctrl;
+ reg |= DMA_EN;
bcmgenet_tdma_writel(priv, reg, DMA_CTRL);
}

@@ -3238,7 +3235,6 @@ static void bcmgenet_netif_start(struct net_device *dev)
static int bcmgenet_open(struct net_device *dev)
{
struct bcmgenet_priv *priv = netdev_priv(dev);
- unsigned long dma_ctrl;
int ret;

netif_dbg(priv, ifup, dev, "bcmgenet_open\n");
@@ -3268,7 +3264,7 @@ static int bcmgenet_open(struct net_device *dev)
bcmgenet_hfb_init(priv);

/* Disable RX/TX DMA and flush TX and RX queues */
- dma_ctrl = bcmgenet_dma_disable(priv, true);
+ bcmgenet_dma_disable(priv, true);

/* Reinitialize TDMA and RDMA and SW housekeeping */
ret = bcmgenet_init_dma(priv);
@@ -3277,7 +3273,7 @@ static int bcmgenet_open(struct net_device *dev)
goto err_clk_disable;
}

- bcmgenet_enable_dma(priv, dma_ctrl);
+ bcmgenet_enable_dma(priv);

ret = request_irq(priv->irq0, bcmgenet_isr0, IRQF_SHARED,
dev->name, priv);
@@ -4067,7 +4063,6 @@ static int bcmgenet_resume(struct device *d)
struct net_device *dev = dev_get_drvdata(d);
struct bcmgenet_priv *priv = netdev_priv(dev);
struct bcmgenet_rxnfc_rule *rule;
- unsigned long dma_ctrl;
int ret;

if (!netif_running(dev))
@@ -4105,7 +4100,7 @@ static int bcmgenet_resume(struct device *d)
bcmgenet_hfb_create_rxnfc_filter(priv, rule);

/* Disable RX/TX DMA and flush TX queues */
- dma_ctrl = bcmgenet_dma_disable(priv, false);
+ bcmgenet_dma_disable(priv, false);

/* Reinitialize TDMA and RDMA and SW housekeeping */
ret = bcmgenet_init_dma(priv);
@@ -4114,7 +4109,7 @@ static int bcmgenet_resume(struct device *d)
goto out_clk_disable;
}

- bcmgenet_enable_dma(priv, dma_ctrl);
+ bcmgenet_enable_dma(priv);

if (!device_may_wakeup(d))
phy_resume(dev->phydev);
--
2.34.1