brcmfmac: remove unnecessary EXPORT_SYMBOL() usage
[deliverable/linux.git] / drivers / net / wireless / brcm80211 / brcmfmac / dhd_bus.h
CommitLineData
5b435de0
AS
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 _BRCMF_BUS_H_
18#define _BRCMF_BUS_H_
19
a8a363ac
FL
20/* The level of bus communication with the dongle */
21enum brcmf_bus_state {
22 BRCMF_BUS_DOWN, /* Not ready for frame transfers */
23 BRCMF_BUS_LOAD, /* Download access only (CPU reset) */
24 BRCMF_BUS_DATA /* Ready for frame transfers */
25};
26
135e4c61
FL
27struct brcmf_bus_dcmd {
28 char *name;
29 char *param;
30 int param_len;
31 struct list_head list;
32};
33
d9cb2596
AS
34/**
35 * struct brcmf_bus_ops - bus callback operations.
36 *
cf458287 37 * @preinit: execute bus/device specific dongle init commands (optional).
d9cb2596
AS
38 * @init: prepare for communication with dongle.
39 * @stop: clear pending frames, disable data flow.
4061f895
AS
40 * @txdata: send a data frame to the dongle. When the data
41 * has been transferred, the common driver must be
42 * notified using brcmf_txcomplete(). The common
43 * driver calls this function with interrupts
44 * disabled.
d9cb2596
AS
45 * @txctl: transmit a control request message to dongle.
46 * @rxctl: receive a control response message from dongle.
e2432b67 47 * @gettxq: obtain a reference of bus transmit queue (optional).
d9cb2596
AS
48 *
49 * This structure provides an abstract interface towards the
50 * bus specific driver. For control messages to common driver
e2432b67
AS
51 * will assure there is only one active transaction. Unless
52 * indicated otherwise these callbacks are mandatory.
d9cb2596
AS
53 */
54struct brcmf_bus_ops {
cf458287 55 int (*preinit)(struct device *dev);
d9cb2596
AS
56 int (*init)(struct device *dev);
57 void (*stop)(struct device *dev);
58 int (*txdata)(struct device *dev, struct sk_buff *skb);
59 int (*txctl)(struct device *dev, unsigned char *msg, uint len);
60 int (*rxctl)(struct device *dev, unsigned char *msg, uint len);
e2432b67 61 struct pktq * (*gettxq)(struct device *dev);
d9cb2596
AS
62};
63
64/**
65 * struct brcmf_bus - interface structure between common and bus layer
66 *
67 * @bus_priv: pointer to private bus device.
68 * @dev: device pointer of bus device.
69 * @drvr: public driver information.
70 * @state: operational state of the bus interface.
71 * @maxctl: maximum size for rxctl request message.
d9cb2596
AS
72 * @tx_realloc: number of tx packets realloced for headroom.
73 * @dstats: dongle-based statistical data.
d9cb2596 74 * @dcmd_list: bus/device specific dongle initialization commands.
75d907d3
AS
75 * @chip: device identifier of the dongle chip.
76 * @chiprev: revision of the dongle chip.
d9cb2596 77 */
a8a363ac 78struct brcmf_bus {
0a332e46 79 union {
0a332e46 80 struct brcmf_sdio_dev *sdio;
71bb244b 81 struct brcmf_usbdev *usb;
0a332e46 82 } bus_priv;
d9cb2596
AS
83 struct device *dev;
84 struct brcmf_pub *drvr;
a8a363ac 85 enum brcmf_bus_state state;
d9cb2596 86 uint maxctl;
d9cb2596 87 unsigned long tx_realloc;
75d907d3
AS
88 u32 chip;
89 u32 chiprev;
a8a363ac 90
d9cb2596 91 struct brcmf_bus_ops *ops;
a8a363ac
FL
92};
93
d9cb2596
AS
94/*
95 * callback wrappers
96 */
cf458287
AS
97static inline int brcmf_bus_preinit(struct brcmf_bus *bus)
98{
99 if (!bus->ops->preinit)
100 return 0;
101 return bus->ops->preinit(bus->dev);
102}
103
d9cb2596
AS
104static inline int brcmf_bus_init(struct brcmf_bus *bus)
105{
106 return bus->ops->init(bus->dev);
107}
108
109static inline void brcmf_bus_stop(struct brcmf_bus *bus)
110{
111 bus->ops->stop(bus->dev);
112}
113
114static inline int brcmf_bus_txdata(struct brcmf_bus *bus, struct sk_buff *skb)
115{
116 return bus->ops->txdata(bus->dev, skb);
117}
118
119static inline
120int brcmf_bus_txctl(struct brcmf_bus *bus, unsigned char *msg, uint len)
121{
122 return bus->ops->txctl(bus->dev, msg, len);
123}
124
125static inline
126int brcmf_bus_rxctl(struct brcmf_bus *bus, unsigned char *msg, uint len)
127{
128 return bus->ops->rxctl(bus->dev, msg, len);
129}
130
e2432b67
AS
131static inline
132struct pktq *brcmf_bus_gettxq(struct brcmf_bus *bus)
133{
134 if (!bus->ops->gettxq)
135 return ERR_PTR(-ENOENT);
136
137 return bus->ops->gettxq(bus->dev);
138}
a8a363ac
FL
139/*
140 * interface functions from common layer
141 */
142
9bd91f3c
JP
143bool brcmf_c_prec_enq(struct device *dev, struct pktq *q, struct sk_buff *pkt,
144 int prec);
a8a363ac
FL
145
146/* Receive frame for delivery to OS. Callee disposes of rxp. */
7009deab 147void brcmf_rx_frame(struct device *dev, struct sk_buff *rxp);
a8a363ac
FL
148
149/* Indication from bus module regarding presence/insertion of dongle. */
8dee77ba 150int brcmf_attach(struct device *dev);
a8a363ac 151/* Indication from bus module regarding removal/absence of dongle */
9bd91f3c 152void brcmf_detach(struct device *dev);
81d5f1bb 153/* Indication from bus module that dongle should be reset */
9bd91f3c 154void brcmf_dev_reset(struct device *dev);
a8a363ac 155/* Indication from bus module to change flow-control state */
9bd91f3c 156void brcmf_txflowblock(struct device *dev, bool state);
a8a363ac 157
7f4bceec 158/* Notify the bus has transferred the tx packet to firmware */
9bd91f3c 159void brcmf_txcomplete(struct device *dev, struct sk_buff *txp, bool success);
a8a363ac 160
9bd91f3c 161int brcmf_bus_start(struct device *dev);
cf458287
AS
162s32 brcmf_iovar_data_set(struct device *dev, char *name, void *data,
163 u32 len);
8dee77ba 164void brcmf_bus_add_txhdrlen(struct device *dev, uint len);
a8a363ac 165
f3d7cdc3 166#ifdef CONFIG_BRCMFMAC_SDIO
9bd91f3c
JP
167void brcmf_sdio_exit(void);
168void brcmf_sdio_init(void);
4fbef95a 169void brcmf_sdio_register(void);
f3d7cdc3 170#endif
71bb244b 171#ifdef CONFIG_BRCMFMAC_USB
9bd91f3c 172void brcmf_usb_exit(void);
4fbef95a 173void brcmf_usb_register(void);
71bb244b 174#endif
f3d7cdc3 175
5b435de0 176#endif /* _BRCMF_BUS_H_ */
This page took 0.185155 seconds and 5 git commands to generate.