Index: sys/dev/sdhci/sdhci.c =================================================================== --- sys/dev/sdhci/sdhci.c (revision 231964) +++ sys/dev/sdhci/sdhci.c (working copy) @@ -76,6 +76,11 @@ #define SDHCI_QUIRK_BROKEN_TIMINGS (1<<8) /* Controller needs lowered frequency */ #define SDHCI_QUIRK_LOWER_FREQUENCY (1<<9) +/* Temp hack for SDHCI 3.0 freq handling */ +#define SDHCI_QUIRK_30_HACK (1<<10) +/* Temp hacks for Ax Bugs */ +#define SDHCI_QUIRK_FORCE_CARD_DETECT (1<<11) +#define SDHCI_QUIRK_HW_RESET_CONTROL (1<<12) static const struct sdhci_device { uint32_t model; @@ -106,6 +111,10 @@ { 0x2381197B, 0xffff, "JMicron JMB38X SD", SDHCI_QUIRK_32BIT_DMA_SIZE | SDHCI_QUIRK_RESET_AFTER_REQUEST }, + { 0x1018184e, 0xffff, "XLP SoC SD", + SDHCI_QUIRK_30_HACK | + SDHCI_QUIRK_FORCE_CARD_DETECT | + SDHCI_QUIRK_HW_RESET_CONTROL }, { 0, 0xffff, NULL, 0 } }; @@ -390,6 +399,8 @@ /* Looking for highest freq <= clock. */ res = slot->max_clk; for (clk = 1; clk < 256; clk <<= 1) { + if (clk == 1 && (slot->sc->quirks & SDHCI_QUIRK_30_HACK)) + continue; if (res <= clock) break; res >>= 1; @@ -452,6 +463,8 @@ WR1(slot, SDHCI_POWER_CONTROL, pwr); /* Turn on the power. */ pwr |= SDHCI_POWER_ON; + if (slot->sc->quirks & SDHCI_QUIRK_HW_RESET_CONTROL) + pwr |= 0x10; WR1(slot, SDHCI_POWER_CONTROL, pwr); } @@ -574,7 +587,8 @@ struct sdhci_slot *slot = arg; SDHCI_LOCK(slot); - if (RD4(slot, SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT) { + if ((slot->sc->quirks & SDHCI_QUIRK_FORCE_CARD_DETECT) || + RD4(slot, SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT) { if (slot->dev == NULL) { /* If card is present - attach mmc bus. */ slot->dev = device_add_child(slot->sc->dev, "mmc", -1);