diff --git a/src/add-ons/kernel/drivers/network/wlan/Jamfile b/src/add-ons/kernel/drivers/network/wlan/Jamfile index a19b4e22d4..2e92c2f0fb 100644 --- a/src/add-ons/kernel/drivers/network/wlan/Jamfile +++ b/src/add-ons/kernel/drivers/network/wlan/Jamfile @@ -12,5 +12,6 @@ SubInclude HAIKU_TOP src add-ons kernel drivers network wlan iprowifi3945 ; SubInclude HAIKU_TOP src add-ons kernel drivers network wlan iprowifi4965 ; SubInclude HAIKU_TOP src add-ons kernel drivers network wlan marvell88w8363 ; SubInclude HAIKU_TOP src add-ons kernel drivers network wlan marvell88w8335 ; +SubInclude HAIKU_TOP src add-ons kernel drivers network wlan ralink2860 ; SubInclude HAIKU_TOP src add-ons kernel drivers network wlan ralinkwifi ; SubInclude HAIKU_TOP src add-ons kernel drivers network wlan wavelanwifi ; diff --git a/src/add-ons/kernel/drivers/network/wlan/ralink2860/Jamfile b/src/add-ons/kernel/drivers/network/wlan/ralink2860/Jamfile new file mode 100644 index 0000000000..eabb42f115 --- /dev/null +++ b/src/add-ons/kernel/drivers/network/wlan/ralink2860/Jamfile @@ -0,0 +1,29 @@ +SubDir HAIKU_TOP src add-ons kernel drivers network wlan ralink2860 ; + +UseHeaders [ FDirName $(HAIKU_TOP) src libs compat freebsd_network compat ] + : true ; +UseHeaders [ FDirName $(HAIKU_TOP) src libs compat freebsd_wlan ] : true ; +UsePrivateHeaders net system ; +UsePrivateKernelHeaders ; + +SubDirCcFlags [ FDefines _KERNEL=1 FBSD_DRIVER=1 ] + -Wno-format + -Wno-unused + -Wno-uninitialized ; + +UseHeaders [ FDirName $(SUBDIR) ] : true ; + +KernelAddon ralink2860 : + glue.c + rt2860.c + rt2860_io.c + rt2860_read_eeprom.c + rt2860_led.c + rt2860_rf.c + rt2860_amrr.c + : + libfreebsd_wlan.a + libfreebsd_network.a + ; + + diff --git a/src/add-ons/kernel/drivers/network/wlan/ralink2860/Makefile b/src/add-ons/kernel/drivers/network/wlan/ralink2860/Makefile deleted file mode 100644 index 587e1a5344..0000000000 --- a/src/add-ons/kernel/drivers/network/wlan/ralink2860/Makefile +++ /dev/null @@ -1,18 +0,0 @@ - -SRCS = device_if.h \ - bus_if.h \ - pci_if.h \ - rt2860_io.c \ - rt2860_read_eeprom.c \ - rt2860_led.c \ - rt2860_rf.c \ - rt2860_amrr.c \ - rt2860.c - -KMOD = rt2860 - -DEBUG_FLAGS = -g -WERROR = -CFLAGS += -DRT2860_DEBUG - -.include diff --git a/src/add-ons/kernel/drivers/network/wlan/ralink2860/glue.c b/src/add-ons/kernel/drivers/network/wlan/ralink2860/glue.c new file mode 100644 index 0000000000..a675b67eed --- /dev/null +++ b/src/add-ons/kernel/drivers/network/wlan/ralink2860/glue.c @@ -0,0 +1,79 @@ +/* + * Copyright 2010, Colin Günther, coling@gmx.de. + * All Rights Reserved. Distributed under the terms of the MIT License. + */ + + +#include +#include + +#include + +#include + +#include +#include + +#include + +#include "rt2860_io.h" +#include "rt2860_reg.h" +#include "rt2860_softc.h" + + +HAIKU_FBSD_WLAN_DRIVER_GLUE(ralink2860, rt2860, pci) +HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_WLAN); + +HAIKU_FIRMWARE_VERSION(0); +NO_HAIKU_FIRMWARE_NAME_MAP(); + +NO_HAIKU_FBSD_MII_DRIVER(); + + +static void rt2860_intr_enable(struct rt2860_softc *sc, uint32_t intr_mask) +{ + uint32_t tmp; + + sc->intr_disable_mask &= ~intr_mask; + + tmp = sc->intr_enable_mask & ~sc->intr_disable_mask; + + rt2860_io_mac_write(sc, RT2860_REG_SCHDMA_INT_MASK, tmp); +} + + +int +HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev) +{ + struct rt2860_softc* sc = (struct rt2860_softc*)device_get_softc(dev); + struct ifnet* ifp = sc->ifp; + + // acknowledge interrupts + uint32_t status = rt2860_io_mac_read(sc, RT2860_REG_SCHDMA_INT_STATUS); + rt2860_io_mac_write(sc, RT2860_REG_SCHDMA_INT_STATUS, status); + + if (status == 0xffffffff || status == 0) + // device likely went away || not for us + return 0; + + sc->interrupts++; + + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) + return 0; + + rt2860_io_mac_write(sc, RT2860_REG_SCHDMA_INT_MASK, 0); + // Disable interrupts + + sc->interrupt_status = status; + + return 1; +} + + +void +HAIKU_REENABLE_INTERRUPTS(device_t dev) +{ + struct rt2860_softc* sc = (struct rt2860_softc*)device_get_softc(dev); + + rt2860_intr_enable(sc, 0); +} diff --git a/src/add-ons/kernel/drivers/network/wlan/ralink2860/rt2860.c b/src/add-ons/kernel/drivers/network/wlan/ralink2860/rt2860.c index 4d902df4b3..934ca56a23 100644 --- a/src/add-ons/kernel/drivers/network/wlan/ralink2860/rt2860.c +++ b/src/add-ons/kernel/drivers/network/wlan/ralink2860/rt2860.c @@ -5017,6 +5017,8 @@ static void rt2860_intr(void *arg) uint32_t status; sc = arg; + +#if !defined(__HAIKU__) ifp = sc->ifp; /* acknowledge interrupts */ @@ -5036,6 +5038,9 @@ static void rt2860_intr(void *arg) if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) return; +#else + status = sc->interrupt_status; +#endif if (status & RT2860_REG_INT_TX_COHERENT) rt2860_tx_coherent_intr(sc); diff --git a/src/add-ons/kernel/drivers/network/wlan/ralink2860/rt2860_softc.h b/src/add-ons/kernel/drivers/network/wlan/ralink2860/rt2860_softc.h index f671c1f766..867083b9e7 100644 --- a/src/add-ons/kernel/drivers/network/wlan/ralink2860/rt2860_softc.h +++ b/src/add-ons/kernel/drivers/network/wlan/ralink2860/rt2860_softc.h @@ -407,6 +407,10 @@ struct rt2860_softc #ifdef RT2860_DEBUG int debug; #endif + +#ifdef __HAIKU__ + uint32_t interrupt_status; +#endif }; #endif /* #ifndef _RT2860_SOFTC_H_ */