mirror of
https://github.com/fail0verflow/mini.git
synced 2024-11-28 06:04:19 +01:00
prepare sdmmc_abort in irq handler
This commit is contained in:
parent
3b9fb897f7
commit
e06fbf3b1e
14
sdhc.c
14
sdhc.c
@ -211,6 +211,7 @@ sdhc_host_found(struct sdhc_softc *sc, bus_space_tag_t iot,
|
|||||||
hp->sc = sc;
|
hp->sc = sc;
|
||||||
hp->iot = iot;
|
hp->iot = iot;
|
||||||
hp->ioh = ioh;
|
hp->ioh = ioh;
|
||||||
|
hp->data_command = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reset the host controller and enable interrupts.
|
* Reset the host controller and enable interrupts.
|
||||||
@ -600,6 +601,9 @@ sdhc_exec_command(sdmmc_chipset_handle_t sch, struct sdmmc_command *cmd)
|
|||||||
struct sdhc_host *hp = sch;
|
struct sdhc_host *hp = sch;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
|
if (cmd->c_datalen > 0)
|
||||||
|
hp->data_command = 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Start the MMC command, or mark `cmd' as failed and return.
|
* Start the MMC command, or mark `cmd' as failed and return.
|
||||||
*/
|
*/
|
||||||
@ -607,6 +611,7 @@ sdhc_exec_command(sdmmc_chipset_handle_t sch, struct sdmmc_command *cmd)
|
|||||||
if (error != 0) {
|
if (error != 0) {
|
||||||
cmd->c_error = error;
|
cmd->c_error = error;
|
||||||
SET(cmd->c_flags, SCF_ITSDONE);
|
SET(cmd->c_flags, SCF_ITSDONE);
|
||||||
|
hp->data_command = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -618,6 +623,7 @@ sdhc_exec_command(sdmmc_chipset_handle_t sch, struct sdmmc_command *cmd)
|
|||||||
SDHC_COMMAND_TIMEOUT)) {
|
SDHC_COMMAND_TIMEOUT)) {
|
||||||
cmd->c_error = ETIMEDOUT;
|
cmd->c_error = ETIMEDOUT;
|
||||||
SET(cmd->c_flags, SCF_ITSDONE);
|
SET(cmd->c_flags, SCF_ITSDONE);
|
||||||
|
hp->data_command = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -650,6 +656,7 @@ sdhc_exec_command(sdmmc_chipset_handle_t sch, struct sdmmc_command *cmd)
|
|||||||
DPRINTF(1,("%s: cmd %u done (flags=%#x error=%d)\n",
|
DPRINTF(1,("%s: cmd %u done (flags=%#x error=%d)\n",
|
||||||
HDEVNAME(hp), cmd->c_opcode, cmd->c_flags, cmd->c_error));
|
HDEVNAME(hp), cmd->c_opcode, cmd->c_flags, cmd->c_error));
|
||||||
SET(cmd->c_flags, SCF_ITSDONE);
|
SET(cmd->c_flags, SCF_ITSDONE);
|
||||||
|
hp->data_command = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -930,6 +937,13 @@ sdhc_intr(void *arg)
|
|||||||
signal = HREAD2(hp, SDHC_EINTR_SIGNAL_EN);
|
signal = HREAD2(hp, SDHC_EINTR_SIGNAL_EN);
|
||||||
HWRITE2(hp, SDHC_EINTR_SIGNAL_EN, 0);
|
HWRITE2(hp, SDHC_EINTR_SIGNAL_EN, 0);
|
||||||
(void)sdhc_soft_reset(hp, SDHC_RESET_DAT|SDHC_RESET_CMD);
|
(void)sdhc_soft_reset(hp, SDHC_RESET_DAT|SDHC_RESET_CMD);
|
||||||
|
if (hp->data_command == 1) {
|
||||||
|
hp->data_command = 0;
|
||||||
|
|
||||||
|
// TODO: add a way to send commands from irq
|
||||||
|
// context and uncomment this
|
||||||
|
// sdmmc_abort();
|
||||||
|
}
|
||||||
HWRITE2(hp, SDHC_EINTR_STATUS, error);
|
HWRITE2(hp, SDHC_EINTR_STATUS, error);
|
||||||
HWRITE2(hp, SDHC_EINTR_SIGNAL_EN, signal);
|
HWRITE2(hp, SDHC_EINTR_SIGNAL_EN, signal);
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ struct sdhc_host {
|
|||||||
u_int8_t regs[14]; /* host controller state */
|
u_int8_t regs[14]; /* host controller state */
|
||||||
u_int16_t intr_status; /* soft interrupt status */
|
u_int16_t intr_status; /* soft interrupt status */
|
||||||
u_int16_t intr_error_status; /* soft error status */
|
u_int16_t intr_error_status; /* soft error status */
|
||||||
|
int data_command;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sdhc_softc {
|
struct sdhc_softc {
|
||||||
|
Loading…
Reference in New Issue
Block a user