diff options
author | Rasmus Villemoes <rasmus.villemoes@prevas.dk> | 2020-07-06 22:01:17 +0200 |
---|---|---|
committer | Heiko Schocher <hs@denx.de> | 2020-07-09 06:02:45 +0200 |
commit | a3e36525a9b853c09d5f5726eff3641cd0cb5619 (patch) | |
tree | fce44af50afc1135607f856839827ac4dd62fd8c /drivers/rtc | |
parent | 9fb6a41cdaa743c98b007c6769970b68c9521cd7 (diff) | |
download | u-boot-a3e36525a9b853c09d5f5726eff3641cd0cb5619.zip u-boot-a3e36525a9b853c09d5f5726eff3641cd0cb5619.tar.gz u-boot-a3e36525a9b853c09d5f5726eff3641cd0cb5619.tar.bz2 |
rtc: i2c_rtc_emul: catch any write to the "reset" register
It's more natural that any write that happens to touch the reset
register should cause a reset, rather than just a write that starts at
that offset.
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/i2c_rtc_emul.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/rtc/i2c_rtc_emul.c b/drivers/rtc/i2c_rtc_emul.c index a010af4..7f78ff8 100644 --- a/drivers/rtc/i2c_rtc_emul.c +++ b/drivers/rtc/i2c_rtc_emul.c @@ -197,7 +197,8 @@ static int sandbox_i2c_rtc_xfer(struct udevice *emul, struct i2c_msg *msg, /* Write the register */ memcpy(plat->reg + offset, ptr, len); - if (offset == REG_RESET) + /* If the reset register was written to, do reset. */ + if (offset <= REG_RESET && REG_RESET < offset + len) reset_time(emul); } } |