1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17#ifndef _BRCMF_BUS_H_
18#define _BRCMF_BUS_H_
19
20
21enum brcmf_bus_state {
22 BRCMF_BUS_DOWN,
23 BRCMF_BUS_LOAD,
24 BRCMF_BUS_DATA
25};
26
27struct brcmf_bus_dcmd {
28 char *name;
29 char *param;
30 int param_len;
31 struct list_head list;
32};
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49struct brcmf_bus_ops {
50 int (*init)(struct device *dev);
51 void (*stop)(struct device *dev);
52 int (*txdata)(struct device *dev, struct sk_buff *skb);
53 int (*txctl)(struct device *dev, unsigned char *msg, uint len);
54 int (*rxctl)(struct device *dev, unsigned char *msg, uint len);
55 struct pktq * (*gettxq)(struct device *dev);
56};
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73struct brcmf_bus {
74 union {
75 struct brcmf_sdio_dev *sdio;
76 struct brcmf_usbdev *usb;
77 } bus_priv;
78 struct device *dev;
79 struct brcmf_pub *drvr;
80 enum brcmf_bus_state state;
81 uint maxctl;
82 unsigned long tx_realloc;
83 u8 align;
84 u32 chip;
85 u32 chiprev;
86 struct list_head dcmd_list;
87
88 struct brcmf_bus_ops *ops;
89};
90
91
92
93
94static inline int brcmf_bus_init(struct brcmf_bus *bus)
95{
96 return bus->ops->init(bus->dev);
97}
98
99static inline void brcmf_bus_stop(struct brcmf_bus *bus)
100{
101 bus->ops->stop(bus->dev);
102}
103
104static inline int brcmf_bus_txdata(struct brcmf_bus *bus, struct sk_buff *skb)
105{
106 return bus->ops->txdata(bus->dev, skb);
107}
108
109static inline
110int brcmf_bus_txctl(struct brcmf_bus *bus, unsigned char *msg, uint len)
111{
112 return bus->ops->txctl(bus->dev, msg, len);
113}
114
115static inline
116int brcmf_bus_rxctl(struct brcmf_bus *bus, unsigned char *msg, uint len)
117{
118 return bus->ops->rxctl(bus->dev, msg, len);
119}
120
121static inline
122struct pktq *brcmf_bus_gettxq(struct brcmf_bus *bus)
123{
124 if (!bus->ops->gettxq)
125 return ERR_PTR(-ENOENT);
126
127 return bus->ops->gettxq(bus->dev);
128}
129
130
131
132
133extern bool brcmf_c_prec_enq(struct device *dev, struct pktq *q,
134 struct sk_buff *pkt, int prec);
135
136
137extern void brcmf_rx_frames(struct device *dev, struct sk_buff_head *rxlist);
138
139
140extern int brcmf_attach(uint bus_hdrlen, struct device *dev);
141
142extern void brcmf_detach(struct device *dev);
143
144extern void brcmf_dev_reset(struct device *dev);
145
146extern void brcmf_txflowblock(struct device *dev, bool state);
147
148
149extern void brcmf_txcomplete(struct device *dev, struct sk_buff *txp,
150 bool success);
151
152extern int brcmf_bus_start(struct device *dev);
153
154#ifdef CONFIG_BRCMFMAC_SDIO
155extern void brcmf_sdio_exit(void);
156extern void brcmf_sdio_init(void);
157#endif
158#ifdef CONFIG_BRCMFMAC_USB
159extern void brcmf_usb_exit(void);
160extern void brcmf_usb_init(void);
161#endif
162
163#endif
164