* The ralinkwifi driver links now.

* There is firmware needed, which can be distributed with Haiku:
  a) Get the firmware from www.ralinktech.com -> Software -> Linux
     -> Firmware RT2501(RT2561/RT2661)
  b) Extract the three binaries to /system/data/firmware/ralinkwifi/
  c) Rename them by removing the '.bin' ending and append fw instead
     (e.g.: rt2561.bin -> rt2561fw)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34663 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Colin Günther 2009-12-14 23:00:33 +00:00
parent b4f369b8a5
commit bfe69c5264
2 changed files with 57 additions and 0 deletions

View File

@ -18,6 +18,7 @@ KernelAddon ralinkwifi :
if_ral_pci.c
rt2560.c
rt2661.c
glue.c
:
libfreebsd_wlan.a
libfreebsd_network.a

View File

@ -0,0 +1,56 @@
/*
* Copyright 2009, 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 <net80211/ieee80211_amrr.h>
#include <dev/ral/rt2560reg.h>
#include <dev/ral/rt2560var.h>
HAIKU_FBSD_WLAN_DRIVER_GLUE(ralinkwifi, ral, pci)
NO_HAIKU_FBSD_MII_DRIVER();
NO_HAIKU_REENABLE_INTERRUPTS();
HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_SWI_TASKQUEUE | FBSD_WLAN);
HAIKU_FIRMWARE_VERSION(0);
#define RT2661_INT_MASK_CSR 0x346c
#define RT2661_MCU_INT_MASK_CSR 0x0018
int
HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev)
{
struct rt2560_softc* sc = (struct rt2560_softc*)device_get_softc(dev);
// assuming that rt2560 and rt2661 share a common context data structure
struct ifnet* ifp = sc->sc_ifp;
if (pci_get_device(dev) == 0x0201) {
// disable interrupts
RAL_WRITE(sc, RT2560_CSR8, 0xffffffff);
} else {
// disable MAC and MCU interrupts
RAL_WRITE(sc, RT2661_INT_MASK_CSR, 0xffffff7f);
RAL_WRITE(sc, RT2661_MCU_INT_MASK_CSR, 0xffffffff);
}
if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
// don't re-enable interrupts if we're shutting down
return 0;
return 1;
}