Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 May 2014 06:24:00 +0300
From:      "Sulev-Madis Silber (ketas)" <madis555@hot.ee>
To:        Warner Losh <imp@bsdimp.com>
Cc:        freebsd-arm <freebsd-arm@FreeBSD.org>
Subject:   Re: Patch to make BBB properly boot from eMMC every time
Message-ID:  <53743350.6080001@hot.ee>
In-Reply-To: <8FE89E4A-1398-4321-BBBC-CA377C7981B1@bsdimp.com>
References:  <5371E1F3.6080002@hot.ee> <8FE89E4A-1398-4321-BBBC-CA377C7981B1@bsdimp.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2014-05-13 17:03, Warner Losh wrote:
> 
> On May 13, 2014, at 3:12 AM, Sulev-Madis Silber (ketas) <madis555@hot.ee> 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).
>>
>> 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’s good info, but not sufficient. Does the problem go away if you put a DELAY(10) or something like that instead? That’s a better fix, or better yet, more nuanced retry...
> 

I should try. Recently, even printf doesn't fix it (~5 fails already,
sometimes repeatedly after hw reset)... it takes tens of seconds and
then fails. Probably retry or something entirely different in detection
code should be used there.


> Warner
> 
>> Actually ian@ made that patch, and was confused about results.
>>
>>
>> -------------------------------------------------------------------------
>> Index: sys/dev/mmc/mmc.c
>> ===================================================================
>> --- 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 = p8;
>>                data.len = 8;
>>                data.flags = MMC_DATA_WRITE;
>> -               mmc_wait_for_cmd(sc, &cmd, 0);
>> -
>> +               err = mmc_wait_for_cmd(sc, &cmd, 0);
>> +               if (err != 0)
>> +                       device_printf(sc->dev, "BUSTEST_W err %d\n", err);
>> +
>>                memset(&cmd, 0, sizeof(cmd));
>>                memset(&data, 0, sizeof(data));
>>                cmd.opcode = MMC_BUSTEST_R;
>> @@ -782,7 +784,12 @@ mmc_test_bus_width(struct mmc_softc *sc)
>>                data.len = 8;
>>                data.flags = MMC_DATA_READ;
>>                err = mmc_wait_for_cmd(sc, &cmd, 0);
>> -
>> +               if (err != 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"
> 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?53743350.6080001>