Lines Matching refs:cmd
22 struct sdhc_command cmd; in sdmmc_read_status() local
25 cmd.opcode = SD_SEND_STATUS; in sdmmc_read_status()
26 cmd.arg = 0; in sdmmc_read_status()
28 cmd.arg = (card->relative_addr << 16U); in sdmmc_read_status()
30 cmd.response_type = (SD_RSP_TYPE_R1 | SD_SPI_RSP_TYPE_R2); in sdmmc_read_status()
31 cmd.retries = CONFIG_SD_CMD_RETRIES; in sdmmc_read_status()
32 cmd.timeout_ms = CONFIG_SD_CMD_TIMEOUT; in sdmmc_read_status()
34 ret = sdhc_request(card->sdhc, &cmd, NULL); in sdmmc_read_status()
40 if ((cmd.response[0U] & SDHC_SPI_R2_CARD_LOCKED) || in sdmmc_read_status()
41 (cmd.response[0U] & SDHC_SPI_R2_UNLOCK_FAIL)) { in sdmmc_read_status()
43 } else if ((cmd.response[0U] & SDHC_SPI_R2_WP_VIOLATION) || in sdmmc_read_status()
44 (cmd.response[0U] & SDHC_SPI_R2_ERASE_PARAM) || in sdmmc_read_status()
45 (cmd.response[0U] & SDHC_SPI_R2_OUT_OF_RANGE)) { in sdmmc_read_status()
47 } else if ((cmd.response[0U] & SDHC_SPI_R2_ERR) || in sdmmc_read_status()
48 (cmd.response[0U] & SDHC_SPI_R2_CC_ERR) || in sdmmc_read_status()
49 (cmd.response[0U] & SDHC_SPI_R2_ECC_FAIL)) { in sdmmc_read_status()
56 if ((cmd.response[0U] & SD_R1_RDY_DATA) && in sdmmc_read_status()
57 (SD_R1_CURRENT_STATE(cmd.response[0U]) == SDMMC_R1_TRANSFER)) { in sdmmc_read_status()
207 struct sdhc_command cmd; in sdmmc_spi_read_cxd() local
213 cmd.opcode = opcode; in sdmmc_spi_read_cxd()
214 cmd.arg = 0; in sdmmc_spi_read_cxd()
215 cmd.response_type = SD_SPI_RSP_TYPE_R1; in sdmmc_spi_read_cxd()
216 cmd.retries = CONFIG_SD_CMD_RETRIES; in sdmmc_spi_read_cxd()
217 cmd.timeout_ms = CONFIG_SD_CMD_TIMEOUT; in sdmmc_spi_read_cxd()
226 ret = sdhc_request(card->sdhc, &cmd, &data); in sdmmc_spi_read_cxd()
240 struct sdhc_command cmd; in sdmmc_read_cxd() local
243 cmd.opcode = opcode; in sdmmc_read_cxd()
244 cmd.arg = (rca << 16); in sdmmc_read_cxd()
245 cmd.response_type = SD_RSP_TYPE_R2; in sdmmc_read_cxd()
246 cmd.retries = CONFIG_SD_CMD_RETRIES; in sdmmc_read_cxd()
247 cmd.timeout_ms = CONFIG_SD_CMD_TIMEOUT; in sdmmc_read_cxd()
249 ret = sdhc_request(card->sdhc, &cmd, NULL); in sdmmc_read_cxd()
255 memcpy(cxd, cmd.response, 16); in sdmmc_read_cxd()
328 struct sdhc_command cmd; in sdmmc_switch_voltage() local
337 cmd.opcode = SD_VOL_SWITCH; in sdmmc_switch_voltage()
338 cmd.arg = 0U; in sdmmc_switch_voltage()
339 cmd.response_type = SD_RSP_TYPE_R1; in sdmmc_switch_voltage()
340 cmd.retries = CONFIG_SD_CMD_RETRIES; in sdmmc_switch_voltage()
341 cmd.timeout_ms = CONFIG_SD_CMD_TIMEOUT; in sdmmc_switch_voltage()
342 ret = sdhc_request(card->sdhc, &cmd, NULL); in sdmmc_switch_voltage()
348 ret = sd_check_response(&cmd); in sdmmc_switch_voltage()
413 struct sdhc_command cmd; in sdmmc_request_rca() local
416 cmd.opcode = SD_SEND_RELATIVE_ADDR; in sdmmc_request_rca()
417 cmd.arg = 0; in sdmmc_request_rca()
418 cmd.response_type = SD_RSP_TYPE_R6; in sdmmc_request_rca()
419 cmd.retries = CONFIG_SD_CMD_RETRIES; in sdmmc_request_rca()
420 cmd.timeout_ms = CONFIG_SD_CMD_TIMEOUT; in sdmmc_request_rca()
423 ret = sdhc_request(card->sdhc, &cmd, NULL); in sdmmc_request_rca()
429 card->relative_addr = ((cmd.response[0U] & 0xFFFF0000) >> 16U); in sdmmc_request_rca()
440 struct sdhc_command cmd; in sdmmc_select_card() local
443 cmd.opcode = SD_SELECT_CARD; in sdmmc_select_card()
444 cmd.arg = ((card->relative_addr) << 16U); in sdmmc_select_card()
445 cmd.response_type = SD_RSP_TYPE_R1; in sdmmc_select_card()
446 cmd.retries = CONFIG_SD_CMD_RETRIES; in sdmmc_select_card()
447 cmd.timeout_ms = CONFIG_SD_CMD_TIMEOUT; in sdmmc_select_card()
449 ret = sdhc_request(card->sdhc, &cmd, NULL); in sdmmc_select_card()
454 ret = sd_check_response(&cmd); in sdmmc_select_card()
465 struct sdhc_command cmd; in card_app_command() local
468 cmd.opcode = SD_APP_CMD; in card_app_command()
469 cmd.arg = relative_card_address << 16U; in card_app_command()
470 cmd.response_type = (SD_RSP_TYPE_R1 | SD_SPI_RSP_TYPE_R1); in card_app_command()
471 cmd.retries = CONFIG_SD_CMD_RETRIES; in card_app_command()
472 cmd.timeout_ms = CONFIG_SD_CMD_TIMEOUT; in card_app_command()
473 ret = sdhc_request(card->sdhc, &cmd, NULL); in card_app_command()
478 ret = sd_check_response(&cmd); in card_app_command()
480 LOG_WRN("SD app command failed with R1 response of 0x%X", cmd.response[0]); in card_app_command()
484 if ((!card->host_props.is_spi) && !(cmd.response[0U] & SD_R1_APP_CMD)) { in card_app_command()
494 struct sdhc_command cmd; in card_read() local
509 cmd.opcode = (num_blocks == 1U) ? SD_READ_SINGLE_BLOCK : SD_READ_MULTIPLE_BLOCK; in card_read()
512 cmd.arg = start_block * card->block_size; in card_read()
514 cmd.arg = start_block; in card_read()
516 cmd.response_type = (SD_RSP_TYPE_R1 | SD_SPI_RSP_TYPE_R1); in card_read()
517 cmd.retries = CONFIG_SD_DATA_RETRIES; in card_read()
518 cmd.timeout_ms = CONFIG_SD_CMD_TIMEOUT; in card_read()
528 ret = sdhc_request(card->sdhc, &cmd, &data); in card_read()
615 struct sdhc_command cmd; in card_query_written() local
625 cmd.opcode = SD_APP_SEND_NUM_WRITTEN_BLK; in card_query_written()
626 cmd.arg = 0; in card_query_written()
627 cmd.response_type = (SD_RSP_TYPE_R1 | SD_SPI_RSP_TYPE_R1); in card_query_written()
628 cmd.retries = CONFIG_SD_CMD_RETRIES; in card_query_written()
629 cmd.timeout_ms = CONFIG_SD_CMD_TIMEOUT; in card_query_written()
637 ret = sdhc_request(card->sdhc, &cmd, &data); in card_query_written()
642 ret = sd_check_response(&cmd); in card_query_written()
658 struct sdhc_command cmd; in card_write() local
665 cmd.opcode = (num_blocks == 1) ? SD_WRITE_SINGLE_BLOCK : SD_WRITE_MULTIPLE_BLOCK; in card_write()
668 cmd.arg = start_block * card->block_size; in card_write()
670 cmd.arg = start_block; in card_write()
672 cmd.response_type = (SD_RSP_TYPE_R1 | SD_SPI_RSP_TYPE_R1); in card_write()
673 cmd.retries = CONFIG_SD_DATA_RETRIES; in card_write()
674 cmd.timeout_ms = CONFIG_SD_CMD_TIMEOUT; in card_write()
684 ret = sdhc_request(card->sdhc, &cmd, &data); in card_write()
774 int card_ioctl(struct sd_card *card, uint8_t cmd, void *buf) in card_ioctl() argument
783 switch (cmd) { in card_ioctl()