f79af59383
Refresh backport patches with make target/linux/refresh. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
104 lines
4.0 KiB
Diff
104 lines
4.0 KiB
Diff
From: Lorenzo Bianconi <lorenzo@kernel.org>
|
|
Date: Thu, 24 Nov 2022 16:22:55 +0100
|
|
Subject: [PATCH] net: ethernet: mtk_wed: add reset to tx_ring_setup callback
|
|
|
|
Introduce reset parameter to mtk_wed_tx_ring_setup signature.
|
|
This is a preliminary patch to add Wireless Ethernet Dispatcher reset
|
|
support.
|
|
|
|
Co-developed-by: Sujuan Chen <sujuan.chen@mediatek.com>
|
|
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
|
|
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
|
|
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
|
---
|
|
|
|
--- a/drivers/net/ethernet/mediatek/mtk_wed.c
|
|
+++ b/drivers/net/ethernet/mediatek/mtk_wed.c
|
|
@@ -1181,7 +1181,8 @@ mtk_wed_ring_alloc(struct mtk_wed_device
|
|
}
|
|
|
|
static int
|
|
-mtk_wed_wdma_rx_ring_setup(struct mtk_wed_device *dev, int idx, int size)
|
|
+mtk_wed_wdma_rx_ring_setup(struct mtk_wed_device *dev, int idx, int size,
|
|
+ bool reset)
|
|
{
|
|
u32 desc_size = sizeof(struct mtk_wdma_desc) * dev->hw->version;
|
|
struct mtk_wed_ring *wdma;
|
|
@@ -1190,8 +1191,8 @@ mtk_wed_wdma_rx_ring_setup(struct mtk_we
|
|
return -EINVAL;
|
|
|
|
wdma = &dev->rx_wdma[idx];
|
|
- if (mtk_wed_ring_alloc(dev, wdma, MTK_WED_WDMA_RING_SIZE, desc_size,
|
|
- true))
|
|
+ if (!reset && mtk_wed_ring_alloc(dev, wdma, MTK_WED_WDMA_RING_SIZE,
|
|
+ desc_size, true))
|
|
return -ENOMEM;
|
|
|
|
wdma_w32(dev, MTK_WDMA_RING_RX(idx) + MTK_WED_RING_OFS_BASE,
|
|
@@ -1389,7 +1390,7 @@ mtk_wed_start(struct mtk_wed_device *dev
|
|
|
|
for (i = 0; i < ARRAY_SIZE(dev->rx_wdma); i++)
|
|
if (!dev->rx_wdma[i].desc)
|
|
- mtk_wed_wdma_rx_ring_setup(dev, i, 16);
|
|
+ mtk_wed_wdma_rx_ring_setup(dev, i, 16, false);
|
|
|
|
mtk_wed_hw_init(dev);
|
|
mtk_wed_configure_irq(dev, irq_mask);
|
|
@@ -1498,7 +1499,8 @@ unlock:
|
|
}
|
|
|
|
static int
|
|
-mtk_wed_tx_ring_setup(struct mtk_wed_device *dev, int idx, void __iomem *regs)
|
|
+mtk_wed_tx_ring_setup(struct mtk_wed_device *dev, int idx, void __iomem *regs,
|
|
+ bool reset)
|
|
{
|
|
struct mtk_wed_ring *ring = &dev->tx_ring[idx];
|
|
|
|
@@ -1517,11 +1519,12 @@ mtk_wed_tx_ring_setup(struct mtk_wed_dev
|
|
if (WARN_ON(idx >= ARRAY_SIZE(dev->tx_ring)))
|
|
return -EINVAL;
|
|
|
|
- if (mtk_wed_ring_alloc(dev, ring, MTK_WED_TX_RING_SIZE,
|
|
- sizeof(*ring->desc), true))
|
|
+ if (!reset && mtk_wed_ring_alloc(dev, ring, MTK_WED_TX_RING_SIZE,
|
|
+ sizeof(*ring->desc), true))
|
|
return -ENOMEM;
|
|
|
|
- if (mtk_wed_wdma_rx_ring_setup(dev, idx, MTK_WED_WDMA_RING_SIZE))
|
|
+ if (mtk_wed_wdma_rx_ring_setup(dev, idx, MTK_WED_WDMA_RING_SIZE,
|
|
+ reset))
|
|
return -ENOMEM;
|
|
|
|
ring->reg_base = MTK_WED_RING_TX(idx);
|
|
--- a/include/linux/soc/mediatek/mtk_wed.h
|
|
+++ b/include/linux/soc/mediatek/mtk_wed.h
|
|
@@ -158,7 +158,7 @@ struct mtk_wed_device {
|
|
struct mtk_wed_ops {
|
|
int (*attach)(struct mtk_wed_device *dev);
|
|
int (*tx_ring_setup)(struct mtk_wed_device *dev, int ring,
|
|
- void __iomem *regs);
|
|
+ void __iomem *regs, bool reset);
|
|
int (*rx_ring_setup)(struct mtk_wed_device *dev, int ring,
|
|
void __iomem *regs);
|
|
int (*txfree_ring_setup)(struct mtk_wed_device *dev,
|
|
@@ -216,8 +216,8 @@ mtk_wed_get_rx_capa(struct mtk_wed_devic
|
|
#define mtk_wed_device_active(_dev) !!(_dev)->ops
|
|
#define mtk_wed_device_detach(_dev) (_dev)->ops->detach(_dev)
|
|
#define mtk_wed_device_start(_dev, _mask) (_dev)->ops->start(_dev, _mask)
|
|
-#define mtk_wed_device_tx_ring_setup(_dev, _ring, _regs) \
|
|
- (_dev)->ops->tx_ring_setup(_dev, _ring, _regs)
|
|
+#define mtk_wed_device_tx_ring_setup(_dev, _ring, _regs, _reset) \
|
|
+ (_dev)->ops->tx_ring_setup(_dev, _ring, _regs, _reset)
|
|
#define mtk_wed_device_txfree_ring_setup(_dev, _regs) \
|
|
(_dev)->ops->txfree_ring_setup(_dev, _regs)
|
|
#define mtk_wed_device_reg_read(_dev, _reg) \
|
|
@@ -243,7 +243,7 @@ static inline bool mtk_wed_device_active
|
|
}
|
|
#define mtk_wed_device_detach(_dev) do {} while (0)
|
|
#define mtk_wed_device_start(_dev, _mask) do {} while (0)
|
|
-#define mtk_wed_device_tx_ring_setup(_dev, _ring, _regs) -ENODEV
|
|
+#define mtk_wed_device_tx_ring_setup(_dev, _ring, _regs, _reset) -ENODEV
|
|
#define mtk_wed_device_txfree_ring_setup(_dev, _ring, _regs) -ENODEV
|
|
#define mtk_wed_device_reg_read(_dev, _reg) 0
|
|
#define mtk_wed_device_reg_write(_dev, _reg, _val) do {} while (0)
|