Merge branch 'staging-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
[pandora-kernel.git] / drivers / staging / brcm80211 / brcmsmac / mac80211_if.h
  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#ifndef _wl_mac80211_h_
-#define _wl_mac80211_h_
+#ifndef _BRCM_MAC80211_IF_H_
+#define _BRCM_MAC80211_IF_H_
+
+#include <linux/timer.h>
+#include <linux/interrupt.h>
+
+/* softmac ioctl definitions */
+#define BRCMS_SET_SHORTSLOT_OVERRIDE           146
+
 
 #include <linux/interrupt.h>
 
  * sleep so perimeter lock has to be a semaphore instead of spinlock. This requires timers to be
  * submitted to workqueue instead of being on kernel timer
  */
-struct wl_timer {
+struct brcms_timer {
        struct timer_list timer;
-       struct wl_info *wl;
+       struct brcms_info *wl;
        void (*fn) (void *);
        void *arg;              /* argument to fn */
        uint ms;
        bool periodic;
        bool set;
-       struct wl_timer *next;
+       struct brcms_timer *next;
 #ifdef BCMDBG
        char *name;             /* Description of the timer */
 #endif
 };
 
-struct wl_if {
+struct brcms_if {
        uint subunit;           /* WDS/BSS unit */
        struct pci_dev *pci_dev;
 };
 
-#define WL_MAX_FW              4
-struct wl_firmware {
+#define MAX_FW_IMAGES          4
+struct brcms_firmware {
        u32 fw_cnt;
-       const struct firmware *fw_bin[WL_MAX_FW];
-       const struct firmware *fw_hdr[WL_MAX_FW];
-       u32 hdr_num_entries[WL_MAX_FW];
+       const struct firmware *fw_bin[MAX_FW_IMAGES];
+       const struct firmware *fw_hdr[MAX_FW_IMAGES];
+       u32 hdr_num_entries[MAX_FW_IMAGES];
 };
 
-struct wl_info {
-       struct wlc_pub *pub;            /* pointer to public wlc state */
+struct brcms_info {
+       struct brcms_pub *pub;          /* pointer to public wlc state */
        void *wlc;              /* pointer to private common os-independent data */
        u32 magic;
 
@@ -59,29 +66,45 @@ struct wl_info {
 
        spinlock_t lock;        /* per-device perimeter lock */
        spinlock_t isr_lock;    /* per-device ISR synchronization lock */
+
+       /* bus type and regsva for unmap in brcms_free() */
        uint bcm_bustype;       /* bus type */
-       bool piomode;           /* set from insmod argument */
        void *regsva;           /* opaque chip registers virtual address */
+
+       /* timer related fields */
        atomic_t callbacks;     /* # outstanding callback functions */
-       struct wl_timer *timers;        /* timer cleanup queue */
+       struct brcms_timer *timers;     /* timer cleanup queue */
+
        struct tasklet_struct tasklet;  /* dpc tasklet */
        bool resched;           /* dpc needs to be and is rescheduled */
 #ifdef LINUXSTA_PS
        u32 pci_psstate[16];    /* pci ps-state save/restore */
 #endif
-       struct wl_firmware fw;
+       struct brcms_firmware fw;
        struct wiphy *wiphy;
 };
 
-#define WL_LOCK(wl)    spin_lock_bh(&(wl)->lock)
-#define WL_UNLOCK(wl)  spin_unlock_bh(&(wl)->lock)
-
-/* locking from inside wl_isr */
-#define WL_ISRLOCK(wl, flags) do {spin_lock(&(wl)->isr_lock); (void)(flags); } while (0)
-#define WL_ISRUNLOCK(wl, flags) do {spin_unlock(&(wl)->isr_lock); (void)(flags); } while (0)
+/* misc callbacks */
+extern void brcms_init(struct brcms_info *wl);
+extern uint brcms_reset(struct brcms_info *wl);
+extern void brcms_intrson(struct brcms_info *wl);
+extern u32 brcms_intrsoff(struct brcms_info *wl);
+extern void brcms_intrsrestore(struct brcms_info *wl, u32 macintmask);
+extern int brcms_up(struct brcms_info *wl);
+extern void brcms_down(struct brcms_info *wl);
+extern void brcms_txflowcontrol(struct brcms_info *wl, struct brcms_if *wlif,
+                               bool state, int prio);
+extern bool wl_alloc_dma_resources(struct brcms_info *wl, uint dmaddrwidth);
+extern bool brcms_rfkill_set_hw_state(struct brcms_info *wl);
 
-/* locking under WL_LOCK() to synchronize with wl_isr */
-#define INT_LOCK(wl, flags)    spin_lock_irqsave(&(wl)->isr_lock, flags)
-#define INT_UNLOCK(wl, flags)  spin_unlock_irqrestore(&(wl)->isr_lock, flags)
+/* timer functions */
+extern struct brcms_timer *brcms_init_timer(struct brcms_info *wl,
+                                     void (*fn) (void *arg), void *arg,
+                                     const char *name);
+extern void brcms_free_timer(struct brcms_info *wl, struct brcms_timer *timer);
+extern void brcms_add_timer(struct brcms_info *wl, struct brcms_timer *timer,
+                           uint ms, int periodic);
+extern bool brcms_del_timer(struct brcms_info *wl, struct brcms_timer *timer);
+extern void brcms_msleep(struct brcms_info *wl, uint ms);
 
-#endif                         /* _wl_mac80211_h_ */
+#endif                         /* _BRCM_MAC80211_IF_H_ */