Skip to content

Commit f1e2eef

Browse files
moore-brosnbd168
authored andcommitted
mt76: mt7921: use physical addr to unify register access
Use physical address to unify the register access and reorder the entries in fixed_map table to accelerate the address lookup for MT7921e. Cosmetics the patch with adding an extra space to make all entries in the array style consistent. Tested-by: Deren Wu <[email protected]> Acked-by: Lorenzo Bianconi <[email protected]> Signed-off-by: Sean Wang <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
1 parent f0ff5d3 commit f1e2eef

File tree

2 files changed

+25
-24
lines changed

2 files changed

+25
-24
lines changed

drivers/net/wireless/mediatek/mt76/mt7921/dma.c

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -85,36 +85,37 @@ static u32 __mt7921_reg_addr(struct mt7921_dev *dev, u32 addr)
8585
u32 mapped;
8686
u32 size;
8787
} fixed_map[] = {
88-
{ 0x00400000, 0x80000, 0x10000}, /* WF_MCU_SYSRAM */
89-
{ 0x00410000, 0x90000, 0x10000}, /* WF_MCU_SYSRAM (configure register) */
90-
{ 0x40000000, 0x70000, 0x10000}, /* WF_UMAC_SYSRAM */
88+
{ 0x820d0000, 0x30000, 0x10000 }, /* WF_LMAC_TOP (WF_WTBLON) */
89+
{ 0x820ed000, 0x24800, 0x0800 }, /* WF_LMAC_TOP BN0 (WF_MIB) */
90+
{ 0x820e4000, 0x21000, 0x0400 }, /* WF_LMAC_TOP BN0 (WF_TMAC) */
91+
{ 0x820e7000, 0x21e00, 0x0200 }, /* WF_LMAC_TOP BN0 (WF_DMA) */
92+
{ 0x820eb000, 0x24200, 0x0400 }, /* WF_LMAC_TOP BN0 (WF_LPON) */
93+
{ 0x820e2000, 0x20800, 0x0400 }, /* WF_LMAC_TOP BN0 (WF_AGG) */
94+
{ 0x820e3000, 0x20c00, 0x0400 }, /* WF_LMAC_TOP BN0 (WF_ARB) */
95+
{ 0x820e5000, 0x21400, 0x0800 }, /* WF_LMAC_TOP BN0 (WF_RMAC) */
96+
{ 0x00400000, 0x80000, 0x10000 }, /* WF_MCU_SYSRAM */
97+
{ 0x00410000, 0x90000, 0x10000 }, /* WF_MCU_SYSRAM (configure register) */
98+
{ 0x40000000, 0x70000, 0x10000 }, /* WF_UMAC_SYSRAM */
9199
{ 0x54000000, 0x02000, 0x1000 }, /* WFDMA PCIE0 MCU DMA0 */
92100
{ 0x55000000, 0x03000, 0x1000 }, /* WFDMA PCIE0 MCU DMA1 */
93101
{ 0x58000000, 0x06000, 0x1000 }, /* WFDMA PCIE1 MCU DMA0 (MEM_DMA) */
94102
{ 0x59000000, 0x07000, 0x1000 }, /* WFDMA PCIE1 MCU DMA1 */
95103
{ 0x7c000000, 0xf0000, 0x10000 }, /* CONN_INFRA */
96104
{ 0x7c020000, 0xd0000, 0x10000 }, /* CONN_INFRA, WFDMA */
97-
{ 0x7c060000, 0xe0000, 0x10000}, /* CONN_INFRA, conn_host_csr_top */
105+
{ 0x7c060000, 0xe0000, 0x10000 }, /* CONN_INFRA, conn_host_csr_top */
98106
{ 0x80020000, 0xb0000, 0x10000 }, /* WF_TOP_MISC_OFF */
99107
{ 0x81020000, 0xc0000, 0x10000 }, /* WF_TOP_MISC_ON */
100108
{ 0x820c0000, 0x08000, 0x4000 }, /* WF_UMAC_TOP (PLE) */
101109
{ 0x820c8000, 0x0c000, 0x2000 }, /* WF_UMAC_TOP (PSE) */
102-
{ 0x820cc000, 0x0e000, 0x2000 }, /* WF_UMAC_TOP (PP) */
110+
{ 0x820cc000, 0x0e000, 0x1000 }, /* WF_UMAC_TOP (PP) */
111+
{ 0x820cd000, 0x0f000, 0x1000 }, /* WF_MDP_TOP */
103112
{ 0x820ce000, 0x21c00, 0x0200 }, /* WF_LMAC_TOP (WF_SEC) */
104113
{ 0x820cf000, 0x22000, 0x1000 }, /* WF_LMAC_TOP (WF_PF) */
105-
{ 0x820d0000, 0x30000, 0x10000 }, /* WF_LMAC_TOP (WF_WTBLON) */
106114
{ 0x820e0000, 0x20000, 0x0400 }, /* WF_LMAC_TOP BN0 (WF_CFG) */
107115
{ 0x820e1000, 0x20400, 0x0200 }, /* WF_LMAC_TOP BN0 (WF_TRB) */
108-
{ 0x820e2000, 0x20800, 0x0400 }, /* WF_LMAC_TOP BN0 (WF_AGG) */
109-
{ 0x820e3000, 0x20c00, 0x0400 }, /* WF_LMAC_TOP BN0 (WF_ARB) */
110-
{ 0x820e4000, 0x21000, 0x0400 }, /* WF_LMAC_TOP BN0 (WF_TMAC) */
111-
{ 0x820e5000, 0x21400, 0x0800 }, /* WF_LMAC_TOP BN0 (WF_RMAC) */
112-
{ 0x820e7000, 0x21e00, 0x0200 }, /* WF_LMAC_TOP BN0 (WF_DMA) */
113116
{ 0x820e9000, 0x23400, 0x0200 }, /* WF_LMAC_TOP BN0 (WF_WTBLOFF) */
114117
{ 0x820ea000, 0x24000, 0x0200 }, /* WF_LMAC_TOP BN0 (WF_ETBF) */
115-
{ 0x820eb000, 0x24200, 0x0400 }, /* WF_LMAC_TOP BN0 (WF_LPON) */
116118
{ 0x820ec000, 0x24600, 0x0200 }, /* WF_LMAC_TOP BN0 (WF_INT) */
117-
{ 0x820ed000, 0x24800, 0x0800 }, /* WF_LMAC_TOP BN0 (WF_MIB) */
118119
{ 0x820f0000, 0xa0000, 0x0400 }, /* WF_LMAC_TOP BN1 (WF_CFG) */
119120
{ 0x820f1000, 0xa0600, 0x0200 }, /* WF_LMAC_TOP BN1 (WF_TRB) */
120121
{ 0x820f2000, 0xa0800, 0x0400 }, /* WF_LMAC_TOP BN1 (WF_AGG) */

drivers/net/wireless/mediatek/mt76/mt7921/regs.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#define MT_MCU_INT_EVENT_SER_TRIGGER BIT(2)
1515
#define MT_MCU_INT_EVENT_RESET_DONE BIT(3)
1616

17-
#define MT_PLE_BASE 0x8000
17+
#define MT_PLE_BASE 0x820c0000
1818
#define MT_PLE(ofs) (MT_PLE_BASE + (ofs))
1919

2020
#define MT_PLE_FL_Q0_CTRL MT_PLE(0x1b0)
@@ -26,7 +26,7 @@
2626
((n) << 2))
2727
#define MT_PLE_AMSDU_PACK_MSDU_CNT(n) MT_PLE(0x10e0 + ((n) << 2))
2828

