public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Lukasz Majewski <lukma@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 03/11] imx: tpc70: Add board_boot_order() to distinguish between eMMC and SD boot
Date: Tue, 30 Jul 2019 09:12:05 +0200	[thread overview]
Message-ID: <20190730071213.11238-4-lukma@denx.de> (raw)
In-Reply-To: <20190730071213.11238-1-lukma@denx.de>

The TPC70 can boot from SD card (debug/development) and eMMC (production).
The board_boot_order() function provides a run time check for the device
from which one wants to boot (it is selected by GPIO pins setup).

Moreover, a fallback to SD card is provided if the detection is not
possible or working properly.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---

 board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c b/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c
index e284d5ec57..e48a577f79 100644
--- a/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c
+++ b/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c
@@ -308,6 +308,26 @@ int board_mmc_init(bd_t *bd)
 	return fsl_esdhc_initialize(bd, &usdhc_cfg[0]);
 }
 
+void board_boot_order(u32 *spl_boot_list)
+{
+	u32 boot_device = spl_boot_device();
+	u32 reg = imx6_src_get_boot_mode();
+
+	reg = (reg & IMX6_BMODE_MASK) >> IMX6_BMODE_SHIFT;
+
+	debug("%s: boot device: 0x%x (0x4 SD, 0x6 eMMC)\n", __func__, reg);
+	if (boot_device == BOOT_DEVICE_MMC1)
+		if (reg == IMX6_BMODE_MMC || reg == IMX6_BMODE_EMMC)
+			boot_device = BOOT_DEVICE_MMC2;
+
+	spl_boot_list[0] = boot_device;
+	/*
+	 * Below boot device is a 'fallback' - it shall always be possible to
+	 * boot from SD card
+	 */
+	spl_boot_list[1] = BOOT_DEVICE_MMC1;
+}
+
 void board_init_f(ulong dummy)
 {
 	/* setup AIPS and disable watchdog */
-- 
2.11.0

  parent reply	other threads:[~2019-07-30  7:12 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-30  7:12 [U-Boot] [PATCH v2 00/11] dm: Convert TPC70 to use DM and DTS in SPL and u-boot proper Lukasz Majewski
2019-07-30  7:12 ` [U-Boot] [PATCH v2 01/11] imx: tpc70: config: Add script commands to update u-boot and OE's wic Lukasz Majewski
2019-08-09  6:35   ` Peng Fan
2019-07-30  7:12 ` [U-Boot] [PATCH v2 02/11] imx: tpc70: config: Update TPC70 config to support eMMC's boot0 SPL update Lukasz Majewski
2019-08-09  7:03   ` Peng Fan
2019-07-30  7:12 ` Lukasz Majewski [this message]
2019-08-09  7:04   ` [U-Boot] [PATCH v2 03/11] imx: tpc70: Add board_boot_order() to distinguish between eMMC and SD boot Peng Fan
2019-07-30  7:12 ` [U-Boot] [PATCH v2 04/11] imx: tpc70: DTS: Explicitly add imx6q-kp.dtb to Makefile for DTB compilation Lukasz Majewski
2019-08-09  7:05   ` Peng Fan
2019-07-30  7:12 ` [U-Boot] [PATCH v2 05/11] imx: tpc70: cosmetic: Replace magic numbers when setting ENET clock Lukasz Majewski
2019-08-09  7:07   ` Peng Fan
2019-08-11 21:27     ` Lukasz Majewski
2019-07-30  7:12 ` [U-Boot] [PATCH v2 06/11] imx: tpc70: led: Enable LED default state Lukasz Majewski
2019-08-09  7:08   ` Peng Fan
2019-07-30  7:12 ` [U-Boot] [PATCH v2 07/11] imx: tpc70: dts: Add TPC70 board (imx6q based) device tree description Lukasz Majewski
2019-08-09  7:10   ` Peng Fan
2019-08-11 21:25     ` Lukasz Majewski
2019-08-11 23:55       ` Tom Rini
2019-08-12  6:39         ` Lukasz Majewski
2019-08-13  8:41   ` Peng Fan
2019-07-30  7:12 ` [U-Boot] [PATCH v2 08/11] imx: dts: Add u-boot specific set of device tree properties for tpc70 Lukasz Majewski
2019-07-30  7:12 ` [U-Boot] [PATCH v2 09/11] imx: tpc70: Convert TPC70 (imx6q) board to use DM/DTS in SPL and u-boot Lukasz Majewski
2019-07-30  7:12 ` [U-Boot] [PATCH v2 10/11] imx: spl: tpc70: Do not remove clock related properties from DTS Lukasz Majewski
2019-08-09  7:11   ` Peng Fan
2019-07-30  7:12 ` [U-Boot] [PATCH v2 11/11] imx: config: Update KP's TPC70 config to support SWUpdate Lukasz Majewski

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=20190730071213.11238-4-lukma@denx.de \
    --to=lukma@denx.de \
    --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