Skip to content

Commit ed39d0d

Browse files
xdarklightlwfinger
authored andcommitted
wifi: rtw88: sdio: Add HCI implementation for SDIO based chipsets
Add a sub-driver for SDIO based chipsets which implements the following functionality: - register accessors for 8, 16 and 32 bits for all states of the card (including usage of 4x 8 bit access for one 32 bit buffer if the card is not fully powered on yet - or if it's fully powered on then 1x 32 bit access is used) - checking whether there's space in the TX FIFO queue to transmit data - transfers from the host to the device for actual network traffic, reserved pages (for firmware download) and H2C (host-to-card) transfers - receiving data from the device - deep power saving state The transmit path is optimized so DMA-capable SDIO host controllers can directly use the buffers provided because the buffer's physical addresses are 8 byte aligned. The receive path is prepared to support RX aggregation where the chipset combines multiple MAC frames into one bigger buffer to reduce SDIO transfer overhead. Co-developed-by: Jernej Skrabec <[email protected]> Signed-off-by: Jernej Skrabec <[email protected]> Reviewed-by: Ulf Hansson <[email protected]> Signed-off-by: Martin Blumenstingl <[email protected]>
1 parent 28b3f26 commit ed39d0d

File tree

6 files changed

+1440
-1
lines changed

6 files changed

+1440
-1
lines changed

debug.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ enum rtw_debug_mask {
2424
RTW_DBG_ADAPTIVITY = 0x00008000,
2525
RTW_DBG_HW_SCAN = 0x00010000,
2626
RTW_DBG_STATE = 0x00020000,
27+
RTW_DBG_SDIO = 0x00040000,
2728

2829
RTW_DBG_ALL = 0xffffffff
2930
};

mac.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "reg.h"
88
#include "fw.h"
99
#include "debug.h"
10+
#include "sdio.h"
1011

1112
void rtw_set_channel_mac(struct rtw_dev *rtwdev, u8 channel, u8 bw,
1213
u8 primary_ch_idx)

mac.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
#define RTW_HW_PORT_NUM 5
99
#define cut_version_to_mask(cut) (0x1 << ((cut) + 1))
10-
#define SDIO_LOCAL_OFFSET 0x10250000
1110
#define DDMA_POLLING_COUNT 1000
1211
#define C2H_PKT_BUF 256
1312
#define REPORT_BUF 128

reg.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
#define BIT_LTE_MUX_CTRL_PATH BIT(26)
8888
#define REG_HCI_OPT_CTRL 0x0074
8989
#define BIT_USB_SUS_DIS BIT(8)
90+
#define BIT_SDIO_PAD_E5 BIT(18)
9091

9192
#define REG_AFE_CTRL_4 0x0078
9293
#define BIT_CK320M_AFE_EN BIT(4)
@@ -185,6 +186,9 @@
185186
(((x) & BIT_MASK_TXDMA_VIQ_MAP) << BIT_SHIFT_TXDMA_VIQ_MAP)
186187
#define REG_TXDMA_PQ_MAP 0x010C
187188
#define BIT_RXDMA_ARBBW_EN BIT(0)
189+
#define BIT_RXSHFT_EN BIT(1)
190+
#define BIT_RXDMA_AGG_EN BIT(2)
191+
#define BIT_TXDMA_BW_EN BIT(3)
188192
#define BIT_SHIFT_TXDMA_BEQ_MAP 8
189193
#define BIT_MASK_TXDMA_BEQ_MAP 0x3
190194
#define BIT_TXDMA_BEQ_MAP(x) \
@@ -283,10 +287,18 @@
283287
#define REG_H2C_TAIL 0x0248
284288
#define REG_H2C_READ_ADDR 0x024C
285289
#define REG_H2C_INFO 0x0254
290+
#define REG_RXDMA_AGG_PG_TH 0x0280
291+
#define BIT_RXDMA_AGG_PG_TH GENMASK(7, 0)
292+
#define BIT_DMA_AGG_TO_V1 GENMASK(15, 8)
293+
#define BIT_EN_PRE_CALC BIT(29)
286294
#define REG_RXPKT_NUM 0x0284
287295
#define BIT_RXDMA_REQ BIT(19)
288296
#define BIT_RW_RELEASE BIT(18)
289297
#define BIT_RXDMA_IDLE BIT(17)
298+
#define REG_RXDMA_STATUS 0x0288
299+
#define REG_RXDMA_DPR 0x028C
300+
#define REG_RXDMA_MODE 0x0290
301+
#define BIT_DMA_MODE BIT(1)
290302
#define REG_RXPKTNUM 0x02B0
291303

292304
#define REG_INT_MIG 0x0304

0 commit comments

Comments
 (0)