xref: /haiku/src/add-ons/kernel/drivers/network/wlan/marvell88w8363/glue.c (revision 9760dcae2038d47442f4658c2575844c6cf92c40)
1 /*
2  * Copyright 2009, Colin Günther, coling@gmx.de.
3  * All Rights Reserved. Distributed under the terms of the MIT License.
4  */
5 
6 
7 #include <sys/bus.h>
8 #include <sys/kernel.h>
9 
10 #include <net/if.h>
11 #include <net/if_media.h>
12 
13 #include <net80211/ieee80211_var.h>
14 
15 #include <machine/bus.h>
16 
17 #include <dev/mwl/if_mwlvar.h>
18 
19 
20 HAIKU_FBSD_WLAN_DRIVER_GLUE(marvell88w8363, mwl, pci)
21 NO_HAIKU_FBSD_MII_DRIVER();
22 HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_WLAN);
23 HAIKU_FIRMWARE_VERSION(0);
24 
25 
26 int
27 HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev)
28 {
29 	struct mwl_softc* sc = (struct mwl_softc*)device_get_softc(dev);
30 	struct mwl_hal* mh = sc->sc_mh;
31 	uint32_t intr_status;
32 
33 	if (sc->sc_invalid) {
34 		 // The hardware is not ready/present, don't touch anything.
35 		 // Note this can happen early on if the IRQ is shared.
36 		return 0;
37 	}
38 
39 	mwl_hal_getisr(mh, &intr_status);
40 		// NB: clears ISR too
41 
42 	if (intr_status == 0) {
43 		// must be a shared irq
44 		return 0;
45 	}
46 
47 	atomic_set((int32*)&sc->sc_intr_status, intr_status);
48 
49 	mwl_hal_intrset(mh, 0);
50 		// disable further intr's
51 	return 1;
52 }
53 
54 
55 void
56 HAIKU_REENABLE_INTERRUPTS(device_t dev)
57 {
58 	struct mwl_softc* sc = (struct mwl_softc*)device_get_softc(dev);
59 	struct mwl_hal* mh = sc->sc_mh;
60 
61 	mwl_hal_intrset(mh, sc->sc_imask);
62 }
63