• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/drivers/usb/storage/

Lines Matching refs:us

157 static int usbat_flash_transport(struct scsi_cmnd * srb, struct us_data *us);
158 static int usbat_hp8200e_transport(struct scsi_cmnd *srb, struct us_data *us);
160 static int init_usbat_cd(struct us_data *us);
161 static int init_usbat_flash(struct us_data *us);
222 static int usbat_get_device_type(struct us_data *us)
224 return ((struct usbat_info*)us->extra)->devicetype;
230 static int usbat_read(struct us_data *us,
235 return usb_stor_ctrl_transfer(us,
236 us->recv_ctrl_pipe,
248 static int usbat_write(struct us_data *us,
253 return usb_stor_ctrl_transfer(us,
254 us->send_ctrl_pipe,
266 static int usbat_bulk_read(struct us_data *us,
275 return usb_stor_bulk_transfer_sg(us, us->recv_bulk_pipe, buf, len, use_sg, NULL);
281 static int usbat_bulk_write(struct us_data *us,
290 return usb_stor_bulk_transfer_sg(us, us->send_bulk_pipe, buf, len, use_sg, NULL);
298 static int usbat_execute_command(struct us_data *us,
302 return usb_stor_ctrl_transfer(us, us->send_ctrl_pipe,
310 static int usbat_get_status(struct us_data *us, unsigned char *status)
313 rc = usbat_read(us, USBAT_ATA, USBAT_ATA_STATUS, status);
322 static int usbat_check_status(struct us_data *us)
324 unsigned char *reply = us->iobuf;
327 rc = usbat_get_status(us, reply);
346 static int usbat_set_shuttle_features(struct us_data *us,
354 unsigned char *command = us->iobuf;
395 return usbat_execute_command(us, command, 8);
402 static int usbat_wait_not_busy(struct us_data *us, int minutes)
406 unsigned char *status = us->iobuf;
416 result = usbat_get_status(us, status);
421 result = usbat_read(us, USBAT_ATA, 0x10, status);
450 static int usbat_read_block(struct us_data *us,
456 unsigned char *command = us->iobuf;
470 result = usbat_execute_command(us, command, 8);
474 result = usbat_bulk_read(us, buf, len, use_sg);
482 static int usbat_write_block(struct us_data *us,
490 unsigned char *command = us->iobuf;
504 result = usbat_execute_command(us, command, 8);
509 result = usbat_bulk_write(us, buf, len, use_sg);
513 return usbat_wait_not_busy(us, minutes);
519 static int usbat_hp8200e_rw_block_test(struct us_data *us,
536 us->recv_bulk_pipe : us->send_bulk_pipe;
538 unsigned char *command = us->iobuf;
541 unsigned char *data = us->iobuf;
542 unsigned char *status = us->iobuf;
590 result = usbat_execute_command(us, command, cmdlen);
602 result = usbat_bulk_write(us, data, num_registers*2, 0);
608 result = usb_stor_bulk_transfer_sg(us,
639 if (usb_stor_clear_halt(us,
640 us->send_bulk_pipe) < 0)
648 result = usbat_read(us, USBAT_ATA,
666 return usbat_wait_not_busy(us, minutes);
678 * Allows us to write specific data to any registers. The data to be written
683 static int usbat_multiple_write(struct us_data *us,
689 unsigned char *data = us->iobuf;
690 unsigned char *command = us->iobuf;
709 result = usbat_execute_command(us, command, 8);
720 result = usbat_bulk_write(us, data, num_registers*2, 0);
724 if (usbat_get_device_type(us) == USBAT_DEV_HP8200)
725 return usbat_wait_not_busy(us, 0);
732 * Allows us to read blocks from a specific data register, based upon the
742 static int usbat_read_blocks(struct us_data *us,
748 unsigned char *command = us->iobuf;
760 result = usbat_execute_command(us, command, 8);
765 result = usbat_bulk_read(us, buffer, len, use_sg);
774 * Allows us to write blocks to a specific data register, based upon the
784 static int usbat_write_blocks(struct us_data *us,
790 unsigned char *command = us->iobuf;
802 result = usbat_execute_command(us, command, 8);
807 result = usbat_bulk_write(us, buffer, len, use_sg);
817 static int usbat_read_user_io(struct us_data *us, unsigned char *data_flags)
821 result = usb_stor_ctrl_transfer(us,
822 us->recv_ctrl_pipe,
838 static int usbat_write_user_io(struct us_data *us,
842 return usb_stor_ctrl_transfer(us,
843 us->send_ctrl_pipe,
856 static int usbat_device_reset(struct us_data *us)
864 rc = usbat_write_user_io(us,
874 rc = usbat_write_user_io(us,
886 static int usbat_device_enable_cdt(struct us_data *us)
891 rc = usbat_write_user_io(us,
929 static int usbat_flash_check_media(struct us_data *us,
933 unsigned char *uio = us->iobuf;
935 rc = usbat_read_user_io(us, uio);
953 rc = usbat_device_reset(us);
956 rc = usbat_device_enable_cdt(us);
962 rc = usbat_read_user_io(us, uio);
980 static int usbat_identify_device(struct us_data *us,
986 if (!us || !info)
989 rc = usbat_device_reset(us);
1000 rc = usbat_write(us, USBAT_ATA, USBAT_ATA_CMD, 0xA1);
1004 rc = usbat_get_status(us, &status);
1025 static int usbat_set_transport(struct us_data *us,
1034 usbat_identify_device(us, info);
1041 us->transport = usbat_hp8200e_transport;
1045 us->transport = usbat_flash_transport;
1055 static int usbat_flash_get_sector_count(struct us_data *us,
1068 if (!us || !info)
1076 rc = usbat_multiple_write(us, registers, command, 3);
1084 if (usbat_get_status(us, &status) != USB_STOR_XFER_GOOD) {
1092 rc = usbat_read_block(us, reply, 512, 0);
1111 static int usbat_flash_read_data(struct us_data *us,
1133 result = usbat_flash_check_media(us, info);
1172 result = usbat_multiple_write(us, registers, command, 7);
1177 result = usbat_read_blocks(us, buffer, len, 0);
1184 usb_stor_access_xfer_buf(buffer, len, us->srb,
1202 static int usbat_flash_write_data(struct us_data *us,
1224 result = usbat_flash_check_media(us, info);
1260 usb_stor_access_xfer_buf(buffer, len, us->srb,
1267 result = usbat_multiple_write(us, registers, command, 7);
1272 result = usbat_write_blocks(us, buffer, len, 0);
1292 static int usbat_hp8200e_handle_read10(struct us_data *us,
1309 result = usbat_hp8200e_rw_block_test(us, USBAT_ATA,
1378 result = usbat_hp8200e_rw_block_test(us, USBAT_ATA,
1404 static int usbat_select_and_test_registers(struct us_data *us)
1407 unsigned char *status = us->iobuf;
1411 if (usbat_write(us, USBAT_ATA, USBAT_ATA_DEVICE, selector) !=
1415 if (usbat_read(us, USBAT_ATA, USBAT_ATA_STATUS, status) !=
1419 if (usbat_read(us, USBAT_ATA, USBAT_ATA_DEVICE, status) !=
1423 if (usbat_read(us, USBAT_ATA, USBAT_ATA_LBA_ME, status) !=
1427 if (usbat_read(us, USBAT_ATA, USBAT_ATA_LBA_HI, status) !=
1431 if (usbat_write(us, USBAT_ATA, USBAT_ATA_LBA_ME, 0x55) !=
1435 if (usbat_write(us, USBAT_ATA, USBAT_ATA_LBA_HI, 0xAA) !=
1439 if (usbat_read(us, USBAT_ATA, USBAT_ATA_LBA_ME, status) !=
1443 if (usbat_read(us, USBAT_ATA, USBAT_ATA_LBA_ME, status) !=
1454 static int init_usbat(struct us_data *us, int devicetype)
1460 unsigned char *status = us->iobuf;
1462 us->extra = kzalloc(sizeof(struct usbat_info), GFP_NOIO);
1463 if (!us->extra) {
1467 info = (struct usbat_info *) (us->extra);
1470 rc = usbat_write_user_io(us,
1480 rc = usbat_read_user_io(us, status);
1486 rc = usbat_read_user_io(us, status);
1490 rc = usbat_read_user_io(us, status);
1496 rc = usbat_select_and_test_registers(us);
1502 rc = usbat_read_user_io(us, status);
1509 rc = usbat_device_enable_cdt(us);
1515 rc = usbat_read_user_io(us, status);
1523 rc = usbat_read_user_io(us, status);
1529 rc = usbat_select_and_test_registers(us);
1536 if (usbat_set_transport(us, info, devicetype))
1541 if (usbat_get_device_type(us) == USBAT_DEV_FLASH) {
1545 rc = usbat_set_shuttle_features(us, (USBAT_FEAT_ETEN | USBAT_FEAT_ET2 | USBAT_FEAT_ET1),
1558 static int usbat_hp8200e_transport(struct scsi_cmnd *srb, struct us_data *us)
1561 unsigned char *status = us->iobuf;
1594 result = usbat_get_status(us, status);
1603 result = usbat_hp8200e_rw_block_test(us, USBAT_ATA,
1621 return usbat_hp8200e_handle_read10(us, registers, data, srb);
1631 result = usbat_multiple_write(us, registers, data, 7);
1646 result = usbat_write_block(us, USBAT_ATA, srb->cmnd, 12,
1658 if (usbat_read(us, USBAT_ATA, USBAT_ATA_LBA_ME, status) !=
1665 if (usbat_read(us, USBAT_ATA, USBAT_ATA_LBA_HI, status) !=
1675 result = usbat_read_block(us, scsi_sglist(srb), len,
1685 static int usbat_flash_transport(struct scsi_cmnd * srb, struct us_data *us)
1688 struct usbat_info *info = (struct usbat_info *) (us->extra);
1690 unsigned char *ptr = us->iobuf;
1698 fill_inquiry_response(us, ptr, 36);
1703 rc = usbat_flash_check_media(us, info);
1707 rc = usbat_flash_get_sector_count(us, info);
1740 return usbat_flash_read_data(us, info, block, blocks);
1754 return usbat_flash_read_data(us, info, block, blocks);
1764 return usbat_flash_write_data(us, info, block, blocks);
1778 return usbat_flash_write_data(us, info, block, blocks);
1785 rc = usbat_flash_check_media(us, info);
1789 return usbat_check_status(us);
1822 static int init_usbat_cd(struct us_data *us)
1824 return init_usbat(us, USBAT_DEV_HP8200);
1827 static int init_usbat_flash(struct us_data *us)
1829 return init_usbat(us, USBAT_DEV_FLASH);
1835 struct us_data *us;
1838 result = usb_stor_probe1(&us, intf, id,
1846 us->transport_name = "Shuttle USBAT";
1847 us->transport = usbat_flash_transport;
1848 us->transport_reset = usb_stor_CB_reset;
1849 us->max_lun = 1;
1851 result = usb_stor_probe2(us);