ieee1394: write broadcast_channel only to select nodes (fixes device recognition) Some old 1394-1995 SBP-2 bridges would hang if they received a broadcast write request to BROADCAST_CHANNEL before the config ROM was read. Affected devices include Datafab MD2-FW2 2.5" HDD and SmartDisk VST FWCDRW-V8 portable CD writer. The write request is now directed to specific nodes instead of being broadcast to all nodes at once, and it is only performed if a previous read request at this register succeeded. Signed-off-by: Stefan Richter --- nodemgr.c | 42 ++++++++++++++++++++++++++++++++---------- 1 files changed, 32 insertions(+), 10 deletions(-) --- linux-2.6.14.3/drivers/ieee1394.orig/nodemgr.c 2005-11-24 23:10:21.000000000 +0100 +++ linux-2.6.14.3/drivers/ieee1394/nodemgr.c 2005-12-04 13:22:09.000000000 +0100 @@ -1349,6 +1349,33 @@ static void nodemgr_update_pdrv(struct n } +/* Write the BROADCAST_CHANNEL as per IEEE1394a 8.3.2.3.11 and 8.4.2.3. This + * seems like an optional service but in the end it is practically mandatory + * as a consequence of these clauses. + * + * Note that we cannot do a broadcast write to all nodes at once because some + * pre-1394a devices would hang. */ +static void nodemgr_irm_write_bc(struct node_entry *ne, int generation) +{ + const u64 bc_addr = (CSR_REGISTER_BASE | CSR_BROADCAST_CHANNEL); + quadlet_t bc_remote, bc_local; + int ret; + + if (!ne->host->is_irm || ne->generation != generation || + ne->nodeid == ne->host->node_id) + return; + + bc_local = cpu_to_be32(ne->host->csr.broadcast_channel); + + /* Check if the register is implemented and 1394a compliant. */ + ret = hpsb_read(ne->host, ne->nodeid, generation, bc_addr, &bc_remote, + sizeof(bc_remote)); + if (!ret && bc_remote & cpu_to_be32(0x80000000) && + bc_remote != bc_local) + hpsb_node_write(ne, bc_addr, &bc_local, sizeof(bc_local)); +} + + static void nodemgr_probe_ne(struct host_info *hi, struct node_entry *ne, int generation) { struct device *dev; @@ -1360,6 +1387,8 @@ static void nodemgr_probe_ne(struct host if (!dev) return; + nodemgr_irm_write_bc(ne, generation); + /* If "needs_probe", then this is either a new or changed node we * rescan totally. If the generation matches for an existing node * (one that existed prior to the bus reset) we send update calls @@ -1413,9 +1442,7 @@ static void nodemgr_node_probe(struct ho return; } -/* Because we are a 1394a-2000 compliant IRM, we need to inform all the other - * nodes of the broadcast channel. (Really we're only setting the validity - * bit). Other IRM responsibilities go in here as well. */ +/* Perform a few high-level IRM responsibilities. */ static int nodemgr_do_irm_duties(struct hpsb_host *host, int cycles) { quadlet_t bc; @@ -1424,13 +1451,8 @@ static int nodemgr_do_irm_duties(struct if (!host->is_irm || host->irm_id == (nodeid_t)-1) return 1; - host->csr.broadcast_channel |= 0x40000000; /* set validity bit */ - - bc = cpu_to_be32(host->csr.broadcast_channel); - - hpsb_write(host, LOCAL_BUS | ALL_NODES, get_hpsb_generation(host), - (CSR_REGISTER_BASE | CSR_BROADCAST_CHANNEL), - &bc, sizeof(quadlet_t)); + /* We are a 1394a-2000 compliant IRM. Set the validity bit. */ + host->csr.broadcast_channel |= 0x40000000; /* If there is no bus manager then we should set the root node's * force_root bit to promote bus stability per the 1394