xref: /haiku/src/add-ons/kernel/drivers/network/wlan/marvell88w8363/glue.c (revision c237c4ce593ee823d9867fd997e51e4c447f5623)
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 HAIKU_DRIVER_REQUIREMENTS(FBSD_WLAN);
22 HAIKU_FIRMWARE_VERSION(0);
23 
24 NO_HAIKU_FBSD_MII_DRIVER();
25 NO_HAIKU_FIRMWARE_NAME_MAP();
26 
27 
28 int
29 HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev)
30 {
31 	struct mwl_softc* sc = (struct mwl_softc*)device_get_softc(dev);
32 	struct mwl_hal* mh = sc->sc_mh;
33 	uint32_t intr_status;
34 
35 	if (sc->sc_invalid) {
36 		 // The hardware is not ready/present, don't touch anything.
37 		 // Note this can happen early on if the IRQ is shared.
38 		return 0;
39 	}
40 
41 	mwl_hal_getisr(mh, &intr_status);
42 		// NB: clears ISR too
43 
44 	if (intr_status == 0) {
45 		// must be a shared irq
46 		return 0;
47 	}
48 
49 	atomic_set((int32*)&sc->sc_intr_status, intr_status);
50 
51 	mwl_hal_intrset(mh, 0);
52 		// disable further intr's
53 	return 1;
54 }
55 
56 
57 void
58 HAIKU_REENABLE_INTERRUPTS(device_t dev)
59 {
60 	struct mwl_softc* sc = (struct mwl_softc*)device_get_softc(dev);
61 	struct mwl_hal* mh = sc->sc_mh;
62 
63 	mwl_hal_intrset(mh, sc->sc_imask);
64 }
65