[haiku-commits] r34475 - in haiku/trunk/src/add-ons/kernel/drivers/network/wlan/marv88w8363: . dev/mwl

  • From: coling@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 3 Dec 2009 21:16:24 +0100 (CET)

Author: colin
Date: 2009-12-03 21:16:24 +0100 (Thu, 03 Dec 2009)
New Revision: 34475
Changeset: http://dev.haiku-os.org/changeset/34475/haiku

Added:
   haiku/trunk/src/add-ons/kernel/drivers/network/wlan/marv88w8363/glue.c
Modified:
   haiku/trunk/src/add-ons/kernel/drivers/network/wlan/marv88w8363/Jamfile
   
haiku/trunk/src/add-ons/kernel/drivers/network/wlan/marv88w8363/dev/mwl/if_mwl.c
   
haiku/trunk/src/add-ons/kernel/drivers/network/wlan/marv88w8363/dev/mwl/if_mwlvar.h
Log:
* Driver marv88w8363 now links. Can't test it as I don't own this hardware.
* Firmware is needed:
  a) Download the firmware files from FreeBSD 8
     here 
http://svn.freebsd.org/viewvc/base/release/8.0.0/sys/contrib/dev/mwl/mw88W8363.fw.uu?view=log
     and here 
http://svn.freebsd.org/viewvc/base/release/8.0.0/sys/contrib/dev/mwl/mwlboot.fw.uu?view=log
  b) Use the tool uudecode <firmware-file> to convert both files into their
     binary format.
  c) Copy both files to /system/data/firmware/marv88w8363/
  d) Rename first file to mw88W8363fw and the second to mwlboot
  e) Copy the License from 
http://svn.freebsd.org/viewvc/base/head/sys/contrib/dev/mwl/LICENSE?view=markup&pathrev=193240
     into this directory, too.


Modified: 
haiku/trunk/src/add-ons/kernel/drivers/network/wlan/marv88w8363/Jamfile
===================================================================
--- haiku/trunk/src/add-ons/kernel/drivers/network/wlan/marv88w8363/Jamfile     
2009-12-03 19:48:11 UTC (rev 34474)
+++ haiku/trunk/src/add-ons/kernel/drivers/network/wlan/marv88w8363/Jamfile     
2009-12-03 20:16:24 UTC (rev 34475)
@@ -21,6 +21,7 @@
        if_mwl.c
        if_mwl_pci.c
        mwlhal.c
+       glue.c
        :
        libfreebsd_wlan.a
        libfreebsd_network.a

Modified: 
haiku/trunk/src/add-ons/kernel/drivers/network/wlan/marv88w8363/dev/mwl/if_mwl.c
===================================================================
--- 
haiku/trunk/src/add-ons/kernel/drivers/network/wlan/marv88w8363/dev/mwl/if_mwl.c
    2009-12-03 19:48:11 UTC (rev 34474)
+++ 
haiku/trunk/src/add-ons/kernel/drivers/network/wlan/marv88w8363/dev/mwl/if_mwl.c
    2009-12-03 20:16:24 UTC (rev 34475)
@@ -821,21 +821,11 @@
        struct mwl_softc *sc = arg;
        struct mwl_hal *mh = sc->sc_mh;
        uint32_t status;
+       HAIKU_INTR_REGISTER_STATE;
 
-       if (sc->sc_invalid) {
-               /*
-                * The hardware is not ready/present, don't touch anything.
-                * Note this can happen early on if the IRQ is shared.
-                */
-               DPRINTF(sc, MWL_DEBUG_ANY, "%s: invalid; ignored\n", __func__);
-               return;
-       }
-       /*
-        * Figure out the reason(s) for the interrupt.
-        */
-       mwl_hal_getisr(mh, &status);            /* NB: clears ISR too */
-       if (status == 0)                        /* must be a shared irq */
-               return;
+       HAIKU_INTR_REGISTER_ENTER();
+       status = sc->sc_lastisr;
+       HAIKU_INTR_REGISTER_LEAVE();
 
        DPRINTF(sc, MWL_DEBUG_INTR, "%s: status 0x%x imask 0x%x\n",
            __func__, status, sc->sc_imask);

