i2c: cmd: Relocate subcommands when MANUAL_RELOC
Subcommands contain pointers to functions which are not updated when MANUAL_RELOC is enabled. This patch fix it. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Acked-by: Heiko Schocher <hs@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
c643f3ef9b
commit
e4099c8b80
|
@ -1944,11 +1944,15 @@ static cmd_tbl_t cmd_i2c_sub[] = {
|
||||||
U_BOOT_CMD_MKENT(speed, 1, 1, do_i2c_bus_speed, "", ""),
|
U_BOOT_CMD_MKENT(speed, 1, 1, do_i2c_bus_speed, "", ""),
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef CONFIG_NEEDS_MANUAL_RELOC
|
static __maybe_unused void i2c_reloc(void)
|
||||||
void i2c_reloc(void) {
|
{
|
||||||
fixup_cmdtable(cmd_i2c_sub, ARRAY_SIZE(cmd_i2c_sub));
|
static int relocated;
|
||||||
|
|
||||||
|
if (!relocated) {
|
||||||
|
fixup_cmdtable(cmd_i2c_sub, ARRAY_SIZE(cmd_i2c_sub));
|
||||||
|
relocated = 1;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* do_i2c() - Handle the "i2c" command-line command
|
* do_i2c() - Handle the "i2c" command-line command
|
||||||
|
@ -1964,6 +1968,10 @@ static int do_i2c(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
|
||||||
{
|
{
|
||||||
cmd_tbl_t *c;
|
cmd_tbl_t *c;
|
||||||
|
|
||||||
|
#ifdef CONFIG_NEEDS_MANUAL_RELOC
|
||||||
|
i2c_reloc();
|
||||||
|
#endif
|
||||||
|
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
return CMD_RET_USAGE;
|
return CMD_RET_USAGE;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue