developer | ee39bcf | 2023-06-16 08:03:30 +0800 | [diff] [blame^] | 1 | From 3bddc232ca043699e893d279a3ec1f72ff6b9fae Mon Sep 17 00:00:00 2001 |
developer | e0cbe33 | 2022-09-10 17:36:02 +0800 | [diff] [blame] | 2 | From: Sujuan Chen <sujuan.chen@mediatek.com> |
developer | ee39bcf | 2023-06-16 08:03:30 +0800 | [diff] [blame^] | 3 | Date: Sat, 10 Sep 2022 15:42:32 +0800 |
| 4 | Subject: [PATCH] 9996-add-wed-tx-wds-support-on-panther |
developer | e0cbe33 | 2022-09-10 17:36:02 +0800 | [diff] [blame] | 5 | |
developer | ee39bcf | 2023-06-16 08:03:30 +0800 | [diff] [blame^] | 6 | Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com> |
developer | e0cbe33 | 2022-09-10 17:36:02 +0800 | [diff] [blame] | 7 | --- |
developer | 203096a | 2022-09-13 21:07:19 +0800 | [diff] [blame] | 8 | drivers/net/ethernet/mediatek/mtk_wed.c | 8 +++++++- |
developer | e0cbe33 | 2022-09-10 17:36:02 +0800 | [diff] [blame] | 9 | drivers/net/ethernet/mediatek/mtk_wed_regs.h | 1 + |
developer | 203096a | 2022-09-13 21:07:19 +0800 | [diff] [blame] | 10 | include/linux/soc/mediatek/mtk_wed.h | 3 +++ |
| 11 | 3 files changed, 11 insertions(+), 1 deletion(-) |
developer | e0cbe33 | 2022-09-10 17:36:02 +0800 | [diff] [blame] | 12 | |
| 13 | diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c |
developer | ee39bcf | 2023-06-16 08:03:30 +0800 | [diff] [blame^] | 14 | index 48b0353..472726e 100644 |
developer | e0cbe33 | 2022-09-10 17:36:02 +0800 | [diff] [blame] | 15 | --- a/drivers/net/ethernet/mediatek/mtk_wed.c |
| 16 | +++ b/drivers/net/ethernet/mediatek/mtk_wed.c |
developer | 203096a | 2022-09-13 21:07:19 +0800 | [diff] [blame] | 17 | @@ -797,7 +797,7 @@ mtk_wed_start(struct mtk_wed_device *dev, u32 irq_mask) |
| 18 | val |= BIT(0); |
| 19 | regmap_write(dev->hw->mirror, dev->hw->index * 4, val); |
| 20 | } else { |
| 21 | - mtk_wed_set_512_support(dev, true); |
| 22 | + mtk_wed_set_512_support(dev, dev->wlan.wcid_512); |
| 23 | } |
| 24 | |
| 25 | mtk_wed_dma_enable(dev); |
developer | e0cbe33 | 2022-09-10 17:36:02 +0800 | [diff] [blame] | 26 | @@ -809,6 +809,7 @@ mtk_wed_attach(struct mtk_wed_device *dev) |
| 27 | __releases(RCU) |
| 28 | { |
| 29 | struct mtk_wed_hw *hw; |
| 30 | + u16 ver; |
| 31 | int ret = 0; |
| 32 | |
| 33 | RCU_LOCKDEP_WARN(!rcu_read_lock_held(), |
| 34 | @@ -839,6 +840,11 @@ mtk_wed_attach(struct mtk_wed_device *dev) |
| 35 | |
| 36 | dev->ver = FIELD_GET(MTK_WED_REV_ID_MAJOR, |
| 37 | wed_r32(dev, MTK_WED_REV_ID)); |
| 38 | + if (dev->ver > MTK_WED_V1) |
| 39 | + ver = FIELD_GET(MTK_WED_REV_ID_MINOR, |
| 40 | + wed_r32(dev, MTK_WED_REV_ID)); |
| 41 | + |
| 42 | + dev->rev_id = ((dev->ver << 28) | ver << 16); |
| 43 | |
| 44 | ret = mtk_wed_buffer_alloc(dev); |
| 45 | if (ret) { |
| 46 | diff --git a/drivers/net/ethernet/mediatek/mtk_wed_regs.h b/drivers/net/ethernet/mediatek/mtk_wed_regs.h |
developer | ee39bcf | 2023-06-16 08:03:30 +0800 | [diff] [blame^] | 47 | index e107de7..b189761 100644 |
developer | e0cbe33 | 2022-09-10 17:36:02 +0800 | [diff] [blame] | 48 | --- a/drivers/net/ethernet/mediatek/mtk_wed_regs.h |
| 49 | +++ b/drivers/net/ethernet/mediatek/mtk_wed_regs.h |
| 50 | @@ -31,6 +31,7 @@ struct mtk_wdma_desc { |
| 51 | #define MTK_WED_REV_ID 0x000 |
| 52 | #define MTK_WED_REV_ID_MAJOR GENMASK(7, 0) |
| 53 | #endif |
| 54 | +#define MTK_WED_REV_ID_MINOR GENMASK(27, 16) |
| 55 | |
| 56 | #define MTK_WED_RESET 0x008 |
| 57 | #define MTK_WED_RESET_TX_BM BIT(0) |
| 58 | diff --git a/include/linux/soc/mediatek/mtk_wed.h b/include/linux/soc/mediatek/mtk_wed.h |
developer | 203096a | 2022-09-13 21:07:19 +0800 | [diff] [blame] | 59 | index ffd547a..e914cb4 100644 |
developer | e0cbe33 | 2022-09-10 17:36:02 +0800 | [diff] [blame] | 60 | --- a/include/linux/soc/mediatek/mtk_wed.h |
| 61 | +++ b/include/linux/soc/mediatek/mtk_wed.h |
| 62 | @@ -42,6 +42,7 @@ struct mtk_wed_device { |
| 63 | int wdma_idx; |
| 64 | int irq; |
| 65 | u8 ver; |
| 66 | + u32 rev_id; |
| 67 | |
| 68 | struct mtk_wed_ring tx_ring[MTK_WED_TX_QUEUES]; |
| 69 | struct mtk_wed_ring txfree_ring; |
developer | 203096a | 2022-09-13 21:07:19 +0800 | [diff] [blame] | 70 | @@ -72,6 +73,8 @@ struct mtk_wed_device { |
| 71 | u16 token_start; |
| 72 | unsigned int nbuf; |
| 73 | |
| 74 | + bool wcid_512; |
| 75 | + |
| 76 | u32 (*init_buf)(void *ptr, dma_addr_t phys, int token_id); |
| 77 | int (*offload_enable)(struct mtk_wed_device *wed); |
| 78 | void (*offload_disable)(struct mtk_wed_device *wed); |
developer | e0cbe33 | 2022-09-10 17:36:02 +0800 | [diff] [blame] | 79 | -- |
| 80 | 2.18.0 |
| 81 | |