Commit 473c5b29 authored by Sami Mujawar's avatar Sami Mujawar Committed by Will Deacon
Browse files

rtc: Initialize the Register D for MC146818 RTC

Some software drivers check the VRT bit (BIT7) of Register D before
using the MC146818 RTC. Initialized the VRT bit in rtc__init() to
indicate that the RAM and time contents are valid.
Signed-off-by: Sami Mujawar's avatarSami Mujawar <>
Signed-off-by: default avatarJulien Thierry <>
Reviewed-by: Andre Przywara's avatarAndre Przywara <>
Signed-off-by: default avatarWill Deacon <>
parent 5ae841d1
...@@ -25,6 +25,11 @@ ...@@ -25,6 +25,11 @@
#define RTC_REG_C 0x0C #define RTC_REG_C 0x0C
#define RTC_REG_D 0x0D #define RTC_REG_D 0x0D
* Register D Bits
#define RTC_REG_D_VRT (1 << 7)
struct rtc_device { struct rtc_device {
u8 cmos_idx; u8 cmos_idx;
u8 cmos_data[128]; u8 cmos_data[128];
...@@ -140,6 +145,9 @@ int rtc__init(struct kvm *kvm) ...@@ -140,6 +145,9 @@ int rtc__init(struct kvm *kvm)
return r; return r;
} }
/* Set the VRT bit in Register D to indicate valid RAM and time */
rtc.cmos_data[RTC_REG_D] = RTC_REG_D_VRT;
return r; return r;
} }
dev_init(rtc__init); dev_init(rtc__init);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment