2 * Copyright 2009, Colin Günther, coling@gmx.de.
3 * All Rights Reserved. Distributed under the terms of the MIT License.
8 #include <sys/kernel.h>
10 #include <dev/pci/pcivar.h>
12 #include <machine/bus.h>
15 #include <net/if_media.h>
17 #include <net80211/ieee80211_var.h>
18 #include <net80211/ieee80211_amrr.h>
20 #include <dev/ral/rt2560reg.h>
21 #include <dev/ral/rt2560var.h>
22 #include <dev/ral/rt2860reg.h>
23 #include <dev/ral/rt2860var.h>
26 HAIKU_FBSD_WLAN_DRIVER_GLUE(ralinkwifi
, ral
, pci
)
27 HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES
| FBSD_SWI_TASKQUEUE
| FBSD_WLAN
);
28 HAIKU_FIRMWARE_VERSION(0);
29 HAIKU_FIRMWARE_NAME_MAP(4) = {{"rt2561fw", "rt2561.bin"},
30 {"rt2561sfw", "rt2561s.bin"}, {"rt2661fw", "rt2661.bin"},
31 {"rt2860fw", "rt2860.bin"}};
33 NO_HAIKU_FBSD_MII_DRIVER();
34 NO_HAIKU_REENABLE_INTERRUPTS();
37 #define RT2661_INT_MASK_CSR 0x346c
38 #define RT2661_MCU_INT_MASK_CSR 0x0018
42 HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev
)
44 struct rt2560_softc
* sc
= (struct rt2560_softc
*)device_get_softc(dev
);
45 // sc_ifp is common between context data structures
46 struct ifnet
* ifp
= sc
->sc_ifp
;
48 switch (pci_get_device(dev
)) {
51 RAL_WRITE(sc
, RT2560_CSR8
, 0xffffffff);
53 if (!(ifp
->if_drv_flags
& IFF_DRV_RUNNING
)) {
54 // don't re-enable interrupts if we're shutting down
61 // disable MAC and MCU interrupts
62 RAL_WRITE(sc
, RT2661_INT_MASK_CSR
, 0xffffff7f);
63 RAL_WRITE(sc
, RT2661_MCU_INT_MASK_CSR
, 0xffffffff);
65 if (!(ifp
->if_drv_flags
& IFF_DRV_RUNNING
)) {
66 // don't re-enable interrupts if we're shutting down
73 struct rt2860_softc
* sc
=
74 (struct rt2860_softc
*)device_get_softc(dev
);
75 r
= RAL_READ(sc
, RT2860_INT_STATUS
);
76 if (r
== 0 || r
== 0xffffffff)
79 atomic_set((int32
*)&sc
->sc_intr_status
, r
);