98d782b1d0740922b263888200e1227854270084
[openwrt/staging/xback.git] /
1 From: Lorenzo Bianconi <lorenzo@kernel.org>
2 Date: Mon, 18 Sep 2023 12:29:09 +0200
3 Subject: [PATCH] net: ethernet: mtk_wed: move mem_region array out of
4 mtk_wed_mcu_load_firmware
5
6 Remove mtk_wed_wo_memory_region boot structure in mtk_wed_wo.
7 This is a preliminary patch to introduce WED support for MT7988 SoC.
8
9 Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
10 Signed-off-by: Paolo Abeni <pabeni@redhat.com>
11 ---
12
13 --- a/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
14 +++ b/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
15 @@ -16,14 +16,30 @@
16 #include "mtk_wed_wo.h"
17 #include "mtk_wed.h"
18
19 +static struct mtk_wed_wo_memory_region mem_region[] = {
20 + [MTK_WED_WO_REGION_EMI] = {
21 + .name = "wo-emi",
22 + },
23 + [MTK_WED_WO_REGION_ILM] = {
24 + .name = "wo-ilm",
25 + },
26 + [MTK_WED_WO_REGION_DATA] = {
27 + .name = "wo-data",
28 + .shared = true,
29 + },
30 + [MTK_WED_WO_REGION_BOOT] = {
31 + .name = "wo-boot",
32 + },
33 +};
34 +
35 static u32 wo_r32(struct mtk_wed_wo *wo, u32 reg)
36 {
37 - return readl(wo->boot.addr + reg);
38 + return readl(mem_region[MTK_WED_WO_REGION_BOOT].addr + reg);
39 }
40
41 static void wo_w32(struct mtk_wed_wo *wo, u32 reg, u32 val)
42 {
43 - writel(val, wo->boot.addr + reg);
44 + writel(val, mem_region[MTK_WED_WO_REGION_BOOT].addr + reg);
45 }
46
47 static struct sk_buff *
48 @@ -294,18 +310,6 @@ next:
49 static int
50 mtk_wed_mcu_load_firmware(struct mtk_wed_wo *wo)
51 {
52 - static struct mtk_wed_wo_memory_region mem_region[] = {
53 - [MTK_WED_WO_REGION_EMI] = {
54 - .name = "wo-emi",
55 - },
56 - [MTK_WED_WO_REGION_ILM] = {
57 - .name = "wo-ilm",
58 - },
59 - [MTK_WED_WO_REGION_DATA] = {
60 - .name = "wo-data",
61 - .shared = true,
62 - },
63 - };
64 const struct mtk_wed_fw_trailer *trailer;
65 const struct firmware *fw;
66 const char *fw_name;
67 @@ -319,11 +323,6 @@ mtk_wed_mcu_load_firmware(struct mtk_wed
68 return ret;
69 }
70
71 - wo->boot.name = "wo-boot";
72 - ret = mtk_wed_get_memory_region(wo, &wo->boot);
73 - if (ret)
74 - return ret;
75 -
76 /* set dummy cr */
77 wed_w32(wo->hw->wed_dev, MTK_WED_SCR0 + 4 * MTK_WED_DUMMY_CR_FWDL,
78 wo->hw->index + 1);
79 --- a/drivers/net/ethernet/mediatek/mtk_wed_wo.h
80 +++ b/drivers/net/ethernet/mediatek/mtk_wed_wo.h
81 @@ -228,7 +228,6 @@ struct mtk_wed_wo_queue {
82
83 struct mtk_wed_wo {
84 struct mtk_wed_hw *hw;
85 - struct mtk_wed_wo_memory_region boot;
86
87 struct mtk_wed_wo_queue q_tx;
88 struct mtk_wed_wo_queue q_rx;