Commit d096614c authored by Thomas Schäfer's avatar Thomas Schäfer
Browse files

pitx-imx8m: add bootsource environment variable



- detect CPU boot source and set 'bootsource' environment variable
  1: boot from eMMC
  2: boot from SD card
Signed-off-by: Thomas Schäfer's avatarThomas Schaefer <thomas.schaefer@kontron.com>
parent fdcf0753
......@@ -18,6 +18,7 @@
#include <asm/arch/sys_proto.h>
#include <asm/mach-imx/gpio.h>
#include <asm/mach-imx/mxc_i2c.h>
#include <asm/mach-imx/boot_mode.h>
#include <asm/arch/clock.h>
#include <asm/mach-imx/video.h>
#include <asm/arch/video_common.h>
......@@ -30,6 +31,8 @@
#include <i2c.h>
#include <search.h>
#include <environment.h>
#include "pitx-imx8m.h"
#include "../common/emb_eep.h"
extern int EMB_EEP_I2C_EEPROM_BUS_NUM_1;
......@@ -488,8 +491,38 @@ int misc_init_r(void)
return 0;
}
static enum boot_source pitx_imx8m_boot_source(void)
{
enum boot_device bdev = get_boot_device();
switch(bdev) {
case MMC1_BOOT:
case MMC2_BOOT:
case MMC3_BOOT:
case MMC4_BOOT:
/*
* USDHC port 1-4 can be used to
* attach an eMMC device.
*/
return BOOT_SOURCE_MMC;
case SD1_BOOT:
case SD2_BOOT:
case SD3_BOOT:
case SD4_BOOT:
/*
* USDHC port 1-4 can be used to
* attach an SD card device.
*/
return BOOT_SOURCE_SDHC;
default:
printf("Unknown bootsource %d\n", bdev);
return BOOT_SOURCE_UNKNOWN;
};
}
int board_late_init(void)
{
env_set_ulong("bootsource", pitx_imx8m_boot_source());
#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
env_set("board_name", "PITX-iMX8M");
env_set("board_rev", "iMX8MQ");
......
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright (c) 2020 Kontron Europe GmbH
*/
#ifndef __PITX_IMX8M_H__
#define __PITX_IMX8M_H__
enum boot_source
{
BOOT_SOURCE_UNKNOWN,
BOOT_SOURCE_MMC,
BOOT_SOURCE_SDHC,
};
static enum boot_source pitx_imx8m_boot_source(void);
#endif
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment