Skip to content

Commit

Permalink
wifi: rtw88: sdio: Add HCI implementation for SDIO based chipsets
Browse files Browse the repository at this point in the history
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 <jernej.skrabec@gmail.com>
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230405200729.632435-3-martin.blumenstingl@googlemail.com
  • Loading branch information
Martin Blumenstingl authored and Kalle Valo committed Apr 12, 2023
1 parent 6a92566 commit 65371a3
Show file tree
Hide file tree
Showing 8 changed files with 1,592 additions and 1 deletion.
3 changes: 3 additions & 0 deletions drivers/net/wireless/realtek/rtw88/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ config RTW88_CORE
config RTW88_PCI
tristate

config RTW88_SDIO
tristate

config RTW88_USB
tristate

Expand Down
3 changes: 3 additions & 0 deletions drivers/net/wireless/realtek/rtw88/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,8 @@ rtw88_8821cu-objs := rtw8821cu.o
obj-$(CONFIG_RTW88_PCI) += rtw88_pci.o
rtw88_pci-objs := pci.o

obj-$(CONFIG_RTW88_SDIO) += rtw88_sdio.o
rtw88_sdio-objs := sdio.o

obj-$(CONFIG_RTW88_USB) += rtw88_usb.o
rtw88_usb-objs := usb.o
1 change: 1 addition & 0 deletions drivers/net/wireless/realtek/rtw88/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ enum rtw_debug_mask {
RTW_DBG_ADAPTIVITY = 0x00008000,
RTW_DBG_HW_SCAN = 0x00010000,
RTW_DBG_STATE = 0x00020000,
RTW_DBG_SDIO = 0x00040000,

RTW_DBG_ALL = 0xffffffff
};
Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/realtek/rtw88/mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "reg.h"
#include "fw.h"
#include "debug.h"
#include "sdio.h"

void rtw_set_channel_mac(struct rtw_dev *rtwdev, u8 channel, u8 bw,
u8 primary_ch_idx)
Expand Down
1 change: 0 additions & 1 deletion drivers/net/wireless/realtek/rtw88/mac.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

#define RTW_HW_PORT_NUM 5
#define cut_version_to_mask(cut) (0x1 << ((cut) + 1))
#define SDIO_LOCAL_OFFSET 0x10250000
#define DDMA_POLLING_COUNT 1000
#define C2H_PKT_BUF 256
#define REPORT_BUF 128
Expand Down
12 changes: 12 additions & 0 deletions drivers/net/wireless/realtek/rtw88/reg.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
#define BIT_LTE_MUX_CTRL_PATH BIT(26)
#define REG_HCI_OPT_CTRL 0x0074
#define BIT_USB_SUS_DIS BIT(8)
#define BIT_SDIO_PAD_E5 BIT(18)

#define REG_AFE_CTRL_4 0x0078
#define BIT_CK320M_AFE_EN BIT(4)
Expand Down Expand Up @@ -185,6 +186,9 @@
(((x) & BIT_MASK_TXDMA_VIQ_MAP) << BIT_SHIFT_TXDMA_VIQ_MAP)
#define REG_TXDMA_PQ_MAP 0x010C
#define BIT_RXDMA_ARBBW_EN BIT(0)
#define BIT_RXSHFT_EN BIT(1)
#define BIT_RXDMA_AGG_EN BIT(2)
#define BIT_TXDMA_BW_EN BIT(3)
#define BIT_SHIFT_TXDMA_BEQ_MAP 8
#define BIT_MASK_TXDMA_BEQ_MAP 0x3
#define BIT_TXDMA_BEQ_MAP(x) \
Expand Down Expand Up @@ -283,10 +287,18 @@
#define REG_H2C_TAIL 0x0248
#define REG_H2C_READ_ADDR 0x024C
#define REG_H2C_INFO 0x0254
#define REG_RXDMA_AGG_PG_TH 0x0280
#define BIT_RXDMA_AGG_PG_TH GENMASK(7, 0)
#define BIT_DMA_AGG_TO_V1 GENMASK(15, 8)
#define BIT_EN_PRE_CALC BIT(29)
#define REG_RXPKT_NUM 0x0284
#define BIT_RXDMA_REQ BIT(19)
#define BIT_RW_RELEASE BIT(18)
#define BIT_RXDMA_IDLE BIT(17)
#define REG_RXDMA_STATUS 0x0288
#define REG_RXDMA_DPR 0x028C
#define REG_RXDMA_MODE 0x0290
#define BIT_DMA_MODE BIT(1)
#define REG_RXPKTNUM 0x02B0

#define REG_INT_MIG 0x0304
Expand Down
Loading

0 comments on commit 65371a3

Please sign in to comment.