summaryrefslogtreecommitdiff
path: root/board/logicpd/imx6
diff options
context:
space:
mode:
authorAdam Ford <aford173@gmail.com>2019-10-08 08:01:12 -0500
committerStefano Babic <sbabic@denx.de>2019-10-08 16:36:37 +0200
commit9fb50c68daa696056c7842989e5f7fae1d326b34 (patch)
tree42df2a1658e416dc8c2ed0c67725bd2fc5dd1115 /board/logicpd/imx6
parent63ce94b16b3527bc6944d1ab8b2572c6f39e0aef (diff)
ARM: imx6q_logic: Fix MMC2 booting
With the reverting of a previous change to spl_boot_device, this board needs a new solution to determining if we're booting from MMC1 or MMC2. This patch creates board_boot_order function which overrides the standard, and returns not only MMC1, or MMC2, but also can fall back to NAND or the serial downloader should other boot options fail. Signed-off-by: Adam Ford <aford173@gmail.com>
Diffstat (limited to 'board/logicpd/imx6')
-rw-r--r--board/logicpd/imx6/imx6logic.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/board/logicpd/imx6/imx6logic.c b/board/logicpd/imx6/imx6logic.c
index 7fb6dc42c6..4bacd8660a 100644
--- a/board/logicpd/imx6/imx6logic.c
+++ b/board/logicpd/imx6/imx6logic.c
@@ -207,6 +207,35 @@ struct fsl_esdhc_cfg usdhc_cfg[] = {
{USDHC2_BASE_ADDR} /* Baseboard */
};
+void board_boot_order(u32 *spl_boot_list)
+{
+ struct src *psrc = (struct src *)SRC_BASE_ADDR;
+ unsigned int reg = readl(&psrc->sbmr1) >> 11;
+ /*
+ * Upon reading BOOT_CFG register the following map is done:
+ * Bit 11 and 12 of BOOT_CFG register can determine the current
+ * mmc port
+ * 0x1 SD1-SOM
+ * 0x2 SD2-Baseboard
+ */
+
+ reg &= 0x3; /* Only care about bottom 2 bits */
+ switch (reg) {
+ case 0:
+ spl_boot_list[0] = BOOT_DEVICE_MMC1;
+ break;
+ case 1:
+ spl_boot_list[0] = BOOT_DEVICE_MMC2;
+ break;
+ }
+
+ /* If we cannot find a valid MMC/SD card, try NAND */
+ spl_boot_list[1] = BOOT_DEVICE_NAND;
+
+ /* As a last resort, use serial downloader */
+ spl_boot_list[2] = BOOT_DEVICE_BOARD;
+}
+
int board_mmc_init(bd_t *bis)
{
struct src *psrc = (struct src *)SRC_BASE_ADDR;