Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/sdhci/sdhci.c
Show First 20 Lines • Show All 1,756 Lines • ▼ Show 20 Lines | if (slot->data_done == 0) { | ||||
WR4(slot, SDHCI_SIGNAL_ENABLE, | WR4(slot, SDHCI_SIGNAL_ENABLE, | ||||
slot->intmask &= ~SDHCI_INT_RESPONSE); | slot->intmask &= ~SDHCI_INT_RESPONSE); | ||||
} | } | ||||
/* Set command argument. */ | /* Set command argument. */ | ||||
WR4(slot, SDHCI_ARGUMENT, cmd->arg); | WR4(slot, SDHCI_ARGUMENT, cmd->arg); | ||||
/* Set data transfer mode. */ | /* Set data transfer mode. */ | ||||
sdhci_set_transfer_mode(slot, cmd->data); | sdhci_set_transfer_mode(slot, cmd->data); | ||||
if (__predict_false(sdhci_debug > 1)) | if (__predict_false(sdhci_debug > 1)) | ||||
slot_printf(slot, "Starting command!\n"); | slot_printf(slot, "Starting command opcode %#04x flags %#04x\n", | ||||
cmd->opcode, flags); | |||||
/* Start command. */ | /* Start command. */ | ||||
WR2(slot, SDHCI_COMMAND_FLAGS, (cmd->opcode << 8) | (flags & 0xff)); | WR2(slot, SDHCI_COMMAND_FLAGS, (cmd->opcode << 8) | (flags & 0xff)); | ||||
/* Start timeout callout. */ | /* Start timeout callout. */ | ||||
callout_reset(&slot->timeout_callout, slot->timeout * hz, | callout_reset(&slot->timeout_callout, slot->timeout * hz, | ||||
sdhci_timeout, slot); | sdhci_timeout, slot); | ||||
} | } | ||||
static void | static void | ||||
sdhci_finish_command(struct sdhci_slot *slot) | sdhci_finish_command(struct sdhci_slot *slot) | ||||
{ | { | ||||
int i; | int i; | ||||
uint32_t val; | uint32_t val; | ||||
uint8_t extra; | uint8_t extra; | ||||
if (__predict_false(sdhci_debug > 1)) | if (__predict_false(sdhci_debug > 1)) | ||||
slot_printf(slot, "%s: called, err %d flags %d\n", | slot_printf(slot, "%s: called, err %d flags %#04x\n", | ||||
__func__, slot->curcmd->error, slot->curcmd->flags); | __func__, slot->curcmd->error, slot->curcmd->flags); | ||||
slot->cmd_done = 1; | slot->cmd_done = 1; | ||||
/* | /* | ||||
* Interrupt aggregation: Restore command interrupt. | * Interrupt aggregation: Restore command interrupt. | ||||
* Main restore point for the case when command interrupt | * Main restore point for the case when command interrupt | ||||
* happened first. | * happened first. | ||||
*/ | */ | ||||
if (__predict_true(slot->curcmd->opcode != MMC_SEND_TUNING_BLOCK && | if (__predict_true(slot->curcmd->opcode != MMC_SEND_TUNING_BLOCK && | ||||
Show All 24 Lines | if (slot->curcmd->flags & MMC_RSP_136) { | ||||
(val << 8) | extra; | (val << 8) | extra; | ||||
extra = val >> 24; | extra = val >> 24; | ||||
} | } | ||||
} | } | ||||
} else | } else | ||||
slot->curcmd->resp[0] = RD4(slot, SDHCI_RESPONSE); | slot->curcmd->resp[0] = RD4(slot, SDHCI_RESPONSE); | ||||
} | } | ||||
if (__predict_false(sdhci_debug > 1)) | if (__predict_false(sdhci_debug > 1)) | ||||
printf("Resp: %02x %02x %02x %02x\n", | slot_printf(slot, "Resp: %#04x %#04x %#04x %#04x\n", | ||||
slot->curcmd->resp[0], slot->curcmd->resp[1], | slot->curcmd->resp[0], slot->curcmd->resp[1], | ||||
slot->curcmd->resp[2], slot->curcmd->resp[3]); | slot->curcmd->resp[2], slot->curcmd->resp[3]); | ||||
/* If data ready - finish. */ | /* If data ready - finish. */ | ||||
if (slot->data_done) | if (slot->data_done) | ||||
sdhci_start(slot); | sdhci_start(slot); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,005 Lines • Show Last 20 Lines |