Lines Matching +full:0 +full:x0138

42 MODULE_PARM_DESC(auto_delink_en, "auto delink mode (0=firmware, 1=software [default])");
115 #define FLIDX_AUTO_DELINK 0x01
131 #define VENDOR_ID(chip) ((chip)->status[0].vid)
132 #define PRODUCT_ID(chip) ((chip)->status[0].pid)
133 #define FW_VERSION(chip) ((chip)->status[0].fw_ver)
136 #define STATUS_SUCCESS 0
141 CHK_BIT((chip)->status[0].function[0], 1)
143 CHK_BIT((chip)->status[0].function[0], 2)
145 CHK_BIT((chip)->status[0].function[0], 3)
147 CHK_BIT((chip)->status[0].function[0], 4)
149 CHK_BIT((chip)->status[0].function[1], 0)
151 CHK_BIT((chip)->status[0].function[1], 1)
215 bcb->Flags = (dir == DMA_FROM_DEVICE) ? US_BULK_FLAG_IN : 0; in rts51x_bulk_transport()
221 memset(bcb->CDB, 0, sizeof(bcb->CDB)); in rts51x_bulk_transport()
304 bcb->Flags = (dir == DMA_FROM_DEVICE) ? US_BULK_FLAG_IN : 0; in rts51x_bulk_transport_special()
310 memset(bcb->CDB, 0, sizeof(bcb->CDB)); in rts51x_bulk_transport_special()
343 us->iobuf[0] = 0; in rts51x_get_max_lun()
348 0, us->ifnum, us->iobuf, 1, 10 * HZ); in rts51x_get_max_lun()
351 result, us->iobuf[0]); in rts51x_get_max_lun()
354 if (result > 0) in rts51x_get_max_lun()
355 return us->iobuf[0]; in rts51x_get_max_lun()
357 return 0; in rts51x_get_max_lun()
363 u8 cmnd[12] = { 0 }; in rts51x_read_mem()
370 usb_stor_dbg(us, "addr = 0x%x, len = %d\n", addr, len); in rts51x_read_mem()
372 cmnd[0] = 0xF0; in rts51x_read_mem()
373 cmnd[1] = 0x0D; in rts51x_read_mem()
379 retval = rts51x_bulk_transport(us, 0, cmnd, 12, in rts51x_read_mem()
388 return 0; in rts51x_read_mem()
394 u8 cmnd[12] = { 0 }; in rts51x_write_mem()
401 usb_stor_dbg(us, "addr = 0x%x, len = %d\n", addr, len); in rts51x_write_mem()
403 cmnd[0] = 0xF0; in rts51x_write_mem()
404 cmnd[1] = 0x0E; in rts51x_write_mem()
410 retval = rts51x_bulk_transport(us, 0, cmnd, 12, in rts51x_write_mem()
416 return 0; in rts51x_write_mem()
423 u8 cmnd[12] = { 0 }; in rts51x_read_status()
432 cmnd[0] = 0xF0; in rts51x_read_status()
433 cmnd[1] = 0x09; in rts51x_read_status()
444 return 0; in rts51x_read_status()
459 chip->status[lun].vid = ((u16) buf[0] << 8) | buf[1]; in rts51x_check_status()
471 chip->status[lun].function[0] = buf[14]; in rts51x_check_status()
475 return 0; in rts51x_check_status()
483 retval = rts51x_read_mem(us, 0xFE77, &value, 1); in enable_oscillator()
484 if (retval < 0) in enable_oscillator()
487 value |= 0x04; in enable_oscillator()
488 retval = rts51x_write_mem(us, 0xFE77, &value, 1); in enable_oscillator()
489 if (retval < 0) in enable_oscillator()
492 retval = rts51x_read_mem(us, 0xFE77, &value, 1); in enable_oscillator()
493 if (retval < 0) in enable_oscillator()
496 if (!(value & 0x04)) in enable_oscillator()
499 return 0; in enable_oscillator()
505 u8 cmnd[12] = {0}; in __do_config_autodelink()
508 usb_stor_dbg(us, "addr = 0xfe47, len = %d\n", len); in __do_config_autodelink()
514 cmnd[0] = 0xF0; in __do_config_autodelink()
515 cmnd[1] = 0x0E; in __do_config_autodelink()
516 cmnd[2] = 0xfe; in __do_config_autodelink()
517 cmnd[3] = 0x47; in __do_config_autodelink()
521 retval = rts51x_bulk_transport_special(us, 0, cmnd, 12, buf, len, DMA_TO_DEVICE, NULL); in __do_config_autodelink()
527 return 0; in __do_config_autodelink()
535 retval = rts51x_read_mem(us, 0xFE47, &value, 1); in do_config_autodelink()
536 if (retval < 0) in do_config_autodelink()
541 value |= 0x03; in do_config_autodelink()
543 value |= 0x01; in do_config_autodelink()
545 value &= ~0x03; in do_config_autodelink()
548 usb_stor_dbg(us, "set 0xfe47 to 0x%x\n", value); in do_config_autodelink()
550 /* retval = rts51x_write_mem(us, 0xFE47, &value, 1); */ in do_config_autodelink()
552 if (retval < 0) in do_config_autodelink()
555 return 0; in do_config_autodelink()
565 return 0; in config_autodelink_after_power_on()
567 retval = rts51x_read_mem(us, 0xFE47, &value, 1); in config_autodelink_after_power_on()
568 if (retval < 0) in config_autodelink_after_power_on()
572 CLR_BIT(value, 0); in config_autodelink_after_power_on()
576 if (CHECK_ID(chip, 0x0138, 0x3882)) in config_autodelink_after_power_on()
581 /* retval = rts51x_write_mem(us, 0xFE47, &value, 1); */ in config_autodelink_after_power_on()
583 if (retval < 0) in config_autodelink_after_power_on()
587 if (retval == 0) in config_autodelink_after_power_on()
588 (void)do_config_autodelink(us, 1, 0); in config_autodelink_after_power_on()
594 if (CHECK_ID(chip, 0x0138, 0x3882)) in config_autodelink_after_power_on()
597 if (CHECK_ID(chip, 0x0159, 0x5889) || in config_autodelink_after_power_on()
598 CHECK_ID(chip, 0x0138, 0x3880)) { in config_autodelink_after_power_on()
599 CLR_BIT(value, 0); in config_autodelink_after_power_on()
603 /* retval = rts51x_write_mem(us, 0xFE47, &value, 1); */ in config_autodelink_after_power_on()
605 if (retval < 0) in config_autodelink_after_power_on()
608 if (CHECK_ID(chip, 0x0159, 0x5888)) { in config_autodelink_after_power_on()
609 value = 0xFF; in config_autodelink_after_power_on()
610 retval = rts51x_write_mem(us, 0xFE79, &value, 1); in config_autodelink_after_power_on()
611 if (retval < 0) in config_autodelink_after_power_on()
614 value = 0x01; in config_autodelink_after_power_on()
615 retval = rts51x_write_mem(us, 0x48, &value, 1); in config_autodelink_after_power_on()
616 if (retval < 0) in config_autodelink_after_power_on()
621 return 0; in config_autodelink_after_power_on()
632 return 0; in config_autodelink_before_power_down()
635 retval = rts51x_read_mem(us, 0xFE77, &value, 1); in config_autodelink_before_power_down()
636 if (retval < 0) in config_autodelink_before_power_down()
640 retval = rts51x_write_mem(us, 0xFE77, &value, 1); in config_autodelink_before_power_down()
641 if (retval < 0) in config_autodelink_before_power_down()
644 if (CHECK_ID(chip, 0x0159, 0x5888)) { in config_autodelink_before_power_down()
645 value = 0x01; in config_autodelink_before_power_down()
646 retval = rts51x_write_mem(us, 0x48, &value, 1); in config_autodelink_before_power_down()
647 if (retval < 0) in config_autodelink_before_power_down()
651 retval = rts51x_read_mem(us, 0xFE47, &value, 1); in config_autodelink_before_power_down()
652 if (retval < 0) in config_autodelink_before_power_down()
655 SET_BIT(value, 0); in config_autodelink_before_power_down()
656 if (CHECK_ID(chip, 0x0138, 0x3882)) in config_autodelink_before_power_down()
658 retval = rts51x_write_mem(us, 0xFE77, &value, 1); in config_autodelink_before_power_down()
659 if (retval < 0) in config_autodelink_before_power_down()
662 if (CHECK_ID(chip, 0x0159, 0x5889) || in config_autodelink_before_power_down()
663 CHECK_ID(chip, 0x0138, 0x3880) || in config_autodelink_before_power_down()
664 CHECK_ID(chip, 0x0138, 0x3882)) { in config_autodelink_before_power_down()
665 retval = rts51x_read_mem(us, 0xFE47, &value, 1); in config_autodelink_before_power_down()
666 if (retval < 0) in config_autodelink_before_power_down()
669 if (CHECK_ID(chip, 0x0159, 0x5889) || in config_autodelink_before_power_down()
670 CHECK_ID(chip, 0x0138, 0x3880)) { in config_autodelink_before_power_down()
671 SET_BIT(value, 0); in config_autodelink_before_power_down()
675 if (CHECK_ID(chip, 0x0138, 0x3882)) in config_autodelink_before_power_down()
678 /* retval = rts51x_write_mem(us, 0xFE47, &value, 1); */ in config_autodelink_before_power_down()
680 if (retval < 0) in config_autodelink_before_power_down()
684 if (CHECK_ID(chip, 0x0159, 0x5888)) { in config_autodelink_before_power_down()
685 value = 0x01; in config_autodelink_before_power_down()
686 retval = rts51x_write_mem(us, 0x48, &value, 1); in config_autodelink_before_power_down()
687 if (retval < 0) in config_autodelink_before_power_down()
692 return 0; in config_autodelink_before_power_down()
701 if ((PRODUCT_ID(chip) != 0x0158) || (FW_VERSION(chip) != 0x5895)) { in fw5895_init()
704 retval = rts51x_read_mem(us, 0xFD6F, &val, 1); in fw5895_init()
705 if (retval == STATUS_SUCCESS && (val & 0x1F) == 0) { in fw5895_init()
706 val = 0x1F; in fw5895_init()
707 retval = rts51x_write_mem(us, 0xFD70, &val, 1); in fw5895_init()
711 usb_stor_dbg(us, "Read memory fail, OR (val & 0x1F) != 0\n"); in fw5895_init()
724 if ((PRODUCT_ID(chip) != 0x0158) || (FW_VERSION(chip) != 0x5895)) { in fw5895_set_mmc_wp()
727 retval = rts51x_read_mem(us, 0xFD6F, buf, 1); in fw5895_set_mmc_wp()
728 if (retval == STATUS_SUCCESS && (buf[0] & 0x24) == 0x24) { in fw5895_set_mmc_wp()
730 retval = rts51x_read_mem(us, 0xD04E, buf, 1); in fw5895_set_mmc_wp()
732 buf[0] |= 0x04; in fw5895_set_mmc_wp()
733 retval = rts51x_write_mem(us, 0xFD70, buf, 1); in fw5895_set_mmc_wp()
740 usb_stor_dbg(us, "Read memory fail, OR (buf[0]&0x24)!=0x24\n"); in fw5895_set_mmc_wp()
770 if (atomic_read(&us->pusb_intf->dev.power.usage_count) > 0) { in rts51x_suspend_timer_fn()
788 if ((srb->cmnd[0] == TEST_UNIT_READY) || in working_scsi()
789 (srb->cmnd[0] == ALLOW_MEDIUM_REMOVAL)) { in working_scsi()
790 return 0; in working_scsi()
800 static u8 media_not_present[] = { 0x70, 0, 0x02, 0, 0, 0, 0, in rts51x_invoke_transport()
801 10, 0, 0, 0, 0, 0x3A, 0, 0, 0, 0, 0 in rts51x_invoke_transport()
803 static u8 invalid_cmd_field[] = { 0x70, 0, 0x05, 0, 0, 0, 0, in rts51x_invoke_transport()
804 10, 0, 0, 0, 0, 0x24, 0, 0, 0, 0, 0 in rts51x_invoke_transport()
812 if (atomic_read(&us->pusb_intf->dev.power.usage_count) <= 0) { in rts51x_invoke_transport()
822 if ((srb->cmnd[0] == TEST_UNIT_READY) && in rts51x_invoke_transport()
835 if (srb->cmnd[0] == ALLOW_MEDIUM_REMOVAL) { in rts51x_invoke_transport()
836 int prevent = srb->cmnd[4] & 0x1; in rts51x_invoke_transport()
852 if (srb->cmnd[0] == TEST_UNIT_READY) { in rts51x_invoke_transport()
856 card_first_show = 0; in rts51x_invoke_transport()
882 chip->support_auto_delink = 0; in realtek_cr_autosuspend_setup()
884 chip->lun_ready = 0; in realtek_cr_autosuspend_setup()
887 retval = rts51x_read_status(us, 0, buf, 16, &(chip->status_len)); in realtek_cr_autosuspend_setup()
893 status->vid = ((u16) buf[0] << 8) | buf[1]; in realtek_cr_autosuspend_setup()
905 status->function[0] = buf[14]; in realtek_cr_autosuspend_setup()
912 /* Set the autosuspend_delay to 0 */ in realtek_cr_autosuspend_setup()
913 pm_runtime_set_autosuspend_delay(&us->pusb_dev->dev, 0); in realtek_cr_autosuspend_setup()
917 chip->timer_expires = 0; in realtek_cr_autosuspend_setup()
918 timer_setup(&chip->rts51x_suspend_timer, rts51x_suspend_timer_fn, 0); in realtek_cr_autosuspend_setup()
924 return 0; in realtek_cr_autosuspend_setup()
938 chip->timer_expires = 0; in realtek_cr_destructor()
956 return 0; in realtek_cr_suspend()
966 return 0; in realtek_cr_resume()
994 for (i = 0; i <= (int)(chip->max_lun); i++) { in init_realtek_cr()
996 if (retval < 0) in init_realtek_cr()
1000 if (CHECK_PID(chip, 0x0138) || CHECK_PID(chip, 0x0158) || in init_realtek_cr()
1001 CHECK_PID(chip, 0x0159)) { in init_realtek_cr()
1002 if (CHECK_FW_VER(chip, 0x5888) || CHECK_FW_VER(chip, 0x5889) || in init_realtek_cr()
1003 CHECK_FW_VER(chip, 0x5901)) in init_realtek_cr()
1015 usb_stor_dbg(us, "chip->flag = 0x%x\n", chip->flag); in init_realtek_cr()
1019 return 0; in init_realtek_cr()