Lines Matching +full:timeout +full:- +full:minutes

1 // SPDX-License-Identifier: GPL-2.0+
3 * Driver for SCM Microsystems (a.k.a. Shuttle) USB-ATAPI cable
20 * which does the USB-to-ATAPI conversion. By obtaining the data sheet on
46 #define DRV_NAME "ums-usbat"
48 MODULE_DESCRIPTION("Driver for SCM Microsystems (a.k.a. Shuttle) USB-ATAPI cable");
216 return ((struct usbat_info*)us->extra)->devicetype; in usbat_get_device_type()
228 us->recv_ctrl_pipe, in usbat_read()
246 us->send_ctrl_pipe, in usbat_write()
267 return usb_stor_bulk_transfer_sg(us, us->recv_bulk_pipe, buf, len, use_sg, NULL); in usbat_bulk_read()
282 return usb_stor_bulk_transfer_sg(us, us->send_bulk_pipe, buf, len, use_sg, NULL); in usbat_bulk_write()
286 * Some USBAT-specific commands can only be executed over a command transport
287 * This transport allows one (len=8) or two (len=16) vendor-specific commands
294 return usb_stor_ctrl_transfer(us, us->send_ctrl_pipe, in usbat_execute_command()
316 unsigned char *reply = us->iobuf; in usbat_check_status()
346 unsigned char *command = us->iobuf; in usbat_set_shuttle_features()
394 static int usbat_wait_not_busy(struct us_data *us, int minutes) in usbat_wait_not_busy() argument
398 unsigned char *status = us->iobuf; in usbat_wait_not_busy()
402 * but probably not more than 10 minutes or so. On the other hand, in usbat_wait_not_busy()
404 * minutes! in usbat_wait_not_busy()
407 for (i=0; i<1200+minutes*60; i++) { in usbat_wait_not_busy()
432 msleep(1000); /* X minutes */ in usbat_wait_not_busy()
435 usb_stor_dbg(us, "Waited not busy for %d minutes, timing out\n", in usbat_wait_not_busy()
436 minutes); in usbat_wait_not_busy()
449 unsigned char *command = us->iobuf; in usbat_read_block()
479 int minutes, in usbat_write_block() argument
483 unsigned char *command = us->iobuf; in usbat_write_block()
506 return usbat_wait_not_busy(us, minutes); in usbat_write_block()
519 unsigned char timeout, in usbat_hp8200e_rw_block_test() argument
525 int minutes) in usbat_hp8200e_rw_block_test() argument
529 us->recv_bulk_pipe : us->send_bulk_pipe; in usbat_hp8200e_rw_block_test()
531 unsigned char *command = us->iobuf; in usbat_hp8200e_rw_block_test()
534 unsigned char *data = us->iobuf; in usbat_hp8200e_rw_block_test()
535 unsigned char *status = us->iobuf; in usbat_hp8200e_rw_block_test()
544 * the data via a write-and-test. Any other time we only in usbat_hp8200e_rw_block_test()
545 * send the command to download the data -- the SCSI command in usbat_hp8200e_rw_block_test()
572 command[cmdlen-8] = (direction==DMA_TO_DEVICE ? 0x40 : 0xC0); in usbat_hp8200e_rw_block_test()
573 command[cmdlen-7] = access | in usbat_hp8200e_rw_block_test()
576 command[cmdlen-6] = data_reg; in usbat_hp8200e_rw_block_test()
577 command[cmdlen-5] = status_reg; in usbat_hp8200e_rw_block_test()
578 command[cmdlen-4] = timeout; in usbat_hp8200e_rw_block_test()
579 command[cmdlen-3] = qualifier; in usbat_hp8200e_rw_block_test()
580 command[cmdlen-2] = LSB_of(len); in usbat_hp8200e_rw_block_test()
581 command[cmdlen-1] = MSB_of(len); in usbat_hp8200e_rw_block_test()
606 * the bulk download -- but not the SCSI command because in usbat_hp8200e_rw_block_test()
611 * Note that a stall for the test-and-read/write command means in usbat_hp8200e_rw_block_test()
613 * sure that the device is error-free in usbat_hp8200e_rw_block_test()
614 * (i.e. bit 0 -- CHK -- of status is 0). The most likely in usbat_hp8200e_rw_block_test()
633 us->send_bulk_pipe) < 0) in usbat_hp8200e_rw_block_test()
660 return usbat_wait_not_busy(us, minutes); in usbat_hp8200e_rw_block_test()
683 unsigned char *data = us->iobuf; in usbat_multiple_write()
684 unsigned char *command = us->iobuf; in usbat_multiple_write()
729 * up until a maximum amount of time has elapsed, as specified by timeout.
742 unsigned char *command = us->iobuf; in usbat_read_blocks()
748 command[4] = 0xFD; /* Timeout (ms); */ in usbat_read_blocks()
771 * up until a maximum amount of time has elapsed, as specified by timeout.
784 unsigned char *command = us->iobuf; in usbat_write_blocks()
790 command[4] = 0xFD; /* Timeout (ms) */ in usbat_write_blocks()
816 us->recv_ctrl_pipe, in usbat_read_user_io()
837 us->send_ctrl_pipe, in usbat_write_user_io()
929 unsigned char *uio = us->iobuf; in usbat_flash_check_media()
938 info->sense_key = 0x02; in usbat_flash_check_media()
939 info->sense_asc = 0x3A; in usbat_flash_check_media()
940 info->sense_ascq = 0x00; in usbat_flash_check_media()
948 /* Reset and re-enable card detect */ in usbat_flash_check_media()
962 info->sense_key = UNIT_ATTENTION; in usbat_flash_check_media()
963 info->sense_asc = 0x28; in usbat_flash_check_media()
964 info->sense_ascq = 0x00; in usbat_flash_check_media()
972 * Determine whether we are controlling a flash-based reader/writer,
973 * or a HP8200-based CD drive.
1008 info->devicetype = USBAT_DEV_HP8200; in usbat_identify_device()
1012 info->devicetype = USBAT_DEV_FLASH; in usbat_identify_device()
1026 if (!info->devicetype) in usbat_set_transport()
1027 info->devicetype = devicetype; in usbat_set_transport()
1029 if (!info->devicetype) in usbat_set_transport()
1032 switch (info->devicetype) { in usbat_set_transport()
1037 us->transport = usbat_hp8200e_transport; in usbat_set_transport()
1041 us->transport = usbat_flash_transport; in usbat_set_transport()
1092 info->sectors = ((u32)(reply[117]) << 24) | in usbat_flash_get_sector_count()
1135 * we can support up to 28-bit addressing. I don't know if Jumpshot in usbat_flash_read_data()
1136 * supports beyond 24-bit addressing. It's kind of hard to test in usbat_flash_read_data()
1143 totallen = sectors * info->ssize; in usbat_flash_read_data()
1159 * (min(128k, 255*info->ssize) is the real limit) in usbat_flash_read_data()
1162 thistime = (len / info->ssize) & 0xff; in usbat_flash_read_data()
1180 usb_stor_access_xfer_buf(buffer, len, us->srb, in usbat_flash_read_data()
1184 totallen -= len; in usbat_flash_read_data()
1226 * we can support up to 28-bit addressing. I don't know if the device in usbat_flash_write_data()
1227 * supports beyond 24-bit addressing. It's kind of hard to test in usbat_flash_write_data()
1234 totallen = sectors * info->ssize; in usbat_flash_write_data()
1250 * (min(128k, 255*info->ssize) is the real limit) in usbat_flash_write_data()
1253 thistime = (len / info->ssize) & 0xff; in usbat_flash_write_data()
1256 usb_stor_access_xfer_buf(buffer, len, us->srb, in usbat_flash_write_data()
1273 totallen -= len; in usbat_flash_write_data()
1300 usb_stor_dbg(us, "transfersize %d\n", srb->transfersize); in usbat_hp8200e_handle_read10()
1317 * a single read command (max is 64k-1), we will perform in usbat_hp8200e_handle_read10()
1319 * a sector. Luckily the sector size is in srb->transfersize in usbat_hp8200e_handle_read10()
1328 srb->transfersize = scsi_bufflen(srb)/len; in usbat_hp8200e_handle_read10()
1331 if (!srb->transfersize) { in usbat_hp8200e_handle_read10()
1332 srb->transfersize = 2048; /* A guess */ in usbat_hp8200e_handle_read10()
1334 srb->transfersize); in usbat_hp8200e_handle_read10()
1343 len = (65535/srb->transfersize) * srb->transfersize; in usbat_hp8200e_handle_read10()
1356 if (len > scsi_bufflen(srb) - transferred) in usbat_hp8200e_handle_read10()
1357 len = scsi_bufflen(srb) - transferred; in usbat_hp8200e_handle_read10()
1370 data[7+7] = MSB_of(len / srb->transfersize); /* SCSI command */ in usbat_hp8200e_handle_read10()
1371 data[7+8] = LSB_of(len / srb->transfersize); /* num sectors */ in usbat_hp8200e_handle_read10()
1391 sector += len / srb->transfersize; in usbat_hp8200e_handle_read10()
1402 unsigned char *status = us->iobuf; in usbat_select_and_test_registers()
1455 unsigned char *status = us->iobuf; in init_usbat()
1457 us->extra = kzalloc(sizeof(struct usbat_info), GFP_NOIO); in init_usbat()
1458 if (!us->extra) in init_usbat()
1459 return -ENOMEM; in init_usbat()
1461 info = (struct usbat_info *) (us->extra); in init_usbat()
1468 return -EIO; in init_usbat()
1476 return -EIO; in init_usbat()
1482 return -EIO; in init_usbat()
1486 return -EIO; in init_usbat()
1492 return -EIO; in init_usbat()
1498 return -EIO; in init_usbat()
1505 return -EIO; in init_usbat()
1511 return -EIO; in init_usbat()
1519 return -EIO; in init_usbat()
1525 return -EIO; in init_usbat()
1531 return -EIO; in init_usbat()
1542 return -EIO; in init_usbat()
1555 unsigned char *status = us->iobuf; in usbat_hp8200e_transport()
1586 data[i] = (i-7 >= srb->cmd_len) ? 0 : srb->cmnd[i-7]; in usbat_hp8200e_transport()
1593 if (srb->cmnd[0] == TEST_UNIT_READY) in usbat_hp8200e_transport()
1596 if (srb->sc_data_direction == DMA_TO_DEVICE) { in usbat_hp8200e_transport()
1613 } else if (srb->cmnd[0] == READ_10 || in usbat_hp8200e_transport()
1614 srb->cmnd[0] == GPCMD_READ_CD) { in usbat_hp8200e_transport()
1632 * Write the 12-byte command header. in usbat_hp8200e_transport()
1634 * If the command is BLANK then set the timer for 75 minutes. in usbat_hp8200e_transport()
1635 * Otherwise set it for 10 minutes. in usbat_hp8200e_transport()
1641 result = usbat_write_block(us, USBAT_ATA, srb->cmnd, 12, in usbat_hp8200e_transport()
1642 srb->cmnd[0] == GPCMD_BLANK ? 75 : 10, 0); in usbat_hp8200e_transport()
1649 if (len != 0 && (srb->sc_data_direction == DMA_FROM_DEVICE)) { in usbat_hp8200e_transport()
1678 * Transport for USBAT02-based CompactFlash and similar storage devices
1683 struct usbat_info *info = (struct usbat_info *) (us->extra); in usbat_flash_transport()
1685 unsigned char *ptr = us->iobuf; in usbat_flash_transport()
1690 if (srb->cmnd[0] == INQUIRY) { in usbat_flash_transport()
1691 usb_stor_dbg(us, "INQUIRY - Returning bogus response\n"); in usbat_flash_transport()
1697 if (srb->cmnd[0] == READ_CAPACITY) { in usbat_flash_transport()
1707 info->ssize = 0x200; in usbat_flash_transport()
1709 info->sectors, info->ssize); in usbat_flash_transport()
1716 ((__be32 *) ptr)[0] = cpu_to_be32(info->sectors - 1); in usbat_flash_transport()
1717 ((__be32 *) ptr)[1] = cpu_to_be32(info->ssize); in usbat_flash_transport()
1723 if (srb->cmnd[0] == MODE_SELECT_10) { in usbat_flash_transport()
1728 if (srb->cmnd[0] == READ_10) { in usbat_flash_transport()
1729 block = ((u32)(srb->cmnd[2]) << 24) | ((u32)(srb->cmnd[3]) << 16) | in usbat_flash_transport()
1730 ((u32)(srb->cmnd[4]) << 8) | ((u32)(srb->cmnd[5])); in usbat_flash_transport()
1732 blocks = ((u32)(srb->cmnd[7]) << 8) | ((u32)(srb->cmnd[8])); in usbat_flash_transport()
1739 if (srb->cmnd[0] == READ_12) { in usbat_flash_transport()
1743 block = ((u32)(srb->cmnd[2]) << 24) | ((u32)(srb->cmnd[3]) << 16) | in usbat_flash_transport()
1744 ((u32)(srb->cmnd[4]) << 8) | ((u32)(srb->cmnd[5])); in usbat_flash_transport()
1746 blocks = ((u32)(srb->cmnd[6]) << 24) | ((u32)(srb->cmnd[7]) << 16) | in usbat_flash_transport()
1747 ((u32)(srb->cmnd[8]) << 8) | ((u32)(srb->cmnd[9])); in usbat_flash_transport()
1754 if (srb->cmnd[0] == WRITE_10) { in usbat_flash_transport()
1755 block = ((u32)(srb->cmnd[2]) << 24) | ((u32)(srb->cmnd[3]) << 16) | in usbat_flash_transport()
1756 ((u32)(srb->cmnd[4]) << 8) | ((u32)(srb->cmnd[5])); in usbat_flash_transport()
1758 blocks = ((u32)(srb->cmnd[7]) << 8) | ((u32)(srb->cmnd[8])); in usbat_flash_transport()
1765 if (srb->cmnd[0] == WRITE_12) { in usbat_flash_transport()
1769 block = ((u32)(srb->cmnd[2]) << 24) | ((u32)(srb->cmnd[3]) << 16) | in usbat_flash_transport()
1770 ((u32)(srb->cmnd[4]) << 8) | ((u32)(srb->cmnd[5])); in usbat_flash_transport()
1772 blocks = ((u32)(srb->cmnd[6]) << 24) | ((u32)(srb->cmnd[7]) << 16) | in usbat_flash_transport()
1773 ((u32)(srb->cmnd[8]) << 8) | ((u32)(srb->cmnd[9])); in usbat_flash_transport()
1781 if (srb->cmnd[0] == TEST_UNIT_READY) { in usbat_flash_transport()
1791 if (srb->cmnd[0] == REQUEST_SENSE) { in usbat_flash_transport()
1796 ptr[2] = info->sense_key; in usbat_flash_transport()
1798 ptr[12] = info->sense_asc; in usbat_flash_transport()
1799 ptr[13] = info->sense_ascq; in usbat_flash_transport()
1805 if (srb->cmnd[0] == ALLOW_MEDIUM_REMOVAL) { in usbat_flash_transport()
1814 srb->cmnd[0], srb->cmnd[0]); in usbat_flash_transport()
1815 info->sense_key = 0x05; in usbat_flash_transport()
1816 info->sense_asc = 0x20; in usbat_flash_transport()
1817 info->sense_ascq = 0x00; in usbat_flash_transport()
1840 (id - usbat_usb_ids) + usbat_unusual_dev_list, in usbat_probe()
1849 us->transport_name = "Shuttle USBAT"; in usbat_probe()
1850 us->transport = usbat_flash_transport; in usbat_probe()
1851 us->transport_reset = usb_stor_CB_reset; in usbat_probe()
1852 us->max_lun = 0; in usbat_probe()