29-
#define MT_MDP_BASE 0xf000
29+
#define MT_MDP_BASE 0x820cd000
3030
#define MT_MDP(ofs) (MT_MDP_BASE + (ofs))
3131

3232
#define MT_MDP_DCR0 MT_MDP(0x000)
@@ -49,7 +49,7 @@
4949
#define MT_MDP_TO_WM 1
5050

5151
/* TMAC: band 0(0x21000), band 1(0xa1000) */
52-
#define MT_WF_TMAC_BASE(_band) ((_band) ? 0xa1000 : 0x21000)
52+
#define MT_WF_TMAC_BASE(_band) ((_band) ? 0x820f4000 : 0x820e4000)
5353
#define MT_WF_TMAC(_band, ofs) (MT_WF_TMAC_BASE(_band) + (ofs))
5454

5555
#define MT_TMAC_TCR0(_band) MT_WF_TMAC(_band, 0)
@@ -74,15 +74,15 @@
7474
#define MT_TMAC_TRCR0(_band) MT_WF_TMAC(_band, 0x09c)
7575
#define MT_TMAC_TFCR0(_band) MT_WF_TMAC(_band, 0x1e0)
7676

77-
#define MT_WF_DMA_BASE(_band) ((_band) ? 0xa1e00 : 0x21e00)
77+
#define MT_WF_DMA_BASE(_band) ((_band) ? 0x820f7000 : 0x820e7000)
7878
#define MT_WF_DMA(_band, ofs) (MT_WF_DMA_BASE(_band) + (ofs))
7979

8080
#define MT_DMA_DCR0(_band) MT_WF_DMA(_band, 0x000)
8181
#define MT_DMA_DCR0_MAX_RX_LEN GENMASK(15, 3)
8282
#define MT_DMA_DCR0_RXD_G5_EN BIT(23)
8383

