1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64#ifndef __i1480_DFU_H__
65#define __i1480_DFU_H__
66
67#include <linux/uwb/spec.h>
68#include <linux/types.h>
69#include <linux/completion.h>
70
71#define i1480_FW_UPLOAD_MODE_MASK (cpu_to_le32(0x00000018))
72
73#if i1480_FW > 0x00000302
74#define i1480_RCEB_EXTENDED
75#endif
76
77struct uwb_rccb;
78struct uwb_rceb;
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113struct i1480 {
114 struct device *dev;
115
116 int (*write)(struct i1480 *, u32 addr, const void *, size_t);
117 int (*read)(struct i1480 *, u32 addr, size_t);
118 int (*rc_setup)(struct i1480 *);
119 void (*rc_release)(struct i1480 *);
120 int (*wait_init_done)(struct i1480 *);
121 int (*cmd)(struct i1480 *, const char *cmd_name, size_t cmd_size);
122 const char *pre_fw_name;
123 const char *mac_fw_name;
124 const char *mac_fw_name_deprecate;
125 const char *phy_fw_name;
126 u8 hw_rev;
127
128 size_t buf_size;
129 void *evt_buf, *cmd_buf;
130 ssize_t evt_result;
131 struct completion evt_complete;
132};
133
134static inline
135void i1480_init(struct i1480 *i1480)
136{
137 i1480->hw_rev = 1;
138 init_completion(&i1480->evt_complete);
139}
140
141extern int i1480_fw_upload(struct i1480 *);
142extern int i1480_pre_fw_upload(struct i1480 *);
143extern int i1480_mac_fw_upload(struct i1480 *);
144extern int i1480_phy_fw_upload(struct i1480 *);
145extern ssize_t i1480_cmd(struct i1480 *, const char *, size_t, size_t);
146extern int i1480_rceb_check(const struct i1480 *,
147 const struct uwb_rceb *, const char *, u8,
148 u8, unsigned);
149
150enum {
151
152 i1480_CET_VS1 = 0xfd,
153
154 i1480_CMD_SET_IP_MAS = 0x000e,
155 i1480_CMD_GET_MAC_PHY_INFO = 0x0003,
156 i1480_CMD_MPI_WRITE = 0x000f,
157 i1480_CMD_MPI_READ = 0x0010,
158
159#if i1480_FW > 0x00000302
160 i1480_EVT_CONFIRM = 0x0002,
161 i1480_EVT_RM_INIT_DONE = 0x0101,
162 i1480_EVT_DEV_ADD = 0x0103,
163 i1480_EVT_DEV_RM = 0x0104,
164 i1480_EVT_DEV_ID_CHANGE = 0x0105,
165 i1480_EVT_GET_MAC_PHY_INFO = i1480_CMD_GET_MAC_PHY_INFO,
166#else
167 i1480_EVT_CONFIRM = 0x0002,
168 i1480_EVT_RM_INIT_DONE = 0x0101,
169 i1480_EVT_DEV_ADD = 0x0103,
170 i1480_EVT_DEV_RM = 0x0104,
171 i1480_EVT_DEV_ID_CHANGE = 0x0105,
172 i1480_EVT_GET_MAC_PHY_INFO = i1480_EVT_CONFIRM,
173#endif
174};
175
176
177struct i1480_evt_confirm {
178 struct uwb_rceb rceb;
179#ifdef i1480_RCEB_EXTENDED
180 __le16 wParamLength;
181#endif
182 u8 bResultCode;
183} __attribute__((packed));
184
185
186struct i1480_rceb {
187 struct uwb_rceb rceb;
188#ifdef i1480_RCEB_EXTENDED
189 __le16 wParamLength;
190#endif
191} __attribute__((packed));
192
193
194
195
196
197
198
199struct i1480_evt_confirm_GMPI {
200#if i1480_FW > 0x00000302
201 struct uwb_rceb rceb;
202 __le16 wParamLength;
203 __le16 status;
204 u8 mac_addr[6];
205 u8 dev_addr[2];
206 __le16 mac_fw_rev;
207 u8 hw_rev;
208 u8 phy_vendor;
209 u8 phy_rev;
210 __le16 mac_caps;
211 u8 phy_caps[3];
212 u8 key_stores;
213 __le16 mcast_addr_stores;
214 u8 sec_mode_supported;
215#else
216 struct uwb_rceb rceb;
217 u8 status;
218 u8 mac_addr[8];
219 u8 dev_addr[2];
220 __le16 mac_fw_rev;
221 __le16 phy_fw_rev;
222 __le16 mac_caps;
223 u8 phy_caps;
224 u8 key_stores;
225 __le16 mcast_addr_stores;
226 u8 sec_mode_supported;
227#endif
228} __attribute__((packed));
229
230
231struct i1480_cmd_mpi_write {
232 struct uwb_rccb rccb;
233 __le16 size;
234 u8 data[];
235};
236
237
238struct i1480_cmd_mpi_read {
239 struct uwb_rccb rccb;
240 __le16 size;
241 struct {
242 u8 page, offset;
243 } __attribute__((packed)) data[];
244} __attribute__((packed));
245
246
247struct i1480_evt_mpi_read {
248 struct uwb_rceb rceb;
249#ifdef i1480_RCEB_EXTENDED
250 __le16 wParamLength;
251#endif
252 u8 bResultCode;
253 __le16 size;
254 struct {
255 u8 page, offset, value;
256 } __attribute__((packed)) data[];
257} __attribute__((packed));
258
259
260#endif
261