Mount root from SD card?

Alexander Motin mav at FreeBSD.org
Wed Jan 21 00:54:28 PST 2009


Alexander Motin wrote:
> Alexander Motin wrote:
>> M. Warner Losh wrote:
>>> In message: <20090120.122312.1543793985.imp at bsdimp.com>
>>>             "M. Warner Losh" <imp at bsdimp.com> writes:
>>> : : IMHO it is incorrect to disable 4bit mode on that stage, it is
>>> too late : : there. It should be done at controller capabilities
>>> announcement stage. : : If you are not objecting, I would remove that
>>> wire4 variable.
>>> : : I am objecting.  The code is there so that the rest of the driver
>>> does
>>> : the right thing when doing 4-bit.  It needs to be a capability too.
>>> : : However, before we go monkeying with this, we need to find the
>>> : underlying bug.
>>>
>>> I've got the following patch, untested, that I think does what I think
>>> needs to be done.  Not sure about the return value from update_ios...

I would prefer attached variant. It will also disable 4-bit support by
default, but will make it properly. How do you plan to control that
wire4 variable? With device.hints?

-- 
Alexander Motin
-------------- next part --------------
--- at91_mci.c.prev	2009-01-20 19:36:58.000000000 +0200
+++ at91_mci.c	2009-01-21 10:46:00.000000000 +0200
@@ -201,7 +201,10 @@ at91_mci_attach(device_t dev)
 	sc->host.f_min = 375000;
 	sc->host.f_max = 30000000;
 	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 freebsd-arm mailing list