svn commit: r187548 - head/sys/arm/at91

Warner Losh imp at FreeBSD.org
Wed Jan 21 09:39:13 PST 2009


Author: imp
Date: Wed Jan 21 17:39:11 2009
New Revision: 187548
URL: http://svn.freebsd.org/changeset/base/187548

Log:
  o The f_max is really at91_master_clock / 2, not 30MHz, so compute it as such.
  o Only set 4-bit caps on those boards that have 4-bit caps (this means that
    because we don't set wire4 yet, this forces us to always use 1-bit bus).
  o Don't test wire4 when setting up the bus width, since bad things will
    happen if we do.
  
  # This likely won't fix the busted at91 sd card support, but these are
  # needful changes for correctness.

Modified:
  head/sys/arm/at91/at91_mci.c

Modified: head/sys/arm/at91/at91_mci.c
==============================================================================
--- head/sys/arm/at91/at91_mci.c	Wed Jan 21 17:36:06 2009	(r187547)
+++ head/sys/arm/at91/at91_mci.c	Wed Jan 21 17:39:11 2009	(r187548)
@@ -199,9 +199,12 @@ at91_mci_attach(device_t dev)
 		goto out;
 	}
 	sc->host.f_min = 375000;
-	sc->host.f_max = 30000000;
+	sc->host.f_max = at91_master_clock / 2;	/* Typically 30MHz */
 	sc->host.host_ocr = MMC_OCR_320_330 | MMC_OCR_330_340;
-	sc->host.caps = MMC_CAP_4_BIT_DATA;
+	if (sc->wire4)
+		sc->host.caps = MMC_CAP_4_BIT_DATA;
+	else
+		sc->host.caps = 0;
 	child = device_add_child(dev, "mmc", 0);
 	device_set_ivars(dev, &sc->host);
 	err = bus_generic_attach(dev);
@@ -294,7 +297,7 @@ at91_mci_update_ios(device_t brdev, devi
 		else
 			clkdiv = (at91_master_clock / ios->clock) / 2;
 	}
-	if (ios->bus_width == bus_width_4 && sc->wire4)
+	if (ios->bus_width == bus_width_4)
 		WR4(sc, MCI_SDCR, RD4(sc, MCI_SDCR) | MCI_SDCR_SDCBUS);
 	else
 		WR4(sc, MCI_SDCR, RD4(sc, MCI_SDCR) & ~MCI_SDCR_SDCBUS);


More information about the svn-src-all mailing list