svn commit: r331034 - stable/11/sys/dev/sdhci
Marius Strobl
marius at FreeBSD.org
Thu Mar 15 22:58:31 UTC 2018
Author: marius
Date: Thu Mar 15 22:58:31 2018
New Revision: 331034
URL: https://svnweb.freebsd.org/changeset/base/331034
Log:
MFC: r327339, r327924
- There is no need to keep the tuning error and re-tuning interrupts
enabled (though, no interrupt generation enabled for them) all the
time as soon as (re-)tuning is supported; only enable them and let
them generate interrupts when actually using (re-)tuning.
- Also disable all interrupts except SDHCI_INT_DATA_AVAIL ones while
executing tuning and not just their signaling.
- Set the tuning error and re-tuning interrupt enable bits based on
the SDHCI_TUNING_ENABLED rather than the SDHCI_TUNING_SUPPORTED flag,
i. e. only when (re-)tuning is actually used. Currently, this change
makes no net difference, though.
Modified:
stable/11/sys/dev/sdhci/sdhci.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/dev/sdhci/sdhci.c
==============================================================================
--- stable/11/sys/dev/sdhci/sdhci.c Thu Mar 15 22:51:13 2018 (r331033)
+++ stable/11/sys/dev/sdhci/sdhci.c Thu Mar 15 22:58:31 2018 (r331034)
@@ -255,7 +255,7 @@ sdhci_tuning_intmask(struct sdhci_slot *slot)
uint32_t intmask;
intmask = 0;
- if (slot->opt & SDHCI_TUNING_SUPPORTED) {
+ if (slot->opt & SDHCI_TUNING_ENABLED) {
intmask |= SDHCI_INT_TUNEERR;
if (slot->retune_mode == SDHCI_RETUNE_MODE_2 ||
slot->retune_mode == SDHCI_RETUNE_MODE_3)
@@ -283,7 +283,7 @@ sdhci_init(struct sdhci_slot *slot)
slot->intmask |= SDHCI_INT_CARD_REMOVE | SDHCI_INT_CARD_INSERT;
}
- WR4(slot, SDHCI_INT_ENABLE, slot->intmask | sdhci_tuning_intmask(slot));
+ WR4(slot, SDHCI_INT_ENABLE, slot->intmask);
WR4(slot, SDHCI_SIGNAL_ENABLE, slot->intmask);
}
@@ -575,6 +575,7 @@ sdhci_card_task(void *arg, int pending __unused)
d = slot->dev;
slot->dev = NULL;
slot->intmask &= ~sdhci_tuning_intmask(slot);
+ WR4(slot, SDHCI_INT_ENABLE, slot->intmask);
WR4(slot, SDHCI_SIGNAL_ENABLE, slot->intmask);
slot->opt &= ~SDHCI_TUNING_ENABLED;
SDHCI_UNLOCK(slot);
@@ -1251,6 +1252,7 @@ sdhci_generic_tune(device_t brdev __unused, device_t r
if (err == 0) {
slot->opt |= SDHCI_TUNING_ENABLED;
slot->intmask |= sdhci_tuning_intmask(slot);
+ WR4(slot, SDHCI_INT_ENABLE, slot->intmask);
WR4(slot, SDHCI_SIGNAL_ENABLE, slot->intmask);
if (slot->retune_ticks) {
callout_reset(&slot->retune_callout, slot->retune_ticks,
@@ -1319,6 +1321,7 @@ sdhci_exec_tuning(struct sdhci_slot *slot, bool reset)
*/
intmask = slot->intmask;
slot->intmask = SDHCI_INT_DATA_AVAIL;
+ WR4(slot, SDHCI_INT_ENABLE, SDHCI_INT_DATA_AVAIL);
WR4(slot, SDHCI_SIGNAL_ENABLE, SDHCI_INT_DATA_AVAIL);
hostctrl2 = RD2(slot, SDHCI_HOST_CONTROL2);
@@ -1349,8 +1352,17 @@ sdhci_exec_tuning(struct sdhci_slot *slot, bool reset)
DELAY(1000);
}
+ /*
+ * Restore DMA usage and interrupts.
+ * Note that the interrupt aggregation code might have cleared
+ * SDHCI_INT_DMA_END and/or SDHCI_INT_RESPONSE in slot->intmask
+ * and SDHCI_SIGNAL_ENABLE respectively so ensure SDHCI_INT_ENABLE
+ * doesn't lose these.
+ */
slot->opt = opt;
slot->intmask = intmask;
+ WR4(slot, SDHCI_INT_ENABLE, intmask | SDHCI_INT_DMA_END |
+ SDHCI_INT_RESPONSE);
WR4(slot, SDHCI_SIGNAL_ENABLE, intmask);
if ((hostctrl2 & (SDHCI_CTRL2_EXEC_TUNING |
More information about the svn-src-stable-11
mailing list