aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/uwb/i1480/dfu
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/uwb/i1480/dfu')
-rw-r--r--drivers/uwb/i1480/dfu/dfu.c10
-rw-r--r--drivers/uwb/i1480/dfu/mac.c18
-rw-r--r--drivers/uwb/i1480/dfu/usb.c26
3 files changed, 2 insertions, 52 deletions
diff --git a/drivers/uwb/i1480/dfu/dfu.c b/drivers/uwb/i1480/dfu/dfu.c
index 9097b3b30385..da7b1d08003c 100644
--- a/drivers/uwb/i1480/dfu/dfu.c
+++ b/drivers/uwb/i1480/dfu/dfu.c
@@ -34,10 +34,7 @@
34#include <linux/uwb.h> 34#include <linux/uwb.h>
35#include <linux/random.h> 35#include <linux/random.h>
36 36
37#define D_LOCAL 0 37/*
38#include <linux/uwb/debug.h>
39
40/**
41 * i1480_rceb_check - Check RCEB for expected field values 38 * i1480_rceb_check - Check RCEB for expected field values
42 * @i1480: pointer to device for which RCEB is being checked 39 * @i1480: pointer to device for which RCEB is being checked
43 * @rceb: RCEB being checked 40 * @rceb: RCEB being checked
@@ -83,7 +80,7 @@ int i1480_rceb_check(const struct i1480 *i1480, const struct uwb_rceb *rceb,
83EXPORT_SYMBOL_GPL(i1480_rceb_check); 80EXPORT_SYMBOL_GPL(i1480_rceb_check);
84 81
85 82
86/** 83/*
87 * Execute a Radio Control Command 84 * Execute a Radio Control Command
88 * 85 *
89 * Command data has to be in i1480->cmd_buf. 86 * Command data has to be in i1480->cmd_buf.
@@ -101,7 +98,6 @@ ssize_t i1480_cmd(struct i1480 *i1480, const char *cmd_name, size_t cmd_size,
101 u8 expected_type = reply->bEventType; 98 u8 expected_type = reply->bEventType;
102 u8 context; 99 u8 context;
103 100
104 d_fnstart(3, i1480->dev, "(%p, %s, %zu)\n", i1480, cmd_name, cmd_size);
105 init_completion(&i1480->evt_complete); 101 init_completion(&i1480->evt_complete);
106 i1480->evt_result = -EINPROGRESS; 102 i1480->evt_result = -EINPROGRESS;
107 do { 103 do {
@@ -150,8 +146,6 @@ ssize_t i1480_cmd(struct i1480 *i1480, const char *cmd_name, size_t cmd_size,
150 result = i1480_rceb_check(i1480, i1480->evt_buf, cmd_name, context, 146 result = i1480_rceb_check(i1480, i1480->evt_buf, cmd_name, context,
151 expected_type, expected_event); 147 expected_type, expected_event);
152error: 148error:
153 d_fnend(3, i1480->dev, "(%p, %s, %zu) = %zd\n",
154 i1480, cmd_name, cmd_size, result);
155 return result; 149 return result;
156} 150}
157EXPORT_SYMBOL_GPL(i1480_cmd); 151EXPORT_SYMBOL_GPL(i1480_cmd);
diff --git a/drivers/uwb/i1480/dfu/mac.c b/drivers/uwb/i1480/dfu/mac.c
index 2e4d8f07c165..694d0daf88ab 100644
--- a/drivers/uwb/i1480/dfu/mac.c
+++ b/drivers/uwb/i1480/dfu/mac.c
@@ -31,9 +31,6 @@
31#include <linux/uwb.h> 31#include <linux/uwb.h>
32#include "i1480-dfu.h" 32#include "i1480-dfu.h"
33 33
34#define D_LOCAL 0
35#include <linux/uwb/debug.h>
36
37/* 34/*
38 * Descriptor for a continuous segment of MAC fw data 35 * Descriptor for a continuous segment of MAC fw data
39 */ 36 */
@@ -184,10 +181,6 @@ ssize_t i1480_fw_cmp(struct i1480 *i1480, struct fw_hdr *hdr)
184 } 181 }
185 if (memcmp(i1480->cmd_buf, bin + src_itr, result)) { 182 if (memcmp(i1480->cmd_buf, bin + src_itr, result)) {
186 u8 *buf = i1480->cmd_buf; 183 u8 *buf = i1480->cmd_buf;
187 d_printf(2, i1480->dev,
188 "original data @ %p + %u, %zu bytes\n",
189 bin, src_itr, result);
190 d_dump(4, i1480->dev, bin + src_itr, result);
191 for (cnt = 0; cnt < result; cnt++) 184 for (cnt = 0; cnt < result; cnt++)
192 if (bin[src_itr + cnt] != buf[cnt]) { 185 if (bin[src_itr + cnt] != buf[cnt]) {
193 dev_err(i1480->dev, "byte failed at " 186 dev_err(i1480->dev, "byte failed at "
@@ -224,7 +217,6 @@ int mac_fw_hdrs_push(struct i1480 *i1480, struct fw_hdr *hdr,
224 struct fw_hdr *hdr_itr; 217 struct fw_hdr *hdr_itr;
225 int verif_retry_count; 218 int verif_retry_count;
226 219
227 d_fnstart(3, dev, "(%p, %p)\n", i1480, hdr);
228 /* Now, header by header, push them to the hw */ 220 /* Now, header by header, push them to the hw */
229 for (hdr_itr = hdr; hdr_itr != NULL; hdr_itr = hdr_itr->next) { 221 for (hdr_itr = hdr; hdr_itr != NULL; hdr_itr = hdr_itr->next) {
230 verif_retry_count = 0; 222 verif_retry_count = 0;
@@ -264,7 +256,6 @@ retry:
264 break; 256 break;
265 } 257 }
266 } 258 }
267 d_fnend(3, dev, "(%zd)\n", result);
268 return result; 259 return result;
269} 260}
270 261
@@ -337,11 +328,9 @@ int __mac_fw_upload(struct i1480 *i1480, const char *fw_name,
337 const struct firmware *fw; 328 const struct firmware *fw;
338 struct fw_hdr *fw_hdrs; 329 struct fw_hdr *fw_hdrs;
339 330
340 d_fnstart(3, i1480->dev, "(%p, %s, %s)\n", i1480, fw_name, fw_tag);
341 result = request_firmware(&fw, fw_name, i1480->dev); 331 result = request_firmware(&fw, fw_name, i1480->dev);
342 if (result < 0) /* Up to caller to complain on -ENOENT */ 332 if (result < 0) /* Up to caller to complain on -ENOENT */
343 goto out; 333 goto out;
344 d_printf(3, i1480->dev, "%s fw '%s': uploading\n", fw_tag, fw_name);
345 result = fw_hdrs_load(i1480, &fw_hdrs, fw->data, fw->size); 334 result = fw_hdrs_load(i1480, &fw_hdrs, fw->data, fw->size);
346 if (result < 0) { 335 if (result < 0) {
347 dev_err(i1480->dev, "%s fw '%s': failed to parse firmware " 336 dev_err(i1480->dev, "%s fw '%s': failed to parse firmware "
@@ -363,8 +352,6 @@ out_hdrs_release:
363out_release: 352out_release:
364 release_firmware(fw); 353 release_firmware(fw);
365out: 354out:
366 d_fnend(3, i1480->dev, "(%p, %s, %s) = %d\n", i1480, fw_name, fw_tag,
367 result);
368 return result; 355 return result;
369} 356}
370 357
@@ -433,7 +420,6 @@ int i1480_fw_is_running_q(struct i1480 *i1480)
433 int result; 420 int result;
434 u32 *val = (u32 *) i1480->cmd_buf; 421 u32 *val = (u32 *) i1480->cmd_buf;
435 422
436 d_fnstart(3, i1480->dev, "(i1480 %p)\n", i1480);
437 for (cnt = 0; cnt < 10; cnt++) { 423 for (cnt = 0; cnt < 10; cnt++) {
438 msleep(100); 424 msleep(100);
439 result = i1480->read(i1480, 0x80080000, 4); 425 result = i1480->read(i1480, 0x80080000, 4);
@@ -447,7 +433,6 @@ int i1480_fw_is_running_q(struct i1480 *i1480)
447 dev_err(i1480->dev, "Timed out waiting for fw to start\n"); 433 dev_err(i1480->dev, "Timed out waiting for fw to start\n");
448 result = -ETIMEDOUT; 434 result = -ETIMEDOUT;
449out: 435out:
450 d_fnend(3, i1480->dev, "(i1480 %p) = %d\n", i1480, result);
451 return result; 436 return result;
452 437
453} 438}
@@ -467,7 +452,6 @@ int i1480_mac_fw_upload(struct i1480 *i1480)
467 int result = 0, deprecated_name = 0; 452 int result = 0, deprecated_name = 0;
468 struct i1480_rceb *rcebe = (void *) i1480->evt_buf; 453 struct i1480_rceb *rcebe = (void *) i1480->evt_buf;
469 454
470 d_fnstart(3, i1480->dev, "(%p)\n", i1480);
471 result = __mac_fw_upload(i1480, i1480->mac_fw_name, "MAC"); 455 result = __mac_fw_upload(i1480, i1480->mac_fw_name, "MAC");
472 if (result == -ENOENT) { 456 if (result == -ENOENT) {
473 result = __mac_fw_upload(i1480, i1480->mac_fw_name_deprecate, 457 result = __mac_fw_upload(i1480, i1480->mac_fw_name_deprecate,
@@ -501,7 +485,6 @@ int i1480_mac_fw_upload(struct i1480 *i1480)
501 dev_err(i1480->dev, "MAC fw '%s': initialization event returns " 485 dev_err(i1480->dev, "MAC fw '%s': initialization event returns "
502 "wrong size (%zu bytes vs %zu needed)\n", 486 "wrong size (%zu bytes vs %zu needed)\n",
503 i1480->mac_fw_name, i1480->evt_result, sizeof(*rcebe)); 487 i1480->mac_fw_name, i1480->evt_result, sizeof(*rcebe));
504 dump_bytes(i1480->dev, rcebe, min(i1480->evt_result, (ssize_t)32));
505 goto error_size; 488 goto error_size;
506 } 489 }
507 result = -EIO; 490 result = -EIO;
@@ -522,6 +505,5 @@ error_fw_not_running:
522error_init_timeout: 505error_init_timeout:
523error_size: 506error_size:
524error_setup: 507error_setup:
525 d_fnend(3, i1480->dev, "(i1480 %p) = %d\n", i1480, result);
526 return result; 508 return result;
527} 509}
diff --git a/drivers/uwb/i1480/dfu/usb.c b/drivers/uwb/i1480/dfu/usb.c
index b7ea525fc06a..686795e97195 100644
--- a/drivers/uwb/i1480/dfu/usb.c
+++ b/drivers/uwb/i1480/dfu/usb.c
@@ -43,10 +43,6 @@
43#include <linux/usb/wusb-wa.h> 43#include <linux/usb/wusb-wa.h>
44#include "i1480-dfu.h" 44#include "i1480-dfu.h"
45 45
46#define D_LOCAL 0
47#include <linux/uwb/debug.h>
48
49
50struct i1480_usb { 46struct i1480_usb {
51 struct i1480 i1480; 47 struct i1480 i1480;
52 struct usb_device *usb_dev; 48 struct usb_device *usb_dev;
@@ -117,8 +113,6 @@ int i1480_usb_write(struct i1480 *i1480, u32 memory_address,
117 struct i1480_usb *i1480_usb = container_of(i1480, struct i1480_usb, i1480); 113 struct i1480_usb *i1480_usb = container_of(i1480, struct i1480_usb, i1480);
118 size_t buffer_size, itr = 0; 114 size_t buffer_size, itr = 0;
119 115
120 d_fnstart(3, i1480->dev, "(%p, 0x%08x, %p, %zu)\n",
121 i1480, memory_address, buffer, size);
122 BUG_ON(size & 0x3); /* Needs to be a multiple of 4 */ 116 BUG_ON(size & 0x3); /* Needs to be a multiple of 4 */
123 while (size > 0) { 117 while (size > 0) {
124 buffer_size = size < i1480->buf_size ? size : i1480->buf_size; 118 buffer_size = size < i1480->buf_size ? size : i1480->buf_size;
@@ -131,16 +125,10 @@ int i1480_usb_write(struct i1480 *i1480, u32 memory_address,
131 i1480->cmd_buf, buffer_size, 100 /* FIXME: arbitrary */); 125 i1480->cmd_buf, buffer_size, 100 /* FIXME: arbitrary */);
132 if (result < 0) 126 if (result < 0)
133 break; 127 break;
134 d_printf(3, i1480->dev,
135 "wrote @ 0x%08x %u bytes (of %zu bytes requested)\n",
136 memory_address, result, buffer_size);
137 d_dump(4, i1480->dev, i1480->cmd_buf, result);
138 itr += result; 128 itr += result;
139 memory_address += result; 129 memory_address += result;
140 size -= result; 130 size -= result;
141 } 131 }
142 d_fnend(3, i1480->dev, "(%p, 0x%08x, %p, %zu) = %d\n",
143 i1480, memory_address, buffer, size, result);
144 return result; 132 return result;
145} 133}
146 134
@@ -165,8 +153,6 @@ int i1480_usb_read(struct i1480 *i1480, u32 addr, size_t size)
165 size_t itr, read_size = i1480->buf_size; 153 size_t itr, read_size = i1480->buf_size;
166 struct i1480_usb *i1480_usb = container_of(i1480, struct i1480_usb, i1480); 154 struct i1480_usb *i1480_usb = container_of(i1480, struct i1480_usb, i1480);
167 155
168 d_fnstart(3, i1480->dev, "(%p, 0x%08x, %zu)\n",
169 i1480, addr, size);
170 BUG_ON(size > i1480->buf_size); 156 BUG_ON(size > i1480->buf_size);
171 BUG_ON(size & 0x3); /* Needs to be a multiple of 4 */ 157 BUG_ON(size & 0x3); /* Needs to be a multiple of 4 */
172 BUG_ON(read_size > 512); 158 BUG_ON(read_size > 512);
@@ -200,10 +186,6 @@ int i1480_usb_read(struct i1480 *i1480, u32 addr, size_t size)
200 } 186 }
201 result = bytes; 187 result = bytes;
202out: 188out:
203 d_fnend(3, i1480->dev, "(%p, 0x%08x, %zu) = %zd\n",
204 i1480, addr, size, result);
205 if (result > 0)
206 d_dump(4, i1480->dev, i1480->cmd_buf, result);
207 return result; 189 return result;
208} 190}
209 191
@@ -259,7 +241,6 @@ int i1480_usb_wait_init_done(struct i1480 *i1480)
259 struct i1480_usb *i1480_usb = container_of(i1480, struct i1480_usb, i1480); 241 struct i1480_usb *i1480_usb = container_of(i1480, struct i1480_usb, i1480);
260 struct usb_endpoint_descriptor *epd; 242 struct usb_endpoint_descriptor *epd;
261 243
262 d_fnstart(3, dev, "(%p)\n", i1480);
263 init_completion(&i1480->evt_complete); 244 init_completion(&i1480->evt_complete);
264 i1480->evt_result = -EINPROGRESS; 245 i1480->evt_result = -EINPROGRESS;
265 epd = &i1480_usb->usb_iface->cur_altsetting->endpoint[0].desc; 246 epd = &i1480_usb->usb_iface->cur_altsetting->endpoint[0].desc;
@@ -281,14 +262,12 @@ int i1480_usb_wait_init_done(struct i1480 *i1480)
281 goto error_wait; 262 goto error_wait;
282 } 263 }
283 usb_kill_urb(i1480_usb->neep_urb); 264 usb_kill_urb(i1480_usb->neep_urb);
284 d_fnend(3, dev, "(%p) = 0\n", i1480);
285 return 0; 265 return 0;
286 266
287error_wait: 267error_wait:
288 usb_kill_urb(i1480_usb->neep_urb); 268 usb_kill_urb(i1480_usb->neep_urb);
289error_submit: 269error_submit:
290 i1480->evt_result = result; 270 i1480->evt_result = result;
291 d_fnend(3, dev, "(%p) = %d\n", i1480, result);
292 return result; 271 return result;
293} 272}
294 273
@@ -319,7 +298,6 @@ int i1480_usb_cmd(struct i1480 *i1480, const char *cmd_name, size_t cmd_size)
319 struct uwb_rccb *cmd = i1480->cmd_buf; 298 struct uwb_rccb *cmd = i1480->cmd_buf;
320 u8 iface_no; 299 u8 iface_no;
321 300
322 d_fnstart(3, dev, "(%p, %s, %zu)\n", i1480, cmd_name, cmd_size);
323 /* Post a read on the notification & event endpoint */ 301 /* Post a read on the notification & event endpoint */
324 iface_no = i1480_usb->usb_iface->cur_altsetting->desc.bInterfaceNumber; 302 iface_no = i1480_usb->usb_iface->cur_altsetting->desc.bInterfaceNumber;
325 epd = &i1480_usb->usb_iface->cur_altsetting->endpoint[0].desc; 303 epd = &i1480_usb->usb_iface->cur_altsetting->endpoint[0].desc;
@@ -347,15 +325,11 @@ int i1480_usb_cmd(struct i1480 *i1480, const char *cmd_name, size_t cmd_size)
347 cmd_name, result); 325 cmd_name, result);
348 goto error_submit_ep0; 326 goto error_submit_ep0;
349 } 327 }
350 d_fnend(3, dev, "(%p, %s, %zu) = %d\n",
351 i1480, cmd_name, cmd_size, result);
352 return result; 328 return result;
353 329
354error_submit_ep0: 330error_submit_ep0:
355 usb_kill_urb(i1480_usb->neep_urb); 331 usb_kill_urb(i1480_usb->neep_urb);
356error_submit_ep1: 332error_submit_ep1:
357 d_fnend(3, dev, "(%p, %s, %zu) = %d\n",
358 i1480, cmd_name, cmd_size, result);
359 return result; 333 return result;
360} 334}
361 335