Lines Matching full:us
480 static int ene_sd_init(struct us_data *us);
481 static int ene_ms_init(struct us_data *us);
482 static int ene_load_bincode(struct us_data *us, unsigned char flag);
493 static int ene_send_scsi_cmd(struct us_data *us, u8 fDir, void *buf, int use_sg) in ene_send_scsi_cmd() argument
495 struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; in ene_send_scsi_cmd()
496 struct bulk_cs_wrap *bcs = (struct bulk_cs_wrap *) us->iobuf; in ene_send_scsi_cmd()
503 /* usb_stor_dbg(us, "transport --- ene_send_scsi_cmd\n"); */ in ene_send_scsi_cmd()
505 result = usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, in ene_send_scsi_cmd()
508 usb_stor_dbg(us, "send cmd to out endpoint fail ---\n"); in ene_send_scsi_cmd()
516 pipe = us->recv_bulk_pipe; in ene_send_scsi_cmd()
518 pipe = us->send_bulk_pipe; in ene_send_scsi_cmd()
522 result = usb_stor_bulk_srb(us, pipe, us->srb); in ene_send_scsi_cmd()
524 result = usb_stor_bulk_transfer_sg(us, pipe, buf, in ene_send_scsi_cmd()
528 usb_stor_dbg(us, "data transfer fail ---\n"); in ene_send_scsi_cmd()
534 result = usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe, bcs, in ene_send_scsi_cmd()
538 usb_stor_dbg(us, "Received 0-length CSW; retrying...\n"); in ene_send_scsi_cmd()
539 result = usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe, in ene_send_scsi_cmd()
545 usb_stor_dbg(us, "Attempting to get CSW (2nd try)...\n"); in ene_send_scsi_cmd()
546 result = usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe, in ene_send_scsi_cmd()
558 * was really transferred and what the device tells us in ene_send_scsi_cmd()
560 if (residue && !(us->fflags & US_FL_IGNORE_RESIDUE)) { in ene_send_scsi_cmd()
562 if (us->srb != NULL) in ene_send_scsi_cmd()
563 scsi_set_resid(us->srb, max(scsi_get_resid(us->srb), in ene_send_scsi_cmd()
573 static int do_scsi_request_sense(struct us_data *us, struct scsi_cmnd *srb) in do_scsi_request_sense() argument
575 struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; in do_scsi_request_sense()
589 static int do_scsi_inquiry(struct us_data *us, struct scsi_cmnd *srb) in do_scsi_inquiry() argument
601 static int sd_scsi_test_unit_ready(struct us_data *us, struct scsi_cmnd *srb) in sd_scsi_test_unit_ready() argument
603 struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; in sd_scsi_test_unit_ready()
608 ene_sd_init(us); in sd_scsi_test_unit_ready()
615 static int sd_scsi_mode_sense(struct us_data *us, struct scsi_cmnd *srb) in sd_scsi_mode_sense() argument
617 struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; in sd_scsi_mode_sense()
634 static int sd_scsi_read_capacity(struct us_data *us, struct scsi_cmnd *srb) in sd_scsi_read_capacity() argument
641 struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; in sd_scsi_read_capacity()
643 usb_stor_dbg(us, "sd_scsi_read_capacity\n"); in sd_scsi_read_capacity()
656 usb_stor_dbg(us, "bl_len = %x\n", bl_len); in sd_scsi_read_capacity()
657 usb_stor_dbg(us, "bl_num = %x\n", bl_num); in sd_scsi_read_capacity()
674 static int sd_scsi_read(struct us_data *us, struct scsi_cmnd *srb) in sd_scsi_read() argument
678 struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; in sd_scsi_read()
679 struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; in sd_scsi_read()
690 result = ene_load_bincode(us, SD_RW_PATTERN); in sd_scsi_read()
692 usb_stor_dbg(us, "Load SD RW pattern Fail !!\n"); in sd_scsi_read()
710 result = ene_send_scsi_cmd(us, FDIR_READ, scsi_sglist(srb), 1); in sd_scsi_read()
714 static int sd_scsi_write(struct us_data *us, struct scsi_cmnd *srb) in sd_scsi_write() argument
718 struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; in sd_scsi_write()
719 struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; in sd_scsi_write()
730 result = ene_load_bincode(us, SD_RW_PATTERN); in sd_scsi_write()
732 usb_stor_dbg(us, "Load SD RW pattern Fail !!\n"); in sd_scsi_write()
750 result = ene_send_scsi_cmd(us, FDIR_WRITE, scsi_sglist(srb), 1); in sd_scsi_write()
758 static int ms_lib_set_logicalpair(struct us_data *us, u16 logblk, u16 phyblk) in ms_lib_set_logicalpair() argument
760 struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; in ms_lib_set_logicalpair()
771 static int ms_lib_set_logicalblockmark(struct us_data *us, u16 phyblk, u16 mark) in ms_lib_set_logicalblockmark() argument
773 struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; in ms_lib_set_logicalblockmark()
783 static int ms_lib_set_initialerrorblock(struct us_data *us, u16 phyblk) in ms_lib_set_initialerrorblock() argument
785 return ms_lib_set_logicalblockmark(us, phyblk, MS_LB_INITIAL_ERROR); in ms_lib_set_initialerrorblock()
788 static int ms_lib_set_bootblockmark(struct us_data *us, u16 phyblk) in ms_lib_set_bootblockmark() argument
790 return ms_lib_set_logicalblockmark(us, phyblk, MS_LB_BOOT_BLOCK); in ms_lib_set_bootblockmark()
793 static int ms_lib_free_logicalmap(struct us_data *us) in ms_lib_free_logicalmap() argument
795 struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; in ms_lib_free_logicalmap()
806 static int ms_lib_alloc_logicalmap(struct us_data *us) in ms_lib_alloc_logicalmap() argument
809 struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; in ms_lib_alloc_logicalmap()
819 ms_lib_free_logicalmap(us); in ms_lib_alloc_logicalmap()
832 static void ms_lib_clear_writebuf(struct us_data *us) in ms_lib_clear_writebuf() argument
835 struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; in ms_lib_clear_writebuf()
853 static int ms_count_freeblock(struct us_data *us, u16 PhyBlock) in ms_count_freeblock() argument
856 struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; in ms_count_freeblock()
872 static int ms_read_readpage(struct us_data *us, u32 PhyBlockAddr, in ms_read_readpage() argument
875 struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; in ms_read_readpage()
876 struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; in ms_read_readpage()
881 result = ene_load_bincode(us, MS_RW_PATTERN); in ms_read_readpage()
899 result = ene_send_scsi_cmd(us, FDIR_READ, PageBuf, 0); in ms_read_readpage()
918 result = ene_send_scsi_cmd(us, FDIR_READ, bbuf, 0); in ms_read_readpage()
934 static int ms_lib_process_bootblock(struct us_data *us, u16 PhyBlock, u8 *PageData) in ms_lib_process_bootblock() argument
942 struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; in ms_lib_process_bootblock()
981 if (ms_lib_alloc_logicalmap(us)) in ms_lib_process_bootblock()
985 ms_lib_set_bootblockmark(us, PhyBlock); in ms_lib_process_bootblock()
1015 switch (ms_read_readpage(us, PhyBlock, PageNumber, (u32 *)PageBuffer, &ExtraData)) { in ms_lib_process_bootblock()
1030 ms_lib_set_initialerrorblock(us, phyblk); in ms_lib_process_bootblock()
1041 …switch (ms_read_readpage(us, PhyBlock, (u8)(EntryOffset / MS_BYTES_PER_PAGE + 1), (u32 *)PageBuffe… in ms_lib_process_bootblock()
1065 ms_lib_free_logicalmap(us); in ms_lib_process_bootblock()
1073 static void ms_lib_free_writebuf(struct us_data *us) in ms_lib_free_writebuf() argument
1075 struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; in ms_lib_free_writebuf()
1094 static void ms_lib_free_allocatedarea(struct us_data *us) in ms_lib_free_allocatedarea() argument
1096 struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; in ms_lib_free_allocatedarea()
1098 ms_lib_free_writebuf(us); /* Free MS_Lib.pagemap */ in ms_lib_free_allocatedarea()
1099 ms_lib_free_logicalmap(us); /* kfree MS_Lib.Phy2LogMap and MS_Lib.Log2PhyMap */ in ms_lib_free_allocatedarea()
1101 /* set struct us point flag to 0 */ in ms_lib_free_allocatedarea()
1115 static int ms_lib_alloc_writebuf(struct us_data *us) in ms_lib_alloc_writebuf() argument
1117 struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; in ms_lib_alloc_writebuf()
1129 ms_lib_free_writebuf(us); in ms_lib_alloc_writebuf()
1133 ms_lib_clear_writebuf(us); in ms_lib_alloc_writebuf()
1138 static int ms_lib_force_setlogical_pair(struct us_data *us, u16 logblk, u16 phyblk) in ms_lib_force_setlogical_pair() argument
1140 struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; in ms_lib_force_setlogical_pair()
1155 static int ms_read_copyblock(struct us_data *us, u16 oldphy, u16 newphy, in ms_read_copyblock() argument
1158 struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; in ms_read_copyblock()
1161 result = ene_load_bincode(us, MS_RW_PATTERN); in ms_read_copyblock()
1181 result = ene_send_scsi_cmd(us, FDIR_WRITE, buf, 0); in ms_read_copyblock()
1188 static int ms_read_eraseblock(struct us_data *us, u32 PhyBlockAddr) in ms_read_eraseblock() argument
1190 struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; in ms_read_eraseblock()
1194 result = ene_load_bincode(us, MS_RW_PATTERN); in ms_read_eraseblock()
1208 result = ene_send_scsi_cmd(us, FDIR_READ, NULL, 0); in ms_read_eraseblock()
1215 static int ms_lib_check_disableblock(struct us_data *us, u16 PhyBlock) in ms_lib_check_disableblock() argument
1221 struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; in ms_lib_check_disableblock()
1229 ms_read_readpage(us, PhyBlock, 1, (u32 *)PageBuf, &extdat); in ms_lib_check_disableblock()
1246 static int ms_lib_setacquired_errorblock(struct us_data *us, u16 phyblk) in ms_lib_setacquired_errorblock() argument
1249 struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; in ms_lib_setacquired_errorblock()
1265 static int ms_lib_overwrite_extra(struct us_data *us, u32 PhyBlockAddr, in ms_lib_overwrite_extra() argument
1268 struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; in ms_lib_overwrite_extra()
1271 result = ene_load_bincode(us, MS_RW_PATTERN); in ms_lib_overwrite_extra()
1290 result = ene_send_scsi_cmd(us, FDIR_READ, NULL, 0); in ms_lib_overwrite_extra()
1297 static int ms_lib_error_phyblock(struct us_data *us, u16 phyblk) in ms_lib_error_phyblock() argument
1299 struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; in ms_lib_error_phyblock()
1304 ms_lib_setacquired_errorblock(us, phyblk); in ms_lib_error_phyblock()
1307 return ms_lib_overwrite_extra(us, phyblk, 0, (u8)(~MS_REG_OVR_BKST & BYTE_MASK)); in ms_lib_error_phyblock()
1312 static int ms_lib_erase_phyblock(struct us_data *us, u16 phyblk) in ms_lib_erase_phyblock() argument
1315 struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; in ms_lib_erase_phyblock()
1328 switch (ms_read_eraseblock(us, phyblk)) { in ms_lib_erase_phyblock()
1334 ms_lib_error_phyblock(us, phyblk); in ms_lib_erase_phyblock()
1338 …fo, MS_LIB_CTRL_RDONLY); /* MS_LibCtrlSet will used by ENE_MSInit ,need check, and why us to info*/ in ms_lib_erase_phyblock()
1339 ms_lib_setacquired_errorblock(us, phyblk); in ms_lib_erase_phyblock()
1344 ms_lib_setacquired_errorblock(us, phyblk); in ms_lib_erase_phyblock()
1349 static int ms_lib_read_extra(struct us_data *us, u32 PhyBlock, in ms_lib_read_extra() argument
1352 struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; in ms_lib_read_extra()
1353 struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; in ms_lib_read_extra()
1369 result = ene_send_scsi_cmd(us, FDIR_READ, bbuf, 0); in ms_lib_read_extra()
1384 static int ms_libsearch_block_from_physical(struct us_data *us, u16 phyblk) in ms_libsearch_block_from_physical() argument
1388 struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; in ms_libsearch_block_from_physical()
1401 switch (ms_lib_read_extra(us, blk, 0, &extdat)) { in ms_libsearch_block_from_physical()
1411 ms_lib_setacquired_errorblock(us, blk); in ms_libsearch_block_from_physical()
1416 ms_lib_setacquired_errorblock(us, blk); in ms_libsearch_block_from_physical()
1420 switch (ms_lib_erase_phyblock(us, blk)) { in ms_libsearch_block_from_physical()
1427 ms_lib_error_phyblock(us, blk); in ms_libsearch_block_from_physical()
1435 static int ms_libsearch_block_from_logical(struct us_data *us, u16 logblk) in ms_libsearch_block_from_logical() argument
1438 struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; in ms_libsearch_block_from_logical()
1450 return ms_libsearch_block_from_physical(us, phyblk); in ms_libsearch_block_from_logical()
1453 static int ms_scsi_test_unit_ready(struct us_data *us, struct scsi_cmnd *srb) in ms_scsi_test_unit_ready() argument
1455 struct ene_ub6250_info *info = (struct ene_ub6250_info *)(us->extra); in ms_scsi_test_unit_ready()
1461 ene_ms_init(us); in ms_scsi_test_unit_ready()
1468 static int ms_scsi_mode_sense(struct us_data *us, struct scsi_cmnd *srb) in ms_scsi_mode_sense() argument
1470 struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; in ms_scsi_mode_sense()
1486 static int ms_scsi_read_capacity(struct us_data *us, struct scsi_cmnd *srb) in ms_scsi_read_capacity() argument
1493 struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; in ms_scsi_read_capacity()
1495 usb_stor_dbg(us, "ms_scsi_read_capacity\n"); in ms_scsi_read_capacity()
1503 usb_stor_dbg(us, "bl_len = %x\n", bl_len); in ms_scsi_read_capacity()
1504 usb_stor_dbg(us, "bl_num = %x\n", bl_num); in ms_scsi_read_capacity()
1534 static int ms_lib_read_extrablock(struct us_data *us, u32 PhyBlock, in ms_lib_read_extrablock() argument
1537 struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; in ms_lib_read_extrablock()
1553 result = ene_send_scsi_cmd(us, FDIR_READ, buf, 0); in ms_lib_read_extrablock()
1560 static int ms_lib_scan_logicalblocknumber(struct us_data *us, u16 btBlk1st) in ms_lib_scan_logicalblocknumber() argument
1566 struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; in ms_lib_scan_logicalblocknumber()
1581 ms_lib_read_extrablock(us, PhyBlock, 0, 0x80, in ms_lib_scan_logicalblocknumber()
1593 ms_lib_setacquired_errorblock(us, PhyBlock); in ms_lib_scan_logicalblocknumber()
1598 ms_lib_erase_phyblock(us, PhyBlock); in ms_lib_scan_logicalblocknumber()
1604 ms_lib_erase_phyblock(us, PhyBlock); in ms_lib_scan_logicalblocknumber()
1612 ms_lib_set_logicalpair(us, extdat.logadr, PhyBlock); in ms_lib_scan_logicalblocknumber()
1613 if (ms_lib_check_disableblock(us, btBlk1st)) { in ms_lib_scan_logicalblocknumber()
1614 ms_lib_set_logicalpair(us, extdat.logadr, newblk); in ms_lib_scan_logicalblocknumber()
1619 ms_lib_read_extra(us, newblk, 0, &extdat); in ms_lib_scan_logicalblocknumber()
1621 ms_lib_erase_phyblock(us, PhyBlock); in ms_lib_scan_logicalblocknumber()
1624 ms_lib_erase_phyblock(us, newblk); in ms_lib_scan_logicalblocknumber()
1628 ms_lib_set_logicalpair(us, extdat.logadr, PhyBlock); in ms_lib_scan_logicalblocknumber()
1637 static int ms_scsi_read(struct us_data *us, struct scsi_cmnd *srb) in ms_scsi_read() argument
1641 struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; in ms_scsi_read()
1642 struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; in ms_scsi_read()
1653 result = ene_load_bincode(us, MSP_RW_PATTERN); in ms_scsi_read()
1655 usb_stor_dbg(us, "Load MPS RW pattern Fail !!\n"); in ms_scsi_read()
1671 result = ene_send_scsi_cmd(us, FDIR_READ, scsi_sglist(srb), 1); in ms_scsi_read()
1684 result = ene_load_bincode(us, MS_RW_PATTERN); in ms_scsi_read()
1715 result = ene_send_scsi_cmd(us, FDIR_READ, buf+offset, 0); in ms_scsi_read()
1736 static int ms_scsi_write(struct us_data *us, struct scsi_cmnd *srb) in ms_scsi_write() argument
1739 struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; in ms_scsi_write()
1741 struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; in ms_scsi_write()
1754 result = ene_load_bincode(us, MSP_RW_PATTERN); in ms_scsi_write()
1772 result = ene_send_scsi_cmd(us, FDIR_WRITE, scsi_sglist(srb), 1); in ms_scsi_write()
1785 result = ene_load_bincode(us, MS_RW_PATTERN); in ms_scsi_write()
1801 oldphy = ms_libconv_to_physical(info, PhyBlockAddr); /* need check us <-> info */ in ms_scsi_write()
1802 newphy = ms_libsearch_block_from_logical(us, PhyBlockAddr); in ms_scsi_write()
1804 result = ms_read_copyblock(us, oldphy, newphy, PhyBlockAddr, PageNum, buf+offset, len); in ms_scsi_write()
1813 ms_lib_force_setlogical_pair(us, PhyBlockAddr, newphy); in ms_scsi_write()
1832 static int ene_get_card_type(struct us_data *us, u16 index, void *buf) in ene_get_card_type() argument
1834 struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; in ene_get_card_type()
1845 result = ene_send_scsi_cmd(us, FDIR_READ, buf, 0); in ene_get_card_type()
1849 static int ene_get_card_status(struct us_data *us, u8 *buf) in ene_get_card_status() argument
1853 struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; in ene_get_card_status()
1855 /*usb_stor_dbg(us, "transport --- ENE_ReadSDReg\n");*/ in ene_get_card_status()
1879 static int ene_load_bincode(struct us_data *us, unsigned char flag) in ene_load_bincode() argument
1886 struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; in ene_load_bincode()
1887 struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; in ene_load_bincode()
1895 usb_stor_dbg(us, "SD_INIT1_PATTERN\n"); in ene_load_bincode()
1899 usb_stor_dbg(us, "SD_INIT2_PATTERN\n"); in ene_load_bincode()
1903 usb_stor_dbg(us, "SD_RW_PATTERN\n"); in ene_load_bincode()
1908 usb_stor_dbg(us, "MS_INIT_PATTERN\n"); in ene_load_bincode()
1912 usb_stor_dbg(us, "MSP_RW_PATTERN\n"); in ene_load_bincode()
1916 usb_stor_dbg(us, "MS_RW_PATTERN\n"); in ene_load_bincode()
1920 usb_stor_dbg(us, "----------- Unknown PATTERN ----------\n"); in ene_load_bincode()
1924 err = request_firmware(&sd_fw, fw_name, &us->pusb_dev->dev); in ene_load_bincode()
1926 usb_stor_dbg(us, "load firmware %s failed\n", fw_name); in ene_load_bincode()
1939 result = ene_send_scsi_cmd(us, FDIR_WRITE, buf, 0); in ene_load_bincode()
1940 if (us->srb != NULL) in ene_load_bincode()
1941 scsi_set_resid(us->srb, 0); in ene_load_bincode()
1950 static int ms_card_init(struct us_data *us) in ms_card_init() argument
1958 struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; in ms_card_init()
1962 ms_lib_free_allocatedarea(us); /* Clean buffer and set struct us_data flag to 0 */ in ms_card_init()
1977 switch (ms_read_readpage(us, TmpBlock, 0, (u32 *)PageBuffer0, &extdat)) { in ms_card_init()
2019 result = ms_lib_process_bootblock(us, btBlk1st, PageBuffer1); in ms_card_init()
2023 result = ms_lib_process_bootblock(us, btBlk2nd, PageBuffer0); in ms_card_init()
2042 result = ms_lib_scan_logicalblocknumber(us, btBlk1st); in ms_card_init()
2049 if (ms_count_freeblock(us, TmpBlock) == 0) { in ms_card_init()
2056 if (ms_lib_alloc_writebuf(us)) { in ms_card_init()
2071 static int ene_ms_init(struct us_data *us) in ene_ms_init() argument
2073 struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; in ene_ms_init()
2076 struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; in ene_ms_init()
2083 result = ene_load_bincode(us, MS_INIT_PATTERN); in ene_ms_init()
2096 result = ene_send_scsi_cmd(us, FDIR_READ, bbuf, 0); in ene_ms_init()
2115 ms_card_init(us); /* Card is MS (to ms.c)*/ in ene_ms_init()
2117 usb_stor_dbg(us, "MS Init Code OK !!\n"); in ene_ms_init()
2119 usb_stor_dbg(us, "MS Card Not Ready --- %x\n", bbuf[0]); in ene_ms_init()
2126 static int ene_sd_init(struct us_data *us) in ene_sd_init() argument
2129 struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; in ene_sd_init()
2130 struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; in ene_sd_init()
2133 usb_stor_dbg(us, "transport --- ENE_SDInit\n"); in ene_sd_init()
2135 result = ene_load_bincode(us, SD_INIT1_PATTERN); in ene_sd_init()
2137 usb_stor_dbg(us, "Load SD Init Code Part-1 Fail !!\n"); in ene_sd_init()
2146 result = ene_send_scsi_cmd(us, FDIR_READ, NULL, 0); in ene_sd_init()
2148 usb_stor_dbg(us, "Execution SD Init Code Fail !!\n"); in ene_sd_init()
2153 result = ene_load_bincode(us, SD_INIT2_PATTERN); in ene_sd_init()
2155 usb_stor_dbg(us, "Load SD Init Code Part-2 Fail !!\n"); in ene_sd_init()
2165 result = ene_send_scsi_cmd(us, FDIR_READ, bbuf, 0); in ene_sd_init()
2167 usb_stor_dbg(us, "Execution SD Init Code Fail !!\n"); in ene_sd_init()
2175 ene_get_card_status(us, bbuf); in ene_sd_init()
2176 usb_stor_dbg(us, "Insert = %x\n", s->Insert); in ene_sd_init()
2177 usb_stor_dbg(us, "Ready = %x\n", s->Ready); in ene_sd_init()
2178 usb_stor_dbg(us, "IsMMC = %x\n", s->IsMMC); in ene_sd_init()
2179 usb_stor_dbg(us, "HiCapacity = %x\n", s->HiCapacity); in ene_sd_init()
2180 usb_stor_dbg(us, "HiSpeed = %x\n", s->HiSpeed); in ene_sd_init()
2181 usb_stor_dbg(us, "WtP = %x\n", s->WtP); in ene_sd_init()
2183 usb_stor_dbg(us, "SD Card Not Ready --- %x\n", bbuf[0]); in ene_sd_init()
2190 static int ene_init(struct us_data *us) in ene_init() argument
2194 struct ene_ub6250_info *info = (struct ene_ub6250_info *)(us->extra); in ene_init()
2197 result = ene_get_card_type(us, REG_CARD_STATUS, bbuf); in ene_init()
2204 result = ene_sd_init(us); in ene_init()
2211 result = ene_ms_init(us); in ene_init()
2220 static int sd_scsi_irp(struct us_data *us, struct scsi_cmnd *srb) in sd_scsi_irp() argument
2223 struct ene_ub6250_info *info = (struct ene_ub6250_info *)us->extra; in sd_scsi_irp()
2227 result = sd_scsi_test_unit_ready(us, srb); in sd_scsi_irp()
2230 result = do_scsi_request_sense(us, srb); in sd_scsi_irp()
2233 result = do_scsi_inquiry(us, srb); in sd_scsi_irp()
2236 result = sd_scsi_mode_sense(us, srb); in sd_scsi_irp()
2240 result = SD_SCSI_Start_Stop(us, srb); in sd_scsi_irp()
2244 result = sd_scsi_read_capacity(us, srb); in sd_scsi_irp()
2247 result = sd_scsi_read(us, srb); in sd_scsi_irp()
2250 result = sd_scsi_write(us, srb); in sd_scsi_irp()
2265 static int ms_scsi_irp(struct us_data *us, struct scsi_cmnd *srb) in ms_scsi_irp() argument
2268 struct ene_ub6250_info *info = (struct ene_ub6250_info *)us->extra; in ms_scsi_irp()
2272 result = ms_scsi_test_unit_ready(us, srb); in ms_scsi_irp()
2275 result = do_scsi_request_sense(us, srb); in ms_scsi_irp()
2278 result = do_scsi_inquiry(us, srb); in ms_scsi_irp()
2281 result = ms_scsi_mode_sense(us, srb); in ms_scsi_irp()
2284 result = ms_scsi_read_capacity(us, srb); in ms_scsi_irp()
2287 result = ms_scsi_read(us, srb); in ms_scsi_irp()
2290 result = ms_scsi_write(us, srb); in ms_scsi_irp()
2302 static int ene_transport(struct scsi_cmnd *srb, struct us_data *us) in ene_transport() argument
2305 struct ene_ub6250_info *info = (struct ene_ub6250_info *)(us->extra); in ene_transport()
2307 /*US_DEBUG(usb_stor_show_command(us, srb)); */ in ene_transport()
2310 result = ene_init(us); in ene_transport()
2314 result = sd_scsi_irp(us, srb); in ene_transport()
2317 result = ms_scsi_irp(us, srb); in ene_transport()
2329 struct us_data *us; in ene_ub6250_probe() local
2332 result = usb_stor_probe1(&us, intf, id, in ene_ub6250_probe()
2339 us->extra = kzalloc(sizeof(struct ene_ub6250_info), GFP_KERNEL); in ene_ub6250_probe()
2340 if (!us->extra) in ene_ub6250_probe()
2342 us->extra_destructor = ene_ub6250_info_destructor; in ene_ub6250_probe()
2344 info = (struct ene_ub6250_info *)(us->extra); in ene_ub6250_probe()
2347 kfree(us->extra); in ene_ub6250_probe()
2351 us->transport_name = "ene_ub6250"; in ene_ub6250_probe()
2352 us->transport = ene_transport; in ene_ub6250_probe()
2353 us->max_lun = 0; in ene_ub6250_probe()
2355 result = usb_stor_probe2(us); in ene_ub6250_probe()
2360 result = ene_get_card_type(us, REG_CARD_STATUS, info->bbuf); in ene_ub6250_probe()
2381 struct us_data *us = usb_get_intfdata(iface); in ene_ub6250_resume() local
2382 struct ene_ub6250_info *info = (struct ene_ub6250_info *)(us->extra); in ene_ub6250_resume()
2384 mutex_lock(&us->dev_mutex); in ene_ub6250_resume()
2386 if (us->suspend_resume_hook) in ene_ub6250_resume()
2387 (us->suspend_resume_hook)(us, US_RESUME); in ene_ub6250_resume()
2389 mutex_unlock(&us->dev_mutex); in ene_ub6250_resume()
2403 struct us_data *us = usb_get_intfdata(iface); in ene_ub6250_reset_resume() local
2404 struct ene_ub6250_info *info = (struct ene_ub6250_info *)(us->extra); in ene_ub6250_reset_resume()