diff options
| -rw-r--r-- | drivers/firewire/ohci.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index e33917bf97d2..8ebccda94df9 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c | |||
| @@ -460,22 +460,36 @@ static inline void flush_writes(const struct fw_ohci *ohci) | |||
| 460 | reg_read(ohci, OHCI1394_Version); | 460 | reg_read(ohci, OHCI1394_Version); |
| 461 | } | 461 | } |
| 462 | 462 | ||
| 463 | static int ohci_update_phy_reg(struct fw_card *card, int addr, | 463 | static int read_phy_reg(struct fw_card *card, int addr, u32 *value) |
| 464 | int clear_bits, int set_bits) | ||
| 465 | { | 464 | { |
| 466 | struct fw_ohci *ohci = fw_ohci(card); | 465 | struct fw_ohci *ohci = fw_ohci(card); |
| 467 | u32 val, old; | 466 | u32 val; |
| 468 | 467 | ||
| 469 | reg_write(ohci, OHCI1394_PhyControl, OHCI1394_PhyControl_Read(addr)); | 468 | reg_write(ohci, OHCI1394_PhyControl, OHCI1394_PhyControl_Read(addr)); |
| 470 | flush_writes(ohci); | 469 | flush_writes(ohci); |
| 471 | msleep(2); | 470 | msleep(2); |
| 472 | val = reg_read(ohci, OHCI1394_PhyControl); | 471 | val = reg_read(ohci, OHCI1394_PhyControl); |
| 473 | if ((val & OHCI1394_PhyControl_ReadDone) == 0) { | 472 | if ((val & OHCI1394_PhyControl_ReadDone) == 0) { |
| 474 | fw_error("failed to set phy reg bits.\n"); | 473 | fw_error("failed to read phy reg bits\n"); |
| 475 | return -EBUSY; | 474 | return -EBUSY; |
| 476 | } | 475 | } |
| 477 | 476 | ||
| 478 | old = OHCI1394_PhyControl_ReadData(val); | 477 | *value = OHCI1394_PhyControl_ReadData(val); |
| 478 | |||
| 479 | return 0; | ||
| 480 | } | ||
| 481 | |||
| 482 | static int ohci_update_phy_reg(struct fw_card *card, int addr, | ||
| 483 | int clear_bits, int set_bits) | ||
| 484 | { | ||
| 485 | struct fw_ohci *ohci = fw_ohci(card); | ||
| 486 | u32 old; | ||
| 487 | int err; | ||
| 488 | |||
| 489 | err = read_phy_reg(card, addr, &old); | ||
| 490 | if (err < 0) | ||
| 491 | return err; | ||
| 492 | |||
| 479 | old = (old & ~clear_bits) | set_bits; | 493 | old = (old & ~clear_bits) | set_bits; |
| 480 | reg_write(ohci, OHCI1394_PhyControl, | 494 | reg_write(ohci, OHCI1394_PhyControl, |
| 481 | OHCI1394_PhyControl_Write(addr, old)); | 495 | OHCI1394_PhyControl_Write(addr, old)); |
