* Removing superflous Makefile.

* Modify driver source to allow correct interrupt processing.
* Add glue file to make driver load in Haiku.
* Update build files accordingly.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39088 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Colin Günther 2010-10-23 20:24:02 +00:00
parent afbf2c78d1
commit 7965271acd
6 changed files with 118 additions and 18 deletions

View File

@ -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 iprowifi4965 ;
SubInclude HAIKU_TOP src add-ons kernel drivers network wlan marvell88w8363 ; 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 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 ralinkwifi ;
SubInclude HAIKU_TOP src add-ons kernel drivers network wlan wavelanwifi ; SubInclude HAIKU_TOP src add-ons kernel drivers network wlan wavelanwifi ;

View File

@ -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
;

View File

@ -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 <bsd.kmod.mk>

View File

@ -0,0 +1,79 @@
/*
* Copyright 2010, Colin Günther, coling@gmx.de.
* All Rights Reserved. Distributed under the terms of the MIT License.
*/
#include <sys/bus.h>
#include <sys/kernel.h>
#include <dev/pci/pcivar.h>
#include <machine/bus.h>
#include <net/if.h>
#include <net/if_media.h>
#include <net80211/ieee80211_var.h>
#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);
}

View File

@ -5017,6 +5017,8 @@ static void rt2860_intr(void *arg)
uint32_t status; uint32_t status;
sc = arg; sc = arg;
#if !defined(__HAIKU__)
ifp = sc->ifp; ifp = sc->ifp;
/* acknowledge interrupts */ /* acknowledge interrupts */
@ -5036,6 +5038,9 @@ static void rt2860_intr(void *arg)
if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
return; return;
#else
status = sc->interrupt_status;
#endif
if (status & RT2860_REG_INT_TX_COHERENT) if (status & RT2860_REG_INT_TX_COHERENT)
rt2860_tx_coherent_intr(sc); rt2860_tx_coherent_intr(sc);

View File

@ -407,6 +407,10 @@ struct rt2860_softc
#ifdef RT2860_DEBUG #ifdef RT2860_DEBUG
int debug; int debug;
#endif #endif
#ifdef __HAIKU__
uint32_t interrupt_status;
#endif
}; };
#endif /* #ifndef _RT2860_SOFTC_H_ */ #endif /* #ifndef _RT2860_SOFTC_H_ */