public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Ian Campbell <ijc@hellion.org.uk>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 4/6] sunxi: When we've both mmc0 and mmc2, detect from which one we're booting
Date: Sat, 04 Oct 2014 09:35:54 +0100	[thread overview]
Message-ID: <1412411754.17796.60.camel@hellion.org.uk> (raw)
In-Reply-To: <1412348759-4599-5-git-send-email-hdegoede@redhat.com>

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?

If it's just that then is it allowable to define CONFIG_SYS_MMC_ENV_DEV
as a call to a function which returns the appropriate number?

Or maybe mmc->block_dev.dev already doesn't correspond to the h/w
controller number? So dev==0 is completely arbitrary?

> +#if CONFIG_MMC_SUNXI_SLOT == 0 && CONFIG_MMC_SUNXI_SLOT_EXTRA == 2
> +	/*
> +	 * Both mmc0 and mmc2 are bootable, figure out where we're booting
> +	 * from. Try mmc0 first, just like the brom does.
> +	 */
> +	if (mmc_getcd(mmc0) && mmc_init(mmc0) == 0 &&
> +	    mmc0->block_dev.block_read(0, 16, 1, buf) == 1) {
> +		buf[12] = 0;
> +		if (strcmp(&buf[4], "eGON.BT0") == 0)
> +			return 0;

This just checks if the mmc is bootable, not necessarily that we booted
from it, does it? Or is "just like the brom does" implying that the
bootrom would always have booted mmc0 if this signature was there? is
that check sufficient or does the brom check other stuff, e.g.
signatures etc or have a fallback path if mmc0 fails to boot somehow?

Ian.

  reply	other threads:[~2014-10-04  8:35 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-03 15:05 [U-Boot] [PATCH 0/6] sunxi: Add second sdcard slot support, including eMMC boot Hans de Goede
2014-10-03 15:05 ` [U-Boot] [PATCH 1/6] sunxi: Add sunxi_gpio_get_val function Hans de Goede
2014-10-04  8:14   ` Ian Campbell
2014-10-05 14:42     ` Hans de Goede
2014-10-03 15:05 ` [U-Boot] [PATCH 2/6] sunxi: Add mmc card-detect functionality Hans de Goede
2014-10-04  8:30   ` Ian Campbell
2014-10-05 14:58     ` Hans de Goede
2014-10-03 15:05 ` [U-Boot] [PATCH 3/6] sunxi: Turn MMC_SUNXI_SLOT_EXTRA into a proper Kconfig option Hans de Goede
2014-10-04  8:32   ` Ian Campbell
2014-10-05 15:00     ` Hans de Goede
2014-10-06  8:30       ` Ian Campbell
2014-10-03 15:05 ` [U-Boot] [PATCH 4/6] sunxi: When we've both mmc0 and mmc2, detect from which one we're booting Hans de Goede
2014-10-04  8:35   ` Ian Campbell [this message]
2014-10-05 15:10     ` Hans de Goede
2014-10-06  8:33       ` Ian Campbell
2014-10-06 14:23         ` Hans de Goede
2014-10-03 15:05 ` [U-Boot] [PATCH 5/6] sunxi: Use PG3 - PG8 as io-pins for mmc1 Hans de Goede
2014-10-04  8:37   ` Ian Campbell
2014-10-06  8:37     ` Hans de Goede
2014-10-06  8:42       ` Ian Campbell
2014-10-06 14:43     ` Hans de Goede
2014-10-06 15:42       ` Ian Campbell
2014-10-03 15:05 ` [U-Boot] [PATCH 6/6] sunxi: Enable second sdcard slot found on some boards Hans de Goede
2014-10-04  8:38   ` Ian Campbell
2014-10-04  8:39     ` Ian Campbell
2014-10-06  8:37       ` Hans de Goede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1412411754.17796.60.camel@hellion.org.uk \
    --to=ijc@hellion.org.uk \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox