-
Notifications
You must be signed in to change notification settings - Fork 7.4k
drivers/rtc/rtc_mc146818: Fix RTC driver for QEMU boards #60321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
drivers/rtc/rtc_mc146818: Fix RTC driver for QEMU boards #60321
Conversation
7d18931
to
5e4a9a3
Compare
Proof of it working @cfriedt :D
|
21eeed4
to
a2e16bc
Compare
a2e16bc
to
00a450d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tiny fix
23e6a2a
to
9ec1897
Compare
I need help solving a test timeout occurring for a library named p4workq, which times out if I am running the test using The stress test has a define 100 -> 13.27 seconds I am enabling I need help to move forward :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like a lot of changes in the driver are potentially unrelated to the actual fix.
I would suggest separating any cosmetic changes, and functional changes to separate commits.
Other than that, I think to avoid breaking other things (libp4work or whatever it is), it might be better to make the necessary DT adjustments in a board overlay in the testsuite.
Also, is it possible to ensure the driver is built and tested in CI? Do we have it in a build all test somewhere?
@@ -51,7 +51,6 @@ | |||
#define RTC_UIP RTC_REG_A | |||
#define RTC_DATA RTC_REG_B | |||
#define RTC_FLAG RTC_REG_C | |||
#define RTC_ALARM_MDAY RTC_REG_D |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How much of this file actually needed to be changed in order for the fix to work?
At a glance, it seems that most of the changes here are cosmetic (formatting, name changes, ...). Is it possible to reduce the change to only what is required for the fix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes are nearly the bare minimum required to get the driver to an acceptable state (I did a small amount of cleanup). There is still quite a bit to go which I agree is not within the scope of this PR.
1957f43
to
44bc4a0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests are passing 🙌
I realize I just approved this, but it looks like a few of the RTC kconfig options are missing from From what I understand all of the rtcs exercised in this testsuite support all of the options, so might be better to add them there as well. |
Only the mandatory tests from the test suite are run by default, which is why the features RTC_ALARM and RTC_UPDATE and RTC_CALIBRATE are not included in the main .prj Features are selected in the board overlays. The MC146818 only supports RTC_ALARM and RTC_UPDATE for example, not RTC_CALIBRATE :) |
Sure, but just remember we need code paths tested, even if they are disabled by default. What if the default prj.conf was to enable all options, and individual board overlays could opt out of testing unsupported options? |
The MC146818 driver was not properly initialized by the driver, interrupts where not handled correctly, and the alarm feature was not implemented properly. This commit fixes these issues, while removing some code which became redundant as the MC146818 driver was patched. Signed-off-by: Bjarki Arge Andreasen <[email protected]>
2739f21
to
983721f
Compare
983721f
to
79ee044
Compare
is @akanisetti able to review / approve as well? |
@bjarki-trackunit - you might need to find another reviewer with approve privileges. |
@henrikbrixandersen @erwango Could you please review this PR? :) |
This commit adds input clock selection to the RTC driver. This is required to allow for the real hardware to operate. The QEMU emulated hardware ignores the input clock settings. Signed-off-by: Bjarki Arge Andreasen <[email protected]>
79ee044
to
4121df5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One tiny spelling mistake - I'll re-approve when fixed.
This commit updates the qemu_x86 board's yaml file to indicate its support for the RTC subsystem. Board overlay and conf for the qemu_x86 has been added to the RTC test suite to enable the MC146818 and its dependencies. Signed-off-by: Bjarki Arge Andreasen <[email protected]>
The update callback test had a bug which prevented it from running on 64-bit architectures. This patch makes the test agnostic to 64-bit and 32-bit architectures. Signed-off-by: Bjarki Arge Andreasen <[email protected]>
4121df5
to
2821b41
Compare
This commit adds overlay and conf for the qemu_x86_64 board to the RTC API test suite, and adds support for the RTC subsystem to the qemu_x86_64's yaml file. The commit also specifies integration platforms for the RTC API test suite, since the qemu_x86_64 board runs in real-time, causing it to time out if the test suite runs for it. Signed-off-by: Bjarki Arge Andreasen <[email protected]>
2821b41
to
8094763
Compare
@cfriedt pretty please :D |
This commit fixes the driver, allowing it to pass
the RTC API test suite for set/get time, alarms and the update callback (the hw does not support calibration)
This requires an additional flag to the HPET module which disables legacy IRQs, allowing the RTCs IRQ to be raised.
Furthermore, the commit cleans up the RTC in the devicetree for the IA32 dtsi and the qemu_x64 dts files, and updates the yaml files for QEMU to indicate the support for the RTC subsystem.
Fixes #59448