Lines Matching full:us

52 static int usb_stor_sddr09_dpcm_init(struct us_data *us);
53 static int sddr09_transport(struct scsi_cmnd *srb, struct us_data *us);
54 static int usb_stor_sddr09_init(struct us_data *us);
289 sddr09_send_command(struct us_data *us, in sddr09_send_command() argument
301 pipe = us->recv_ctrl_pipe; in sddr09_send_command()
303 pipe = us->send_ctrl_pipe; in sddr09_send_command()
305 rc = usb_stor_ctrl_transfer(us, pipe, request, requesttype, in sddr09_send_command()
315 sddr09_send_scsi_command(struct us_data *us, in sddr09_send_scsi_command() argument
318 return sddr09_send_command(us, 0, USB_DIR_OUT, command, command_len); in sddr09_send_scsi_command()
327 sddr09_test_unit_ready(struct us_data *us) {
328 unsigned char *command = us->iobuf;
334 result = sddr09_send_scsi_command(us, command, 6);
336 usb_stor_dbg(us, "sddr09_test_unit_ready returns %d\n", result);
348 sddr09_request_sense(struct us_data *us, unsigned char *sensebuf, int buflen) { in sddr09_request_sense() argument
349 unsigned char *command = us->iobuf; in sddr09_request_sense()
357 result = sddr09_send_scsi_command(us, command, 12); in sddr09_request_sense()
361 result = usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe, in sddr09_request_sense()
389 sddr09_readX(struct us_data *us, int x, unsigned long fromaddress, in sddr09_readX() argument
393 unsigned char *command = us->iobuf; in sddr09_readX()
409 result = sddr09_send_scsi_command(us, command, 12); in sddr09_readX()
412 usb_stor_dbg(us, "Result for send_control in sddr09_read2%d %d\n", in sddr09_readX()
417 result = usb_stor_bulk_transfer_sg(us, us->recv_bulk_pipe, in sddr09_readX()
421 usb_stor_dbg(us, "Result for bulk_transfer in sddr09_read2%d %d\n", in sddr09_readX()
438 sddr09_read20(struct us_data *us, unsigned long fromaddress, in sddr09_read20() argument
443 return sddr09_readX(us, 0, fromaddress, nr_of_pages, bulklen, in sddr09_read20()
461 sddr09_read21(struct us_data *us, unsigned long fromaddress, in sddr09_read21() argument
465 return sddr09_readX(us, 1, fromaddress, count, bulklen, in sddr09_read21()
479 sddr09_read22(struct us_data *us, unsigned long fromaddress, in sddr09_read22() argument
483 usb_stor_dbg(us, "reading %d pages, %d bytes\n", nr_of_pages, bulklen); in sddr09_read22()
484 return sddr09_readX(us, 2, fromaddress, nr_of_pages, bulklen, in sddr09_read22()
503 sddr09_read23(struct us_data *us, unsigned long fromaddress,
507 return sddr09_readX(us, 3, fromaddress, count, bulklen,
522 sddr09_erase(struct us_data *us, unsigned long Eaddress) { in sddr09_erase() argument
523 unsigned char *command = us->iobuf; in sddr09_erase()
526 usb_stor_dbg(us, "erase address %lu\n", Eaddress); in sddr09_erase()
536 result = sddr09_send_scsi_command(us, command, 12); in sddr09_erase()
539 usb_stor_dbg(us, "Result for send_control in sddr09_erase %d\n", in sddr09_erase()
571 sddr09_writeX(struct us_data *us, in sddr09_writeX() argument
575 unsigned char *command = us->iobuf; in sddr09_writeX()
594 result = sddr09_send_scsi_command(us, command, 12); in sddr09_writeX()
597 usb_stor_dbg(us, "Result for send_control in sddr09_writeX %d\n", in sddr09_writeX()
602 result = usb_stor_bulk_transfer_sg(us, us->send_bulk_pipe, in sddr09_writeX()
606 usb_stor_dbg(us, "Result for bulk_transfer in sddr09_writeX %d\n", in sddr09_writeX()
615 sddr09_write_inplace(struct us_data *us, unsigned long address, in sddr09_write_inplace() argument
619 return sddr09_writeX(us, address, address, nr_of_pages, bulklen, in sddr09_write_inplace()
636 sddr09_read_sg_test_only(struct us_data *us) {
637 unsigned char *command = us->iobuf;
672 result = sddr09_send_scsi_command(us, command, 4*nsg+3);
675 usb_stor_dbg(us, "Result for send_control in sddr09_read_sg %d\n",
684 result = usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe,
688 usb_stor_dbg(us, "Result for bulk_transfer in sddr09_read_sg %d\n",
709 sddr09_read_status(struct us_data *us, unsigned char *status) { in sddr09_read_status() argument
711 unsigned char *command = us->iobuf; in sddr09_read_status()
712 unsigned char *data = us->iobuf; in sddr09_read_status()
715 usb_stor_dbg(us, "Reading status...\n"); in sddr09_read_status()
721 result = sddr09_send_scsi_command(us, command, 12); in sddr09_read_status()
725 result = usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe, in sddr09_read_status()
732 sddr09_read_data(struct us_data *us, in sddr09_read_data() argument
736 struct sddr09_card_info *info = (struct sddr09_card_info *) us->extra; in sddr09_read_data()
775 usb_stor_dbg(us, "Error: Requested lba %u exceeds maximum %u\n", in sddr09_read_data()
786 usb_stor_dbg(us, "Read %d zero pages (LBA %d) page %d\n", in sddr09_read_data()
799 usb_stor_dbg(us, "Read %d pages, from PBA %d (LBA %d) page %d\n", in sddr09_read_data()
805 result = sddr09_read20(us, address>>1, in sddr09_read_data()
812 usb_stor_access_xfer_buf(buffer, len, us->srb, in sddr09_read_data()
851 sddr09_write_lba(struct us_data *us, unsigned int lba, in sddr09_write_lba() argument
855 struct sddr09_card_info *info = (struct sddr09_card_info *) us->extra; in sddr09_write_lba()
892 result = sddr09_read22(us, address>>1, info->blocksize, in sddr09_write_lba()
903 usb_stor_dbg(us, "Warning: bad ecc in page %d- of pba %d\n", in sddr09_write_lba()
909 usb_stor_dbg(us, "Warning: bad ecc in page %d+ of pba %d\n", in sddr09_write_lba()
930 usb_stor_dbg(us, "Rewrite PBA %d (LBA %d)\n", pba, lba); in sddr09_write_lba()
932 result = sddr09_write_inplace(us, address>>1, info->blocksize, in sddr09_write_lba()
935 usb_stor_dbg(us, "sddr09_write_inplace returns %d\n", result); in sddr09_write_lba()
940 int result2 = sddr09_read_status(us, &status); in sddr09_write_lba()
942 usb_stor_dbg(us, "cannot read status\n"); in sddr09_write_lba()
944 usb_stor_dbg(us, "status after write: 0x%x\n", status); in sddr09_write_lba()
950 int result2 = sddr09_test_unit_ready(us); in sddr09_write_lba()
958 sddr09_write_data(struct us_data *us, in sddr09_write_data() argument
962 struct sddr09_card_info *info = (struct sddr09_card_info *) us->extra; in sddr09_write_data()
1020 usb_stor_dbg(us, "Error: Requested lba %u exceeds maximum %u\n", in sddr09_write_data()
1027 usb_stor_access_xfer_buf(buffer, len, us->srb, in sddr09_write_data()
1030 result = sddr09_write_lba(us, lba, page, pages, in sddr09_write_data()
1047 sddr09_read_control(struct us_data *us, in sddr09_read_control() argument
1053 usb_stor_dbg(us, "Read control address %lu, blocks %d\n", in sddr09_read_control()
1056 return sddr09_read21(us, address, blocks, in sddr09_read_control()
1071 sddr09_read_deviceID(struct us_data *us, unsigned char *deviceID) { in sddr09_read_deviceID() argument
1072 unsigned char *command = us->iobuf; in sddr09_read_deviceID()
1073 unsigned char *content = us->iobuf; in sddr09_read_deviceID()
1080 result = sddr09_send_scsi_command(us, command, 12); in sddr09_read_deviceID()
1084 result = usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe, in sddr09_read_deviceID()
1094 sddr09_get_wp(struct us_data *us, struct sddr09_card_info *info) { in sddr09_get_wp() argument
1099 result = sddr09_read_status(us, &status); in sddr09_get_wp()
1101 usb_stor_dbg(us, "read_status fails\n"); in sddr09_get_wp()
1110 usb_stor_dbg(us, "status 0x%02X%s%s%s%s\n", status, wp_fmt, in sddr09_get_wp()
1124 sddr09_reset(struct us_data *us) {
1126 unsigned char *command = us->iobuf;
1132 return sddr09_send_scsi_command(us, command, 12);
1137 sddr09_get_cardinfo(struct us_data *us, unsigned char flags) { in sddr09_get_cardinfo() argument
1143 usb_stor_dbg(us, "Reading capacity...\n"); in sddr09_get_cardinfo()
1145 result = sddr09_read_deviceID(us, deviceID); in sddr09_get_cardinfo()
1148 usb_stor_dbg(us, "Result of read_deviceID is %d\n", result); in sddr09_get_cardinfo()
1197 sddr09_read_map(struct us_data *us) { in sddr09_read_map() argument
1199 struct sddr09_card_info *info = (struct sddr09_card_info *) us->extra; in sddr09_read_map()
1259 us, address>>1, in sddr09_read_map()
1358 sddr09_erase(us, address>>1); in sddr09_read_map()
1385 usb_stor_dbg(us, "Found %d LBA's\n", lbact); in sddr09_read_map()
1411 sddr09_common_init(struct us_data *us) { in sddr09_common_init() argument
1415 if (us->pusb_dev->actconfig->desc.bConfigurationValue != 1) { in sddr09_common_init()
1416 usb_stor_dbg(us, "active config #%d != 1 ??\n", in sddr09_common_init()
1417 us->pusb_dev->actconfig->desc.bConfigurationValue); in sddr09_common_init()
1421 result = usb_reset_configuration(us->pusb_dev); in sddr09_common_init()
1422 usb_stor_dbg(us, "Result of usb_reset_configuration is %d\n", result); in sddr09_common_init()
1424 usb_stor_dbg(us, "-- stall on control interface\n"); in sddr09_common_init()
1427 usb_stor_dbg(us, "-- Unknown error. Rejecting device\n"); in sddr09_common_init()
1431 us->extra = kzalloc(sizeof(struct sddr09_card_info), GFP_NOIO); in sddr09_common_init()
1432 if (!us->extra) in sddr09_common_init()
1434 us->extra_destructor = sddr09_card_info_destructor; in sddr09_common_init()
1447 usb_stor_sddr09_dpcm_init(struct us_data *us) { in usb_stor_sddr09_dpcm_init() argument
1449 unsigned char *data = us->iobuf; in usb_stor_sddr09_dpcm_init()
1451 result = sddr09_common_init(us); in usb_stor_sddr09_dpcm_init()
1455 result = sddr09_send_command(us, 0x01, USB_DIR_IN, data, 2); in usb_stor_sddr09_dpcm_init()
1457 usb_stor_dbg(us, "send_command fails\n"); in usb_stor_sddr09_dpcm_init()
1461 usb_stor_dbg(us, "%02X %02X\n", data[0], data[1]); in usb_stor_sddr09_dpcm_init()
1464 result = sddr09_send_command(us, 0x08, USB_DIR_IN, data, 2); in usb_stor_sddr09_dpcm_init()
1466 usb_stor_dbg(us, "2nd send_command fails\n"); in usb_stor_sddr09_dpcm_init()
1470 usb_stor_dbg(us, "%02X %02X\n", data[0], data[1]); in usb_stor_sddr09_dpcm_init()
1473 result = sddr09_request_sense(us, data, 18); in usb_stor_sddr09_dpcm_init()
1496 static int dpcm_transport(struct scsi_cmnd *srb, struct us_data *us) in dpcm_transport() argument
1500 usb_stor_dbg(us, "LUN=%d\n", (u8)srb->device->lun); in dpcm_transport()
1508 ret = usb_stor_CB_transport(srb, us); in dpcm_transport()
1521 ret = sddr09_transport(srb, us); in dpcm_transport()
1526 usb_stor_dbg(us, "Invalid LUN %d\n", (u8)srb->device->lun); in dpcm_transport()
1537 static int sddr09_transport(struct scsi_cmnd *srb, struct us_data *us) in sddr09_transport() argument
1542 unsigned char *ptr = us->iobuf; in sddr09_transport()
1559 info = (struct sddr09_card_info *)us->extra; in sddr09_transport()
1582 fill_inquiry_response(us, ptr, 36); in sddr09_transport()
1589 sddr09_get_wp(us, info); /* read WP bit */ in sddr09_transport()
1591 cardinfo = sddr09_get_cardinfo(us, info->flags); in sddr09_transport()
1608 if (sddr09_read_map(us)) { in sddr09_transport()
1636 usb_stor_dbg(us, "Dummy up request for mode page 0x%x\n", in sddr09_transport()
1663 usb_stor_dbg(us, "READ_10: read page %d pagect %d\n", in sddr09_transport()
1666 result = sddr09_read_data(us, page, pages); in sddr09_transport()
1678 usb_stor_dbg(us, "WRITE_10: write page %d pagect %d\n", in sddr09_transport()
1681 result = sddr09_write_data(us, page, pages); in sddr09_transport()
1707 usb_stor_dbg(us, "Send control for command %s\n", ptr); in sddr09_transport()
1709 result = sddr09_send_scsi_command(us, srb->cmnd, 12); in sddr09_transport()
1711 usb_stor_dbg(us, "sddr09_send_scsi_command returns %d\n", in sddr09_transport()
1722 ? us->send_bulk_pipe : us->recv_bulk_pipe; in sddr09_transport()
1724 usb_stor_dbg(us, "%s %d bytes\n", in sddr09_transport()
1729 result = usb_stor_bulk_srb(us, pipe, srb); in sddr09_transport()
1742 usb_stor_sddr09_init(struct us_data *us) { in usb_stor_sddr09_init() argument
1743 return sddr09_common_init(us); in usb_stor_sddr09_init()
1751 struct us_data *us; in sddr09_probe() local
1754 result = usb_stor_probe1(&us, intf, id, in sddr09_probe()
1760 if (us->protocol == USB_PR_DPCM_USB) { in sddr09_probe()
1761 us->transport_name = "Control/Bulk-EUSB/SDDR09"; in sddr09_probe()
1762 us->transport = dpcm_transport; in sddr09_probe()
1763 us->transport_reset = usb_stor_CB_reset; in sddr09_probe()
1764 us->max_lun = 1; in sddr09_probe()
1766 us->transport_name = "EUSB/SDDR09"; in sddr09_probe()
1767 us->transport = sddr09_transport; in sddr09_probe()
1768 us->transport_reset = usb_stor_CB_reset; in sddr09_probe()
1769 us->max_lun = 0; in sddr09_probe()
1772 result = usb_stor_probe2(us); in sddr09_probe()