aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire/fw-sbp2.c
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2007-07-21 16:43:05 -0400
committerStefan Richter <stefanr@s5r6.in-berlin.de>2007-08-02 14:34:16 -0400
commit25659f7183376c6b37661da6141d5eaa21479061 (patch)
tree7ac9590d43a3c2b7760a88c00a39c1eb0f231745 /drivers/firewire/fw-sbp2.c
parente4f8cac5e07528f7e0bc21d3682c16c9de993ecb (diff)
firewire: fw-sbp2: set correct maximum payload (fixes CardBus adapters)
As far as I know, all CardBus FireWire 400 adapters have a maximum payload of 1024 bytes which is less than the speed-dependent limit of 2048 bytes. Fw-sbp2 has to take the host adapter's limit into account. This apparently fixes Juju's incompatibility with my CardBus cards, a NEC based card and a VIA based card. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Acked-by: Kristian Høgsberg <krh@redhat.com>
Diffstat (limited to 'drivers/firewire/fw-sbp2.c')
-rw-r--r--drivers/firewire/fw-sbp2.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c
index 3e4a369d0057..ba816ef6def1 100644
--- a/drivers/firewire/fw-sbp2.c
+++ b/drivers/firewire/fw-sbp2.c
@@ -984,6 +984,7 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done)
984 struct fw_unit *unit = sd->unit; 984 struct fw_unit *unit = sd->unit;
985 struct fw_device *device = fw_device(unit->device.parent); 985 struct fw_device *device = fw_device(unit->device.parent);
986 struct sbp2_command_orb *orb; 986 struct sbp2_command_orb *orb;
987 unsigned max_payload;
987 988
988 /* 989 /*
989 * Bidirectional commands are not yet implemented, and unknown 990 * Bidirectional commands are not yet implemented, and unknown
@@ -1017,8 +1018,10 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done)
1017 * specifies the max payload size as 2 ^ (max_payload + 2), so 1018 * specifies the max payload size as 2 ^ (max_payload + 2), so
1018 * if we set this to max_speed + 7, we get the right value. 1019 * if we set this to max_speed + 7, we get the right value.
1019 */ 1020 */
1021 max_payload = min(device->max_speed + 7,
1022 device->card->max_receive - 1);
1020 orb->request.misc = 1023 orb->request.misc =
1021 COMMAND_ORB_MAX_PAYLOAD(device->max_speed + 7) | 1024 COMMAND_ORB_MAX_PAYLOAD(max_payload) |
1022 COMMAND_ORB_SPEED(device->max_speed) | 1025 COMMAND_ORB_SPEED(device->max_speed) |
1023 COMMAND_ORB_NOTIFY; 1026 COMMAND_ORB_NOTIFY;
1024 1027