firewire: core: fix unstable I/O with Canon camcorder

Regression since commit 10389536742c, "firewire: core: check for 1394a
compliant IRM, fix inaccessibility of Sony camcorder":

The camcorder Canon MV5i generates lots of bus resets when asynchronous
requests are sent to it (e.g. Config ROM read requests or FCP Command
write requests) if the camcorder is not root node. This causes drop-
outs in videos or makes the camcorder entirely inaccessible.
https://bugzilla.redhat.com/show_bug.cgi?id=633260

Fix this by allowing any Canon device, even if it is a pre-1394a IRM
like MV5i are, to remain root node (if it is at least Cycle Master
capable). With the FireWire controller cards that I tested, MV5i always
becomes root node when plugged in and left to its own devices.

Reported-by: Ralf Lange
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: <stable@kernel.org> # 2.6.32.y and newer

+9 -2
+9 -2
drivers/firewire/core-card.c
··· 75 #define BIB_IRMC ((1) << 31) 76 #define NODE_CAPABILITIES 0x0c0083c0 /* per IEEE 1394 clause 8.3.2.6.5.2 */ 77 78 static void generate_config_rom(struct fw_card *card, __be32 *config_rom) 79 { 80 struct fw_descriptor *desc; ··· 286 bool root_device_is_running; 287 bool root_device_is_cmc; 288 bool irm_is_1394_1995_only; 289 290 spin_lock_irq(&card->lock); 291 ··· 307 irm_device = card->irm_node->data; 308 irm_is_1394_1995_only = irm_device && irm_device->config_rom && 309 (irm_device->config_rom[2] & 0x000000f0) == 0; 310 311 root_id = root_node->node_id; 312 irm_id = card->irm_node->node_id; ··· 340 goto pick_me; 341 } 342 343 - if (irm_is_1394_1995_only) { 344 new_root_id = local_id; 345 fw_notify("%s, making local node (%02x) root.\n", 346 "IRM is not 1394a compliant", new_root_id); ··· 389 390 spin_lock_irq(&card->lock); 391 392 - if (rcode != RCODE_COMPLETE) { 393 /* 394 * The lock request failed, maybe the IRM 395 * isn't really IRM capable after all. Let's
··· 75 #define BIB_IRMC ((1) << 31) 76 #define NODE_CAPABILITIES 0x0c0083c0 /* per IEEE 1394 clause 8.3.2.6.5.2 */ 77 78 + #define CANON_OUI 0x000085 79 + 80 static void generate_config_rom(struct fw_card *card, __be32 *config_rom) 81 { 82 struct fw_descriptor *desc; ··· 284 bool root_device_is_running; 285 bool root_device_is_cmc; 286 bool irm_is_1394_1995_only; 287 + bool keep_this_irm; 288 289 spin_lock_irq(&card->lock); 290 ··· 304 irm_device = card->irm_node->data; 305 irm_is_1394_1995_only = irm_device && irm_device->config_rom && 306 (irm_device->config_rom[2] & 0x000000f0) == 0; 307 + 308 + /* Canon MV5i works unreliably if it is not root node. */ 309 + keep_this_irm = irm_device && irm_device->config_rom && 310 + irm_device->config_rom[3] >> 8 == CANON_OUI; 311 312 root_id = root_node->node_id; 313 irm_id = card->irm_node->node_id; ··· 333 goto pick_me; 334 } 335 336 + if (irm_is_1394_1995_only && !keep_this_irm) { 337 new_root_id = local_id; 338 fw_notify("%s, making local node (%02x) root.\n", 339 "IRM is not 1394a compliant", new_root_id); ··· 382 383 spin_lock_irq(&card->lock); 384 385 + if (rcode != RCODE_COMPLETE && !keep_this_irm) { 386 /* 387 * The lock request failed, maybe the IRM 388 * isn't really IRM capable after all. Let's