diff options
| -rw-r--r-- | drivers/usb/storage/initializers.h | 4 | ||||
| -rw-r--r-- | drivers/usb/storage/sddr09.c | 72 | ||||
| -rw-r--r-- | drivers/usb/storage/sddr09.h | 15 | ||||
| -rw-r--r-- | drivers/usb/storage/unusual_devs.h | 14 | ||||
| -rw-r--r-- | drivers/usb/storage/usb.c | 22 |
5 files changed, 64 insertions, 63 deletions
diff --git a/drivers/usb/storage/initializers.h b/drivers/usb/storage/initializers.h index 7372386f33d5..4c1b2bd2e2e4 100644 --- a/drivers/usb/storage/initializers.h +++ b/drivers/usb/storage/initializers.h | |||
| @@ -45,10 +45,6 @@ | |||
| 45 | * mode */ | 45 | * mode */ |
| 46 | int usb_stor_euscsi_init(struct us_data *us); | 46 | int usb_stor_euscsi_init(struct us_data *us); |
| 47 | 47 | ||
| 48 | #ifdef CONFIG_USB_STORAGE_SDDR09 | ||
| 49 | int sddr09_init(struct us_data *us); | ||
| 50 | #endif | ||
| 51 | |||
| 52 | /* This function is required to activate all four slots on the UCR-61S2B | 48 | /* This function is required to activate all four slots on the UCR-61S2B |
| 53 | * flash reader */ | 49 | * flash reader */ |
| 54 | int usb_stor_ucr61s2b_init(struct us_data *us); | 50 | int usb_stor_ucr61s2b_init(struct us_data *us); |
diff --git a/drivers/usb/storage/sddr09.c b/drivers/usb/storage/sddr09.c index 0a6efae452fb..6c379b6b43d1 100644 --- a/drivers/usb/storage/sddr09.c +++ b/drivers/usb/storage/sddr09.c | |||
| @@ -214,6 +214,20 @@ static void nand_store_ecc(unsigned char *data, unsigned char *ecc) { | |||
| 214 | * The actual driver starts here. | 214 | * The actual driver starts here. |
| 215 | */ | 215 | */ |
| 216 | 216 | ||
| 217 | struct sddr09_card_info { | ||
| 218 | unsigned long capacity; /* Size of card in bytes */ | ||
| 219 | int pagesize; /* Size of page in bytes */ | ||
| 220 | int pageshift; /* log2 of pagesize */ | ||
| 221 | int blocksize; /* Size of block in pages */ | ||
| 222 | int blockshift; /* log2 of blocksize */ | ||
| 223 | int blockmask; /* 2^blockshift - 1 */ | ||
| 224 | int *lba_to_pba; /* logical to physical map */ | ||
| 225 | int *pba_to_lba; /* physical to logical map */ | ||
| 226 | int lbact; /* number of available pages */ | ||
| 227 | int flags; | ||
| 228 | #define SDDR09_WP 1 /* write protected */ | ||
| 229 | }; | ||
| 230 | |||
| 217 | /* | 231 | /* |
| 218 | * On my 16MB card, control blocks have size 64 (16 real control bytes, | 232 | * On my 16MB card, control blocks have size 64 (16 real control bytes, |
| 219 | * and 48 junk bytes). In reality of course the card uses 16 control bytes, | 233 | * and 48 junk bytes). In reality of course the card uses 16 control bytes, |
| @@ -1342,27 +1356,51 @@ sddr09_card_info_destructor(void *extra) { | |||
| 1342 | kfree(info->pba_to_lba); | 1356 | kfree(info->pba_to_lba); |
| 1343 | } | 1357 | } |
| 1344 | 1358 | ||
| 1345 | static void | 1359 | static int |
| 1346 | sddr09_init_card_info(struct us_data *us) { | 1360 | sddr09_common_init(struct us_data *us) { |
| 1347 | if (!us->extra) { | 1361 | int result; |
| 1348 | us->extra = kmalloc(sizeof(struct sddr09_card_info), GFP_NOIO); | 1362 | |
| 1349 | if (us->extra) { | 1363 | /* set the configuration -- STALL is an acceptable response here */ |
| 1350 | memset(us->extra, 0, sizeof(struct sddr09_card_info)); | 1364 | if (us->pusb_dev->actconfig->desc.bConfigurationValue != 1) { |
| 1351 | us->extra_destructor = sddr09_card_info_destructor; | 1365 | US_DEBUGP("active config #%d != 1 ??\n", us->pusb_dev |
| 1352 | } | 1366 | ->actconfig->desc.bConfigurationValue); |
| 1367 | return -EINVAL; | ||
| 1368 | } | ||
| 1369 | |||
| 1370 | result = usb_reset_configuration(us->pusb_dev); | ||
| 1371 | US_DEBUGP("Result of usb_reset_configuration is %d\n", result); | ||
| 1372 | if (result == -EPIPE) { | ||
| 1373 | US_DEBUGP("-- stall on control interface\n"); | ||
| 1374 | } else if (result != 0) { | ||
| 1375 | /* it's not a stall, but another error -- time to bail */ | ||
| 1376 | US_DEBUGP("-- Unknown error. Rejecting device\n"); | ||
| 1377 | return -EINVAL; | ||
| 1353 | } | 1378 | } |
| 1379 | |||
| 1380 | us->extra = kzalloc(sizeof(struct sddr09_card_info), GFP_NOIO); | ||
| 1381 | if (!us->extra) | ||
| 1382 | return -ENOMEM; | ||
| 1383 | us->extra_destructor = sddr09_card_info_destructor; | ||
| 1384 | |||
| 1385 | nand_init_ecc(); | ||
| 1386 | return 0; | ||
| 1354 | } | 1387 | } |
| 1355 | 1388 | ||
| 1389 | |||
| 1356 | /* | 1390 | /* |
| 1357 | * This is needed at a very early stage. If this is not listed in the | 1391 | * This is needed at a very early stage. If this is not listed in the |
| 1358 | * unusual devices list but called from here then LUN 0 of the combo reader | 1392 | * unusual devices list but called from here then LUN 0 of the combo reader |
| 1359 | * is not recognized. But I do not know what precisely these calls do. | 1393 | * is not recognized. But I do not know what precisely these calls do. |
| 1360 | */ | 1394 | */ |
| 1361 | int | 1395 | int |
| 1362 | sddr09_init(struct us_data *us) { | 1396 | usb_stor_sddr09_dpcm_init(struct us_data *us) { |
| 1363 | int result; | 1397 | int result; |
| 1364 | unsigned char *data = us->iobuf; | 1398 | unsigned char *data = us->iobuf; |
| 1365 | 1399 | ||
| 1400 | result = sddr09_common_init(us); | ||
| 1401 | if (result) | ||
| 1402 | return result; | ||
| 1403 | |||
| 1366 | result = sddr09_send_command(us, 0x01, USB_DIR_IN, data, 2); | 1404 | result = sddr09_send_command(us, 0x01, USB_DIR_IN, data, 2); |
| 1367 | if (result != USB_STOR_TRANSPORT_GOOD) { | 1405 | if (result != USB_STOR_TRANSPORT_GOOD) { |
| 1368 | US_DEBUGP("sddr09_init: send_command fails\n"); | 1406 | US_DEBUGP("sddr09_init: send_command fails\n"); |
| @@ -1398,7 +1436,7 @@ sddr09_init(struct us_data *us) { | |||
| 1398 | 1436 | ||
| 1399 | // test unit ready | 1437 | // test unit ready |
| 1400 | 1438 | ||
| 1401 | return USB_STOR_TRANSPORT_GOOD; /* not result */ | 1439 | return 0; /* not result */ |
| 1402 | } | 1440 | } |
| 1403 | 1441 | ||
| 1404 | /* | 1442 | /* |
| @@ -1427,13 +1465,6 @@ int sddr09_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
| 1427 | }; | 1465 | }; |
| 1428 | 1466 | ||
| 1429 | info = (struct sddr09_card_info *)us->extra; | 1467 | info = (struct sddr09_card_info *)us->extra; |
| 1430 | if (!info) { | ||
| 1431 | nand_init_ecc(); | ||
| 1432 | sddr09_init_card_info(us); | ||
| 1433 | info = (struct sddr09_card_info *)us->extra; | ||
| 1434 | if (!info) | ||
| 1435 | return USB_STOR_TRANSPORT_ERROR; | ||
| 1436 | } | ||
| 1437 | 1468 | ||
| 1438 | if (srb->cmnd[0] == REQUEST_SENSE && havefakesense) { | 1469 | if (srb->cmnd[0] == REQUEST_SENSE && havefakesense) { |
| 1439 | /* for a faked command, we have to follow with a faked sense */ | 1470 | /* for a faked command, we have to follow with a faked sense */ |
| @@ -1606,3 +1637,10 @@ int sddr09_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
| 1606 | return USB_STOR_TRANSPORT_GOOD; | 1637 | return USB_STOR_TRANSPORT_GOOD; |
| 1607 | } | 1638 | } |
| 1608 | 1639 | ||
| 1640 | /* | ||
| 1641 | * Initialization routine for the sddr09 subdriver | ||
| 1642 | */ | ||
| 1643 | int | ||
| 1644 | usb_stor_sddr09_init(struct us_data *us) { | ||
| 1645 | return sddr09_common_init(us); | ||
| 1646 | } | ||
diff --git a/drivers/usb/storage/sddr09.h b/drivers/usb/storage/sddr09.h index c9d78d6188b1..c03089a9ec38 100644 --- a/drivers/usb/storage/sddr09.h +++ b/drivers/usb/storage/sddr09.h | |||
| @@ -31,18 +31,7 @@ | |||
| 31 | 31 | ||
| 32 | extern int sddr09_transport(struct scsi_cmnd *srb, struct us_data *us); | 32 | extern int sddr09_transport(struct scsi_cmnd *srb, struct us_data *us); |
| 33 | 33 | ||
| 34 | struct sddr09_card_info { | 34 | extern int usb_stor_sddr09_dpcm_init(struct us_data *us); |
| 35 | unsigned long capacity; /* Size of card in bytes */ | 35 | extern int usb_stor_sddr09_init(struct us_data *us); |
| 36 | int pagesize; /* Size of page in bytes */ | ||
| 37 | int pageshift; /* log2 of pagesize */ | ||
| 38 | int blocksize; /* Size of block in pages */ | ||
| 39 | int blockshift; /* log2 of blocksize */ | ||
| 40 | int blockmask; /* 2^blockshift - 1 */ | ||
| 41 | int *lba_to_pba; /* logical to physical map */ | ||
| 42 | int *pba_to_lba; /* physical to logical map */ | ||
| 43 | int lbact; /* number of available pages */ | ||
| 44 | int flags; | ||
| 45 | #define SDDR09_WP 1 /* write protected */ | ||
| 46 | }; | ||
| 47 | 36 | ||
| 48 | #endif | 37 | #endif |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 100f53c2097e..be3c06d17533 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
| @@ -284,14 +284,14 @@ UNUSUAL_DEV( 0x04e6, 0x0002, 0x0100, 0x0100, | |||
| 284 | UNUSUAL_DEV( 0x04e6, 0x0003, 0x0000, 0x9999, | 284 | UNUSUAL_DEV( 0x04e6, 0x0003, 0x0000, 0x9999, |
| 285 | "Sandisk", | 285 | "Sandisk", |
| 286 | "ImageMate SDDR09", | 286 | "ImageMate SDDR09", |
| 287 | US_SC_SCSI, US_PR_EUSB_SDDR09, NULL, | 287 | US_SC_SCSI, US_PR_EUSB_SDDR09, usb_stor_sddr09_init, |
| 288 | US_FL_SINGLE_LUN ), | 288 | 0), |
| 289 | 289 | ||
| 290 | /* This entry is from Andries.Brouwer@cwi.nl */ | 290 | /* This entry is from Andries.Brouwer@cwi.nl */ |
| 291 | UNUSUAL_DEV( 0x04e6, 0x0005, 0x0100, 0x0208, | 291 | UNUSUAL_DEV( 0x04e6, 0x0005, 0x0100, 0x0208, |
| 292 | "SCM Microsystems", | 292 | "SCM Microsystems", |
| 293 | "eUSB SmartMedia / CompactFlash Adapter", | 293 | "eUSB SmartMedia / CompactFlash Adapter", |
| 294 | US_SC_SCSI, US_PR_DPCM_USB, sddr09_init, | 294 | US_SC_SCSI, US_PR_DPCM_USB, usb_stor_sddr09_dpcm_init, |
| 295 | 0), | 295 | 0), |
| 296 | #endif | 296 | #endif |
| 297 | 297 | ||
| @@ -681,8 +681,8 @@ UNUSUAL_DEV( 0x0644, 0x0000, 0x0100, 0x0100, | |||
| 681 | UNUSUAL_DEV( 0x066b, 0x0105, 0x0100, 0x0100, | 681 | UNUSUAL_DEV( 0x066b, 0x0105, 0x0100, 0x0100, |
| 682 | "Olympus", | 682 | "Olympus", |
| 683 | "Camedia MAUSB-2", | 683 | "Camedia MAUSB-2", |
| 684 | US_SC_SCSI, US_PR_EUSB_SDDR09, NULL, | 684 | US_SC_SCSI, US_PR_EUSB_SDDR09, usb_stor_sddr09_init, |
| 685 | US_FL_SINGLE_LUN ), | 685 | 0), |
| 686 | #endif | 686 | #endif |
| 687 | 687 | ||
| 688 | /* Reported by Darsen Lu <darsen@micro.ee.nthu.edu.tw> */ | 688 | /* Reported by Darsen Lu <darsen@micro.ee.nthu.edu.tw> */ |
| @@ -747,8 +747,8 @@ UNUSUAL_DEV( 0x0781, 0x0100, 0x0100, 0x0100, | |||
| 747 | UNUSUAL_DEV( 0x0781, 0x0200, 0x0000, 0x9999, | 747 | UNUSUAL_DEV( 0x0781, 0x0200, 0x0000, 0x9999, |
| 748 | "Sandisk", | 748 | "Sandisk", |
| 749 | "ImageMate SDDR-09", | 749 | "ImageMate SDDR-09", |
| 750 | US_SC_SCSI, US_PR_EUSB_SDDR09, NULL, | 750 | US_SC_SCSI, US_PR_EUSB_SDDR09, usb_stor_sddr09_init, |
| 751 | US_FL_SINGLE_LUN ), | 751 | 0), |
| 752 | #endif | 752 | #endif |
| 753 | 753 | ||
| 754 | #ifdef CONFIG_USB_STORAGE_FREECOM | 754 | #ifdef CONFIG_USB_STORAGE_FREECOM |
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index ca02ae97be86..85c8c17b3c0c 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c | |||
| @@ -919,28 +919,6 @@ static int storage_probe(struct usb_interface *intf, | |||
| 919 | */ | 919 | */ |
| 920 | get_device_info(us, id); | 920 | get_device_info(us, id); |
| 921 | 921 | ||
| 922 | #ifdef CONFIG_USB_STORAGE_SDDR09 | ||
| 923 | if (us->protocol == US_PR_EUSB_SDDR09 || | ||
| 924 | us->protocol == US_PR_DPCM_USB) { | ||
| 925 | /* set the configuration -- STALL is an acceptable response here */ | ||
| 926 | if (us->pusb_dev->actconfig->desc.bConfigurationValue != 1) { | ||
| 927 | US_DEBUGP("active config #%d != 1 ??\n", us->pusb_dev | ||
| 928 | ->actconfig->desc.bConfigurationValue); | ||
| 929 | goto BadDevice; | ||
| 930 | } | ||
| 931 | result = usb_reset_configuration(us->pusb_dev); | ||
| 932 | |||
| 933 | US_DEBUGP("Result of usb_reset_configuration is %d\n", result); | ||
| 934 | if (result == -EPIPE) { | ||
| 935 | US_DEBUGP("-- stall on control interface\n"); | ||
| 936 | } else if (result != 0) { | ||
| 937 | /* it's not a stall, but another error -- time to bail */ | ||
| 938 | US_DEBUGP("-- Unknown error. Rejecting device\n"); | ||
| 939 | goto BadDevice; | ||
| 940 | } | ||
| 941 | } | ||
| 942 | #endif | ||
| 943 | |||
| 944 | /* Get the transport, protocol, and pipe settings */ | 922 | /* Get the transport, protocol, and pipe settings */ |
| 945 | result = get_transport(us); | 923 | result = get_transport(us); |
| 946 | if (result) | 924 | if (result) |
