retval = rtsx_send_cmd(chip, SD_CARD, 100);
if (retval != STATUS_SUCCESS) {
rtsx_trace(chip);
- goto Fail;
+ goto fail;
}
val = *rtsx_get_cmd_data(chip);
if (val & DCMPS_ERROR) {
rtsx_trace(chip);
- goto Fail;
+ goto fail;
}
if ((val & DCMPS_CURRENT_PHASE) != sample_point) {
rtsx_trace(chip);
- goto Fail;
+ goto fail;
}
retval = rtsx_write_register(chip, SD_DCMPS_CTL,
return STATUS_SUCCESS;
-Fail:
+fail:
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);
else
final_phase = (u8)chip->sd_default_tx_phase;
- goto Search_Finish;
+ goto search_finish;
}
cont_path_cnt = 0;
if (cont_path_cnt == 0) {
dev_dbg(rtsx_dev(chip), "No continuous phase path\n");
- goto Search_Finish;
+ goto search_finish;
} else {
int idx = cont_path_cnt - 1;
}
}
-Search_Finish:
+search_finish:
dev_dbg(rtsx_dev(chip), "Final chosen phase: %d\n", final_phase);
return final_phase;
}
SET_SD(sd_card);
-Switch_Fail:
+switch_fail:
i = 0;
j = 0;
retval = sd_prepare_reset(chip);
if (retval != STATUS_SUCCESS)
- goto Status_Fail;
+ goto status_fail;
retval = sd_dummy_clock(chip);
if (retval != STATUS_SUCCESS)
- goto Status_Fail;
+ goto status_fail;
if (CHK_SDIO_EXIST(chip) && !CHK_SDIO_IGNORED(chip) && try_sdio) {
int rty_cnt = 0;
for (; rty_cnt < chip->sdio_retry_cnt; rty_cnt++) {
if (detect_card_cd(chip, SD_CARD) != STATUS_SUCCESS) {
sd_set_err_code(chip, SD_NO_CARD);
- goto Status_Fail;
+ goto status_fail;
}
retval = sd_send_cmd_get_rsp(chip, IO_SEND_OP_COND, 0,
dev_dbg(rtsx_dev(chip), "SD_IO card (Function number: %d)!\n",
func_num);
chip->sd_io = 1;
- goto Status_Fail;
+ goto status_fail;
}
break;
retval = sd_send_cmd_get_rsp(chip, GO_IDLE_STATE, 0, SD_RSP_TYPE_R0,
NULL, 0);
if (retval != STATUS_SUCCESS)
- goto Status_Fail;
+ goto status_fail;
wait_timeout(20);
retval = sd_send_cmd_get_rsp(chip, GO_IDLE_STATE, 0,
SD_RSP_TYPE_R0, NULL, 0);
if (retval != STATUS_SUCCESS)
- goto Status_Fail;
+ goto status_fail;
wait_timeout(20);
}
if (retval != STATUS_SUCCESS) {
if (detect_card_cd(chip, SD_CARD) != STATUS_SUCCESS) {
sd_set_err_code(chip, SD_NO_CARD);
- goto Status_Fail;
+ goto status_fail;
}
j++;
if (j < 3)
goto RTY_SD_RST;
else
- goto Status_Fail;
+ goto status_fail;
}
retval = sd_send_cmd_get_rsp(chip, SD_APP_OP_COND, voltage,
if (k < 3)
goto RTY_SD_RST;
else
- goto Status_Fail;
+ goto status_fail;
}
i++;
} while (!(rsp[1] & 0x80) && (i < 255));
if (i == 255)
- goto Status_Fail;
+ goto status_fail;
if (hi_cap_flow) {
if (rsp[1] & 0x40)
if (support_1v8) {
retval = sd_voltage_switch(chip);
if (retval != STATUS_SUCCESS)
- goto Status_Fail;
+ goto status_fail;
}
retval = sd_send_cmd_get_rsp(chip, ALL_SEND_CID, 0, SD_RSP_TYPE_R2,
NULL, 0);
if (retval != STATUS_SUCCESS)
- goto Status_Fail;
+ goto status_fail;
for (i = 0; i < 3; i++) {
retval = sd_send_cmd_get_rsp(chip, SEND_RELATIVE_ADDR, 0,
SD_RSP_TYPE_R6, rsp, 5);
if (retval != STATUS_SUCCESS)
- goto Status_Fail;
+ goto status_fail;
sd_card->sd_addr = (u32)rsp[1] << 24;
sd_card->sd_addr += (u32)rsp[2] << 16;
retval = sd_check_csd(chip, 1);
if (retval != STATUS_SUCCESS)
- goto Status_Fail;
+ goto status_fail;
retval = sd_select_card(chip, 1);
if (retval != STATUS_SUCCESS)
- goto Status_Fail;
+ goto status_fail;
#ifdef SUPPORT_SD_LOCK
SD_UNLOCK_ENTRY:
retval = sd_update_lock_status(chip);
if (retval != STATUS_SUCCESS)
- goto Status_Fail;
+ goto status_fail;
if (sd_card->sd_lock_status & SD_LOCKED) {
sd_card->sd_lock_status |= (SD_LOCK_1BIT_MODE | SD_PWD_EXIST);
retval = sd_send_cmd_get_rsp(chip, APP_CMD, sd_card->sd_addr,
SD_RSP_TYPE_R1, NULL, 0);
if (retval != STATUS_SUCCESS)
- goto Status_Fail;
+ goto status_fail;
retval = sd_send_cmd_get_rsp(chip, SET_CLR_CARD_DETECT, 0,
SD_RSP_TYPE_R1, NULL, 0);
if (retval != STATUS_SUCCESS)
- goto Status_Fail;
+ goto status_fail;
if (support_1v8) {
retval = sd_send_cmd_get_rsp(chip, APP_CMD, sd_card->sd_addr,
SD_RSP_TYPE_R1, NULL, 0);
if (retval != STATUS_SUCCESS)
- goto Status_Fail;
+ goto status_fail;
retval = sd_send_cmd_get_rsp(chip, SET_BUS_WIDTH, 2,
SD_RSP_TYPE_R1, NULL, 0);
if (retval != STATUS_SUCCESS)
- goto Status_Fail;
+ goto status_fail;
switch_bus_width = SD_BUS_WIDTH_4;
} else {
retval = sd_send_cmd_get_rsp(chip, SET_BLOCKLEN, 0x200, SD_RSP_TYPE_R1,
NULL, 0);
if (retval != STATUS_SUCCESS)
- goto Status_Fail;
+ goto status_fail;
retval = sd_set_clock_divider(chip, SD_CLK_DIVIDE_0);
if (retval != STATUS_SUCCESS)
- goto Status_Fail;
+ goto status_fail;
if (!(sd_card->raw_csd[4] & 0x40))
sd_dont_switch = true;
sd_dont_switch = true;
try_sdio = false;
- goto Switch_Fail;
+ goto switch_fail;
}
} else {
if (support_1v8) {
sd_dont_switch = true;
try_sdio = false;
- goto Switch_Fail;
+ goto switch_fail;
}
}
}
retval = sd_send_cmd_get_rsp(chip, APP_CMD, sd_card->sd_addr,
SD_RSP_TYPE_R1, NULL, 0);
if (retval != STATUS_SUCCESS)
- goto Status_Fail;
+ goto status_fail;
retval = sd_send_cmd_get_rsp(chip, SET_BUS_WIDTH, 2,
SD_RSP_TYPE_R1, NULL, 0);
if (retval != STATUS_SUCCESS)
- goto Status_Fail;
+ goto status_fail;
}
#ifdef SUPPORT_SD_LOCK
retval = sd_set_init_para(chip);
if (retval != STATUS_SUCCESS)
- goto Status_Fail;
+ goto status_fail;
if (CHK_SD_DDR50(sd_card))
retval = sd_ddr_tuning(chip);
if (retval != STATUS_SUCCESS) {
if (sd20_mode) {
- goto Status_Fail;
+ goto status_fail;
} else {
retval = sd_init_power(chip);
if (retval != STATUS_SUCCESS)
- goto Status_Fail;
+ goto status_fail;
try_sdio = false;
sd20_mode = true;
- goto Switch_Fail;
+ goto switch_fail;
}
}
retval = sd_read_lba0(chip);
if (retval != STATUS_SUCCESS) {
if (sd20_mode) {
- goto Status_Fail;
+ goto status_fail;
} else {
retval = sd_init_power(chip);
if (retval != STATUS_SUCCESS)
- goto Status_Fail;
+ goto status_fail;
try_sdio = false;
sd20_mode = true;
- goto Switch_Fail;
+ goto switch_fail;
}
}
}
retval = sd_check_wp_state(chip);
if (retval != STATUS_SUCCESS)
- goto Status_Fail;
+ goto status_fail;
chip->card_bus_width[chip->card2lun[SD_CARD]] = 4;
return STATUS_SUCCESS;
-Status_Fail:
+status_fail:
rtsx_trace(chip);
return STATUS_FAIL;
}
goto MMC_UNLOCK_ENTRY;
#endif
-Switch_Fail:
+switch_fail:
retval = sd_prepare_reset(chip);
if (retval != STATUS_SUCCESS) {
rtsx_trace(chip);
}
sd_card->mmc_dont_switch_bus = 1;
rtsx_trace(chip);
- goto Switch_Fail;
+ goto switch_fail;
}
}
switch_ddr = false;
rtsx_trace(chip);
- goto Switch_Fail;
+ goto switch_fail;
}
retval = sd_wait_state_data_ready(chip, 0x08, 1, 1000);
switch_ddr = false;
rtsx_trace(chip);
- goto Switch_Fail;
+ goto switch_fail;
}
}
}
retval = sd_select_card(chip, 0);
if (retval != STATUS_SUCCESS) {
rtsx_trace(chip);
- goto SD_Execute_Cmd_Failed;
+ goto sd_execute_cmd_failed;
}
}
false);
if (retval != STATUS_SUCCESS) {
rtsx_trace(chip);
- goto SD_Execute_Cmd_Failed;
+ goto sd_execute_cmd_failed;
}
}
sd_card->rsp, rsp_len, false);
if (retval != STATUS_SUCCESS) {
rtsx_trace(chip);
- goto SD_Execute_Cmd_Failed;
+ goto sd_execute_cmd_failed;
}
if (standby) {
retval = sd_select_card(chip, 1);
if (retval != STATUS_SUCCESS) {
rtsx_trace(chip);
- goto SD_Execute_Cmd_Failed;
+ goto sd_execute_cmd_failed;
}
}
retval = sd_update_lock_status(chip);
if (retval != STATUS_SUCCESS) {
rtsx_trace(chip);
- goto SD_Execute_Cmd_Failed;
+ goto sd_execute_cmd_failed;
}
#endif
scsi_set_resid(srb, 0);
return TRANSPORT_GOOD;
-SD_Execute_Cmd_Failed:
+sd_execute_cmd_failed:
sd_card->pre_cmd_err = 1;
set_sense_type(chip, lun, SENSE_TYPE_NO_SENSE);
release_sd_card(chip);
false);
if (retval != STATUS_SUCCESS) {
rtsx_trace(chip);
- goto SD_Execute_Read_Cmd_Failed;
+ goto sd_execute_read_cmd_failed;
}
}
retval = sd_select_card(chip, 0);
if (retval != STATUS_SUCCESS) {
rtsx_trace(chip);
- goto SD_Execute_Read_Cmd_Failed;
+ goto sd_execute_read_cmd_failed;
}
}
false);
if (retval != STATUS_SUCCESS) {
rtsx_trace(chip);
- goto SD_Execute_Read_Cmd_Failed;
+ goto sd_execute_read_cmd_failed;
}
}
kfree(buf);
rtsx_clear_sd_error(chip);
rtsx_trace(chip);
- goto SD_Execute_Read_Cmd_Failed;
+ goto sd_execute_read_cmd_failed;
}
min_len = min(data_len, scsi_bufflen(srb));
read_err = true;
rtsx_clear_sd_error(chip);
rtsx_trace(chip);
- goto SD_Execute_Read_Cmd_Failed;
+ goto sd_execute_read_cmd_failed;
}
} else {
rtsx_trace(chip);
- goto SD_Execute_Read_Cmd_Failed;
+ goto sd_execute_read_cmd_failed;
}
retval = ext_sd_get_rsp(chip, rsp_len, sd_card->rsp, rsp_type);
if (retval != STATUS_SUCCESS) {
rtsx_trace(chip);
- goto SD_Execute_Read_Cmd_Failed;
+ goto sd_execute_read_cmd_failed;
}
if (standby) {
retval = sd_select_card(chip, 1);
if (retval != STATUS_SUCCESS) {
rtsx_trace(chip);
- goto SD_Execute_Read_Cmd_Failed;
+ goto sd_execute_read_cmd_failed;
}
}
false);
if (retval != STATUS_SUCCESS) {
rtsx_trace(chip);
- goto SD_Execute_Read_Cmd_Failed;
+ goto sd_execute_read_cmd_failed;
}
}
false);
if (retval != STATUS_SUCCESS) {
rtsx_trace(chip);
- goto SD_Execute_Read_Cmd_Failed;
+ goto sd_execute_read_cmd_failed;
}
retval = rtsx_write_register(chip, SD_BYTE_CNT_H, 0xFF, 0x02);
if (retval != STATUS_SUCCESS) {
rtsx_trace(chip);
- goto SD_Execute_Read_Cmd_Failed;
+ goto sd_execute_read_cmd_failed;
}
retval = rtsx_write_register(chip, SD_BYTE_CNT_L, 0xFF, 0x00);
if (retval != STATUS_SUCCESS) {
rtsx_trace(chip);
- goto SD_Execute_Read_Cmd_Failed;
+ goto sd_execute_read_cmd_failed;
}
}
}
if (retval != STATUS_SUCCESS) {
rtsx_trace(chip);
- goto SD_Execute_Read_Cmd_Failed;
+ goto sd_execute_read_cmd_failed;
}
scsi_set_resid(srb, 0);
return TRANSPORT_GOOD;
-SD_Execute_Read_Cmd_Failed:
+sd_execute_read_cmd_failed:
sd_card->pre_cmd_err = 1;
set_sense_type(chip, lun, SENSE_TYPE_NO_SENSE);
if (read_err)
false);
if (retval != STATUS_SUCCESS) {
rtsx_trace(chip);
- goto SD_Execute_Write_Cmd_Failed;
+ goto sd_execute_write_cmd_failed;
}
}
retval = sd_select_card(chip, 0);
if (retval != STATUS_SUCCESS) {
rtsx_trace(chip);
- goto SD_Execute_Write_Cmd_Failed;
+ goto sd_execute_write_cmd_failed;
}
}
false);
if (retval != STATUS_SUCCESS) {
rtsx_trace(chip);
- goto SD_Execute_Write_Cmd_Failed;
+ goto sd_execute_write_cmd_failed;
}
}
sd_card->rsp, rsp_len, false);
if (retval != STATUS_SUCCESS) {
rtsx_trace(chip);
- goto SD_Execute_Write_Cmd_Failed;
+ goto sd_execute_write_cmd_failed;
}
if (data_len <= 512) {
if (retval != STATUS_SUCCESS) {
kfree(buf);
rtsx_trace(chip);
- goto SD_Execute_Write_Cmd_Failed;
+ goto sd_execute_write_cmd_failed;
}
rtsx_init_cmd(chip);
if (retval != STATUS_SUCCESS) {
kfree(buf);
rtsx_trace(chip);
- goto SD_Execute_Write_Cmd_Failed;
+ goto sd_execute_write_cmd_failed;
}
} else {
rtsx_init_cmd(chip);
if (retval != STATUS_SUCCESS) {
kfree(buf);
rtsx_trace(chip);
- goto SD_Execute_Write_Cmd_Failed;
+ goto sd_execute_write_cmd_failed;
}
}
} else {
rtsx_trace(chip);
- goto SD_Execute_Write_Cmd_Failed;
+ goto sd_execute_write_cmd_failed;
}
if (retval < 0) {
write_err = true;
rtsx_clear_sd_error(chip);
rtsx_trace(chip);
- goto SD_Execute_Write_Cmd_Failed;
+ goto sd_execute_write_cmd_failed;
}
#ifdef SUPPORT_SD_LOCK
retval = sd_select_card(chip, 1);
if (retval != STATUS_SUCCESS) {
rtsx_trace(chip);
- goto SD_Execute_Write_Cmd_Failed;
+ goto sd_execute_write_cmd_failed;
}
}
false);
if (retval != STATUS_SUCCESS) {
rtsx_trace(chip);
- goto SD_Execute_Write_Cmd_Failed;
+ goto sd_execute_write_cmd_failed;
}
}
false);
if (retval != STATUS_SUCCESS) {
rtsx_trace(chip);
- goto SD_Execute_Write_Cmd_Failed;
+ goto sd_execute_write_cmd_failed;
}
retval = rtsx_write_register(chip, SD_BYTE_CNT_H, 0xFF, 0x02);
if (retval != STATUS_SUCCESS) {
rtsx_trace(chip);
- goto SD_Execute_Write_Cmd_Failed;
+ goto sd_execute_write_cmd_failed;
}
rtsx_write_register(chip, SD_BYTE_CNT_L, 0xFF, 0x00);
if (retval != STATUS_SUCCESS) {
rtsx_trace(chip);
- goto SD_Execute_Write_Cmd_Failed;
+ goto sd_execute_write_cmd_failed;
}
}
}
if (retval != STATUS_SUCCESS) {
rtsx_trace(chip);
- goto SD_Execute_Write_Cmd_Failed;
+ goto sd_execute_write_cmd_failed;
}
#ifdef SUPPORT_SD_LOCK
if (retval != STATUS_SUCCESS) {
sd_card->sd_lock_status &= ~(SD_UNLOCK_POW_ON | SD_SDR_RST);
rtsx_trace(chip);
- goto SD_Execute_Write_Cmd_Failed;
+ goto sd_execute_write_cmd_failed;
}
}
scsi_set_resid(srb, 0);
return TRANSPORT_GOOD;
-SD_Execute_Write_Cmd_Failed:
+sd_execute_write_cmd_failed:
sd_card->pre_cmd_err = 1;
set_sense_type(chip, lun, SENSE_TYPE_NO_SENSE);
if (write_err)