aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire/fw-sbp2.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/firewire/fw-sbp2.c')
-rw-r--r--drivers/firewire/fw-sbp2.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c
index 625518792841..e99a33fcc923 100644
--- a/drivers/firewire/fw-sbp2.c
+++ b/drivers/firewire/fw-sbp2.c
@@ -173,7 +173,8 @@ struct sbp2_target {
173#define SBP2_ORB_TIMEOUT 2000U /* Timeout in ms */ 173#define SBP2_ORB_TIMEOUT 2000U /* Timeout in ms */
174#define SBP2_ORB_NULL 0x80000000 174#define SBP2_ORB_NULL 0x80000000
175#define SBP2_MAX_SG_ELEMENT_LENGTH 0xf000 175#define SBP2_MAX_SG_ELEMENT_LENGTH 0xf000
176#define SBP2_RETRY_LIMIT 0xf /* 15 retries */ 176#define SBP2_RETRY_LIMIT 0xf /* 15 retries */
177#define SBP2_CYCLE_LIMIT (0xc8 << 12) /* 200 125us cycles */
177 178
178/* Unit directory keys */ 179/* Unit directory keys */
179#define SBP2_CSR_UNIT_CHARACTERISTICS 0x3a 180#define SBP2_CSR_UNIT_CHARACTERISTICS 0x3a
@@ -813,6 +814,22 @@ complete_set_busy_timeout(struct fw_card *card, int rcode,
813 complete(done); 814 complete(done);
814} 815}
815 816
817/*
818 * Write retransmit retry values into the BUSY_TIMEOUT register.
819 * - The single-phase retry protocol is supported by all SBP-2 devices, but the
820 * default retry_limit value is 0 (i.e. never retry transmission). We write a
821 * saner value after logging into the device.
822 * - The dual-phase retry protocol is optional to implement, and if not
823 * supported, writes to the dual-phase portion of the register will be
824 * ignored. We try to write the original 1394-1995 default here.
825 * - In the case of devices that are also SBP-3-compliant, all writes are
826 * ignored, as the register is read-only, but contains single-phase retry of
827 * 15, which is what we're trying to set for all SBP-2 device anyway, so this
828 * write attempt is safe and yields more consistent behavior for all devices.
829 *
830 * See section 8.3.2.3.5 of the 1394-1995 spec, section 6.2 of the SBP-2 spec,
831 * and section 6.4 of the SBP-3 spec for further details.
832 */
816static void sbp2_set_busy_timeout(struct sbp2_logical_unit *lu) 833static void sbp2_set_busy_timeout(struct sbp2_logical_unit *lu)
817{ 834{
818 struct fw_device *device = fw_device(lu->tgt->unit->device.parent); 835 struct fw_device *device = fw_device(lu->tgt->unit->device.parent);
@@ -820,8 +837,7 @@ static void sbp2_set_busy_timeout(struct sbp2_logical_unit *lu)
820 struct fw_transaction t; 837 struct fw_transaction t;
821 static __be32 busy_timeout; 838 static __be32 busy_timeout;
822 839
823 /* FIXME: we should try to set dual-phase cycle_limit too */ 840 busy_timeout = cpu_to_be32(SBP2_CYCLE_LIMIT | SBP2_RETRY_LIMIT);
824 busy_timeout = cpu_to_be32(SBP2_RETRY_LIMIT);
825 841
826 fw_send_request(device->card, &t, TCODE_WRITE_QUADLET_REQUEST, 842 fw_send_request(device->card, &t, TCODE_WRITE_QUADLET_REQUEST,
827 lu->tgt->node_id, lu->generation, device->max_speed, 843 lu->tgt->node_id, lu->generation, device->max_speed,