diff options
Diffstat (limited to 'drivers/usb/storage/scsiglue.c')
-rw-r--r-- | drivers/usb/storage/scsiglue.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index 7c9593b7b04e..8c1e2954f3b9 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c | |||
@@ -81,6 +81,16 @@ static int slave_alloc (struct scsi_device *sdev) | |||
81 | */ | 81 | */ |
82 | sdev->inquiry_len = 36; | 82 | sdev->inquiry_len = 36; |
83 | 83 | ||
84 | /* Scatter-gather buffers (all but the last) must have a length | ||
85 | * divisible by the bulk maxpacket size. Otherwise a data packet | ||
86 | * would end up being short, causing a premature end to the data | ||
87 | * transfer. Since high-speed bulk pipes have a maxpacket size | ||
88 | * of 512, we'll use that as the scsi device queue's DMA alignment | ||
89 | * mask. Guaranteeing proper alignment of the first buffer will | ||
90 | * have the desired effect because, except at the beginning and | ||
91 | * the end, scatter-gather buffers follow page boundaries. */ | ||
92 | blk_queue_update_dma_alignment(sdev->request_queue, (512 - 1)); | ||
93 | |||
84 | /* | 94 | /* |
85 | * The UFI spec treates the Peripheral Qualifier bits in an | 95 | * The UFI spec treates the Peripheral Qualifier bits in an |
86 | * INQUIRY result as reserved and requires devices to set them | 96 | * INQUIRY result as reserved and requires devices to set them |
@@ -100,16 +110,6 @@ static int slave_configure(struct scsi_device *sdev) | |||
100 | { | 110 | { |
101 | struct us_data *us = host_to_us(sdev->host); | 111 | struct us_data *us = host_to_us(sdev->host); |
102 | 112 | ||
103 | /* Scatter-gather buffers (all but the last) must have a length | ||
104 | * divisible by the bulk maxpacket size. Otherwise a data packet | ||
105 | * would end up being short, causing a premature end to the data | ||
106 | * transfer. Since high-speed bulk pipes have a maxpacket size | ||
107 | * of 512, we'll use that as the scsi device queue's DMA alignment | ||
108 | * mask. Guaranteeing proper alignment of the first buffer will | ||
109 | * have the desired effect because, except at the beginning and | ||
110 | * the end, scatter-gather buffers follow page boundaries. */ | ||
111 | blk_queue_dma_alignment(sdev->request_queue, (512 - 1)); | ||
112 | |||
113 | /* Many devices have trouble transfering more than 32KB at a time, | 113 | /* Many devices have trouble transfering more than 32KB at a time, |
114 | * while others have trouble with more than 64K. At this time we | 114 | * while others have trouble with more than 64K. At this time we |
115 | * are limiting both to 32K (64 sectores). | 115 | * are limiting both to 32K (64 sectores). |
@@ -187,6 +187,10 @@ static int slave_configure(struct scsi_device *sdev) | |||
187 | * automatically, requiring a START-STOP UNIT command. */ | 187 | * automatically, requiring a START-STOP UNIT command. */ |
188 | sdev->allow_restart = 1; | 188 | sdev->allow_restart = 1; |
189 | 189 | ||
190 | /* Some USB cardreaders have trouble reading an sdcard's last | ||
191 | * sector in a larger then 1 sector read, since the performance | ||
192 | * impact is negible we set this flag for all USB disks */ | ||
193 | sdev->last_sector_bug = 1; | ||
190 | } else { | 194 | } else { |
191 | 195 | ||
192 | /* Non-disk-type devices don't need to blacklist any pages | 196 | /* Non-disk-type devices don't need to blacklist any pages |