rtwn(4): decode some bit fields + merge duplicate code.
Add macros for R12A_RXDMA_PRO register (descriptions were seen in the RTL8822B vendor driver) and merge 2 r21au_init_burstlen() copies. No functional change intended.
This commit is contained in:
parent
ecd4eb0056
commit
02e3fed58c
@ -58,6 +58,16 @@
|
||||
/* Bits for R92C_LEDCFG2. */
|
||||
#define R12A_LEDCFG2_ENA 0x20
|
||||
|
||||
/* Bits for R12A_RXDMA_PRO. */
|
||||
#define R12A_DMA_MODE 0x02
|
||||
#define R12A_BURST_CNT_M 0x0c
|
||||
#define R12A_BURST_CNT_S 2
|
||||
#define R12A_BURST_SZ_M 0x30
|
||||
#define R12A_BURST_SZ_S 4
|
||||
#define R12A_BURST_SZ_USB3 0
|
||||
#define R12A_BURST_SZ_USB2 1
|
||||
#define R12A_BURST_SZ_USB1 2
|
||||
|
||||
/* Bits for R12A_CCK_CHECK. */
|
||||
#define R12A_CCK_CHECK_BCN1 0x20
|
||||
#define R12A_CCK_CHECK_5GHZ 0x80
|
||||
|
@ -37,6 +37,7 @@
|
||||
*/
|
||||
/* r12au_init.c */
|
||||
void r12au_init_rx_agg(struct rtwn_softc *);
|
||||
void r12au_init_burstlen_usb2(struct rtwn_softc *);
|
||||
void r12au_init_burstlen(struct rtwn_softc *);
|
||||
void r12au_init_ampdu_fwhw(struct rtwn_softc *);
|
||||
void r12au_init_ampdu(struct rtwn_softc *);
|
||||
|
@ -71,20 +71,33 @@ r12au_init_rx_agg(struct rtwn_softc *sc)
|
||||
R92C_TRXDMA_CTRL_RXDMA_AGG_EN);
|
||||
}
|
||||
|
||||
void
|
||||
r12au_init_burstlen_usb2(struct rtwn_softc *sc)
|
||||
{
|
||||
const uint8_t dma_count = R12A_DMA_MODE | SM(R12A_BURST_CNT, 3);
|
||||
|
||||
if ((rtwn_read_1(sc, R92C_USB_INFO) & 0x30) == 0) {
|
||||
/* Set burst packet length to 512 B. */
|
||||
rtwn_setbits_1(sc, R12A_RXDMA_PRO, R12A_BURST_SZ_M,
|
||||
dma_count | SM(R12A_BURST_SZ, R12A_BURST_SZ_USB2));
|
||||
} else {
|
||||
/* Set burst packet length to 64 B. */
|
||||
rtwn_setbits_1(sc, R12A_RXDMA_PRO, R12A_BURST_SZ_M,
|
||||
dma_count | SM(R12A_BURST_SZ, R12A_BURST_SZ_USB1));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
r12au_init_burstlen(struct rtwn_softc *sc)
|
||||
{
|
||||
if (rtwn_read_1(sc, R92C_TYPE_ID + 3) & 0x80) {
|
||||
if ((rtwn_read_1(sc, R92C_USB_INFO) & 0x30) == 0) {
|
||||
/* Set burst packet length to 512 B. */
|
||||
rtwn_setbits_1(sc, R12A_RXDMA_PRO, 0x20, 0x1e);
|
||||
} else {
|
||||
/* Set burst packet length to 64 B. */
|
||||
rtwn_setbits_1(sc, R12A_RXDMA_PRO, 0x10, 0x2e);
|
||||
}
|
||||
} else { /* USB 3.0 */
|
||||
const uint8_t dma_count = R12A_DMA_MODE | SM(R12A_BURST_CNT, 3);
|
||||
|
||||
if (rtwn_read_1(sc, R92C_TYPE_ID + 3) & 0x80)
|
||||
r12au_init_burstlen_usb2(sc);
|
||||
else { /* USB 3.0 */
|
||||
/* Set burst packet length to 1 KB. */
|
||||
rtwn_setbits_1(sc, R12A_RXDMA_PRO, 0x30, 0x0e);
|
||||
rtwn_setbits_1(sc, R12A_RXDMA_PRO, R12A_BURST_SZ_M,
|
||||
dma_count | SM(R12A_BURST_SZ, R12A_BURST_SZ_USB3));
|
||||
|
||||
rtwn_setbits_1(sc, 0xf008, 0x18, 0);
|
||||
}
|
||||
|
@ -37,7 +37,6 @@
|
||||
*/
|
||||
/* r21au_init.c */
|
||||
void r21au_init_tx_agg(struct rtwn_softc *);
|
||||
void r21au_init_burstlen(struct rtwn_softc *);
|
||||
|
||||
/* r21au_dfs.c */
|
||||
void r21au_chan_check(void *, int);
|
||||
|
@ -135,7 +135,7 @@ r21a_attach_private(struct rtwn_softc *sc)
|
||||
rs->rs_fix_spur = rtwn_nop_softc_chan;
|
||||
rs->rs_set_band_2ghz = r21a_set_band_2ghz;
|
||||
rs->rs_set_band_5ghz = r21a_set_band_5ghz;
|
||||
rs->rs_init_burstlen = r21au_init_burstlen;
|
||||
rs->rs_init_burstlen = r12au_init_burstlen_usb2;
|
||||
rs->rs_init_ampdu_fwhw = r21a_init_ampdu_fwhw;
|
||||
rs->rs_crystalcap_write = r21a_crystalcap_write;
|
||||
#ifndef RTWN_WITHOUT_UCODE
|
||||
|
@ -70,14 +70,3 @@ r21au_init_tx_agg(struct rtwn_softc *sc)
|
||||
rtwn_write_1(sc, R21A_DWBCN1_CTRL, uc->tx_agg_desc_num << 1);
|
||||
}
|
||||
|
||||
void
|
||||
r21au_init_burstlen(struct rtwn_softc *sc)
|
||||
{
|
||||
if ((rtwn_read_1(sc, R92C_USB_INFO) & 0x30) == 0) {
|
||||
/* Set burst packet length to 512 B. */
|
||||
rtwn_setbits_1(sc, R12A_RXDMA_PRO, 0x20, 0x1e);
|
||||
} else {
|
||||
/* Set burst packet length to 64 B. */
|
||||
rtwn_setbits_1(sc, R12A_RXDMA_PRO, 0x10, 0x2e);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user