Add a workaround needed to fix a bug of Arasan Host Controller where it may

lose the contents of consecutive writes (that happens within two SD card
clock cycles).

This fixes the causes of instability during the SD card detection and
identification on Raspberry Pi (which happens at 400 kHz and so was much
more vulnerable to this issue).

Remove the previous workaround which clearly can't provide the same effect.

MFC after:	1 week
Relnotes:	yes
This commit is contained in:
Luiz Otavio O Souza 2014-10-18 19:01:07 +00:00
parent bcf1cd88da
commit 7c26b0a7c8

View File

@ -312,21 +312,15 @@ RD4(struct bcm_sdhci_softc *sc, bus_size_t off)
static inline void
WR4(struct bcm_sdhci_softc *sc, bus_size_t off, uint32_t val)
{
bus_space_write_4(sc->sc_bst, sc->sc_bsh, off, val);
if ((off != SDHCI_BUFFER && off != SDHCI_INT_STATUS && off != SDHCI_CLOCK_CONTROL))
{
int timeout = 100000;
while (val != bus_space_read_4(sc->sc_bst, sc->sc_bsh, off)
&& --timeout > 0)
continue;
if (timeout <= 0)
printf("sdhci_brcm: writing 0x%X to reg 0x%X "
"always gives 0x%X\n",
val, (uint32_t)off,
bus_space_read_4(sc->sc_bst, sc->sc_bsh, off));
}
/*
* The Arasan HC has a bug where it may lose the content of
* consecutive writes to registers that are within two SD-card
* clock cycles of each other (a clock domain crossing problem).
*/
if (sc->sc_slot.clock > 0)
DELAY(((2 * 1000000) / sc->sc_slot.clock) + 1);
}
static uint8_t