Merge branch 'next-dev' into thunder-boot

This commit is contained in:
Joseph Chen 2020-04-03 18:12:46 +08:00
commit a4d1e7eec0
12 changed files with 149 additions and 37 deletions

View File

@ -55,33 +55,6 @@ static int fit_is_required(void *fit, const void *sig_blob)
return 0;
}
static int fit_get_image_defconf_node(void *fit, int *images, int *defconf)
{
int images_node, confs_node, defconf_node;
const char *def_name;
images_node = fdt_path_offset(fit, FIT_IMAGES_PATH);
if (images_node < 0)
return images_node;
confs_node = fdt_path_offset(fit, FIT_CONFS_PATH);
if (confs_node < 0)
return confs_node;
def_name = fdt_getprop(fit, confs_node, FIT_DEFAULT_PROP, NULL);
if (!def_name)
return -ENOENT;
defconf_node = fdt_subnode_offset(fit, confs_node, def_name);
if (defconf_node < 0)
return defconf_node;
*images = images_node;
*defconf = defconf_node;
return 0;
}
int fit_fixup_load_entry(void *fit, int images, int defconf,
char *name, ulong *load, ulong new_addr)
{
@ -493,7 +466,7 @@ void *fit_image_load_bootables(ulong *size)
static void verbose_msg(void *fit, int defconf)
{
FIT_I("%ssigned, %srequired\n",
FIT_I("%ssigned, %sverified-boot\n",
fit_is_signed(fit, gd_fdt_blob()) ? "" : "no ",
fit_is_required(fit, gd_fdt_blob()) ? "" : "no ");

View File

@ -67,7 +67,7 @@
default = "conf@1";
conf@1 {
description = "Boot Linux kernel with FDT blob";
conf-version = <1>;
rollback-index = <0x0>;
fdt = "fdt@1";
kernel = "kernel@1";
ramdisk = "ramdisk@1";

View File

@ -68,7 +68,7 @@
default = "conf@1";
conf@1 {
description = "Boot Linux kernel with FDT blob";
conf-version = <1>;
rollback-index = <0x0>;
fdt = "fdt@1";
kernel = "kernel@1";
ramdisk = "ramdisk@1";

View File

@ -103,6 +103,7 @@ def append_fdt_node(file, dtbs):
def append_conf_section(file, cnt, dtname, atf_cnt):
print >> file, '\t\tconfig@%d {' % cnt
print >> file, '\t\t\tdescription = "Rockchip armv8 with ATF";'
print >> file, '\t\t\trollback-index = <0x0>;'
print >> file, '\t\t\tfirmware = "atf@1";'
print >> file, '\t\t\tloadables = "uboot@1",',
for i in range(1, atf_cnt):

View File

@ -66,6 +66,7 @@ cat << EOF
default = "conf@1";
conf@1 {
description = "Rockchip armv7 with OP-TEE";
rollback-index = <0x0>;
firmware = "optee@1";
loadables = "uboot@1";
fdt = "fdt@1";

View File

@ -1033,6 +1033,7 @@ int bootm_host_load_images(const void *fit, int cfg_noffset, int is_spl)
IH_TYPE_FLATDT,
IH_TYPE_RAMDISK,
};
#ifdef CONFIG_SPL_ATF
static uint8_t image_types_spl[] = {
IH_TYPE_FLATDT,
IH_TYPE_FIRMWARE,
@ -1040,6 +1041,13 @@ int bootm_host_load_images(const void *fit, int cfg_noffset, int is_spl)
IH_TYPE_LOADABLE,
IH_TYPE_LOADABLE,
};
#else
static uint8_t image_types_spl[] = {
IH_TYPE_FLATDT,
IH_TYPE_FIRMWARE,
IH_TYPE_LOADABLE,
};
#endif
int loadable_index = 0;
int err = 0;
int index;

View File

@ -949,6 +949,30 @@ int fit_image_get_data_size(const void *fit, int noffset, int *data_size)
return 0;
}
/**
* Get 'rollback-index' property from a given image node.
*
* @fit: pointer to the FIT image header
* @noffset: component image node offset
* @index: holds the rollback-index property
*
* returns:
* 0, on success
* -ENOENT if the property could not be found
*/
int fit_image_get_rollback_index(const void *fit, int noffset, uint32_t *index)
{
const fdt32_t *val;
val = fdt_getprop(fit, noffset, FIT_ROLLBACK_PROP, NULL);
if (!val)
return -ENOENT;
*index = fdt32_to_cpu(*val);
return 0;
}
/**
* fit_image_hash_get_algo - get hash algorithm name
* @fit: pointer to the FIT format image header
@ -1070,6 +1094,33 @@ int fit_set_timestamp(void *fit, int noffset, time_t timestamp)
return 0;
}
int fit_get_image_defconf_node(const void *fit, int *images_noffset, int *def_noffset)
{
int images_node, confs_node, defconf_node;
const char *def_name;
images_node = fdt_path_offset(fit, FIT_IMAGES_PATH);
if (images_node < 0)
return images_node;
confs_node = fdt_path_offset(fit, FIT_CONFS_PATH);
if (confs_node < 0)
return confs_node;
def_name = fdt_getprop(fit, confs_node, FIT_DEFAULT_PROP, NULL);
if (!def_name)
return -ENOENT;
defconf_node = fdt_subnode_offset(fit, confs_node, def_name);
if (defconf_node < 0)
return defconf_node;
*images_noffset = images_node;
*def_noffset = defconf_node;
return 0;
}
/**
* calculate_hash - calculate and return hash for provided input data
* @data: pointer to the input data

View File

@ -386,6 +386,13 @@ config GENERIC_ATMEL_MCI
the SD Memory Card Specification V2.0, the SDIO V2.0 specification
and CE-ATA V1.1.
config MMC_USE_PRE_CONFIG
bool "Enable to use pre-configure set by pre-loader or bootrom"
help
The MMC is initialized by pre-loader or bootrom, so it is no need to
initialize it again. Open this config to skip some unused initialized
process.
endif
config TEGRA124_MMC_DISABLE_EXT_LOOPBACK

View File

@ -386,6 +386,7 @@ static int mmc_go_idle(struct mmc *mmc)
return 0;
}
#ifndef CONFIG_MMC_USE_PRE_CONFIG
static int sd_send_op_cond(struct mmc *mmc)
{
int timeout = 1000;
@ -453,6 +454,7 @@ static int sd_send_op_cond(struct mmc *mmc)
return 0;
}
#endif
static int mmc_send_op_cond_iter(struct mmc *mmc, int use_arg)
{
@ -475,6 +477,7 @@ static int mmc_send_op_cond_iter(struct mmc *mmc, int use_arg)
return 0;
}
#ifndef CONFIG_MMC_USE_PRE_CONFIG
static int mmc_send_op_cond(struct mmc *mmc)
{
int err, i;
@ -495,7 +498,7 @@ static int mmc_send_op_cond(struct mmc *mmc)
mmc->op_cond_pending = 1;
return 0;
}
#endif
static int mmc_complete_op_cond(struct mmc *mmc)
{
struct mmc_cmd cmd;
@ -1553,7 +1556,7 @@ static int mmc_startup(struct mmc *mmc)
return err;
}
#endif
#ifndef CONFIG_MMC_USE_PRE_CONFIG
/* Put the Card in Identify Mode */
cmd.cmdidx = mmc_host_is_spi(mmc) ? MMC_CMD_SEND_CID :
MMC_CMD_ALL_SEND_CID; /* cmd not supported in spi */
@ -1585,7 +1588,7 @@ static int mmc_startup(struct mmc *mmc)
if (IS_SD(mmc))
mmc->rca = (cmd.response[0] >> 16) & 0xffff;
}
#endif
/* Get the Card-Specific Data */
cmd.cmdidx = MMC_CMD_SEND_CSD;
cmd.resp_type = MMC_RSP_R2;
@ -1924,6 +1927,7 @@ static int mmc_startup(struct mmc *mmc)
return 0;
}
#ifndef CONFIG_MMC_USE_PRE_CONFIG
static int mmc_send_if_cond(struct mmc *mmc)
{
struct mmc_cmd cmd;
@ -1946,6 +1950,7 @@ static int mmc_send_if_cond(struct mmc *mmc)
return 0;
}
#endif
#if !CONFIG_IS_ENABLED(DM_MMC)
/* board-specific MMC power initializations. */
@ -1954,6 +1959,7 @@ __weak void board_mmc_power_init(void)
}
#endif
#ifndef CONFIG_MMC_USE_PRE_CONFIG
static int mmc_power_init(struct mmc *mmc)
{
#if CONFIG_IS_ENABLED(DM_MMC)
@ -1983,7 +1989,50 @@ static int mmc_power_init(struct mmc *mmc)
#endif
return 0;
}
#endif
#ifdef CONFIG_MMC_USE_PRE_CONFIG
static int mmc_select_card(struct mmc *mmc, int n)
{
struct mmc_cmd cmd;
int err = 0;
memset(&cmd, 0, sizeof(struct mmc_cmd));
if (!mmc_host_is_spi(mmc)) { /* cmd not supported in spi */
mmc->rca = n;
cmd.cmdidx = MMC_CMD_SELECT_CARD;
cmd.resp_type = MMC_RSP_R1;
cmd.cmdarg = mmc->rca << 16;
err = mmc_send_cmd(mmc, &cmd, NULL);
}
return err;
}
int mmc_start_init(struct mmc *mmc)
{
/*
* We use the MMC config set by the bootrom.
* So it is no need to reset the eMMC device.
*/
mmc_set_bus_width(mmc, 8);
mmc_set_clock(mmc, 1);
mmc_set_timing(mmc, MMC_TIMING_LEGACY);
/* Send cmd7 to return stand-by state*/
mmc_select_card(mmc, 0);
mmc->version = MMC_VERSION_UNKNOWN;
mmc->high_capacity = 1;
/*
* The RCA is set to 2 by rockchip bootrom, use the default
* value here.
*/
#ifdef CONFIG_ARCH_ROCKCHIP
mmc->rca = 2;
#else
mmc->rca = 1;
#endif
return 0;
}
#else
int mmc_start_init(struct mmc *mmc)
{
bool no_card;
@ -2056,6 +2105,7 @@ int mmc_start_init(struct mmc *mmc)
return err;
}
#endif
static int mmc_complete_init(struct mmc *mmc)
{

View File

@ -1135,6 +1135,23 @@ static int switch_get_suspend_enable(struct udevice *dev)
*/
static int switch_get_value(struct udevice *dev)
{
const char *supply_name[] = { "vcc9-supply", "vcc8-supply", };
struct rk8xx_priv *priv = dev_get_priv(dev->parent);
struct udevice *supply;
int id = dev->driver_data - 1;
if (!switch_get_enable(dev))
return 0;
/* note: rk817 only contains switch0 */
if ((priv->variant == RK809_ID) || (priv->variant == RK817_ID)) {
if (!uclass_get_device_by_phandle(UCLASS_REGULATOR,
dev_get_parent(dev),
supply_name[id],
&supply))
return regulator_get_value(supply);
}
return 0;
}

View File

@ -921,6 +921,7 @@ int bootz_setup(ulong image, ulong *start, ulong *end);
#define FIT_COMP_PROP "compression"
#define FIT_ENTRY_PROP "entry"
#define FIT_LOAD_PROP "load"
#define FIT_ROLLBACK_PROP "rollback-index"
/* configuration node */
#define FIT_KERNEL_PROP "kernel"
@ -1005,6 +1006,7 @@ int fit_image_get_data_offset(const void *fit, int noffset, int *data_offset);
int fit_image_get_data_position(const void *fit, int noffset,
int *data_position);
int fit_image_get_data_size(const void *fit, int noffset, int *data_size);
int fit_image_get_rollback_index(const void *fit, int noffset, uint32_t *index);
int fit_image_hash_get_algo(const void *fit, int noffset, char **algo);
int fit_image_hash_get_value(const void *fit, int noffset, uint8_t **value,
@ -1012,6 +1014,9 @@ int fit_image_hash_get_value(const void *fit, int noffset, uint8_t **value,
int fit_set_timestamp(void *fit, int noffset, time_t timestamp);
int fit_get_image_defconf_node(const void *fit,
int *images_noffset, int *def_noffset);
/**
* fit_add_verification_data() - add verification data to FIT image nodes
*

View File

@ -549,11 +549,10 @@ pack_spl_loader_image()
rm ${RKBIN}/.temp -rf
cd -
ls *_loader_*.bin >/dev/null 2>&1 && rm *_loader_*.bin
RKCHIP_LOWCASE=`echo ${RKCHIP} |tr '[A-Z]' '[a-z]'`
mv ${RKBIN}/*_loader_*.bin ./${RKCHIP_LOWCASE}_loader_spl.bin
mv ${RKBIN}/*_loader_*.bin ./
rename 's/loader_/spl_loader_/' *_loader_*.bin
echo "pack loader(${label}) okay! Input: ${ini}"
ls ./${RKCHIP_LOWCASE}_loader_spl.bin
ls ./*_loader_*.bin
}
pack_loader_image()