diff options
Diffstat (limited to 'drivers/staging/rts5208/sd.c')
-rw-r--r-- | drivers/staging/rts5208/sd.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/staging/rts5208/sd.c b/drivers/staging/rts5208/sd.c index c79bea8..c28a927 100644 --- a/drivers/staging/rts5208/sd.c +++ b/drivers/staging/rts5208/sd.c @@ -427,7 +427,7 @@ static int sd_check_csd(struct rtsx_chip *chip, char check_wp) memcpy(sd_card->raw_csd, rsp + 1, 15); dev_dbg(rtsx_dev(chip), "CSD Response:\n"); - RTSX_DUMP(sd_card->raw_csd, 16); + dev_dbg(rtsx_dev(chip), "%*ph\n", 16, sd_card->raw_csd); csd_ver = (rsp[1] & 0xc0) >> 6; dev_dbg(rtsx_dev(chip), "csd_ver = %d\n", csd_ver); @@ -476,6 +476,7 @@ static int sd_check_csd(struct rtsx_chip *chip, char check_wp) if ((!CHK_SD_HCXC(sd_card)) || (csd_ver == 0)) { u8 blk_size, c_size_mult; u16 c_size; + blk_size = rsp[6] & 0x0F; c_size = ((u16)(rsp[7] & 0x03) << 10) + ((u16)rsp[8] << 2) @@ -487,6 +488,7 @@ static int sd_check_csd(struct rtsx_chip *chip, char check_wp) << (blk_size - 9); } else { u32 total_sector = 0; + total_sector = (((u32)rsp[8] & 0x3f) << 16) | ((u32)rsp[9] << 8) | (u32)rsp[10]; sd_card->capacity = (total_sector + 1) << 10; @@ -812,12 +814,10 @@ static int sd_change_phase(struct rtsx_chip *chip, u8 sample_point, u8 tune_dir) PHASE_NOT_RESET); RTSX_WRITE_REG(chip, CLK_CTL, CHANGE_CLK, 0); } else { -#ifdef CONFIG_RTS5208_DEBUG rtsx_read_register(chip, SD_VP_CTL, &val); dev_dbg(rtsx_dev(chip), "SD_VP_CTL: 0x%x\n", val); rtsx_read_register(chip, SD_DCMPS_CTL, &val); dev_dbg(rtsx_dev(chip), "SD_DCMPS_CTL: 0x%x\n", val); -#endif if (ddr_rx) { RTSX_WRITE_REG(chip, SD_VP_CTL, PHASE_CHANGE, @@ -863,12 +863,11 @@ static int sd_change_phase(struct rtsx_chip *chip, u8 sample_point, u8 tune_dir) return STATUS_SUCCESS; Fail: -#ifdef CONFIG_RTS5208_DEBUG rtsx_read_register(chip, SD_VP_CTL, &val); dev_dbg(rtsx_dev(chip), "SD_VP_CTL: 0x%x\n", val); rtsx_read_register(chip, SD_DCMPS_CTL, &val); dev_dbg(rtsx_dev(chip), "SD_DCMPS_CTL: 0x%x\n", val); -#endif + rtsx_write_register(chip, SD_DCMPS_CTL, DCMPS_CHANGE, 0); rtsx_write_register(chip, SD_VP_CTL, PHASE_CHANGE, 0); wait_timeout(10); @@ -1060,7 +1059,7 @@ static int sd_check_switch_mode(struct rtsx_chip *chip, u8 mode, TRACE_RET(chip, STATUS_FAIL); } - RTSX_DUMP(buf, 64); + dev_dbg(rtsx_dev(chip), "%*ph\n", 64, buf); if (func_group == NO_ARGUMENT) { sd_card->func_group1_mask = buf[0x0D]; @@ -1081,6 +1080,7 @@ static int sd_check_switch_mode(struct rtsx_chip *chip, u8 mode, * acceptable; bit[511:496] = 0x0000 means some error happened. */ u16 cc = ((u16)buf[0] << 8) | buf[1]; + dev_dbg(rtsx_dev(chip), "Maximum current consumption: %dmA\n", cc); if ((cc == 0) || (cc > 800)) @@ -1553,6 +1553,7 @@ static u8 sd_search_final_phase(struct rtsx_chip *chip, u32 phase_map, new_block = 1; if (cont_path_cnt) { int idx = cont_path_cnt - 1; + path[idx].len = path[idx].end - path[idx].start + 1; path[idx].mid = path[idx].start + @@ -1566,6 +1567,7 @@ static u8 sd_search_final_phase(struct rtsx_chip *chip, u32 phase_map, goto Search_Finish; } else { int idx = cont_path_cnt - 1; + path[idx].len = path[idx].end - path[idx].start + 1; path[idx].mid = path[idx].start + path[idx].len / 2; } @@ -2119,7 +2121,7 @@ static int sd_check_wp_state(struct rtsx_chip *chip) } dev_dbg(rtsx_dev(chip), "ACMD13:\n"); - RTSX_DUMP(buf, 64); + dev_dbg(rtsx_dev(chip), "%*ph\n", 64, buf); sd_card_type = ((u16)buf[2] << 8) | buf[3]; dev_dbg(rtsx_dev(chip), "sd_card_type = 0x%04x\n", sd_card_type); @@ -2183,6 +2185,7 @@ Switch_Fail: SD_RSP_TYPE_R4, rsp, 5); if (retval == STATUS_SUCCESS) { int func_num = (rsp[1] >> 4) & 0x07; + if (func_num) { dev_dbg(rtsx_dev(chip), "SD_IO card (Function number: %d)!\n", func_num); |