aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire/fw-ohci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/firewire/fw-ohci.c')
-rw-r--r--drivers/firewire/fw-ohci.c110
1 files changed, 56 insertions, 54 deletions
diff --git a/drivers/firewire/fw-ohci.c b/drivers/firewire/fw-ohci.c
index 4f02c55f13e1..0b66306af479 100644
--- a/drivers/firewire/fw-ohci.c
+++ b/drivers/firewire/fw-ohci.c
@@ -265,27 +265,25 @@ static void log_irqs(u32 evt)
265 !(evt & OHCI1394_busReset)) 265 !(evt & OHCI1394_busReset))
266 return; 266 return;
267 267
268 printk(KERN_DEBUG KBUILD_MODNAME ": IRQ " 268 fw_notify("IRQ %08x%s%s%s%s%s%s%s%s%s%s%s%s%s\n", evt,
269 "%08x%s%s%s%s%s%s%s%s%s%s%s%s%s\n", 269 evt & OHCI1394_selfIDComplete ? " selfID" : "",
270 evt, 270 evt & OHCI1394_RQPkt ? " AR_req" : "",
271 evt & OHCI1394_selfIDComplete ? " selfID" : "", 271 evt & OHCI1394_RSPkt ? " AR_resp" : "",
272 evt & OHCI1394_RQPkt ? " AR_req" : "", 272 evt & OHCI1394_reqTxComplete ? " AT_req" : "",
273 evt & OHCI1394_RSPkt ? " AR_resp" : "", 273 evt & OHCI1394_respTxComplete ? " AT_resp" : "",
274 evt & OHCI1394_reqTxComplete ? " AT_req" : "", 274 evt & OHCI1394_isochRx ? " IR" : "",
275 evt & OHCI1394_respTxComplete ? " AT_resp" : "", 275 evt & OHCI1394_isochTx ? " IT" : "",
276 evt & OHCI1394_isochRx ? " IR" : "", 276 evt & OHCI1394_postedWriteErr ? " postedWriteErr" : "",
277 evt & OHCI1394_isochTx ? " IT" : "", 277 evt & OHCI1394_cycleTooLong ? " cycleTooLong" : "",
278 evt & OHCI1394_postedWriteErr ? " postedWriteErr" : "", 278 evt & OHCI1394_cycle64Seconds ? " cycle64Seconds" : "",
279 evt & OHCI1394_cycleTooLong ? " cycleTooLong" : "", 279 evt & OHCI1394_regAccessFail ? " regAccessFail" : "",
280 evt & OHCI1394_cycle64Seconds ? " cycle64Seconds" : "", 280 evt & OHCI1394_busReset ? " busReset" : "",
281 evt & OHCI1394_regAccessFail ? " regAccessFail" : "", 281 evt & ~(OHCI1394_selfIDComplete | OHCI1394_RQPkt |
282 evt & OHCI1394_busReset ? " busReset" : "", 282 OHCI1394_RSPkt | OHCI1394_reqTxComplete |
283 evt & ~(OHCI1394_selfIDComplete | OHCI1394_RQPkt | 283 OHCI1394_respTxComplete | OHCI1394_isochRx |
284 OHCI1394_RSPkt | OHCI1394_reqTxComplete | 284 OHCI1394_isochTx | OHCI1394_postedWriteErr |
285 OHCI1394_respTxComplete | OHCI1394_isochRx | 285 OHCI1394_cycleTooLong | OHCI1394_cycle64Seconds |
286 OHCI1394_isochTx | OHCI1394_postedWriteErr | 286 OHCI1394_regAccessFail | OHCI1394_busReset)
287 OHCI1394_cycleTooLong | OHCI1394_cycle64Seconds |
288 OHCI1394_regAccessFail | OHCI1394_busReset)
289 ? " ?" : ""); 287 ? " ?" : "");
290} 288}
291 289
@@ -308,23 +306,22 @@ static void log_selfids(int node_id, int generation, int self_id_count, u32 *s)
308 if (likely(!(param_debug & OHCI_PARAM_DEBUG_SELFIDS))) 306 if (likely(!(param_debug & OHCI_PARAM_DEBUG_SELFIDS)))
309 return; 307 return;
310 308
311 printk(KERN_DEBUG KBUILD_MODNAME ": %d selfIDs, generation %d, " 309 fw_notify("%d selfIDs, generation %d, local node ID %04x\n",
312 "local node ID %04x\n", self_id_count, generation, node_id); 310 self_id_count, generation, node_id);
313 311
314 for (; self_id_count--; ++s) 312 for (; self_id_count--; ++s)
315 if ((*s & 1 << 23) == 0) 313 if ((*s & 1 << 23) == 0)
316 printk(KERN_DEBUG "selfID 0: %08x, phy %d [%c%c%c] " 314 fw_notify("selfID 0: %08x, phy %d [%c%c%c] "
317 "%s gc=%d %s %s%s%s\n", 315 "%s gc=%d %s %s%s%s\n",
318 *s, *s >> 24 & 63, _p(s, 6), _p(s, 4), _p(s, 2), 316 *s, *s >> 24 & 63, _p(s, 6), _p(s, 4), _p(s, 2),
319 speed[*s >> 14 & 3], *s >> 16 & 63, 317 speed[*s >> 14 & 3], *s >> 16 & 63,
320 power[*s >> 8 & 7], *s >> 22 & 1 ? "L" : "", 318 power[*s >> 8 & 7], *s >> 22 & 1 ? "L" : "",
321 *s >> 11 & 1 ? "c" : "", *s & 2 ? "i" : ""); 319 *s >> 11 & 1 ? "c" : "", *s & 2 ? "i" : "");
322 else 320 else
323 printk(KERN_DEBUG "selfID n: %08x, phy %d " 321 fw_notify("selfID n: %08x, phy %d [%c%c%c%c%c%c%c%c]\n",
324 "[%c%c%c%c%c%c%c%c]\n", 322 *s, *s >> 24 & 63,
325 *s, *s >> 24 & 63, 323 _p(s, 16), _p(s, 14), _p(s, 12), _p(s, 10),
326 _p(s, 16), _p(s, 14), _p(s, 12), _p(s, 10), 324 _p(s, 8), _p(s, 6), _p(s, 4), _p(s, 2));
327 _p(s, 8), _p(s, 6), _p(s, 4), _p(s, 2));
328} 325}
329 326
330static const char *evts[] = { 327static const char *evts[] = {
@@ -373,15 +370,14 @@ static void log_ar_at_event(char dir, int speed, u32 *header, int evt)
373 evt = 0x1f; 370 evt = 0x1f;
374 371
375 if (evt == OHCI1394_evt_bus_reset) { 372 if (evt == OHCI1394_evt_bus_reset) {
376 printk(KERN_DEBUG "A%c evt_bus_reset, generation %d\n", 373 fw_notify("A%c evt_bus_reset, generation %d\n",
377 dir, (header[2] >> 16) & 0xff); 374 dir, (header[2] >> 16) & 0xff);
378 return; 375 return;
379 } 376 }
380 377
381 if (header[0] == ~header[1]) { 378 if (header[0] == ~header[1]) {
382 printk(KERN_DEBUG "A%c %s, %s, %08x\n", 379 fw_notify("A%c %s, %s, %08x\n",
383 dir, evts[evt], phys[header[0] >> 30 & 0x3], 380 dir, evts[evt], phys[header[0] >> 30 & 0x3], header[0]);
384 header[0]);
385 return; 381 return;
386 } 382 }
387 383
@@ -400,24 +396,23 @@ static void log_ar_at_event(char dir, int speed, u32 *header, int evt)
400 396
401 switch (tcode) { 397 switch (tcode) {
402 case 0xe: case 0xa: 398 case 0xe: case 0xa:
403 printk(KERN_DEBUG "A%c %s, %s\n", 399 fw_notify("A%c %s, %s\n", dir, evts[evt], tcodes[tcode]);
404 dir, evts[evt], tcodes[tcode]);
405 break; 400 break;
406 case 0x0: case 0x1: case 0x4: case 0x5: case 0x9: 401 case 0x0: case 0x1: case 0x4: case 0x5: case 0x9:
407 printk(KERN_DEBUG "A%c spd %x tl %02x, " 402 fw_notify("A%c spd %x tl %02x, "
408 "%04x -> %04x, %s, " 403 "%04x -> %04x, %s, "
409 "%s, %04x%08x%s\n", 404 "%s, %04x%08x%s\n",
410 dir, speed, header[0] >> 10 & 0x3f, 405 dir, speed, header[0] >> 10 & 0x3f,
411 header[1] >> 16, header[0] >> 16, evts[evt], 406 header[1] >> 16, header[0] >> 16, evts[evt],
412 tcodes[tcode], header[1] & 0xffff, header[2], specific); 407 tcodes[tcode], header[1] & 0xffff, header[2], specific);
413 break; 408 break;
414 default: 409 default:
415 printk(KERN_DEBUG "A%c spd %x tl %02x, " 410 fw_notify("A%c spd %x tl %02x, "
416 "%04x -> %04x, %s, " 411 "%04x -> %04x, %s, "
417 "%s%s\n", 412 "%s%s\n",
418 dir, speed, header[0] >> 10 & 0x3f, 413 dir, speed, header[0] >> 10 & 0x3f,
419 header[1] >> 16, header[0] >> 16, evts[evt], 414 header[1] >> 16, header[0] >> 16, evts[evt],
420 tcodes[tcode], specific); 415 tcodes[tcode], specific);
421 } 416 }
422} 417}
423 418
@@ -548,6 +543,11 @@ static __le32 *handle_ar_packet(struct ar_context *ctx, __le32 *buffer)
548 p.header_length = 12; 543 p.header_length = 12;
549 p.payload_length = 0; 544 p.payload_length = 0;
550 break; 545 break;
546
547 default:
548 /* FIXME: Stop context, discard everything, and restart? */
549 p.header_length = 0;
550 p.payload_length = 0;
551 } 551 }
552 552
553 p.payload = (void *) buffer + p.header_length; 553 p.payload = (void *) buffer + p.header_length;
@@ -1468,6 +1468,9 @@ static int ohci_enable(struct fw_card *card, u32 *config_rom, size_t length)
1468 reg_write(ohci, OHCI1394_HCControlClear, 1468 reg_write(ohci, OHCI1394_HCControlClear,
1469 OHCI1394_HCControl_noByteSwapData); 1469 OHCI1394_HCControl_noByteSwapData);
1470 1470
1471 reg_write(ohci, OHCI1394_SelfIDBuffer, ohci->self_id_bus);
1472 reg_write(ohci, OHCI1394_LinkControlClear,
1473 OHCI1394_LinkControl_rcvPhyPkt);
1471 reg_write(ohci, OHCI1394_LinkControlSet, 1474 reg_write(ohci, OHCI1394_LinkControlSet,
1472 OHCI1394_LinkControl_rcvSelfID | 1475 OHCI1394_LinkControl_rcvSelfID |
1473 OHCI1394_LinkControl_cycleTimerEnable | 1476 OHCI1394_LinkControl_cycleTimerEnable |
@@ -1481,7 +1484,6 @@ static int ohci_enable(struct fw_card *card, u32 *config_rom, size_t length)
1481 ar_context_run(&ohci->ar_request_ctx); 1484 ar_context_run(&ohci->ar_request_ctx);
1482 ar_context_run(&ohci->ar_response_ctx); 1485 ar_context_run(&ohci->ar_response_ctx);
1483 1486
1484 reg_write(ohci, OHCI1394_SelfIDBuffer, ohci->self_id_bus);
1485 reg_write(ohci, OHCI1394_PhyUpperBound, 0x00010000); 1487 reg_write(ohci, OHCI1394_PhyUpperBound, 0x00010000);
1486 reg_write(ohci, OHCI1394_IntEventClear, ~0); 1488 reg_write(ohci, OHCI1394_IntEventClear, ~0);
1487 reg_write(ohci, OHCI1394_IntMaskClear, ~0); 1489 reg_write(ohci, OHCI1394_IntMaskClear, ~0);