svn commit: r273264 - head/sys/arm/broadcom/bcm2835
Luiz Otavio O Souza
loos at FreeBSD.org
Sat Oct 18 19:01:08 UTC 2014
Author: loos
Date: Sat Oct 18 19:01:07 2014
New Revision: 273264
URL: https://svnweb.freebsd.org/changeset/base/273264
Log:
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
Modified:
head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c
Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c
==============================================================================
--- head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Sat Oct 18 18:27:24 2014 (r273263)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Sat Oct 18 19:01:07 2014 (r273264)
@@ -312,21 +312,15 @@ RD4(struct bcm_sdhci_softc *sc, bus_size
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));
- }
+ bus_space_write_4(sc->sc_bst, sc->sc_bsh, off, val);
+ /*
+ * 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
More information about the svn-src-all
mailing list