mirror of
https://github.com/fail0verflow/mini.git
synced 2024-11-27 21:54:18 +01:00
sdhctrl: allow different timeouts for each command
This commit is contained in:
parent
f41e7fdd7c
commit
be3f3c0559
11
sdhc.c
11
sdhc.c
@ -42,7 +42,7 @@
|
||||
|
||||
//#define SDHC_DEBUG
|
||||
|
||||
#define SDHC_COMMAND_TIMEOUT 100
|
||||
#define SDHC_COMMAND_TIMEOUT 500
|
||||
#define SDHC_TRANSFER_TIMEOUT 5000
|
||||
|
||||
#define HDEVNAME(hp) ((hp)->sc->sc_dev.dv_xname)
|
||||
@ -578,6 +578,13 @@ sdhc_exec_command(sdmmc_chipset_handle_t sch, struct sdmmc_command *cmd)
|
||||
if (cmd->c_datalen > 0)
|
||||
hp->data_command = 1;
|
||||
|
||||
if (cmd->c_timeout == 0) {
|
||||
if (cmd->c_datalen > 0)
|
||||
cmd->c_timeout = SDHC_TRANSFER_TIMEOUT;
|
||||
else
|
||||
cmd->c_timeout = SDHC_COMMAND_TIMEOUT;
|
||||
}
|
||||
|
||||
/*
|
||||
* Start the MMC command, or mark `cmd' as failed and return.
|
||||
*/
|
||||
@ -594,7 +601,7 @@ sdhc_exec_command(sdmmc_chipset_handle_t sch, struct sdmmc_command *cmd)
|
||||
* is marked done for any other reason.
|
||||
*/
|
||||
if (!sdhc_wait_intr(hp, SDHC_COMMAND_COMPLETE,
|
||||
SDHC_COMMAND_TIMEOUT)) {
|
||||
cmd->c_timeout)) {
|
||||
cmd->c_error = ETIMEDOUT;
|
||||
SET(cmd->c_flags, SCF_ITSDONE);
|
||||
hp->data_command = 0;
|
||||
|
1
sdmmc.c
1
sdmmc.c
@ -184,6 +184,7 @@ void sdmmc_needs_discover(struct device *dev)
|
||||
cmd.c_opcode = SD_SEND_IF_COND;
|
||||
cmd.c_arg = 0x1aa;
|
||||
cmd.c_flags = SCF_RSP_R7;
|
||||
cmd.c_timeout = 100;
|
||||
sdmmc_host_exec_command(c, &cmd);
|
||||
|
||||
ocr = sdmmc_host_ocr(c);
|
||||
|
@ -90,7 +90,9 @@ struct sdmmc_command {
|
||||
#define SCF_RSP_R5B (SCF_RSP_PRESENT|SCF_RSP_CRC|SCF_RSP_IDX|SCF_RSP_BSY)
|
||||
#define SCF_RSP_R6 (SCF_RSP_PRESENT|SCF_RSP_CRC|SCF_RSP_IDX)
|
||||
#define SCF_RSP_R7 (SCF_RSP_PRESENT|SCF_RSP_CRC|SCF_RSP_IDX)
|
||||
int c_error; /* errno value on completion */
|
||||
int c_error; /* errno value on completion */
|
||||
|
||||
int c_timeout;
|
||||
|
||||
/* Host controller owned fields for data xfer in progress */
|
||||
int c_resid; /* remaining I/O */
|
||||
|
Loading…
Reference in New Issue
Block a user