mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-13 15:03:58 +03:00
This patch renames the board directory from board/freescale to board/nxp because NXP now provides Board Support Packages (BSPs) and tools for the former Freescale i.MX and other i.MX products. All relevant references have been updated accordingly. This change does not affect functionality. Signed-off-by: Alice Guo <alice.guo@nxp.com> Reviewed-by: Fabio Estevam <festevam@gmail.com>
50 lines
952 B
C
50 lines
952 B
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* Copyright 2016 Freescale Semiconductor, Inc.
|
|
* Copyright 2018-2022 NXP
|
|
*/
|
|
|
|
#include <command.h>
|
|
#include <vsprintf.h>
|
|
#include <asm/arch/sys_proto.h>
|
|
#include <linux/errno.h>
|
|
#include <asm/io.h>
|
|
#include <stdbool.h>
|
|
#include <mmc.h>
|
|
#include <env.h>
|
|
|
|
static int check_mmc_autodetect(void)
|
|
{
|
|
char *autodetect_str = env_get("mmcautodetect");
|
|
|
|
if (autodetect_str && !strcmp(autodetect_str, "yes"))
|
|
return 1;
|
|
|
|
return 0;
|
|
}
|
|
|
|
/* This should be defined for each board */
|
|
__weak int mmc_map_to_kernel_blk(int dev_no)
|
|
{
|
|
return dev_no;
|
|
}
|
|
|
|
void board_late_mmc_env_init(void)
|
|
{
|
|
char cmd[32];
|
|
char mmcblk[32];
|
|
u32 dev_no = mmc_get_env_dev();
|
|
|
|
if (!check_mmc_autodetect())
|
|
return;
|
|
|
|
env_set_ulong("mmcdev", dev_no);
|
|
|
|
/* Set mmcblk env */
|
|
sprintf(mmcblk, "/dev/mmcblk%dp2 rootwait rw", mmc_map_to_kernel_blk(dev_no));
|
|
env_set("mmcroot", mmcblk);
|
|
|
|
sprintf(cmd, "mmc dev %d", dev_no);
|
|
run_command(cmd, 0);
|
|
}
|