firewire: consistent usage of node_id
Definitions as per IEEE 1212 and IEEE 1394:
Node ID: Concatenation of bus ID and local ID. 16 bits long.
Bus ID: Identifies a particular bus within a group of buses
interconnected by bus bridges.
Local ID: Identifies a particular node on a bus.
PHY ID: Local ID of IEEE 1394 nodes. 6 bits long.
Never ever use a variable called node_id for anything else than a node ID.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
diff --git a/drivers/firewire/fw-ohci.c b/drivers/firewire/fw-ohci.c
index ba10203..d6f0644 100644
--- a/drivers/firewire/fw-ohci.c
+++ b/drivers/firewire/fw-ohci.c
@@ -828,10 +828,10 @@
{
struct fw_ohci *ohci = fw_ohci(card);
unsigned long flags;
- int retval = 0;
+ int n, retval = 0;
- /* FIXME: make sure this bitmask is cleared when we clear the
- * busReset interrupt bit. */
+ /* FIXME: Make sure this bitmask is cleared when we clear the busReset
+ * interrupt bit. Clear physReqResourceAllBuses on bus reset. */
spin_lock_irqsave(&ohci->lock, flags);
@@ -840,12 +840,15 @@
goto out;
}
- if (node_id < 32) {
- reg_write(ohci, OHCI1394_PhyReqFilterLoSet, 1 << node_id);
- } else {
- reg_write(ohci, OHCI1394_PhyReqFilterHiSet,
- 1 << (node_id - 32));
- }
+ /* NOTE, if the node ID contains a non-local bus ID, physical DMA is
+ * enabled for _all_ nodes on remote buses. */
+
+ n = (node_id & 0xffc0) == LOCAL_BUS ? node_id & 0x3f : 63;
+ if (n < 32)
+ reg_write(ohci, OHCI1394_PhyReqFilterLoSet, 1 << n);
+ else
+ reg_write(ohci, OHCI1394_PhyReqFilterHiSet, 1 << (n - 32));
+
flush_writes(ohci);
out:
spin_unlock_irqrestore(&ohci->lock, flags);