From owner-freebsd-arm@FreeBSD.ORG Tue Jan 20 19:33:15 2009 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB17A106564A; Tue, 20 Jan 2009 19:33:15 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id A18728FC17; Tue, 20 Jan 2009 19:33:15 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n0KJVs5V002207; Tue, 20 Jan 2009 12:31:54 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Tue, 20 Jan 2009 12:32:30 -0700 (MST) Message-Id: <20090120.123230.-272218744.imp@bsdimp.com> To: mav@freebsd.org From: "M. Warner Losh" In-Reply-To: <20090120.122312.1543793985.imp@bsdimp.com> References: <20090120.114051.-854291995.imp@bsdimp.com> <4976215B.40302@FreeBSD.org> <20090120.122312.1543793985.imp@bsdimp.com> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: freebsd-arm@freebsd.org Subject: Re: Mount root from SD card? X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Jan 2009 19:33:16 -0000 In message: <20090120.122312.1543793985.imp@bsdimp.com> "M. Warner Losh" 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... Index: at91_mci.c =================================================================== --- at91_mci.c (revision 187479) +++ at91_mci.c (working copy) @@ -201,7 +201,10 @@ 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); @@ -295,6 +298,8 @@ clkdiv = (at91_master_clock / ios->clock) / 2; } if (ios->bus_width == bus_width_4 && sc->wire4) + return EINVAL; + 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); Warner