summaryrefslogtreecommitdiffstats
path: root/common/cmd_date.c
diff options
context:
space:
mode:
authorHeiko Schocher <hs@denx.de>2012-01-16 21:12:24 +0000
committerHeiko Schocher <hs@denx.de>2013-07-23 05:54:28 +0200
commit3f4978c713255c8406875fbdf23ffed1129bc44b (patch)
treec27f00ba6219d75f772167b7630bb4ebb383a271 /common/cmd_date.c
parent385c9ef5a7215b2b0c22836fee6c692dfc8559d7 (diff)
downloadblackbird-obmc-uboot-3f4978c713255c8406875fbdf23ffed1129bc44b.tar.gz
blackbird-obmc-uboot-3f4978c713255c8406875fbdf23ffed1129bc44b.zip
i2c: common changes for multibus/multiadapter support
Signed-off-by: Heiko Schocher <hs@denx.de> Signed-off-by: Simon Glass <sjg@chromium.org> Cc: Henrik Nordström <henrik@henriknordstrom.net>
Diffstat (limited to 'common/cmd_date.c')
-rw-r--r--common/cmd_date.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/common/cmd_date.c b/common/cmd_date.c
index 0ac032cf30..f7ae1da1e2 100644
--- a/common/cmd_date.c
+++ b/common/cmd_date.c
@@ -50,8 +50,13 @@ static int do_date(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
int old_bus;
/* switch to correct I2C bus */
+#ifdef CONFIG_SYS_I2C
+ old_bus = i2c_get_bus_num();
+ i2c_set_bus_num(CONFIG_SYS_RTC_BUS_NUM);
+#else
old_bus = I2C_GET_BUS();
I2C_SET_BUS(CONFIG_SYS_RTC_BUS_NUM);
+#endif
switch (argc) {
case 2: /* set date & time */
@@ -97,7 +102,11 @@ static int do_date(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
/* switch back to original I2C bus */
+#ifdef CONFIG_SYS_I2C
+ i2c_set_bus_num(old_bus);
+#else
I2C_SET_BUS(old_bus);
+#endif
return rcode;
}
OpenPOWER on IntegriCloud