aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire/ohci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/firewire/ohci.c')
-rw-r--r--drivers/firewire/ohci.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c
index de5ff376231c..65b9bdb8541a 100644
--- a/drivers/firewire/ohci.c
+++ b/drivers/firewire/ohci.c
@@ -474,12 +474,17 @@ static int read_phy_reg(struct fw_ohci *ohci, int addr)
474 int i; 474 int i;
475 475
476 reg_write(ohci, OHCI1394_PhyControl, OHCI1394_PhyControl_Read(addr)); 476 reg_write(ohci, OHCI1394_PhyControl, OHCI1394_PhyControl_Read(addr));
477 for (i = 0; i < 10; i++) { 477 for (i = 0; i < 3 + 100; i++) {
478 val = reg_read(ohci, OHCI1394_PhyControl); 478 val = reg_read(ohci, OHCI1394_PhyControl);
479 if (val & OHCI1394_PhyControl_ReadDone) 479 if (val & OHCI1394_PhyControl_ReadDone)
480 return OHCI1394_PhyControl_ReadData(val); 480 return OHCI1394_PhyControl_ReadData(val);
481 481
482 msleep(1); 482 /*
483 * Try a few times without waiting. Sleeping is necessary
484 * only when the link/PHY interface is busy.
485 */
486 if (i >= 3)
487 msleep(1);
483 } 488 }
484 fw_error("failed to read phy reg\n"); 489 fw_error("failed to read phy reg\n");
485 490
@@ -492,12 +497,13 @@ static int write_phy_reg(const struct fw_ohci *ohci, int addr, u32 val)
492 497
493 reg_write(ohci, OHCI1394_PhyControl, 498 reg_write(ohci, OHCI1394_PhyControl,
494 OHCI1394_PhyControl_Write(addr, val)); 499 OHCI1394_PhyControl_Write(addr, val));
495 for (i = 0; i < 100; i++) { 500 for (i = 0; i < 3 + 100; i++) {
496 val = reg_read(ohci, OHCI1394_PhyControl); 501 val = reg_read(ohci, OHCI1394_PhyControl);
497 if (!(val & OHCI1394_PhyControl_WritePending)) 502 if (!(val & OHCI1394_PhyControl_WritePending))
498 return 0; 503 return 0;
499 504
500 msleep(1); 505 if (i >= 3)
506 msleep(1);
501 } 507 }
502 fw_error("failed to write phy reg\n"); 508 fw_error("failed to write phy reg\n");
503 509