spi-topcliff-pch: supports a spi mode setup and bit order setup by IO control
[zen-stable.git] / drivers / net / wireless / brcm80211 / brcmfmac / dhd_bus.h
blobad9be2410b59337158879fe301673433d68d6320
1 /*
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 _BRCMF_BUS_H_
18 #define _BRCMF_BUS_H_
20 /* The level of bus communication with the dongle */
21 enum 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 */
27 struct dngl_stats {
28 unsigned long rx_packets; /* total packets received */
29 unsigned long tx_packets; /* total packets transmitted */
30 unsigned long rx_bytes; /* total bytes received */
31 unsigned long tx_bytes; /* total bytes transmitted */
32 unsigned long rx_errors; /* bad packets received */
33 unsigned long tx_errors; /* packet transmit problems */
34 unsigned long rx_dropped; /* packets dropped by dongle */
35 unsigned long tx_dropped; /* packets dropped by dongle */
36 unsigned long multicast; /* multicast packets received */
39 /* interface structure between common and bus layer */
40 struct brcmf_bus {
41 u8 type; /* bus type */
42 void *bus_priv; /* pointer to bus private structure */
43 void *drvr; /* pointer to driver pub structure brcmf_pub */
44 enum brcmf_bus_state state;
45 uint maxctl; /* Max size rxctl request from proto to bus */
46 bool drvr_up; /* Status flag of driver up/down */
47 unsigned long tx_realloc; /* Tx packets realloced for headroom */
48 struct dngl_stats dstats; /* Stats for dongle-based data */
49 u8 align; /* bus alignment requirement */
51 /* interface functions pointers */
52 /* Stop bus module: clear pending frames, disable data flow */
53 void (*brcmf_bus_stop)(struct device *);
54 /* Initialize bus module: prepare for communication w/dongle */
55 int (*brcmf_bus_init)(struct device *);
56 /* Send a data frame to the dongle. Callee disposes of txp. */
57 int (*brcmf_bus_txdata)(struct device *, struct sk_buff *);
58 /* Send/receive a control message to/from the dongle.
59 * Expects caller to enforce a single outstanding transaction.
61 int (*brcmf_bus_txctl)(struct device *, unsigned char *, uint);
62 int (*brcmf_bus_rxctl)(struct device *, unsigned char *, uint);
66 * interface functions from common layer
69 /* Remove any protocol-specific data header. */
70 extern int brcmf_proto_hdrpull(struct device *dev, int *ifidx,
71 struct sk_buff *rxp);
73 extern bool brcmf_c_prec_enq(struct device *dev, struct pktq *q,
74 struct sk_buff *pkt, int prec);
76 /* Receive frame for delivery to OS. Callee disposes of rxp. */
77 extern void brcmf_rx_frame(struct device *dev, int ifidx,
78 struct sk_buff_head *rxlist);
79 static inline void brcmf_rx_packet(struct device *dev, int ifidx,
80 struct sk_buff *pkt)
82 struct sk_buff_head q;
84 skb_queue_head_init(&q);
85 skb_queue_tail(&q, pkt);
86 brcmf_rx_frame(dev, ifidx, &q);
89 /* Indication from bus module regarding presence/insertion of dongle. */
90 extern int brcmf_attach(uint bus_hdrlen, struct device *dev);
91 /* Indication from bus module regarding removal/absence of dongle */
92 extern void brcmf_detach(struct device *dev);
94 /* Indication from bus module to change flow-control state */
95 extern void brcmf_txflowcontrol(struct device *dev, int ifidx, bool on);
97 /* Notify tx completion */
98 extern void brcmf_txcomplete(struct device *dev, struct sk_buff *txp,
99 bool success);
101 extern int brcmf_bus_start(struct device *dev);
103 extern int brcmf_add_if(struct device *dev, int ifidx,
104 char *name, u8 *mac_addr);
105 #endif /* _BRCMF_BUS_H_ */