@@ -130,7 +130,8 @@ static const struct sdhci_pci_fixes sdhci_ricoh_mmc = {
static const struct sdhci_pci_fixes sdhci_ene_712 = {
.quirks = SDHCI_QUIRK_SINGLE_POWER_WRITE |
- SDHCI_QUIRK_BROKEN_DMA,
+ SDHCI_QUIRK_BROKEN_DMA |
+ SDHCI_QUIRK_1BIT_INTERRUPT,
};
static const struct sdhci_pci_fixes sdhci_ene_714 = {
@@ -245,6 +245,27 @@ static void sdhci_led_control(struct led_classdev *led,
}
#endif
+/* handle bus case where controller cannot detect CIRQ reliably when in 4-bit mode */
+static void sdhci_idle_bus_adjust(struct sdhci_host *host, u8 idle)
+{
+ u8 ctrl;
+
+ if (!(host->flags & SDHCI_IN_4BIT_MODE))
+ return;
+
+ if (!(host->quirks & SDHCI_QUIRK_1BIT_INTERRUPT))
+ return;
+
+ /* while bus is idle, leave it in 1-bit mode at the controller level */
+ ctrl = readb(host->ioaddr + SDHCI_HOST_CONTROL);
+ ctrl &= ~SDHCI_CTRL_4BITBUS;
+
+ if (!idle)
+ ctrl |= SDHCI_CTRL_4BITBUS;
+
+ writeb(ctrl, host->ioaddr + SDHCI_HOST_CONTROL);
+}
+
/*****************************************************************************\
* *
* Core functions *
@@ -919,6 +940,8 @@ static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd)
mod_timer(&host->timer, jiffies + 10 * HZ);
+ sdhci_idle_bus_adjust(host, 0);
+
host->cmd = cmd;
sdhci_prepare_data(host, cmd->data);
@@ -1374,6 +1397,8 @@ static void sdhci_tasklet_finish(unsigned long param)
host->cmd = NULL;
host->data = NULL;
+ sdhci_idle_bus_adjust(host, 1);
+
#ifndef SDHCI_USE_LEDS_CLASS
sdhci_deactivate_led(host);
#endif
@@ -85,6 +85,8 @@ struct sdhci_host {
#define SDHCI_QUIRK_NO_HISPD_BIT (1<<29)
/* Controller treats ADMA descriptors with length 0000h incorrectly */
#define SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC (1<<30)
+/* Controller cannot detect CIRQ reliably when in 4-bit mode */
+#define SDHCI_QUIRK_1BIT_INTERRUPT (1<<31)
int irq; /* Device IRQ */
void __iomem *ioaddr; /* Mapped address */