2 * Copyright 2010, 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>
19 #include "dev/rt2860/rt2860_io.h"
20 #include "dev/rt2860/rt2860_reg.h"
21 #include "dev/rt2860/rt2860_softc.h"
24 HAIKU_FBSD_WLAN_DRIVER_GLUE(ralink2860
, rt2860
, pci
)
25 HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES
| FBSD_WLAN
);
27 HAIKU_FIRMWARE_VERSION(0);
28 NO_HAIKU_FIRMWARE_NAME_MAP();
30 NO_HAIKU_FBSD_MII_DRIVER();
33 static void rt2860_intr_enable(struct rt2860_softc
* sc
, uint32_t intr_mask
)
37 sc
->intr_disable_mask
&= ~intr_mask
;
39 tmp
= sc
->intr_enable_mask
& ~sc
->intr_disable_mask
;
41 rt2860_io_mac_write(sc
, RT2860_REG_SCHDMA_INT_MASK
, tmp
);
46 HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev
)
48 struct rt2860_softc
* sc
= (struct rt2860_softc
*)device_get_softc(dev
);
49 struct ifnet
* ifp
= sc
->ifp
;
51 // acknowledge interrupts
52 uint32_t status
= rt2860_io_mac_read(sc
, RT2860_REG_SCHDMA_INT_STATUS
);
53 rt2860_io_mac_write(sc
, RT2860_REG_SCHDMA_INT_STATUS
, status
);
55 if (status
== 0xffffffff || status
== 0)
56 // device likely went away || not for us
61 if (!(ifp
->if_drv_flags
& IFF_DRV_RUNNING
))
64 rt2860_io_mac_write(sc
, RT2860_REG_SCHDMA_INT_MASK
, 0);
67 sc
->interrupt_status
= status
;
74 HAIKU_REENABLE_INTERRUPTS(device_t dev
)
76 struct rt2860_softc
* sc
= (struct rt2860_softc
*)device_get_softc(dev
);
78 rt2860_intr_enable(sc
, 0);