Lines Matching refs:chip
71 #define rts51x_set_stat(chip, stat) \ argument
72 ((chip)->state = (enum RTS51X_STAT)(stat))
73 #define rts51x_get_stat(chip) ((chip)->state) argument
75 #define SET_LUN_READY(chip, lun) ((chip)->lun_ready |= ((u8)1 << (lun))) argument
76 #define CLR_LUN_READY(chip, lun) ((chip)->lun_ready &= ~((u8)1 << (lun))) argument
77 #define TST_LUN_READY(chip, lun) ((chip)->lun_ready & ((u8)1 << (lun))) argument
132 #define SET_AUTO_DELINK(chip) ((chip)->flag |= FLIDX_AUTO_DELINK) argument
133 #define CLR_AUTO_DELINK(chip) ((chip)->flag &= ~FLIDX_AUTO_DELINK) argument
134 #define CHK_AUTO_DELINK(chip) ((chip)->flag & FLIDX_AUTO_DELINK) argument
136 #define RTS51X_GET_VID(chip) ((chip)->vendor_id) argument
137 #define RTS51X_GET_PID(chip) ((chip)->product_id) argument
139 #define VENDOR_ID(chip) ((chip)->status[0].vid) argument
140 #define PRODUCT_ID(chip) ((chip)->status[0].pid) argument
141 #define FW_VERSION(chip) ((chip)->status[0].fw_ver) argument
142 #define STATUS_LEN(chip) ((chip)->status_len) argument
148 #define SUPPORT_DETAILED_TYPE1(chip) \ argument
149 CHK_BIT((chip)->status[0].function[0], 1)
150 #define SUPPORT_OT(chip) \ argument
151 CHK_BIT((chip)->status[0].function[0], 2)
152 #define SUPPORT_OC(chip) \ argument
153 CHK_BIT((chip)->status[0].function[0], 3)
154 #define SUPPORT_AUTO_DELINK(chip) \ argument
155 CHK_BIT((chip)->status[0].function[0], 4)
156 #define SUPPORT_SDIO(chip) \ argument
157 CHK_BIT((chip)->status[0].function[1], 0)
158 #define SUPPORT_DETAILED_TYPE2(chip) \ argument
159 CHK_BIT((chip)->status[0].function[1], 1)
161 #define CHECK_PID(chip, pid) (RTS51X_GET_PID(chip) == (pid)) argument
162 #define CHECK_FW_VER(chip, fw_ver) (FW_VERSION(chip) == (fw_ver)) argument
163 #define CHECK_ID(chip, pid, fw_ver) \ argument
164 (CHECK_PID((chip), (pid)) && CHECK_FW_VER((chip), (fw_ver)))
454 struct rts51x_chip *chip = (struct rts51x_chip *)(us->extra); in rts51x_check_status() local
458 retval = rts51x_read_status(us, lun, buf, 16, &(chip->status_len)); in rts51x_check_status()
462 usb_stor_dbg(us, "chip->status_len = %d\n", chip->status_len); in rts51x_check_status()
464 chip->status[lun].vid = ((u16) buf[0] << 8) | buf[1]; in rts51x_check_status()
465 chip->status[lun].pid = ((u16) buf[2] << 8) | buf[3]; in rts51x_check_status()
466 chip->status[lun].cur_lun = buf[4]; in rts51x_check_status()
467 chip->status[lun].card_type = buf[5]; in rts51x_check_status()
468 chip->status[lun].total_lun = buf[6]; in rts51x_check_status()
469 chip->status[lun].fw_ver = ((u16) buf[7] << 8) | buf[8]; in rts51x_check_status()
470 chip->status[lun].phy_exist = buf[9]; in rts51x_check_status()
471 chip->status[lun].multi_flag = buf[10]; in rts51x_check_status()
472 chip->status[lun].multi_card = buf[11]; in rts51x_check_status()
473 chip->status[lun].log_exist = buf[12]; in rts51x_check_status()
474 if (chip->status_len == 16) { in rts51x_check_status()
475 chip->status[lun].detailed_type.detailed_type1 = buf[13]; in rts51x_check_status()
476 chip->status[lun].function[0] = buf[14]; in rts51x_check_status()
477 chip->status[lun].function[1] = buf[15]; in rts51x_check_status()
565 struct rts51x_chip *chip = (struct rts51x_chip *)(us->extra); in config_autodelink_after_power_on() local
569 if (!CHK_AUTO_DELINK(chip)) in config_autodelink_after_power_on()
581 if (CHECK_ID(chip, 0x0138, 0x3882)) in config_autodelink_after_power_on()
599 if (CHECK_ID(chip, 0x0138, 0x3882)) in config_autodelink_after_power_on()
602 if (CHECK_ID(chip, 0x0159, 0x5889) || in config_autodelink_after_power_on()
603 CHECK_ID(chip, 0x0138, 0x3880)) { in config_autodelink_after_power_on()
613 if (CHECK_ID(chip, 0x0159, 0x5888)) { in config_autodelink_after_power_on()
632 struct rts51x_chip *chip = (struct rts51x_chip *)(us->extra); in config_autodelink_before_power_down() local
636 if (!CHK_AUTO_DELINK(chip)) in config_autodelink_before_power_down()
649 if (CHECK_ID(chip, 0x0159, 0x5888)) { in config_autodelink_before_power_down()
661 if (CHECK_ID(chip, 0x0138, 0x3882)) in config_autodelink_before_power_down()
667 if (CHECK_ID(chip, 0x0159, 0x5889) || in config_autodelink_before_power_down()
668 CHECK_ID(chip, 0x0138, 0x3880) || in config_autodelink_before_power_down()
669 CHECK_ID(chip, 0x0138, 0x3882)) { in config_autodelink_before_power_down()
674 if (CHECK_ID(chip, 0x0159, 0x5889) || in config_autodelink_before_power_down()
675 CHECK_ID(chip, 0x0138, 0x3880)) { in config_autodelink_before_power_down()
680 if (CHECK_ID(chip, 0x0138, 0x3882)) in config_autodelink_before_power_down()
689 if (CHECK_ID(chip, 0x0159, 0x5888)) { in config_autodelink_before_power_down()
702 struct rts51x_chip *chip = (struct rts51x_chip *)(us->extra); in fw5895_init() local
706 if ((PRODUCT_ID(chip) != 0x0158) || (FW_VERSION(chip) != 0x5895)) { in fw5895_init()
725 struct rts51x_chip *chip = (struct rts51x_chip *)(us->extra); in fw5895_set_mmc_wp() local
729 if ((PRODUCT_ID(chip) != 0x0158) || (FW_VERSION(chip) != 0x5895)) { in fw5895_set_mmc_wp()
750 static void rts51x_modi_suspend_timer(struct rts51x_chip *chip) in rts51x_modi_suspend_timer() argument
752 struct us_data *us = chip->us; in rts51x_modi_suspend_timer()
754 usb_stor_dbg(us, "state:%d\n", rts51x_get_stat(chip)); in rts51x_modi_suspend_timer()
756 chip->timer_expires = jiffies + msecs_to_jiffies(1000*ss_delay); in rts51x_modi_suspend_timer()
757 mod_timer(&chip->rts51x_suspend_timer, chip->timer_expires); in rts51x_modi_suspend_timer()
762 struct rts51x_chip *chip = (struct rts51x_chip *)data; in rts51x_suspend_timer_fn() local
763 struct us_data *us = chip->us; in rts51x_suspend_timer_fn()
765 switch (rts51x_get_stat(chip)) { in rts51x_suspend_timer_fn()
768 rts51x_modi_suspend_timer(chip); in rts51x_suspend_timer_fn()
778 rts51x_set_stat(chip, RTS51X_STAT_SS); in rts51x_suspend_timer_fn()
805 struct rts51x_chip *chip = (struct rts51x_chip *)(us->extra); in rts51x_invoke_transport() local
824 if (rts51x_get_stat(chip) != RTS51X_STAT_RUN) in rts51x_invoke_transport()
825 rts51x_set_stat(chip, RTS51X_STAT_RUN); in rts51x_invoke_transport()
826 chip->proto_handler_backup(srb, us); in rts51x_invoke_transport()
828 if (rts51x_get_stat(chip) == RTS51X_STAT_SS) { in rts51x_invoke_transport()
831 (chip->pwr_state == US_SUSPEND)) { in rts51x_invoke_transport()
832 if (TST_LUN_READY(chip, srb->device->lun)) { in rts51x_invoke_transport()
858 chip->proto_handler_backup(srb, us); in rts51x_invoke_transport()
862 SET_LUN_READY(chip, srb->device->lun); in rts51x_invoke_transport()
868 CLR_LUN_READY(chip, srb->device->lun); in rts51x_invoke_transport()
872 if (rts51x_get_stat(chip) != RTS51X_STAT_IDLE) in rts51x_invoke_transport()
873 rts51x_set_stat(chip, RTS51X_STAT_IDLE); in rts51x_invoke_transport()
877 usb_stor_dbg(us, "state:%d\n", rts51x_get_stat(chip)); in rts51x_invoke_transport()
878 if (rts51x_get_stat(chip) == RTS51X_STAT_RUN) in rts51x_invoke_transport()
879 rts51x_modi_suspend_timer(chip); in rts51x_invoke_transport()
884 struct rts51x_chip *chip; in realtek_cr_autosuspend_setup() local
889 chip = (struct rts51x_chip *)us->extra; in realtek_cr_autosuspend_setup()
890 chip->support_auto_delink = 0; in realtek_cr_autosuspend_setup()
891 chip->pwr_state = US_RESUME; in realtek_cr_autosuspend_setup()
892 chip->lun_ready = 0; in realtek_cr_autosuspend_setup()
893 rts51x_set_stat(chip, RTS51X_STAT_INIT); in realtek_cr_autosuspend_setup()
895 retval = rts51x_read_status(us, 0, buf, 16, &(chip->status_len)); in realtek_cr_autosuspend_setup()
900 status = chip->status; in realtek_cr_autosuspend_setup()
911 if (chip->status_len == 16) { in realtek_cr_autosuspend_setup()
918 chip = (struct rts51x_chip *)(us->extra); in realtek_cr_autosuspend_setup()
919 chip->proto_handler_backup = us->proto_handler; in realtek_cr_autosuspend_setup()
925 chip->timer_expires = 0; in realtek_cr_autosuspend_setup()
926 setup_timer(&chip->rts51x_suspend_timer, rts51x_suspend_timer_fn, in realtek_cr_autosuspend_setup()
927 (unsigned long)chip); in realtek_cr_autosuspend_setup()
939 struct rts51x_chip *chip = extra; in realtek_cr_destructor() local
941 if (!chip) in realtek_cr_destructor()
946 del_timer(&chip->rts51x_suspend_timer); in realtek_cr_destructor()
947 chip->timer_expires = 0; in realtek_cr_destructor()
950 kfree(chip->status); in realtek_cr_destructor()
984 struct rts51x_chip *chip; in init_realtek_cr() local
987 chip = kzalloc(sizeof(struct rts51x_chip), GFP_KERNEL); in init_realtek_cr()
988 if (!chip) in init_realtek_cr()
991 us->extra = chip; in init_realtek_cr()
993 us->max_lun = chip->max_lun = rts51x_get_max_lun(us); in init_realtek_cr()
994 chip->us = us; in init_realtek_cr()
996 usb_stor_dbg(us, "chip->max_lun = %d\n", chip->max_lun); in init_realtek_cr()
998 size = (chip->max_lun + 1) * sizeof(struct rts51x_status); in init_realtek_cr()
999 chip->status = kzalloc(size, GFP_KERNEL); in init_realtek_cr()
1000 if (!chip->status) in init_realtek_cr()
1003 for (i = 0; i <= (int)(chip->max_lun); i++) { in init_realtek_cr()
1009 if (CHECK_FW_VER(chip, 0x5888) || CHECK_FW_VER(chip, 0x5889) || in init_realtek_cr()
1010 CHECK_FW_VER(chip, 0x5901)) in init_realtek_cr()
1011 SET_AUTO_DELINK(chip); in init_realtek_cr()
1012 if (STATUS_LEN(chip) == 16) { in init_realtek_cr()
1013 if (SUPPORT_AUTO_DELINK(chip)) in init_realtek_cr()
1014 SET_AUTO_DELINK(chip); in init_realtek_cr()
1021 usb_stor_dbg(us, "chip->flag = 0x%x\n", chip->flag); in init_realtek_cr()
1029 kfree(chip->status); in init_realtek_cr()