aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/sdhci
diff options
context:
space:
mode:
authorLuiz Otavio O Souza <loos@FreeBSD.org>2015-05-21 20:09:36 +0000
committerLuiz Otavio O Souza <loos@FreeBSD.org>2015-05-21 20:09:36 +0000
commitba6fc1c73c83dbd3f2eb33dd821ed35e4179b8d8 (patch)
treedac302b6ab37b478f088edfdcd5474b2bc35db17 /sys/dev/sdhci
parent9cf4cabed7cb36e1ce10aae27d710941293d7179 (diff)
Notes
Diffstat (limited to 'sys/dev/sdhci')
-rw-r--r--sys/dev/sdhci/sdhci.c11
-rw-r--r--sys/dev/sdhci/sdhci.h1
2 files changed, 10 insertions, 2 deletions
diff --git a/sys/dev/sdhci/sdhci.c b/sys/dev/sdhci/sdhci.c
index b9af721c0a35..b1fae2916ccf 100644
--- a/sys/dev/sdhci/sdhci.c
+++ b/sys/dev/sdhci/sdhci.c
@@ -615,10 +615,16 @@ sdhci_init_slot(device_t dev, struct sdhci_slot *slot, int num)
(slot->opt & SDHCI_HAVE_DMA) ? "DMA" : "PIO");
sdhci_dumpregs(slot);
}
-
+
+ slot->timeout = 10;
+ SYSCTL_ADD_INT(device_get_sysctl_ctx(slot->bus),
+ SYSCTL_CHILDREN(device_get_sysctl_tree(slot->bus)), OID_AUTO,
+ "timeout", CTLFLAG_RW, &slot->timeout, 0,
+ "Maximum timeout for SDHCI transfers (in secs)");
TASK_INIT(&slot->card_task, 0, sdhci_card_task, slot);
callout_init(&slot->card_callout, 1);
callout_init_mtx(&slot->timeout_callout, &slot->mtx, 0);
+
return (0);
}
@@ -872,7 +878,8 @@ sdhci_start_command(struct sdhci_slot *slot, struct mmc_command *cmd)
/* Start command. */
WR2(slot, SDHCI_COMMAND_FLAGS, (cmd->opcode << 8) | (flags & 0xff));
/* Start timeout callout. */
- callout_reset(&slot->timeout_callout, 2*hz, sdhci_timeout, slot);
+ callout_reset(&slot->timeout_callout, slot->timeout * hz,
+ sdhci_timeout, slot);
}
static void
diff --git a/sys/dev/sdhci/sdhci.h b/sys/dev/sdhci/sdhci.h
index b7d196039d0f..3c27d0c3cd22 100644
--- a/sys/dev/sdhci/sdhci.h
+++ b/sys/dev/sdhci/sdhci.h
@@ -271,6 +271,7 @@ struct sdhci_slot {
#define SDHCI_HAVE_DMA 1
#define SDHCI_PLATFORM_TRANSFER 2
u_char version;
+ int timeout; /* Transfer timeout */
uint32_t max_clk; /* Max possible freq */
uint32_t timeout_clk; /* Timeout freq */
bus_dma_tag_t dmatag;