From: Ian Campbell Date: Mon, 06 Oct 2014 09:33:34 +0100 Subject: [U-Boot] [PATCH 4/6] sunxi: When we've both mmc0 and mmc2, detect from which one we're booting In-Reply-To: <54315F71.7070609@redhat.com> References: <1412348759-4599-1-git-send-email-hdegoede@redhat.com> <1412348759-4599-5-git-send-email-hdegoede@redhat.com> <1412411754.17796.60.camel@hellion.org.uk> <54315F71.7070609@redhat.com> Message-ID: <1412584414.12695.48.camel@hellion.org.uk> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Sun, 2014-10-05 at 17:10 +0200, Hans de Goede wrote: > > On 10/04/2014 10:35 AM, Ian Campbell wrote: > > On Fri, 2014-10-03 at 17:05 +0200, Hans de Goede wrote: > >> sunxi SOCs can boot from both mmc0 and mmc2, detect from which one we're > >> booting, and make that one "mmc dev 0" so that a single u-boot binary can > >> be used for both the onboard eMMC and for external sdcards. > > > > Where does the dependency on dev 0 being the boot device come from? Is > > it just the env via CONFIG_SYS_MMC_ENV_DEV? > > No, the main reason why we need dev 0 to be the mmc we're actually booting > from is because that is where the SPL will load the tertiary payload > (the actual u-boot binary in our case) from, see: > > common/spl/spl_mmc.c > > Which has dev 0 hardcoded everywhere. I see. Could you paste this bit of reasoning into the commit log please? (pretty much s/No, t/T/ on the above would do IMHO) > There is no fallback path, if you insert a sdcard with a bad > u-boot build, things will just hang, the brom is not smart enough > to switch over to an internal boot medium in this case. So I believe > that the check which I'm adding should be sufficient to determine whether > or not we're booting from mmc0. I really don't expect people to leave > a bootable sdcard in slot0, they could have a sdcard there to store data, > but in that case I would expect it to not have the magic boot signature. This makes sense too, thanks. Ian