2 * Copyright (c) 2010 Broadcom Corporation
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.
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.
17 #ifndef _BRCM_MAC80211_IF_H_
18 #define _BRCM_MAC80211_IF_H_
20 #include <linux/timer.h>
21 #include <linux/interrupt.h>
22 #include <linux/workqueue.h>
23 #include <linux/leds.h>
25 #include "ucode_loader.h"
28 * Starting index for 5G rates in the
31 #define BRCMS_LEGACY_5G_RATE_OFFSET 4
33 /* softmac ioctl definitions */
34 #define BRCMS_SET_SHORTSLOT_OVERRIDE 146
37 struct delayed_work dly_wrk;
38 struct brcms_info *wl;
39 void (*fn) (void *); /* function called upon expiration */
40 void *arg; /* fixed argument provided to called function */
43 bool set; /* indicates if timer is active */
44 struct brcms_timer *next; /* for freeing on unload */
46 char *name; /* Description of the timer */
51 uint subunit; /* WDS/BSS unit */
52 struct pci_dev *pci_dev;
55 #define MAX_FW_IMAGES 4
56 struct brcms_firmware {
58 const struct firmware *fw_bin[MAX_FW_IMAGES];
59 const struct firmware *fw_hdr[MAX_FW_IMAGES];
60 u32 hdr_num_entries[MAX_FW_IMAGES];
64 struct brcms_pub *pub; /* pointer to public wlc state */
65 struct brcms_c_info *wlc; /* pointer to private common data */
70 spinlock_t lock; /* per-device perimeter lock */
71 spinlock_t isr_lock; /* per-device ISR synchronization lock */
74 wait_queue_head_t tx_flush_wq;
76 /* timer related fields */
77 atomic_t callbacks; /* # outstanding callback functions */
78 struct brcms_timer *timers; /* timer cleanup queue */
80 struct tasklet_struct tasklet; /* dpc tasklet */
81 bool resched; /* dpc needs to be and is rescheduled */
82 struct brcms_firmware fw;
84 struct brcms_ucode ucode;
86 struct brcms_led radio_led;
87 struct led_classdev led_dev;
91 void brcms_init(struct brcms_info *wl);
92 uint brcms_reset(struct brcms_info *wl);
93 void brcms_intrson(struct brcms_info *wl);
94 u32 brcms_intrsoff(struct brcms_info *wl);
95 void brcms_intrsrestore(struct brcms_info *wl, u32 macintmask);
96 int brcms_up(struct brcms_info *wl);
97 void brcms_down(struct brcms_info *wl);
98 void brcms_txflowcontrol(struct brcms_info *wl, struct brcms_if *wlif,
99 bool state, int prio);
100 bool brcms_rfkill_set_hw_state(struct brcms_info *wl);
102 /* timer functions */
103 struct brcms_timer *brcms_init_timer(struct brcms_info *wl,
104 void (*fn) (void *arg), void *arg,
106 void brcms_free_timer(struct brcms_timer *timer);
107 void brcms_add_timer(struct brcms_timer *timer, uint ms, int periodic);
108 bool brcms_del_timer(struct brcms_timer *timer);
109 void brcms_dpc(struct tasklet_struct *t);
110 void brcms_timer(struct brcms_timer *t);
111 void brcms_fatal_error(struct brcms_info *wl);
113 #endif /* _BRCM_MAC80211_IF_H_ */