drivers: sdhc: Add SD response type masks
Add SD response type masks, to allow drivers to mask out the SPI or SD native mode response type based on the SD host controller mode they use. Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
This commit is contained in:
parent
7840b07121
commit
e2fe582d62
|
@ -586,7 +586,7 @@ static int imx_usdhc_request(const struct device *dev, struct sdhc_command *cmd,
|
|||
host_cmd.index = cmd->opcode;
|
||||
host_cmd.argument = cmd->arg;
|
||||
/* Mask out part of response type field used for SPI commands */
|
||||
host_cmd.responseType = (cmd->response_type & 0xF);
|
||||
host_cmd.responseType = (cmd->response_type & SDHC_NATIVE_RESPONSE_MASK);
|
||||
transfer.command = &host_cmd;
|
||||
if (cmd->timeout_ms == SDHC_TIMEOUT_FOREVER) {
|
||||
request.command_timeout = K_FOREVER;
|
||||
|
@ -711,8 +711,10 @@ static int imx_usdhc_request(const struct device *dev, struct sdhc_command *cmd,
|
|||
k_mutex_unlock(&dev_data->access_mutex);
|
||||
/* Record command response */
|
||||
memcpy(cmd->response, host_cmd.response, sizeof(cmd->response));
|
||||
/* Record number of bytes xfered */
|
||||
data->bytes_xfered = dev_data->transfer_handle.transferredWords;
|
||||
if (data) {
|
||||
/* Record number of bytes xfered */
|
||||
data->bytes_xfered = dev_data->transfer_handle.transferredWords;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -231,7 +231,7 @@ static int sdhc_spi_response_get(const struct device *dev, struct sdhc_command *
|
|||
}
|
||||
/* else IDLE_STATE bit is set, which is not an error, card is just resetting */
|
||||
}
|
||||
switch ((cmd->response_type & 0xF0)) {
|
||||
switch ((cmd->response_type & SDHC_SPI_RESPONSE_TYPE_MASK)) {
|
||||
case SD_SPI_RSP_TYPE_R1:
|
||||
/* R1 response - one byte*/
|
||||
break;
|
||||
|
|
|
@ -48,6 +48,9 @@ struct sdhc_command {
|
|||
int timeout_ms; /*!< Command timeout in milliseconds */
|
||||
};
|
||||
|
||||
#define SDHC_NATIVE_RESPONSE_MASK 0xF
|
||||
#define SDHC_SPI_RESPONSE_TYPE_MASK 0xF0
|
||||
|
||||
/**
|
||||
* @brief SD host controller data structure
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue