80 #define D_SUBMODULE fw
96 int pipe, do_autopm = 1;
98 result = usb_autopm_get_interface(i2400mu->
usb_iface);
100 dev_err(dev,
"BM-CMD: can't get autopm: %d\n", result);
109 if (len != buf_size) {
110 dev_err(dev,
"BM-CMD: short write (%u B vs %zu "
111 "expected)\n", len, buf_size);
130 dev_err(dev,
"BM-CMD: too many stalls in "
131 "URB; resetting device\n");
151 dev_err(dev,
"BM-CMD: maximum errors in "
152 "URB exceeded; resetting device\n");
157 dev_err(dev,
"BM-CMD: URB error %d, retrying\n",
162 usb_autopm_put_interface(i2400mu->
usb_iface);
188 int opcode = _cmd ==
NULL ? -1 : i2400m_brh_get_opcode(_cmd);
190 size_t cmd_size_a =
ALIGN(cmd_size, 16);
192 d_fnstart(8, dev,
"(i2400m %p cmd %p size %zu)\n",
193 i2400m, _cmd, cmd_size);
200 if (cmd_size_a > cmd_size)
203 if (
WARN_ON(i2400m_brh_get_response_required(cmd) == 0))
204 dev_warn(dev,
"SW BUG: response_required == 0\n");
207 result = i2400mu_tx_bulk_out(i2400mu, i2400m->
bm_cmd_buf, cmd_size);
209 dev_err(dev,
"boot-mode cmd %d: cannot send: %zd\n",
213 if (result != cmd_size) {
214 dev_err(dev,
"boot-mode cmd %d: incomplete transfer "
215 "(%zd vs %zu submitted)\n", opcode, result, cmd_size);
222 d_fnend(8, dev,
"(i2400m %p cmd %p size %zu) = %zd\n",
223 i2400m, _cmd, cmd_size, result);
229 void __i2400mu_bm_notif_cb(
struct urb *
urb)
255 usb_fill_int_urb(urb, i2400mu->
usb_dev, pipe,
257 __i2400mu_bm_notif_cb, completion,
283 struct urb notif_urb;
290 d_fnstart(8, dev,
"(i2400m %p ack %p size %zu)\n",
291 i2400m, ack, ack_size);
293 result = usb_autopm_get_interface(i2400mu->
usb_iface);
295 dev_err(dev,
"BM-ACK: can't get autopm: %d\n", (
int) result);
301 while (offset < ack_size) {
302 init_completion(¬if_completion);
303 result = i2400mu_notif_submit(i2400mu, ¬if_urb,
306 goto error_notif_urb_submit;
308 ¬if_completion,
HZ);
312 goto error_notif_wait;
317 goto error_notif_wait;
319 result = notif_urb.status;
335 dev_err(dev,
"BM-ACK: URB error %d, "
336 "retrying\n", notif_urb.status);
339 if (notif_urb.actual_length == 0) {
340 d_printf(6, dev,
"ZLP received, retrying\n");
344 len =
min(ack_size - offset, (
size_t) notif_urb.actual_length);
349 error_notif_urb_submit:
354 usb_autopm_put_interface(i2400mu->
usb_iface);
355 d_fnend(8, dev,
"(i2400m %p ack %p size %zu) = %ld\n",
356 i2400m, ack, ack_size, (
long) result);
360 dev_err(dev,
"bm: maximum errors in notification URB exceeded; "
361 "resetting device\n");