Modified: 
haiku/trunk/src/add-ons/kernel/drivers/network/wlan/marv88w8363/dev/mwl/if_mwlvar.h
===================================================================
--- 
haiku/trunk/src/add-ons/kernel/drivers/network/wlan/marv88w8363/dev/mwl/if_mwlvar.h
 2009-12-03 19:48:11 UTC (rev 34474)
+++ 
haiku/trunk/src/add-ons/kernel/drivers/network/wlan/marv88w8363/dev/mwl/if_mwlvar.h
 2009-12-03 20:16:24 UTC (rev 34475)
@@ -331,6 +331,8 @@
 
        struct mwl_tx_radiotap_header sc_tx_th;
        struct mwl_rx_radiotap_header sc_rx_th;
+
+       uint32_t sc_lastisr;
 };
 
 #define        MWL_LOCK_INIT(_sc) \

Added: haiku/trunk/src/add-ons/kernel/drivers/network/wlan/marv88w8363/glue.c
===================================================================
--- haiku/trunk/src/add-ons/kernel/drivers/network/wlan/marv88w8363/glue.c      
                        (rev 0)
+++ haiku/trunk/src/add-ons/kernel/drivers/network/wlan/marv88w8363/glue.c      
2009-12-03 20:16:24 UTC (rev 34475)
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2009, Colin Günther, coling@xxxxxxx
+ * All Rights Reserved. Distributed under the terms of the MIT License.
+ */
+
+
+#include <sys/bus.h>
+#include <sys/kernel.h>
+
+#include <net/if.h>
+#include <net/if_media.h>
+
+#include <net80211/ieee80211_var.h>
+
+#include <machine/bus.h>
+
+#include <dev/mwl/if_mwlvar.h>
+
+
+HAIKU_FBSD_WLAN_DRIVER_GLUE(marv88w8363, mwl, pci)
+NO_HAIKU_FBSD_MII_DRIVER();
+HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES|FBSD_WLAN);
+HAIKU_FIRMWARE_VERSION(0);
+
+
+int
+HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev)
+{
+       struct mwl_softc* sc = (struct mwl_softc*)device_get_softc(dev);
+       struct mwl_hal* mh = sc->sc_mh;
+       HAIKU_INTR_REGISTER_STATE;
+
+       if (sc->sc_invalid) {
+               /*
+                * The hardware is not ready/present, don't touch anything.
+                * Note this can happen early on if the IRQ is shared.
+                */
+               return 0;
+       }
+
+       HAIKU_INTR_REGISTER_ENTER();
+
+       /*
+        * We have to save the isr status right now.
+        * Some devices don't like having the interrupt disabled
+        * before accessing the isr status.
+        *
+        * Those devices return status 0, when status access
+        * occurs after disabling the interrupts with mwl_hal_intrset.
+        *
+        * Note: This glue.c is based on the one for the atheros wlan driver.
+        *       So the comment above isn't based on tests on real marvell 
hardware.
+        *       But due to the similarities in both drivers I just go the safe
+        *       route here. It doesn't do any harm, but may prevent hard to 
spot
+        *       bugs.
+        */
+       mwl_hal_getisr(mh, &sc->sc_lastisr);    /* NB: clears ISR too */
+       if (sc->sc_lastisr == 0) {                              /* must be a 
shared irq */
+               HAIKU_INTR_REGISTER_LEAVE();
+               return 0;
+       }
+
+       mwl_hal_intrset(mh, 0); // disable further intr's
+
+       HAIKU_INTR_REGISTER_LEAVE();
+       return 1;
+}
+
+
+void
+HAIKU_REENABLE_INTERRUPTS(device_t dev)
+{
+       struct mwl_softc* sc = (struct mwl_softc*)device_get_softc(dev);
+       struct mwl_hal* mh = sc->sc_mh;
+
+       mwl_hal_intrset(mh, sc->sc_imask);
+}


Other related posts:

  • » [haiku-commits] r34475 - in haiku/trunk/src/add-ons/kernel/drivers/network/wlan/marv88w8363: . dev/mwl - coling