From owner-freebsd-arm@FreeBSD.ORG Tue May 13 14:03:36 2014 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E5911506 for ; Tue, 13 May 2014 14:03:36 +0000 (UTC) Received: from mail-ie0-f175.google.com (mail-ie0-f175.google.com [209.85.223.175]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AC4FA29B1 for ; Tue, 13 May 2014 14:03:36 +0000 (UTC) Received: by mail-ie0-f175.google.com with SMTP id y20so346647ier.20 for ; Tue, 13 May 2014 07:03:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:content-type:mime-version:subject:from :in-reply-to:date:cc:message-id:references:to; bh=YW4pi2/NX3LuPiEo1XAm+q1IRlZ8sj/OPsy42xdsuHI=; b=JYLZNUFvoWCsFMdEAiObiAWiHE2P+d3KDW3ZZQe7IpRwGIsn2dLubJWy98kvcbg+Vd 1I5koM9jnVHeXBO+teJj56NIJUXI97LxCdBGWBJLuAnYoEwQhUsJ/4sl+5ezJVKg4BpH 7NW/G/7yL9W7aH+ktXxNnklyRaKrYsFzMSG19UugnH3unR4ouJEIhLYVQZw215x/cAZO jMiWZOM+lqg+0OZFhI0cajeIizzpAUqBXX6kcwTZPPl+GD08AQIhtm7JNM4TzUrEs4a2 Ca1FC7EwpkyszxgFRRMJz/JA+pe+u+ShcFt4NHUGD86APBf7NOyFPnzGxkM2KAG3djGK B9Eg== X-Gm-Message-State: ALoCoQk/HjqjIJ15j3X9PZsTIkDE0C+FXKF0rt3vDh8Ze9tnUgNblkPjqe/mHXWKlPeNOIzbvoEg X-Received: by 10.50.128.162 with SMTP id np2mr58833563igb.22.1399989809903; Tue, 13 May 2014 07:03:29 -0700 (PDT) Received: from [172.29.67.66] (63-156-62-129.dia.static.qwest.net. [63.156.62.129]) by mx.google.com with ESMTPSA id pi3sm30327867igb.5.2014.05.13.07.03.28 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 May 2014 07:03:28 -0700 (PDT) Sender: Warner Losh Content-Type: multipart/signed; boundary="Apple-Mail=_A3435621-31A0-41D8-837C-F9BFFB27DAA0"; protocol="application/pgp-signature"; micalg=pgp-sha512 Mime-Version: 1.0 (Mac OS X Mail 7.2 \(1874\)) Subject: Re: Patch to make BBB properly boot from eMMC every time From: Warner Losh In-Reply-To: <5371E1F3.6080002@hot.ee> Date: Tue, 13 May 2014 08:03:27 -0600 Message-Id: <8FE89E4A-1398-4321-BBBC-CA377C7981B1@bsdimp.com> References: <5371E1F3.6080002@hot.ee> To: "Sulev-Madis Silber (ketas)" X-Mailer: Apple Mail (2.1874) Cc: freebsd-arm X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 May 2014 14:03:37 -0000 --Apple-Mail=_A3435621-31A0-41D8-837C-F9BFFB27DAA0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 On May 13, 2014, at 3:12 AM, Sulev-Madis Silber (ketas) = wrote: > On my BBB, I need following patch to boot from eMMC 100% of cases. > Without that, device is detected with 1 / 4 bit bus (it's actually 8 > bit) or not at all (then boot fails). >=20 > Actually, that code looks like weird way to implement sleep(), or at > least it has such (side) effect. So you added a printf and the problem went away. That=92s good info, but = not sufficient. Does the problem go away if you put a DELAY(10) or = something like that instead? That=92s a better fix, or better yet, more = nuanced retry... Warner > Actually ian@ made that patch, and was confused about results. >=20 >=20 > = ------------------------------------------------------------------------- > Index: sys/dev/mmc/mmc.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- sys/dev/mmc/mmc.c (revision 264141) > +++ sys/dev/mmc/mmc.c (working copy) > @@ -769,8 +769,10 @@ mmc_test_bus_width(struct mmc_softc *sc) > data.data =3D p8; > data.len =3D 8; > data.flags =3D MMC_DATA_WRITE; > - mmc_wait_for_cmd(sc, &cmd, 0); > - > + err =3D mmc_wait_for_cmd(sc, &cmd, 0); > + if (err !=3D 0) > + device_printf(sc->dev, "BUSTEST_W err %d\n", = err); > + > memset(&cmd, 0, sizeof(cmd)); > memset(&data, 0, sizeof(data)); > cmd.opcode =3D MMC_BUSTEST_R; > @@ -782,7 +784,12 @@ mmc_test_bus_width(struct mmc_softc *sc) > data.len =3D 8; > data.flags =3D MMC_DATA_READ; > err =3D mmc_wait_for_cmd(sc, &cmd, 0); > - > + if (err !=3D 0) > + device_printf(sc->dev, "BUSTEST_R err %d\n", = err); > + > + device_printf(sc->dev, "read %02x %02x %02x %02x %02x > %02x %02x %02x\n", > + buf[0], buf[1], buf[2], buf[3], buf[4], = buf[5], > buf[6], buf[7]); > + > mmcbr_set_bus_width(sc->dev, bus_width_1); > mmcbr_update_ios(sc->dev); > = ------------------------------------------------------------------------- > _______________________________________________ > freebsd-arm@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-arm > To unsubscribe, send any mail to "freebsd-arm-unsubscribe@freebsd.org" --Apple-Mail=_A3435621-31A0-41D8-837C-F9BFFB27DAA0 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJTciYvAAoJEGwc0Sh9sBEAMw4QALZ3QZ0d1NoEAWpT14L2w5s4 5xmViT2vOMfVan1Uu8LsGoI0th+VY04dD1KhJsKYvYsDb1gREgp2LwOllxwMEa26 N8uMRoXes5/SBjuhXTgTUD8Iz9IjaPH9+UpoNrddU5VhA7OtjUXYgLWMwQc9aL5c dMlTM3r4305xrwoLQnQf4zq36vAPgsvodoiH2TDmac9wTcWdugGPfsCUqC2TnoTG qepbxWDW8uD4IoUwtb3JOfB2HWmnwfFGt6ZUyLpD1C3K2VFKgTRK9HNscqHaKdAL xTcXlyrG3dSaLiHwUCkvMnmWXHT8SOiI1OYXbnzWzRqgD6g1PpUB780yq/84ig2d 8MTeeiib1tEXPcdSZ19YH+nIsrPtpYz+q8wtXjEzO9azyxgYj2FEeLyZYRNQiWDj WMkyl+QPftM2V2H6oofn5DMOjAppQzixGd5+Uw6vpkmxn3MgEE0GC12C6kV0vq1y AS8M4Kv57kzqZlDhhud/v5iN0uwzBPMzuJ/Z86o1iTQLEp6GL9ynH08KxIGPQym6 F5UpBIso+RYY93BrPWDuiCS5N6PjuL43je1LrE8DiUEYNOkeT6RI0qFaCfrVR5T4 TwyQ1FeTOhMJ95fVQjQNElmrW6GosVdBrpPZ25KP3Q2X9V00TdH6xUJ6X85JDUIV Ef/u76dU/ZHrPVtMtNRl =yrhZ -----END PGP SIGNATURE----- --Apple-Mail=_A3435621-31A0-41D8-837C-F9BFFB27DAA0--