28 #include <linux/sched.h>
41 static int check_sd_speed_prior(
u32 sd_speed_prior)
46 for (i = 0; i < 4; i++) {
47 u8 tmp = (
u8) (sd_speed_prior >> (i * 8));
48 if ((tmp < 0x01) || (tmp > 0x04)) {
76 chip->
option.sd30_pad_drive);
78 chip->
option.sd20_pad_drive);
117 rts51x_init_cmd(chip);
134 if (chip->
option.FT2_fast_mode) {
157 #ifdef CLOSE_SSC_POWER
175 if (!check_sd_speed_prior(chip->
option.sd_speed_prior))
176 chip->
option.sd_speed_prior = 0x01020403;
178 chip->
option.sd_speed_prior);
226 chip->
option.led_toggle_interval) {
235 static void rts51x_auto_delink_cmd(
struct rts51x_chip *chip)
241 static void rts51x_auto_delink_force_cmd(
struct rts51x_chip *chip)
248 #ifdef USING_POLLING_CYCLE_DELINK
250 static void rts51x_auto_delink_polling_cycle(
struct rts51x_chip *chip)
253 chip->
option.delink_delay * 2) {
255 chip->
option.delink_delay) {
262 "do force delink\n");
263 rts51x_auto_delink_force_cmd(chip);
265 chip->
option.delink_delay * 2 + 1;
271 rts51x_auto_delink_cmd(chip);
275 chip->
option.delink_delay * 2) {
277 rts51x_auto_delink_force_cmd(chip);
283 static void rts51x_auto_delink(
struct rts51x_chip *chip)
285 rts51x_auto_delink_polling_cycle(chip);
289 static void rts51x_auto_delink(
struct rts51x_chip *chip)
324 if (chip->
option.led_always_on
340 #ifdef CLOSE_SSC_POWER
355 rts51x_blink_led(chip);
367 rts51x_auto_delink(chip);
380 ((cmd_type & 0x03) << 6) | (
u8) ((reg_addr >> 8) & 0x3F);
414 rsp_len += (4 - rsp_len % 4);
417 (
void *)chip->
rsp_buf, rsp_len,
430 #ifdef GET_CARD_STATUS_USING_EPC
452 rts51x_init_cmd(chip);
467 rts51x_init_cmd(chip);
490 value |= (
u16) (3 & 0x03) << 14;
491 value |= (
u16) (addr & 0x3FFF);
513 value |= (
u16) (2 & 0x03) << 14;
514 value |= (
u16) (addr & 0x3FFF);
540 cmd_len += (4 - cmd_len % 4);
556 (
void *)(chip->
cmd_buf), cmd_len, 0,
574 rsp_len = len + (4 - len % 4);
596 (
void *)data, rsp_len, 0,
NULL, 100,
638 RTS51X_DEBUGP(
"Write 0x%x to phy register 0x%x\n", val, addr);
640 rts51x_init_cmd(chip);
666 rts51x_init_cmd(chip);
737 #ifdef CLOSE_SSC_POWER
764 *(ptr++) = (
u8) (msg_cnt >> 24);
765 *(ptr++) = (
u8) (msg_cnt >> 16);
766 *(ptr++) = (
u8) (msg_cnt >> 8);
767 *(ptr++) = (
u8) msg_cnt;
770 for (i = 1; i <= msg_cnt; i++) {
802 u8 oc_now_mask = 0, oc_ever_mask = 0;
805 if (!status || (status_len < 32))
812 if (chip->
option.auto_delink_en)
908 if (!rts51x_status || (status_len < 16))
919 rts51x_status[4] = (
u8) lun;
924 rts51x_status[5] = 4;
926 rts51x_status[5] = 2;
928 rts51x_status[5] = 3;
930 rts51x_status[5] = 7;
932 rts51x_status[5] = 7;
936 rts51x_status[6] = 1;
944 rts51x_status[9] = 1;
946 rts51x_status[9] = 0;
949 rts51x_status[10] = 1;
956 rts51x_status[12] = 1;
958 rts51x_status[12] = 0;
962 rts51x_status[13] = 0x40;
966 rts51x_status[13] = 0x20;
969 rts51x_status[13] |= 0x04;
971 rts51x_status[13] |= 0x02;
973 rts51x_status[13] |= 0x08;
975 rts51x_status[13] |= 0x02;
977 rts51x_status[13] |= 0x04;
983 rts51x_status[13] = 0x38;
985 rts51x_status[13] |= 0x04;
988 rts51x_status[13] |= 0x01;
991 rts51x_status[13] = 0x30;
994 rts51x_status[13] = 0x70;
997 rts51x_status[14] = 0x78;
999 rts51x_status[15] = 0x82;
1003 void *
buf,
unsigned int len,
int use_sg,
1004 unsigned int *act_len,
int timeout,
u8 stage_flag)