ralinkwifi (ral): Upgrade to FreeBSD 13.1

One new device ID.
This commit is contained in:
Augustin Cavalier
2022-06-21 17:34:52 -04:00
parent b071913066
commit 8e059bfa63
10 changed files with 23 additions and 30 deletions
@@ -16,7 +16,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__FBSDID("$FreeBSD: releng/12.0/sys/dev/ral/if_ral_pci.c 338951 2018-09-26 19:41:00Z imp $"); __FBSDID("$FreeBSD$");
/* /*
* PCI/Cardbus front-end for the Ralink RT2560/RT2561/RT2561S/RT2661 driver. * PCI/Cardbus front-end for the Ralink RT2560/RT2561/RT2561S/RT2661 driver.
@@ -100,6 +100,7 @@ static const struct ral_pci_ident ral_pci_ids[] = {
{ 0x1814, 0x5390, "Ralink Technology RT5390" }, { 0x1814, 0x5390, "Ralink Technology RT5390" },
{ 0x1814, 0x5392, "Ralink Technology RT5392" }, { 0x1814, 0x5392, "Ralink Technology RT5392" },
{ 0x1814, 0x539a, "Ralink Technology RT5390" }, { 0x1814, 0x539a, "Ralink Technology RT5390" },
{ 0x1814, 0x539b, "Ralink Technology RT5390" },
{ 0x1814, 0x539f, "Ralink Technology RT5390" }, { 0x1814, 0x539f, "Ralink Technology RT5390" },
{ 0x1a3b, 0x1059, "AWT RT2890" }, { 0x1a3b, 0x1059, "AWT RT2890" },
{ 0, 0, NULL } { 0, 0, NULL }
@@ -230,7 +231,7 @@ ral_pci_attach(device_t dev)
sc->sc_st = rman_get_bustag(psc->mem); sc->sc_st = rman_get_bustag(psc->mem);
sc->sc_sh = rman_get_bushandle(psc->mem); sc->sc_sh = rman_get_bushandle(psc->mem);
sc->sc_invalid = 1; sc->sc_invalid = 1;
rid = 0; rid = 0;
if (ral_msi_disable == 0) { if (ral_msi_disable == 0) {
count = 1; count = 1;
@@ -264,7 +265,7 @@ ral_pci_attach(device_t dev)
return error; return error;
} }
sc->sc_invalid = 0; sc->sc_invalid = 0;
return 0; return 0;
} }
@@ -273,7 +274,7 @@ ral_pci_detach(device_t dev)
{ {
struct ral_pci_softc *psc = device_get_softc(dev); struct ral_pci_softc *psc = device_get_softc(dev);
struct rt2560_softc *sc = &psc->u.sc_rt2560; struct rt2560_softc *sc = &psc->u.sc_rt2560;
/* check if device was removed */ /* check if device was removed */
sc->sc_invalid = !bus_child_present(dev); sc->sc_invalid = !bus_child_present(dev);
@@ -1,4 +1,4 @@
/* $FreeBSD: releng/12.0/sys/dev/ral/rt2560.c 330688 2018-03-09 11:33:56Z avos $ */ /* $FreeBSD$ */
/*- /*-
* Copyright (c) 2005, 2006 * Copyright (c) 2005, 2006
@@ -18,7 +18,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__FBSDID("$FreeBSD: releng/12.0/sys/dev/ral/rt2560.c 330688 2018-03-09 11:33:56Z avos $"); __FBSDID("$FreeBSD$");
/*- /*-
* Ralink Technology RT2560 chipset driver * Ralink Technology RT2560 chipset driver
@@ -342,7 +342,7 @@ rt2560_detach(void *xsc)
{ {
struct rt2560_softc *sc = xsc; struct rt2560_softc *sc = xsc;
struct ieee80211com *ic = &sc->sc_ic; struct ieee80211com *ic = &sc->sc_ic;
rt2560_stop(sc); rt2560_stop(sc);
ieee80211_ifdetach(ic); ieee80211_ifdetach(ic);
@@ -1,4 +1,4 @@
/* $FreeBSD: releng/12.0/sys/dev/ral/rt2560reg.h 258780 2013-11-30 22:17:27Z eadler $ */ /* $FreeBSD$ */
/*- /*-
* Copyright (c) 2005, 2006 * Copyright (c) 2005, 2006
@@ -115,7 +115,6 @@
#define RT2560_SECCSR1 0x0158 /* WEP control */ #define RT2560_SECCSR1 0x0158 /* WEP control */
#define RT2560_BBPCSR1 0x015c /* BBP TX Configuration */ #define RT2560_BBPCSR1 0x015c /* BBP TX Configuration */
/* possible flags for register RXCSR0 */ /* possible flags for register RXCSR0 */
#define RT2560_DISABLE_RX (1 << 0) #define RT2560_DISABLE_RX (1 << 0)
#define RT2560_DROP_CRC_ERROR (1 << 1) #define RT2560_DROP_CRC_ERROR (1 << 1)
@@ -1,4 +1,4 @@
/* $FreeBSD: releng/12.0/sys/dev/ral/rt2560var.h 306591 2016-10-02 20:35:55Z avos $ */ /* $FreeBSD$ */
/*- /*-
* Copyright (c) 2005, 2006 * Copyright (c) 2005, 2006
@@ -1,4 +1,4 @@
/* $FreeBSD: releng/12.0/sys/dev/ral/rt2661.c 330688 2018-03-09 11:33:56Z avos $ */ /* $FreeBSD$ */
/*- /*-
* Copyright (c) 2006 * Copyright (c) 2006
@@ -18,7 +18,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__FBSDID("$FreeBSD: releng/12.0/sys/dev/ral/rt2661.c 330688 2018-03-09 11:33:56Z avos $"); __FBSDID("$FreeBSD$");
/*- /*-
* Ralink Technology RT2561, RT2561S and RT2661 chipset driver * Ralink Technology RT2561, RT2561S and RT2661 chipset driver
@@ -332,7 +332,7 @@ rt2661_detach(void *xsc)
{ {
struct rt2661_softc *sc = xsc; struct rt2661_softc *sc = xsc;
struct ieee80211com *ic = &sc->sc_ic; struct ieee80211com *ic = &sc->sc_ic;
RAL_LOCK(sc); RAL_LOCK(sc);
rt2661_stop_locked(sc); rt2661_stop_locked(sc);
RAL_UNLOCK(sc); RAL_UNLOCK(sc);
@@ -1,4 +1,4 @@
/* $FreeBSD: releng/12.0/sys/dev/ral/rt2661reg.h 258780 2013-11-30 22:17:27Z eadler $ */ /* $FreeBSD$ */
/*- /*-
* Copyright (c) 2006 * Copyright (c) 2006
@@ -119,7 +119,6 @@
#define RT2661_IO_CNTL_CSR 0x3498 #define RT2661_IO_CNTL_CSR 0x3498
#define RT2661_MCU_CODE_BASE 0x4000 #define RT2661_MCU_CODE_BASE 0x4000
/* possible flags for register HOST_CMD_CSR */ /* possible flags for register HOST_CMD_CSR */
#define RT2661_KICK_CMD (1 << 7) #define RT2661_KICK_CMD (1 << 7)
/* Host to MCU (8051) command identifiers */ /* Host to MCU (8051) command identifiers */
@@ -1,4 +1,4 @@
/* $FreeBSD: releng/12.0/sys/dev/ral/rt2661var.h 306591 2016-10-02 20:35:55Z avos $ */ /* $FreeBSD$ */
/*- /*-
* Copyright (c) 2005 * Copyright (c) 2005
@@ -114,7 +114,7 @@ struct rt2661_softc {
* The same in both up to here * The same in both up to here
* ------------------------------------------------ * ------------------------------------------------
*/ */
int sc_flags; int sc_flags;
#define RAL_FW_LOADED 0x1 #define RAL_FW_LOADED 0x1
#define RAL_INPUT_RUNNING 0x2 #define RAL_INPUT_RUNNING 0x2
@@ -18,7 +18,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__FBSDID("$FreeBSD: releng/12.0/sys/dev/ral/rt2860.c 327479 2018-01-02 00:07:28Z adrian $"); __FBSDID("$FreeBSD$");
/*- /*-
* Ralink Technology RT2860/RT3090/RT3390/RT3562/RT5390/RT5392 chipset driver * Ralink Technology RT2860/RT3090/RT3390/RT3562/RT5390/RT5392 chipset driver
@@ -504,7 +504,6 @@ rt2860_dma_map_addr(void *arg, bus_dma_segment_t *segs, int nseg, int error)
*(bus_addr_t *)arg = segs[0].ds_addr; *(bus_addr_t *)arg = segs[0].ds_addr;
} }
static int static int
rt2860_alloc_tx_ring(struct rt2860_softc *sc, struct rt2860_tx_ring *ring) rt2860_alloc_tx_ring(struct rt2860_softc *sc, struct rt2860_tx_ring *ring)
{ {
@@ -1092,9 +1091,8 @@ rt2860_drain_stats_fifo(struct rt2860_softc *sc)
DPRINTFN(4, ("tx stat 0x%08x\n", stat)); DPRINTFN(4, ("tx stat 0x%08x\n", stat));
wcid = (stat >> RT2860_TXQ_WCID_SHIFT) & 0xff; wcid = (stat >> RT2860_TXQ_WCID_SHIFT) & 0xff;
if (wcid == 0xFF) if (wcid > RT2860_WCID_MAX)
continue; continue;
ni = sc->wcid2ni[wcid]; ni = sc->wcid2ni[wcid];
/* if no ACK was requested, no feedback is available */ /* if no ACK was requested, no feedback is available */
@@ -2225,7 +2223,7 @@ static void
rt2860_enable_mrr(struct rt2860_softc *sc) rt2860_enable_mrr(struct rt2860_softc *sc)
{ {
#define CCK(mcs) (mcs) #define CCK(mcs) (mcs)
#define OFDM(mcs) (1 << 3 | (mcs)) #define OFDM(mcs) (1U << 3 | (mcs))
RAL_WRITE(sc, RT2860_LG_FBK_CFG0, RAL_WRITE(sc, RT2860_LG_FBK_CFG0,
OFDM(6) << 28 | /* 54->48 */ OFDM(6) << 28 | /* 54->48 */
OFDM(5) << 24 | /* 48->36 */ OFDM(5) << 24 | /* 48->36 */
@@ -2593,7 +2591,7 @@ rt5390_set_chan(struct rt2860_softc *sc, u_int chan)
rf = MIN(rf, 0x5f); rf = MIN(rf, 0x5f);
if (tmp != rf) if (tmp != rf)
rt2860_mcu_cmd(sc, 0x74, (tmp << 8 ) | rf, 0); rt2860_mcu_cmd(sc, 0x74, (tmp << 8 ) | rf, 0);
if (sc->mac_ver == 0x5390) { if (sc->mac_ver == 0x5390) {
if (chan <= 4) if (chan <= 4)
rf = 0x73; rf = 0x73;
@@ -3330,7 +3328,7 @@ b4inc(uint32_t b32, int8_t delta)
b4 = 0; b4 = 0;
else if (b4 > 0xf) else if (b4 > 0xf)
b4 = 0xf; b4 = 0xf;
b32 = b32 >> 4 | b4 << 28; b32 = b32 >> 4 | (uint32_t)b4 << 28;
} }
return b32; return b32;
} }
@@ -15,7 +15,7 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
* *
* $OpenBSD: rt2860reg.h,v 1.30 2010/05/10 18:17:10 damien Exp $ * $OpenBSD: rt2860reg.h,v 1.30 2010/05/10 18:17:10 damien Exp $
* $FreeBSD: releng/12.0/sys/dev/ral/rt2860reg.h 301575 2016-06-08 02:37:23Z kevlo $ * $FreeBSD$
*/ */
#define RT2860_NOISE_FLOOR -95 #define RT2860_NOISE_FLOOR -95
@@ -210,7 +210,6 @@
#define RT2860_H2M_BBPAGENT 0x7028 #define RT2860_H2M_BBPAGENT 0x7028
#define RT2860_BCN_BASE(vap) (0x7800 + (vap) * 512) #define RT2860_BCN_BASE(vap) (0x7800 + (vap) * 512)
/* possible flags for RT2860_PCI_CFG */ /* possible flags for RT2860_PCI_CFG */
#define RT2860_PCI_CFG_USB (1 << 17) #define RT2860_PCI_CFG_USB (1 << 17)
#define RT2860_PCI_CFG_PCI (1 << 16) #define RT2860_PCI_CFG_PCI (1 << 16)
@@ -699,13 +698,11 @@
#define RT2860_H2M_BUSY (1 << 24) #define RT2860_H2M_BUSY (1 << 24)
#define RT2860_TOKEN_NO_INTR 0xff #define RT2860_TOKEN_NO_INTR 0xff
/* possible flags for MCU command RT2860_MCU_CMD_LEDS */ /* possible flags for MCU command RT2860_MCU_CMD_LEDS */
#define RT2860_LED_RADIO (1 << 13) #define RT2860_LED_RADIO (1 << 13)
#define RT2860_LED_LINK_2GHZ (1 << 14) #define RT2860_LED_LINK_2GHZ (1 << 14)
#define RT2860_LED_LINK_5GHZ (1 << 15) #define RT2860_LED_LINK_5GHZ (1 << 15)
/* possible flags for RT3020 RF register 1 */ /* possible flags for RT3020 RF register 1 */
#define RT3070_RF_BLOCK (1 << 0) #define RT3070_RF_BLOCK (1 << 0)
#define RT3070_PLL_PD (1 << 1) #define RT3070_PLL_PD (1 << 1)
@@ -897,7 +894,6 @@ struct rt2860_rxwi {
uint16_t reserved2; uint16_t reserved2;
} __packed; } __packed;
/* first DMA segment contains TXWI + 802.11 header + 32-bit padding */ /* first DMA segment contains TXWI + 802.11 header + 32-bit padding */
#define RT2860_TXWI_DMASZ \ #define RT2860_TXWI_DMASZ \
(sizeof (struct rt2860_txwi) + \ (sizeof (struct rt2860_txwi) + \
@@ -15,7 +15,7 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
* *
* $OpenBSD: rt2860var.h,v 1.20 2010/09/07 16:21:42 deraadt Exp $ * $OpenBSD: rt2860var.h,v 1.20 2010/09/07 16:21:42 deraadt Exp $
* $FreeBSD: releng/12.0/sys/dev/ral/rt2860var.h 306591 2016-10-02 20:35:55Z avos $ * $FreeBSD$
*/ */
#define RT2860_TX_RING_COUNT 64 #define RT2860_TX_RING_COUNT 64