]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.h
Merge commit '6bb27d7349db51b50c40534710fe164ca0d58902' into omap-timer-for-v3.10
[karo-tx-linux.git] / drivers / net / wireless / brcm80211 / brcmsmac / mac80211_if.h
1 /*
2  * Copyright (c) 2010 Broadcom Corporation
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16
17 #ifndef _BRCM_MAC80211_IF_H_
18 #define _BRCM_MAC80211_IF_H_
19
20 #include <linux/timer.h>
21 #include <linux/interrupt.h>
22 #include <linux/workqueue.h>
23
24 #include "ucode_loader.h"
25 /*
26  * Starting index for 5G rates in the
27  * legacy rate table.
28  */
29 #define BRCMS_LEGACY_5G_RATE_OFFSET     4
30
31 /* softmac ioctl definitions */
32 #define BRCMS_SET_SHORTSLOT_OVERRIDE            146
33
34 struct brcms_timer {
35         struct delayed_work dly_wrk;
36         struct brcms_info *wl;
37         void (*fn) (void *);    /* function called upon expiration */
38         void *arg;              /* fixed argument provided to called function */
39         uint ms;
40         bool periodic;
41         bool set;               /* indicates if timer is active */
42         struct brcms_timer *next;       /* for freeing on unload */
43 #ifdef DEBUG
44         char *name;             /* Description of the timer */
45 #endif
46 };
47
48 struct brcms_if {
49         uint subunit;           /* WDS/BSS unit */
50         struct pci_dev *pci_dev;
51 };
52
53 #define MAX_FW_IMAGES           4
54 struct brcms_firmware {
55         u32 fw_cnt;
56         const struct firmware *fw_bin[MAX_FW_IMAGES];
57         const struct firmware *fw_hdr[MAX_FW_IMAGES];
58         u32 hdr_num_entries[MAX_FW_IMAGES];
59 };
60
61 struct brcms_info {
62         struct brcms_pub *pub;          /* pointer to public wlc state */
63         struct brcms_c_info *wlc;       /* pointer to private common data */
64         u32 magic;
65
66         int irq;
67
68         spinlock_t lock;        /* per-device perimeter lock */
69         spinlock_t isr_lock;    /* per-device ISR synchronization lock */
70
71         /* tx flush */
72         wait_queue_head_t tx_flush_wq;
73
74         /* timer related fields */
75         atomic_t callbacks;     /* # outstanding callback functions */
76         struct brcms_timer *timers;     /* timer cleanup queue */
77
78         struct tasklet_struct tasklet;  /* dpc tasklet */
79         bool resched;           /* dpc needs to be and is rescheduled */
80         struct brcms_firmware fw;
81         struct wiphy *wiphy;
82         struct brcms_ucode ucode;
83         bool mute_tx;
84 };
85
86 /* misc callbacks */
87 extern void brcms_init(struct brcms_info *wl);
88 extern uint brcms_reset(struct brcms_info *wl);
89 extern void brcms_intrson(struct brcms_info *wl);
90 extern u32 brcms_intrsoff(struct brcms_info *wl);
91 extern void brcms_intrsrestore(struct brcms_info *wl, u32 macintmask);
92 extern int brcms_up(struct brcms_info *wl);
93 extern void brcms_down(struct brcms_info *wl);
94 extern void brcms_txflowcontrol(struct brcms_info *wl, struct brcms_if *wlif,
95                                 bool state, int prio);
96 extern bool brcms_rfkill_set_hw_state(struct brcms_info *wl);
97
98 /* timer functions */
99 extern struct brcms_timer *brcms_init_timer(struct brcms_info *wl,
100                                       void (*fn) (void *arg), void *arg,
101                                       const char *name);
102 extern void brcms_free_timer(struct brcms_timer *timer);
103 extern void brcms_add_timer(struct brcms_timer *timer, uint ms, int periodic);
104 extern bool brcms_del_timer(struct brcms_timer *timer);
105 extern void brcms_dpc(unsigned long data);
106 extern void brcms_timer(struct brcms_timer *t);
107 extern void brcms_fatal_error(struct brcms_info *wl);
108
109 #endif                          /* _BRCM_MAC80211_IF_H_ */