8484
/* LPON: band 0(0x24200), band 1(0xa4200) */
85-
#define MT_WF_LPON_BASE(_band) ((_band) ? 0xa4200 : 0x24200)
85+
#define MT_WF_LPON_BASE(_band) ((_band) ? 0x820fb000 : 0x820eb000)
8686
#define MT_WF_LPON(_band, ofs) (MT_WF_LPON_BASE(_band) + (ofs))
8787

8888
#define MT_LPON_UTTR0(_band) MT_WF_LPON(_band, 0x080)
@@ -93,7 +93,7 @@
9393
#define MT_LPON_TCR_SW_WRITE BIT(0)
9494

9595
/* MIB: band 0(0x24800), band 1(0xa4800) */
96-
#define MT_WF_MIB_BASE(_band) ((_band) ? 0xa4800 : 0x24800)
96+
#define MT_WF_MIB_BASE(_band) ((_band) ? 0x820fd000 : 0x820ed000)
9797
#define MT_WF_MIB(_band, ofs) (MT_WF_MIB_BASE(_band) + (ofs))
9898

9999
#define MT_MIB_SCR1(_band) MT_WF_MIB(_band, 0x004)
@@ -142,7 +142,7 @@
142142
#define MT_MIB_ARNG(_band, n) MT_WF_MIB(_band, 0x0b0 + ((n) << 2))
143143
#define MT_MIB_ARNCR_RANGE(val, n) (((val) >> ((n) << 3)) & GENMASK(7, 0))
144144

145-
#define MT_WTBLON_TOP_BASE 0x34000
145+
#define MT_WTBLON_TOP_BASE 0x820d4000
146146
#define MT_WTBLON_TOP(ofs) (MT_WTBLON_TOP_BASE + (ofs))
147147
#define MT_WTBLON_TOP_WDUCR MT_WTBLON_TOP(0x200)
148148
#define MT_WTBLON_TOP_WDUCR_GROUP GENMASK(2, 0)
@@ -152,15 +152,15 @@
152152
#define MT_WTBL_UPDATE_ADM_COUNT_CLEAR BIT(12)
153153
#define MT_WTBL_UPDATE_BUSY BIT(31)
154154

155-
#define MT_WTBL_BASE 0x38000
155+
#define MT_WTBL_BASE 0x820d8000
156156
#define MT_WTBL_LMAC_ID GENMASK(14, 8)
157157
#define MT_WTBL_LMAC_DW GENMASK(7, 2)
158158
#define MT_WTBL_LMAC_OFFS(_id, _dw) (MT_WTBL_BASE | \
159159
FIELD_PREP(MT_WTBL_LMAC_ID, _id) | \
160160
FIELD_PREP(MT_WTBL_LMAC_DW, _dw))
161161

162162
/* AGG: band 0(0x20800), band 1(0xa0800) */
163-
#define MT_WF_AGG_BASE(_band) ((_band) ? 0xa0800 : 0x20800)
163+
#define MT_WF_AGG_BASE(_band) ((_band) ? 0x820f2000 : 0x820e2000)
164164
#define MT_WF_AGG(_band, ofs) (MT_WF_AGG_BASE(_band) + (ofs))
165165

166166
#define MT_AGG_AWSCR0(_band, _n) MT_WF_AGG(_band, 0x05c + (_n) * 4)
@@ -191,7 +191,7 @@
191191
#define MT_AGG_ATCR3(_band) MT_WF_AGG(_band, 0x0f4)
192192

193193
/* ARB: band 0(0x20c00), band 1(0xa0c00) */
194-
#define MT_WF_ARB_BASE(_band) ((_band) ? 0xa0c00 : 0x20c00)
194+
#define MT_WF_ARB_BASE(_band) ((_band) ? 0x820f3000 : 0x820e3000)
195195
#define MT_WF_ARB(_band, ofs) (MT_WF_ARB_BASE(_band) + (ofs))
196196

197197
#define MT_ARB_SCR(_band) MT_WF_ARB(_band, 0x080)
@@ -201,7 +201,7 @@
201201
#define MT_ARB_DRNGR0(_band, _n) MT_WF_ARB(_band, 0x194 + (_n) * 4)
202202

203203
/* RMAC: band 0(0x21400), band 1(0xa1400) */
204-
#define MT_WF_RMAC_BASE(_band) ((_band) ? 0xa1400 : 0x21400)
204+
#define MT_WF_RMAC_BASE(_band) ((_band) ? 0x820f5000 : 0x820e5000)
205205
#define MT_WF_RMAC(_band, ofs) (MT_WF_RMAC_BASE(_band) + (ofs))
206206

207207
#define MT_WF_RFCR(_band) MT_WF_RMAC(_band, 0x000)

0 commit comments

Comments
 (0)