diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/storage/scsiglue.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index b4c9e0f18a82..09779f6a8179 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c | |||
@@ -71,7 +71,6 @@ static const char* host_info(struct Scsi_Host *host) | |||
71 | static int slave_alloc (struct scsi_device *sdev) | 71 | static int slave_alloc (struct scsi_device *sdev) |
72 | { | 72 | { |
73 | struct us_data *us = host_to_us(sdev->host); | 73 | struct us_data *us = host_to_us(sdev->host); |
74 | struct usb_host_endpoint *bulk_in_ep; | ||
75 | 74 | ||
76 | /* | 75 | /* |
77 | * Set the INQUIRY transfer length to 36. We don't use any of | 76 | * Set the INQUIRY transfer length to 36. We don't use any of |
@@ -80,16 +79,22 @@ static int slave_alloc (struct scsi_device *sdev) | |||
80 | */ | 79 | */ |
81 | sdev->inquiry_len = 36; | 80 | sdev->inquiry_len = 36; |
82 | 81 | ||
83 | /* Scatter-gather buffers (all but the last) must have a length | 82 | /* USB has unusual DMA-alignment requirements: Although the |
84 | * divisible by the bulk maxpacket size. Otherwise a data packet | 83 | * starting address of each scatter-gather element doesn't matter, |
85 | * would end up being short, causing a premature end to the data | 84 | * the length of each element except the last must be divisible |
86 | * transfer. We'll use the maxpacket value of the bulk-IN pipe | 85 | * by the Bulk maxpacket value. There's currently no way to |
87 | * to set the SCSI device queue's DMA alignment mask. | 86 | * express this by block-layer constraints, so we'll cop out |
87 | * and simply require addresses to be aligned at 512-byte | ||
88 | * boundaries. This is okay since most block I/O involves | ||
89 | * hardware sectors that are multiples of 512 bytes in length, | ||
90 | * and since host controllers up through USB 2.0 have maxpacket | ||
91 | * values no larger than 512. | ||
92 | * | ||
93 | * But it doesn't suffice for Wireless USB, where Bulk maxpacket | ||
94 | * values can be as large as 2048. To make that work properly | ||
95 | * will require changes to the block layer. | ||
88 | */ | 96 | */ |
89 | bulk_in_ep = us->pusb_dev->ep_in[usb_pipeendpoint(us->recv_bulk_pipe)]; | 97 | blk_queue_update_dma_alignment(sdev->request_queue, (512 - 1)); |
90 | blk_queue_update_dma_alignment(sdev->request_queue, | ||
91 | le16_to_cpu(bulk_in_ep->desc.wMaxPacketSize) - 1); | ||
92 | /* wMaxPacketSize must be a power of 2 */ | ||
93 | 98 | ||
94 | /* | 99 | /* |
95 | * The UFI spec treates the Peripheral Qualifier bits in an | 100 | * The UFI spec treates the Peripheral Qualifier bits in an |