Searched refs:i1480 (Results 1 - 10 of 10) sorted by relevance

/linux-4.4.14/drivers/uwb/i1480/dfu/
H A DMakefile1 obj-$(CONFIG_UWB_I1480U) += i1480-dfu-usb.o
3 i1480-dfu-usb-objs := \
H A Dmac.c26 * common entry point in __mac_fw_upload(), which uses the i1480
33 #include "i1480-dfu.h"
62 int fw_hdr_load(struct i1480 *i1480, struct fw_hdr *hdr, unsigned hdr_cnt, fw_hdr_load() argument
68 dev_err(i1480->dev, "fw hdr #%u/%zu: EOF reached in header at " fw_hdr_load()
80 dev_err(i1480->dev, "fw hdr #%u/%zu: EOF reached in data; " fw_hdr_load()
108 int fw_hdrs_load(struct i1480 *i1480, struct fw_hdr **phdr, fw_hdrs_load() argument
129 dev_err(i1480->dev, "Cannot allocate fw header " fw_hdrs_load()
133 result = fw_hdr_load(i1480, hdr, hdr_cnt, fw_hdrs_load()
157 * @i1480: Device instance
167 ssize_t i1480_fw_cmp(struct i1480 *i1480, struct fw_hdr *hdr) i1480_fw_cmp() argument
176 chunk_size = size < i1480->buf_size ? size : i1480->buf_size; i1480_fw_cmp()
177 result = i1480->read(i1480, hdr->address + src_itr, chunk_size); i1480_fw_cmp()
179 dev_err(i1480->dev, "error reading for verification: " i1480_fw_cmp()
183 if (memcmp(i1480->cmd_buf, bin + src_itr, result)) { i1480_fw_cmp()
184 u8 *buf = i1480->cmd_buf; i1480_fw_cmp()
187 dev_err(i1480->dev, "byte failed at " i1480_fw_cmp()
213 int mac_fw_hdrs_push(struct i1480 *i1480, struct fw_hdr *hdr, mac_fw_hdrs_push() argument
216 struct device *dev = i1480->dev; mac_fw_hdrs_push()
228 result = i1480->write(i1480, hdr_itr->address, hdr_itr->bin, mac_fw_hdrs_push()
237 result = i1480_fw_cmp(i1480, hdr_itr); mac_fw_hdrs_push()
266 int mac_fw_upload_enable(struct i1480 *i1480) mac_fw_upload_enable() argument
270 u32 *buffer = (u32 *)i1480->cmd_buf; mac_fw_upload_enable()
272 if (i1480->hw_rev > 1) mac_fw_upload_enable()
274 result = i1480->read(i1480, reg, sizeof(u32)); mac_fw_upload_enable()
278 result = i1480->write(i1480, reg, buffer, sizeof(u32)); mac_fw_upload_enable()
283 dev_err(i1480->dev, "can't enable fw upload mode: %d\n", result); mac_fw_upload_enable()
290 int mac_fw_upload_disable(struct i1480 *i1480) mac_fw_upload_disable() argument
294 u32 *buffer = (u32 *)i1480->cmd_buf; mac_fw_upload_disable()
296 if (i1480->hw_rev > 1) mac_fw_upload_disable()
298 result = i1480->read(i1480, reg, sizeof(u32)); mac_fw_upload_disable()
302 result = i1480->write(i1480, reg, buffer, sizeof(u32)); mac_fw_upload_disable()
307 dev_err(i1480->dev, "can't disable fw upload mode: %d\n", result); mac_fw_upload_disable()
316 * @i1480: Device instance
325 int __mac_fw_upload(struct i1480 *i1480, const char *fw_name, __mac_fw_upload() argument
332 result = request_firmware(&fw, fw_name, i1480->dev); __mac_fw_upload()
335 result = fw_hdrs_load(i1480, &fw_hdrs, fw->data, fw->size); __mac_fw_upload()
337 dev_err(i1480->dev, "%s fw '%s': failed to parse firmware " __mac_fw_upload()
341 result = mac_fw_upload_enable(i1480); __mac_fw_upload()
344 result = mac_fw_hdrs_push(i1480, fw_hdrs, fw_name, fw_tag); __mac_fw_upload()
345 mac_fw_upload_disable(i1480); __mac_fw_upload()
348 dev_info(i1480->dev, "%s fw '%s': uploaded\n", fw_tag, fw_name); __mac_fw_upload()
350 dev_err(i1480->dev, "%s fw '%s': failed to upload (%d), " __mac_fw_upload()
364 int i1480_pre_fw_upload(struct i1480 *i1480) i1480_pre_fw_upload() argument
367 result = __mac_fw_upload(i1480, i1480->pre_fw_name, "PRE"); i1480_pre_fw_upload()
377 * @i1480: Device's instance
388 int i1480_cmd_reset(struct i1480 *i1480) i1480_cmd_reset() argument
391 struct uwb_rccb *cmd = (void *) i1480->cmd_buf; i1480_cmd_reset()
395 } __attribute__((packed)) *reply = (void *) i1480->evt_buf; i1480_cmd_reset()
402 result = i1480_cmd(i1480, "RESET", sizeof(*cmd), sizeof(*reply)); i1480_cmd_reset()
406 dev_err(i1480->dev, "RESET: command execution failed: %u\n", i1480_cmd_reset()
418 int i1480_fw_is_running_q(struct i1480 *i1480) i1480_fw_is_running_q() argument
422 u32 *val = (u32 *) i1480->cmd_buf; i1480_fw_is_running_q()
426 result = i1480->read(i1480, 0x80080000, 4); i1480_fw_is_running_q()
428 dev_err(i1480->dev, "Can't read 0x8008000: %d\n", result); i1480_fw_is_running_q()
434 dev_err(i1480->dev, "Timed out waiting for fw to start\n"); i1480_fw_is_running_q()
445 * @i1480: Device instance
451 int i1480_mac_fw_upload(struct i1480 *i1480) i1480_mac_fw_upload() argument
454 struct i1480_rceb *rcebe = (void *) i1480->evt_buf; i1480_mac_fw_upload()
456 result = __mac_fw_upload(i1480, i1480->mac_fw_name, "MAC"); i1480_mac_fw_upload()
458 result = __mac_fw_upload(i1480, i1480->mac_fw_name_deprecate, i1480_mac_fw_upload()
465 dev_warn(i1480->dev, i1480_mac_fw_upload()
468 i1480->mac_fw_name_deprecate, i1480->mac_fw_name); i1480_mac_fw_upload()
469 result = i1480_fw_is_running_q(i1480); i1480_mac_fw_upload()
472 result = i1480->rc_setup ? i1480->rc_setup(i1480) : 0; i1480_mac_fw_upload()
474 dev_err(i1480->dev, "Cannot setup after MAC fw upload: %d\n", i1480_mac_fw_upload()
478 result = i1480->wait_init_done(i1480); /* wait init'on */ i1480_mac_fw_upload()
480 dev_err(i1480->dev, "MAC fw '%s': Initialization timed out " i1480_mac_fw_upload()
481 "(%d)\n", i1480->mac_fw_name, result); i1480_mac_fw_upload()
485 if (i1480->evt_result != sizeof(*rcebe)) { i1480_mac_fw_upload()
486 dev_err(i1480->dev, "MAC fw '%s': initialization event returns " i1480_mac_fw_upload()
488 i1480->mac_fw_name, i1480->evt_result, sizeof(*rcebe)); i1480_mac_fw_upload()
492 if (i1480_rceb_check(i1480, &rcebe->rceb, NULL, 0, i1480_CET_VS1, i1480_mac_fw_upload()
494 dev_err(i1480->dev, "wrong initialization event 0x%02x/%04x/%02x " i1480_mac_fw_upload()
501 result = i1480_cmd_reset(i1480); i1480_mac_fw_upload()
503 dev_err(i1480->dev, "MAC fw '%s': MBOA reset failed (%d)\n", i1480_mac_fw_upload()
504 i1480->mac_fw_name, result); i1480_mac_fw_upload()
H A Dusb.c23 * This driver will prepare the i1480 device to behave as a real
34 * uses to do its job. All the ops in the common code are i1480->NAME,
45 #include "i1480-dfu.h"
48 struct i1480 i1480; member in struct:i1480_usb
58 i1480_init(&i1480_usb->i1480); i1480_usb_init()
96 * Write a buffer to a memory address in the i1480 device
98 * @i1480: i1480 instance
106 * so we copy it to the local i1480 buffer before proceeding. In any
110 int i1480_usb_write(struct i1480 *i1480, u32 memory_address, i1480_usb_write() argument
114 struct i1480_usb *i1480_usb = container_of(i1480, struct i1480_usb, i1480); i1480_usb_write()
119 buffer_size = size < i1480->buf_size ? size : i1480->buf_size; i1480_usb_write()
120 memcpy(i1480->cmd_buf, buffer + itr, buffer_size); i1480_usb_write()
125 i1480->cmd_buf, buffer_size, 100 /* FIXME: arbitrary */); i1480_usb_write()
137 * Read a block [max size 512] of the device's memory to @i1480's buffer.
139 * @i1480: i1480 instance
150 int i1480_usb_read(struct i1480 *i1480, u32 addr, size_t size) i1480_usb_read() argument
153 size_t itr, read_size = i1480->buf_size; i1480_usb_read()
154 struct i1480_usb *i1480_usb = container_of(i1480, struct i1480_usb, i1480); i1480_usb_read()
156 BUG_ON(size > i1480->buf_size); i1480_usb_read()
170 i1480->cmd_buf + itr, itr_size, i1480_usb_read()
173 dev_err(i1480->dev, "%s: USB read error: %zd\n", i1480_usb_read()
179 dev_err(i1480->dev, i1480_usb_read()
200 struct i1480 *i1480 = urb->context; i1480_usb_neep_cb() local
201 struct device *dev = i1480->dev; i1480_usb_neep_cb()
217 i1480->evt_result = urb->actual_length; i1480_usb_neep_cb()
218 complete(&i1480->evt_complete); i1480_usb_neep_cb()
227 * initializing. Get that notification into i1480->evt_buf; upper layer
230 * Set i1480->evt_result with the result of getting the event or its
233 * Delivers the data directly to i1480->evt_buf
236 int i1480_usb_wait_init_done(struct i1480 *i1480) i1480_usb_wait_init_done() argument
239 struct device *dev = i1480->dev; i1480_usb_wait_init_done()
240 struct i1480_usb *i1480_usb = container_of(i1480, struct i1480_usb, i1480); i1480_usb_wait_init_done()
243 init_completion(&i1480->evt_complete); i1480_usb_wait_init_done()
244 i1480->evt_result = -EINPROGRESS; i1480_usb_wait_init_done()
248 i1480->evt_buf, i1480->buf_size, i1480_usb_wait_init_done()
249 i1480_usb_neep_cb, i1480, epd->bInterval); i1480_usb_wait_init_done()
258 &i1480->evt_complete, HZ); i1480_usb_wait_init_done()
269 i1480->evt_result = result; i1480_usb_wait_init_done()
275 * Generic function for issuing commands to the i1480
277 * @i1480: i1480 instance
291 int i1480_usb_cmd(struct i1480 *i1480, const char *cmd_name, size_t cmd_size) i1480_usb_cmd() argument
294 struct device *dev = i1480->dev; i1480_usb_cmd()
295 struct i1480_usb *i1480_usb = container_of(i1480, struct i1480_usb, i1480); i1480_usb_cmd()
297 struct uwb_rccb *cmd = i1480->cmd_buf; i1480_usb_cmd()
306 i1480->evt_buf, i1480->buf_size, i1480_usb_cmd()
307 i1480_usb_neep_cb, i1480, epd->bInterval); i1480_usb_cmd()
337 * Probe a i1480 device for uploading firmware.
345 struct i1480 *i1480; i1480_usb_probe() local
373 i1480 = &i1480_usb->i1480; i1480_usb_probe()
374 i1480->buf_size = 512; i1480_usb_probe()
375 i1480->cmd_buf = kmalloc(2 * i1480->buf_size, GFP_KERNEL); i1480_usb_probe()
376 if (i1480->cmd_buf == NULL) { i1480_usb_probe()
381 i1480->evt_buf = i1480->cmd_buf + i1480->buf_size; i1480_usb_probe()
390 i1480->pre_fw_name = "i1480-pre-phy-0.0.bin"; i1480_usb_probe()
391 i1480->mac_fw_name = "i1480-usb-0.0.bin"; i1480_usb_probe()
392 i1480->mac_fw_name_deprecate = "ptc-0.0.bin"; i1480_usb_probe()
393 i1480->phy_fw_name = "i1480-phy-0.0.bin"; i1480_usb_probe()
394 i1480->dev = &iface->dev; i1480_usb_probe()
395 i1480->write = i1480_usb_write; i1480_usb_probe()
396 i1480->read = i1480_usb_read; i1480_usb_probe()
397 i1480->rc_setup = NULL; i1480_usb_probe()
398 i1480->wait_init_done = i1480_usb_wait_init_done; i1480_usb_probe()
399 i1480->cmd = i1480_usb_cmd; i1480_usb_probe()
401 result = i1480_fw_upload(&i1480_usb->i1480); /* the real thing */ i1480_usb_probe()
408 kfree(i1480->cmd_buf); i1480_usb_probe()
415 MODULE_FIRMWARE("i1480-pre-phy-0.0.bin");
416 MODULE_FIRMWARE("i1480-usb-0.0.bin");
417 MODULE_FIRMWARE("i1480-phy-0.0.bin");
448 .name = "i1480-dfu-usb",
H A Ddfu.c29 #include "i1480-dfu.h"
40 * @i1480: pointer to device for which RCEB is being checked
52 int i1480_rceb_check(const struct i1480 *i1480, const struct uwb_rceb *rceb, i1480_rceb_check() argument
57 struct device *dev = i1480->dev; i1480_rceb_check()
87 * Command data has to be in i1480->cmd_buf.
89 * @returns size of the reply data filled in i1480->evt_buf or < 0 errno
92 ssize_t i1480_cmd(struct i1480 *i1480, const char *cmd_name, size_t cmd_size, i1480_cmd() argument
96 struct uwb_rceb *reply = i1480->evt_buf; i1480_cmd()
97 struct uwb_rccb *cmd = i1480->cmd_buf; i1480_cmd()
102 init_completion(&i1480->evt_complete); i1480_cmd()
103 i1480->evt_result = -EINPROGRESS; i1480_cmd()
108 result = i1480->cmd(i1480, cmd_name, cmd_size); i1480_cmd()
113 &i1480->evt_complete, HZ); i1480_cmd()
120 result = i1480->evt_result; i1480_cmd()
122 dev_err(i1480->dev, "%s: command reply reception failed: %zd\n", i1480_cmd()
132 if (i1480_rceb_check(i1480, i1480->evt_buf, NULL, i1480_cmd()
135 result = i1480->wait_init_done(i1480); i1480_cmd()
138 result = i1480->evt_result; i1480_cmd()
141 dev_err(i1480->dev, "%s returned only %zu bytes, %zu expected\n", i1480_cmd()
147 result = i1480_rceb_check(i1480, i1480->evt_buf, cmd_name, context, i1480_cmd()
156 int i1480_print_state(struct i1480 *i1480) i1480_print_state() argument
159 u32 *buf = (u32 *) i1480->cmd_buf; i1480_print_state()
161 result = i1480->read(i1480, 0x80080000, 2 * sizeof(*buf)); i1480_print_state()
163 dev_err(i1480->dev, "cannot read U & L states: %d\n", result); i1480_print_state()
166 dev_info(i1480->dev, "state U 0x%08x, L 0x%08x\n", buf[0], buf[1]); i1480_print_state()
177 int i1480_fw_upload(struct i1480 *i1480) i1480_fw_upload() argument
181 result = i1480_pre_fw_upload(i1480); /* PHY pre fw */ i1480_fw_upload()
183 i1480_print_state(i1480); i1480_fw_upload()
186 result = i1480_mac_fw_upload(i1480); /* MAC fw */ i1480_fw_upload()
189 dev_err(i1480->dev, "Cannot locate MAC FW file '%s'\n", i1480_fw_upload()
190 i1480->mac_fw_name); i1480_fw_upload()
192 i1480_print_state(i1480); i1480_fw_upload()
195 result = i1480_phy_fw_upload(i1480); /* PHY fw */ i1480_fw_upload()
197 i1480_print_state(i1480); i1480_fw_upload()
204 dev_info(i1480->dev, "firmware uploaded successfully\n"); i1480_fw_upload()
206 if (i1480->rc_release) i1480_fw_upload()
207 i1480->rc_release(i1480); i1480_fw_upload()
H A Dphy.c33 #include "i1480-dfu.h"
39 * @i1480: Device descriptor
52 int i1480_mpi_write(struct i1480 *i1480, const void *data, size_t size) i1480_mpi_write() argument
55 struct i1480_cmd_mpi_write *cmd = i1480->cmd_buf; i1480_mpi_write()
56 struct i1480_evt_confirm *reply = i1480->evt_buf; i1480_mpi_write()
66 result = i1480_cmd(i1480, "MPI-WRITE", sizeof(*cmd) + size, sizeof(*reply)); i1480_mpi_write()
70 dev_err(i1480->dev, "MPI-WRITE: command execution failed: %d\n", i1480_mpi_write()
82 * @i1480: Device descriptor
94 * We use the i1480->cmd_buf for the command, i1480->evt_buf for the reply.
96 * As the reply has to fit in 512 bytes (i1480->evt_buffer), the max amount
100 int i1480_mpi_read(struct i1480 *i1480, u8 *data, u16 srcaddr, size_t size) i1480_mpi_read() argument
103 struct i1480_cmd_mpi_read *cmd = i1480->cmd_buf; i1480_mpi_read()
104 struct i1480_evt_mpi_read *reply = i1480->evt_buf; i1480_mpi_read()
107 memset(i1480->cmd_buf, 0x69, 512); i1480_mpi_read()
108 memset(i1480->evt_buf, 0x69, 512); i1480_mpi_read()
110 BUG_ON(size > (i1480->buf_size - sizeof(*reply)) / 3); i1480_mpi_read()
121 result = i1480_cmd(i1480, "MPI-READ", sizeof(*cmd) + 2*size, i1480_mpi_read()
126 dev_err(i1480->dev, "MPI-READ: command execution failed: %d\n", i1480_mpi_read()
132 dev_err(i1480->dev, "MPI-READ: page inconsistency at " i1480_mpi_read()
136 dev_err(i1480->dev, "MPI-READ: offset inconsistency at " i1480_mpi_read()
151 * @i1480: Device instance
162 int i1480_phy_fw_upload(struct i1480 *i1480) i1480_phy_fw_upload() argument
171 result = request_firmware(&fw, i1480->phy_fw_name, i1480->dev); i1480_phy_fw_upload()
178 result = i1480_mpi_write(i1480, data_itr, data_size); i1480_phy_fw_upload()
183 result = i1480_mpi_read(i1480, &phy_stat, 0x0006, 1); i1480_phy_fw_upload()
185 dev_err(i1480->dev, "PHY: can't get status: %d\n", result); i1480_phy_fw_upload()
190 dev_info(i1480->dev, "error, PHY not ready: %u\n", phy_stat); i1480_phy_fw_upload()
193 dev_info(i1480->dev, "PHY fw '%s': uploaded\n", i1480->phy_fw_name); i1480_phy_fw_upload()
199 dev_err(i1480->dev, "PHY fw '%s': failed to upload (%d), " i1480_phy_fw_upload()
200 "power cycle device\n", i1480->phy_fw_name, result); i1480_phy_fw_upload()
H A Di1480-dfu.h2 * i1480 Device Firmware Upload
45 * i1480->write() [i1480_{usb,pci}_write()]
47 * i1480->read() [i1480_{usb,pci}_read()]
50 * i1480->setup(()
51 * i1480->wait_init_done()
53 * i1480->cmd() [i1480_{usb,pci}_cmd()]
58 * i1480->cmd() [i1480_{usb,pci}_cmd()]
86 * @read Read from device's memory to i1480->evt_buf.
92 * command data is contained in i1480->cmd_buf and the size
94 * in i1480->evt_buf and the size in i1480->evt_result (or if
107 * i1480->evt_buf (and size/result in i1480->evt_result).
113 struct i1480 { struct
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);
135 void i1480_init(struct i1480 *i1480) i1480_init() argument
137 i1480->hw_rev = 1; i1480_init()
138 init_completion(&i1480->evt_complete); i1480_init()
141 extern int i1480_fw_upload(struct i1480 *);
142 extern int i1480_pre_fw_upload(struct i1480 *);
143 extern int i1480_mac_fw_upload(struct i1480 *);
144 extern int i1480_phy_fw_upload(struct i1480 *);
145 extern ssize_t i1480_cmd(struct i1480 *, const char *, size_t, size_t);
146 extern int i1480_rceb_check(const struct i1480 *,
153 /* i1480 commands */
158 /* i1480 events */
/linux-4.4.14/drivers/uwb/
H A DMakefile4 obj-$(CONFIG_UWB_I1480U) += i1480/
H A Dhwa-rc.c914 /* Intel i1480 (using firmware 1.3PA2-20070828) */
/linux-4.4.14/drivers/uwb/i1480/
H A Di1480-est.c30 #include "dfu/i1480-dfu.h"
86 MODULE_DESCRIPTION("i1480's Vendor Specific Event Size Tables");
/linux-4.4.14/include/uapi/linux/usb/
H A Dch11.h18 * Current Wireless USB host hardware (Intel i1480 for example) allows

Completed in 188 milliseconds