diff options
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/storage/shuttle_usbat.c | 54 |
1 files changed, 30 insertions, 24 deletions
diff --git a/drivers/usb/storage/shuttle_usbat.c b/drivers/usb/storage/shuttle_usbat.c index f2bc5c9e23d5..92095b858eb7 100644 --- a/drivers/usb/storage/shuttle_usbat.c +++ b/drivers/usb/storage/shuttle_usbat.c | |||
@@ -131,28 +131,30 @@ static int usbat_write(struct us_data *us, | |||
131 | * Convenience function to perform a bulk read | 131 | * Convenience function to perform a bulk read |
132 | */ | 132 | */ |
133 | static int usbat_bulk_read(struct us_data *us, | 133 | static int usbat_bulk_read(struct us_data *us, |
134 | unsigned char *data, | 134 | unsigned char *data, |
135 | unsigned int len) | 135 | unsigned int len, |
136 | int use_sg) | ||
136 | { | 137 | { |
137 | if (len == 0) | 138 | if (len == 0) |
138 | return USB_STOR_XFER_GOOD; | 139 | return USB_STOR_XFER_GOOD; |
139 | 140 | ||
140 | US_DEBUGP("usbat_bulk_read: len = %d\n", len); | 141 | US_DEBUGP("usbat_bulk_read: len = %d\n", len); |
141 | return usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe, data, len, NULL); | 142 | return usb_stor_bulk_transfer_sg(us, us->recv_bulk_pipe, data, len, use_sg, NULL); |
142 | } | 143 | } |
143 | 144 | ||
144 | /* | 145 | /* |
145 | * Convenience function to perform a bulk write | 146 | * Convenience function to perform a bulk write |
146 | */ | 147 | */ |
147 | static int usbat_bulk_write(struct us_data *us, | 148 | static int usbat_bulk_write(struct us_data *us, |
148 | unsigned char *data, | 149 | unsigned char *data, |
149 | unsigned int len) | 150 | unsigned int len, |
151 | int use_sg) | ||
150 | { | 152 | { |
151 | if (len == 0) | 153 | if (len == 0) |
152 | return USB_STOR_XFER_GOOD; | 154 | return USB_STOR_XFER_GOOD; |
153 | 155 | ||
154 | US_DEBUGP("usbat_bulk_write: len = %d\n", len); | 156 | US_DEBUGP("usbat_bulk_write: len = %d\n", len); |
155 | return usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, data, len, NULL); | 157 | return usb_stor_bulk_transfer_sg(us, us->send_bulk_pipe, data, len, use_sg, NULL); |
156 | } | 158 | } |
157 | 159 | ||
158 | /* | 160 | /* |
@@ -317,7 +319,8 @@ static int usbat_wait_not_busy(struct us_data *us, int minutes) | |||
317 | */ | 319 | */ |
318 | static int usbat_read_block(struct us_data *us, | 320 | static int usbat_read_block(struct us_data *us, |
319 | unsigned char *content, | 321 | unsigned char *content, |
320 | unsigned short len) | 322 | unsigned short len, |
323 | int use_sg) | ||
321 | { | 324 | { |
322 | int result; | 325 | int result; |
323 | unsigned char *command = us->iobuf; | 326 | unsigned char *command = us->iobuf; |
@@ -338,7 +341,7 @@ static int usbat_read_block(struct us_data *us, | |||
338 | if (result != USB_STOR_XFER_GOOD) | 341 | if (result != USB_STOR_XFER_GOOD) |
339 | return USB_STOR_TRANSPORT_ERROR; | 342 | return USB_STOR_TRANSPORT_ERROR; |
340 | 343 | ||
341 | result = usbat_bulk_read(us, content, len); | 344 | result = usbat_bulk_read(us, content, len, use_sg); |
342 | return (result == USB_STOR_XFER_GOOD ? | 345 | return (result == USB_STOR_XFER_GOOD ? |
343 | USB_STOR_TRANSPORT_GOOD : USB_STOR_TRANSPORT_ERROR); | 346 | USB_STOR_TRANSPORT_GOOD : USB_STOR_TRANSPORT_ERROR); |
344 | } | 347 | } |
@@ -350,7 +353,8 @@ static int usbat_write_block(struct us_data *us, | |||
350 | unsigned char access, | 353 | unsigned char access, |
351 | unsigned char *content, | 354 | unsigned char *content, |
352 | unsigned short len, | 355 | unsigned short len, |
353 | int minutes) | 356 | int minutes, |
357 | int use_sg) | ||
354 | { | 358 | { |
355 | int result; | 359 | int result; |
356 | unsigned char *command = us->iobuf; | 360 | unsigned char *command = us->iobuf; |
@@ -372,7 +376,7 @@ static int usbat_write_block(struct us_data *us, | |||
372 | if (result != USB_STOR_XFER_GOOD) | 376 | if (result != USB_STOR_XFER_GOOD) |
373 | return USB_STOR_TRANSPORT_ERROR; | 377 | return USB_STOR_TRANSPORT_ERROR; |
374 | 378 | ||
375 | result = usbat_bulk_write(us, content, len); | 379 | result = usbat_bulk_write(us, content, len, use_sg); |
376 | if (result != USB_STOR_XFER_GOOD) | 380 | if (result != USB_STOR_XFER_GOOD) |
377 | return USB_STOR_TRANSPORT_ERROR; | 381 | return USB_STOR_TRANSPORT_ERROR; |
378 | 382 | ||
@@ -465,7 +469,7 @@ static int usbat_hp8200e_rw_block_test(struct us_data *us, | |||
465 | data[1+(j<<1)] = data_out[j]; | 469 | data[1+(j<<1)] = data_out[j]; |
466 | } | 470 | } |
467 | 471 | ||
468 | result = usbat_bulk_write(us, data, num_registers*2); | 472 | result = usbat_bulk_write(us, data, num_registers*2, 0); |
469 | if (result != USB_STOR_XFER_GOOD) | 473 | if (result != USB_STOR_XFER_GOOD) |
470 | return USB_STOR_TRANSPORT_ERROR; | 474 | return USB_STOR_TRANSPORT_ERROR; |
471 | 475 | ||
@@ -583,7 +587,7 @@ static int usbat_multiple_write(struct us_data *us, | |||
583 | } | 587 | } |
584 | 588 | ||
585 | /* Send the data */ | 589 | /* Send the data */ |
586 | result = usbat_bulk_write(us, data, num_registers*2); | 590 | result = usbat_bulk_write(us, data, num_registers*2, 0); |
587 | if (result != USB_STOR_XFER_GOOD) | 591 | if (result != USB_STOR_XFER_GOOD) |
588 | return USB_STOR_TRANSPORT_ERROR; | 592 | return USB_STOR_TRANSPORT_ERROR; |
589 | 593 | ||
@@ -606,8 +610,9 @@ static int usbat_multiple_write(struct us_data *us, | |||
606 | * other related details) are defined beforehand with _set_shuttle_features(). | 610 | * other related details) are defined beforehand with _set_shuttle_features(). |
607 | */ | 611 | */ |
608 | static int usbat_read_blocks(struct us_data *us, | 612 | static int usbat_read_blocks(struct us_data *us, |
609 | unsigned char *buffer, | 613 | unsigned char *buffer, |
610 | int len) | 614 | int len, |
615 | int use_sg) | ||
611 | { | 616 | { |
612 | int result; | 617 | int result; |
613 | unsigned char *command = us->iobuf; | 618 | unsigned char *command = us->iobuf; |
@@ -627,7 +632,7 @@ static int usbat_read_blocks(struct us_data *us, | |||
627 | return USB_STOR_TRANSPORT_FAILED; | 632 | return USB_STOR_TRANSPORT_FAILED; |
628 | 633 | ||
629 | /* Read the blocks we just asked for */ | 634 | /* Read the blocks we just asked for */ |
630 | result = usbat_bulk_read(us, buffer, len); | 635 | result = usbat_bulk_read(us, buffer, len, use_sg); |
631 | if (result != USB_STOR_XFER_GOOD) | 636 | if (result != USB_STOR_XFER_GOOD) |
632 | return USB_STOR_TRANSPORT_FAILED; | 637 | return USB_STOR_TRANSPORT_FAILED; |
633 | 638 | ||
@@ -648,7 +653,8 @@ static int usbat_read_blocks(struct us_data *us, | |||
648 | */ | 653 | */ |
649 | static int usbat_write_blocks(struct us_data *us, | 654 | static int usbat_write_blocks(struct us_data *us, |
650 | unsigned char *buffer, | 655 | unsigned char *buffer, |
651 | int len) | 656 | int len, |
657 | int use_sg) | ||
652 | { | 658 | { |
653 | int result; | 659 | int result; |
654 | unsigned char *command = us->iobuf; | 660 | unsigned char *command = us->iobuf; |
@@ -668,7 +674,7 @@ static int usbat_write_blocks(struct us_data *us, | |||
668 | return USB_STOR_TRANSPORT_FAILED; | 674 | return USB_STOR_TRANSPORT_FAILED; |
669 | 675 | ||
670 | /* Write the data */ | 676 | /* Write the data */ |
671 | result = usbat_bulk_write(us, buffer, len); | 677 | result = usbat_bulk_write(us, buffer, len, use_sg); |
672 | if (result != USB_STOR_XFER_GOOD) | 678 | if (result != USB_STOR_XFER_GOOD) |
673 | return USB_STOR_TRANSPORT_FAILED; | 679 | return USB_STOR_TRANSPORT_FAILED; |
674 | 680 | ||
@@ -947,7 +953,7 @@ static int usbat_flash_get_sector_count(struct us_data *us, | |||
947 | msleep(100); | 953 | msleep(100); |
948 | 954 | ||
949 | /* Read the device identification data */ | 955 | /* Read the device identification data */ |
950 | rc = usbat_read_block(us, reply, 512); | 956 | rc = usbat_read_block(us, reply, 512, 0); |
951 | if (rc != USB_STOR_TRANSPORT_GOOD) | 957 | if (rc != USB_STOR_TRANSPORT_GOOD) |
952 | goto leave; | 958 | goto leave; |
953 | 959 | ||
@@ -1031,7 +1037,7 @@ static int usbat_flash_read_data(struct us_data *us, | |||
1031 | goto leave; | 1037 | goto leave; |
1032 | 1038 | ||
1033 | /* Read the data we just requested */ | 1039 | /* Read the data we just requested */ |
1034 | result = usbat_read_blocks(us, buffer, len); | 1040 | result = usbat_read_blocks(us, buffer, len, 0); |
1035 | if (result != USB_STOR_TRANSPORT_GOOD) | 1041 | if (result != USB_STOR_TRANSPORT_GOOD) |
1036 | goto leave; | 1042 | goto leave; |
1037 | 1043 | ||
@@ -1125,7 +1131,7 @@ static int usbat_flash_write_data(struct us_data *us, | |||
1125 | goto leave; | 1131 | goto leave; |
1126 | 1132 | ||
1127 | /* Write the data */ | 1133 | /* Write the data */ |
1128 | result = usbat_write_blocks(us, buffer, len); | 1134 | result = usbat_write_blocks(us, buffer, len, 0); |
1129 | if (result != USB_STOR_TRANSPORT_GOOD) | 1135 | if (result != USB_STOR_TRANSPORT_GOOD) |
1130 | goto leave; | 1136 | goto leave; |
1131 | 1137 | ||
@@ -1503,10 +1509,10 @@ static int usbat_hp8200e_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
1503 | * AT SPEED 4 IS UNRELIABLE!!! | 1509 | * AT SPEED 4 IS UNRELIABLE!!! |
1504 | */ | 1510 | */ |
1505 | 1511 | ||
1506 | if ( (result = usbat_write_block(us, | 1512 | if ((result = usbat_write_block(us, |
1507 | USBAT_ATA, srb->cmnd, 12, | 1513 | USBAT_ATA, srb->cmnd, 12, |
1508 | srb->cmnd[0]==GPCMD_BLANK ? 75 : 10)) != | 1514 | (srb->cmnd[0]==GPCMD_BLANK ? 75 : 10), 0) != |
1509 | USB_STOR_TRANSPORT_GOOD) { | 1515 | USB_STOR_TRANSPORT_GOOD)) { |
1510 | return result; | 1516 | return result; |
1511 | } | 1517 | } |
1512 | 1518 | ||
@@ -1533,7 +1539,7 @@ static int usbat_hp8200e_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
1533 | len = *status; | 1539 | len = *status; |
1534 | 1540 | ||
1535 | 1541 | ||
1536 | result = usbat_read_block(us, srb->request_buffer, len); | 1542 | result = usbat_read_block(us, srb->request_buffer, len, srb->use_sg); |
1537 | 1543 | ||
1538 | /* Debug-print the first 32 bytes of the transfer */ | 1544 | /* Debug-print the first 32 bytes of the transfer */ |
1539 | 1545 | ||