Skip to content

Commit

Permalink
firewire: ohci: get IR bit from TSB41BA3D phy
Browse files Browse the repository at this point in the history
In case of a self constructed selfID packet this patch correctly
determines the information if the TSB41BA3D phy initiated a bus reset.

Signed-off-by: Stephan Gatzka <stephan.gatzka@gmail.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
  • Loading branch information
Stephan Gatzka authored and Stefan Richter committed Sep 25, 2012
1 parent badfcb2 commit 52439d6
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion drivers/firewire/ohci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1777,11 +1777,35 @@ static int get_self_id_pos(struct fw_ohci *ohci, u32 self_id,
return i;
}

static int initiated_reset(struct fw_ohci *ohci)
{
int reg;
int ret = 0;

mutex_lock(&ohci->phy_reg_mutex);
reg = write_phy_reg(ohci, 7, 0xe0); /* Select page 7 */
if (reg >= 0) {
reg = read_phy_reg(ohci, 8);
reg |= 0x40;
reg = write_phy_reg(ohci, 8, reg); /* set PMODE bit */
if (reg >= 0) {
reg = read_phy_reg(ohci, 12); /* read register 12 */
if (reg >= 0) {
if ((reg & 0x08) == 0x08) {
/* bit 3 indicates "initiated reset" */
ret = 0x2;
}
}
}
}
mutex_unlock(&ohci->phy_reg_mutex);
return ret;
}

/*
* TI TSB82AA2B and TSB12LV26 do not receive the selfID of a locally
* attached TSB41BA3D phy; see http://www.ti.com/litv/pdf/sllz059.
* Construct the selfID from phy register contents.
* FIXME: How to determine the selfID.i flag?
*/
static int find_and_insert_self_id(struct fw_ohci *ohci, int self_id_count)
{
Expand Down Expand Up @@ -1814,6 +1838,8 @@ static int find_and_insert_self_id(struct fw_ohci *ohci, int self_id_count)
self_id |= ((status & 0x3) << (6 - (i * 2)));
}

self_id |= initiated_reset(ohci);

pos = get_self_id_pos(ohci, self_id, self_id_count);
if (pos >= 0) {
memmove(&(ohci->self_id_buffer[pos+1]),
Expand Down

0 comments on commit 52439d6

Please sign in to comment.