summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2015-12-07 08:13:02 -0500
committerTom Rini <trini@konsulko.com>2015-12-07 08:13:02 -0500
commitdcf4cb068e19a7f39e4a295102b247376bd27c95 (patch)
tree181457dc202707b9ee622d6dce5117aab8e102d5 /common
parent25ef4bea59dadbd25dec1dbb376ed84dfc735f02 (diff)
parent8bebf03c73cd0830cb2cd234021004cde67c6412 (diff)
Merge branch 'zynq' of git://www.denx.de/git/u-boot-microblaze
Diffstat (limited to 'common')
-rw-r--r--common/cmd_i2c.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c
index 3d0de81c32..552c875f62 100644
--- a/common/cmd_i2c.c
+++ b/common/cmd_i2c.c
@@ -1944,11 +1944,15 @@ static cmd_tbl_t cmd_i2c_sub[] = {
U_BOOT_CMD_MKENT(speed, 1, 1, do_i2c_bus_speed, "", ""),
};
-#ifdef CONFIG_NEEDS_MANUAL_RELOC
-void i2c_reloc(void) {
- fixup_cmdtable(cmd_i2c_sub, ARRAY_SIZE(cmd_i2c_sub));
+static __maybe_unused void i2c_reloc(void)
+{
+ 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
@@ -1964,6 +1968,10 @@ static int do_i2c(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
{
cmd_tbl_t *c;
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
+ i2c_reloc();
+#endif
+
if (argc < 2)
return CMD_RET_USAGE;