Lines Matching refs:chip

74 #define rts51x_set_stat(chip, stat)	\  argument
75 ((chip)->state = (enum RTS51X_STAT)(stat))
76 #define rts51x_get_stat(chip) ((chip)->state) argument
78 #define SET_LUN_READY(chip, lun) ((chip)->lun_ready |= ((u8)1 << (lun))) argument
79 #define CLR_LUN_READY(chip, lun) ((chip)->lun_ready &= ~((u8)1 << (lun))) argument
80 #define TST_LUN_READY(chip, lun) ((chip)->lun_ready & ((u8)1 << (lun))) argument
135 #define SET_AUTO_DELINK(chip) ((chip)->flag |= FLIDX_AUTO_DELINK) argument
136 #define CLR_AUTO_DELINK(chip) ((chip)->flag &= ~FLIDX_AUTO_DELINK) argument
137 #define CHK_AUTO_DELINK(chip) ((chip)->flag & FLIDX_AUTO_DELINK) argument
139 #define RTS51X_GET_VID(chip) ((chip)->vendor_id) argument
140 #define RTS51X_GET_PID(chip) ((chip)->product_id) argument
142 #define VENDOR_ID(chip) ((chip)->status[0].vid) argument
143 #define PRODUCT_ID(chip) ((chip)->status[0].pid) argument
144 #define FW_VERSION(chip) ((chip)->status[0].fw_ver) argument
145 #define STATUS_LEN(chip) ((chip)->status_len) argument
151 #define SUPPORT_DETAILED_TYPE1(chip) \ argument
152 CHK_BIT((chip)->status[0].function[0], 1)
153 #define SUPPORT_OT(chip) \ argument
154 CHK_BIT((chip)->status[0].function[0], 2)
155 #define SUPPORT_OC(chip) \ argument
156 CHK_BIT((chip)->status[0].function[0], 3)
157 #define SUPPORT_AUTO_DELINK(chip) \ argument
158 CHK_BIT((chip)->status[0].function[0], 4)
159 #define SUPPORT_SDIO(chip) \ argument
160 CHK_BIT((chip)->status[0].function[1], 0)
161 #define SUPPORT_DETAILED_TYPE2(chip) \ argument
162 CHK_BIT((chip)->status[0].function[1], 1)
164 #define CHECK_PID(chip, pid) (RTS51X_GET_PID(chip) == (pid)) argument
165 #define CHECK_FW_VER(chip, fw_ver) (FW_VERSION(chip) == (fw_ver)) argument
166 #define CHECK_ID(chip, pid, fw_ver) \ argument
167 (CHECK_PID((chip), (pid)) && CHECK_FW_VER((chip), (fw_ver)))
457 struct rts51x_chip *chip = (struct rts51x_chip *)(us->extra); in rts51x_check_status() local
461 retval = rts51x_read_status(us, lun, buf, 16, &(chip->status_len)); in rts51x_check_status()
465 usb_stor_dbg(us, "chip->status_len = %d\n", chip->status_len); in rts51x_check_status()
467 chip->status[lun].vid = ((u16) buf[0] << 8) | buf[1]; in rts51x_check_status()
468 chip->status[lun].pid = ((u16) buf[2] << 8) | buf[3]; in rts51x_check_status()
469 chip->status[lun].cur_lun = buf[4]; in rts51x_check_status()
470 chip->status[lun].card_type = buf[5]; in rts51x_check_status()
471 chip->status[lun].total_lun = buf[6]; in rts51x_check_status()
472 chip->status[lun].fw_ver = ((u16) buf[7] << 8) | buf[8]; in rts51x_check_status()
473 chip->status[lun].phy_exist = buf[9]; in rts51x_check_status()
474 chip->status[lun].multi_flag = buf[10]; in rts51x_check_status()
475 chip->status[lun].multi_card = buf[11]; in rts51x_check_status()
476 chip->status[lun].log_exist = buf[12]; in rts51x_check_status()
477 if (chip->status_len == 16) { in rts51x_check_status()
478 chip->status[lun].detailed_type.detailed_type1 = buf[13]; in rts51x_check_status()
479 chip->status[lun].function[0] = buf[14]; in rts51x_check_status()
480 chip->status[lun].function[1] = buf[15]; in rts51x_check_status()
568 struct rts51x_chip *chip = (struct rts51x_chip *)(us->extra); in config_autodelink_after_power_on() local
572 if (!CHK_AUTO_DELINK(chip)) in config_autodelink_after_power_on()
584 if (CHECK_ID(chip, 0x0138, 0x3882)) in config_autodelink_after_power_on()
602 if (CHECK_ID(chip, 0x0138, 0x3882)) in config_autodelink_after_power_on()
605 if (CHECK_ID(chip, 0x0159, 0x5889) || in config_autodelink_after_power_on()
606 CHECK_ID(chip, 0x0138, 0x3880)) { in config_autodelink_after_power_on()
616 if (CHECK_ID(chip, 0x0159, 0x5888)) { in config_autodelink_after_power_on()
635 struct rts51x_chip *chip = (struct rts51x_chip *)(us->extra); in config_autodelink_before_power_down() local
639 if (!CHK_AUTO_DELINK(chip)) in config_autodelink_before_power_down()
652 if (CHECK_ID(chip, 0x0159, 0x5888)) { in config_autodelink_before_power_down()
664 if (CHECK_ID(chip, 0x0138, 0x3882)) in config_autodelink_before_power_down()
670 if (CHECK_ID(chip, 0x0159, 0x5889) || in config_autodelink_before_power_down()
671 CHECK_ID(chip, 0x0138, 0x3880) || in config_autodelink_before_power_down()
672 CHECK_ID(chip, 0x0138, 0x3882)) { in config_autodelink_before_power_down()
677 if (CHECK_ID(chip, 0x0159, 0x5889) || in config_autodelink_before_power_down()
678 CHECK_ID(chip, 0x0138, 0x3880)) { in config_autodelink_before_power_down()
683 if (CHECK_ID(chip, 0x0138, 0x3882)) in config_autodelink_before_power_down()
692 if (CHECK_ID(chip, 0x0159, 0x5888)) { in config_autodelink_before_power_down()
705 struct rts51x_chip *chip = (struct rts51x_chip *)(us->extra); in fw5895_init() local
709 if ((PRODUCT_ID(chip) != 0x0158) || (FW_VERSION(chip) != 0x5895)) { in fw5895_init()
728 struct rts51x_chip *chip = (struct rts51x_chip *)(us->extra); in fw5895_set_mmc_wp() local
732 if ((PRODUCT_ID(chip) != 0x0158) || (FW_VERSION(chip) != 0x5895)) { in fw5895_set_mmc_wp()
753 static void rts51x_modi_suspend_timer(struct rts51x_chip *chip) in rts51x_modi_suspend_timer() argument
755 struct us_data *us = chip->us; in rts51x_modi_suspend_timer()
757 usb_stor_dbg(us, "state:%d\n", rts51x_get_stat(chip)); in rts51x_modi_suspend_timer()
759 chip->timer_expires = jiffies + msecs_to_jiffies(1000*ss_delay); in rts51x_modi_suspend_timer()
760 mod_timer(&chip->rts51x_suspend_timer, chip->timer_expires); in rts51x_modi_suspend_timer()
765 struct rts51x_chip *chip = (struct rts51x_chip *)data; in rts51x_suspend_timer_fn() local
766 struct us_data *us = chip->us; in rts51x_suspend_timer_fn()
768 switch (rts51x_get_stat(chip)) { in rts51x_suspend_timer_fn()
771 rts51x_modi_suspend_timer(chip); in rts51x_suspend_timer_fn()
781 rts51x_set_stat(chip, RTS51X_STAT_SS); in rts51x_suspend_timer_fn()
808 struct rts51x_chip *chip = (struct rts51x_chip *)(us->extra); in rts51x_invoke_transport() local
827 if (rts51x_get_stat(chip) != RTS51X_STAT_RUN) in rts51x_invoke_transport()
828 rts51x_set_stat(chip, RTS51X_STAT_RUN); in rts51x_invoke_transport()
829 chip->proto_handler_backup(srb, us); in rts51x_invoke_transport()
831 if (rts51x_get_stat(chip) == RTS51X_STAT_SS) { in rts51x_invoke_transport()
834 (chip->pwr_state == US_SUSPEND)) { in rts51x_invoke_transport()
835 if (TST_LUN_READY(chip, srb->device->lun)) { in rts51x_invoke_transport()
861 chip->proto_handler_backup(srb, us); in rts51x_invoke_transport()
865 SET_LUN_READY(chip, srb->device->lun); in rts51x_invoke_transport()
871 CLR_LUN_READY(chip, srb->device->lun); in rts51x_invoke_transport()
875 if (rts51x_get_stat(chip) != RTS51X_STAT_IDLE) in rts51x_invoke_transport()
876 rts51x_set_stat(chip, RTS51X_STAT_IDLE); in rts51x_invoke_transport()
880 usb_stor_dbg(us, "state:%d\n", rts51x_get_stat(chip)); in rts51x_invoke_transport()
881 if (rts51x_get_stat(chip) == RTS51X_STAT_RUN) in rts51x_invoke_transport()
882 rts51x_modi_suspend_timer(chip); in rts51x_invoke_transport()
887 struct rts51x_chip *chip; in realtek_cr_autosuspend_setup() local
892 chip = (struct rts51x_chip *)us->extra; in realtek_cr_autosuspend_setup()
893 chip->support_auto_delink = 0; in realtek_cr_autosuspend_setup()
894 chip->pwr_state = US_RESUME; in realtek_cr_autosuspend_setup()
895 chip->lun_ready = 0; in realtek_cr_autosuspend_setup()
896 rts51x_set_stat(chip, RTS51X_STAT_INIT); in realtek_cr_autosuspend_setup()
898 retval = rts51x_read_status(us, 0, buf, 16, &(chip->status_len)); in realtek_cr_autosuspend_setup()
903 status = chip->status; in realtek_cr_autosuspend_setup()
914 if (chip->status_len == 16) { in realtek_cr_autosuspend_setup()
921 chip = (struct rts51x_chip *)(us->extra); in realtek_cr_autosuspend_setup()
922 chip->proto_handler_backup = us->proto_handler; in realtek_cr_autosuspend_setup()
928 chip->timer_expires = 0; in realtek_cr_autosuspend_setup()
929 setup_timer(&chip->rts51x_suspend_timer, rts51x_suspend_timer_fn, in realtek_cr_autosuspend_setup()
930 (unsigned long)chip); in realtek_cr_autosuspend_setup()
942 struct rts51x_chip *chip = extra; in realtek_cr_destructor() local
944 if (!chip) in realtek_cr_destructor()
949 del_timer(&chip->rts51x_suspend_timer); in realtek_cr_destructor()
950 chip->timer_expires = 0; in realtek_cr_destructor()
953 kfree(chip->status); in realtek_cr_destructor()
987 struct rts51x_chip *chip; in init_realtek_cr() local
990 chip = kzalloc(sizeof(struct rts51x_chip), GFP_KERNEL); in init_realtek_cr()
991 if (!chip) in init_realtek_cr()
994 us->extra = chip; in init_realtek_cr()
996 us->max_lun = chip->max_lun = rts51x_get_max_lun(us); in init_realtek_cr()
997 chip->us = us; in init_realtek_cr()
999 usb_stor_dbg(us, "chip->max_lun = %d\n", chip->max_lun); in init_realtek_cr()
1001 size = (chip->max_lun + 1) * sizeof(struct rts51x_status); in init_realtek_cr()
1002 chip->status = kzalloc(size, GFP_KERNEL); in init_realtek_cr()
1003 if (!chip->status) in init_realtek_cr()
1006 for (i = 0; i <= (int)(chip->max_lun); i++) { in init_realtek_cr()
1012 if (CHECK_FW_VER(chip, 0x5888) || CHECK_FW_VER(chip, 0x5889) || in init_realtek_cr()
1013 CHECK_FW_VER(chip, 0x5901)) in init_realtek_cr()
1014 SET_AUTO_DELINK(chip); in init_realtek_cr()
1015 if (STATUS_LEN(chip) == 16) { in init_realtek_cr()
1016 if (SUPPORT_AUTO_DELINK(chip)) in init_realtek_cr()
1017 SET_AUTO_DELINK(chip); in init_realtek_cr()
1024 usb_stor_dbg(us, "chip->flag = 0x%x\n", chip->flag); in init_realtek_cr()
1032 kfree(chip->status); in init_realtek_cr()