Skip to content
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

Adafruit PiRTC DS3231 #204

Open
zap8600 opened this issue Jan 26, 2022 · 14 comments
Open

Adafruit PiRTC DS3231 #204

zap8600 opened this issue Jan 26, 2022 · 14 comments

Comments

@zap8600
Copy link

zap8600 commented Jan 26, 2022

Hi. I'm making a laptop with my Pi 4 and I've decided to run Windows on it. I'm going to add a Adafruit PiRTC DS3231 and I'm wondering if adding dtoverlay=i2c-trc,ds3231 to the config.txt will work. I thought I would need to code some Windows drivers (which I wouldn't mind), but if it is supported, it would make things a lot easier. Will it work?

@jlinton
Copy link
Member

jlinton commented Jan 31, 2022

Oh another RTC, this isn't really a device tree thing as UEFI has runtime support for RTC's that should be the primary enablement path (for the time being). If you want to write a windows driver, then you need to add it to the DSDT when the device is detected.

Basically, step one is just to enable it for edk2, and it should work on all OS's without a driver.

@zap8600
Copy link
Author

zap8600 commented Jan 31, 2022

So, the RTC is supported? If so, then do I still need to add the dtoverlay to config.txt?

@jlinton
Copy link
Member

jlinton commented Feb 1, 2022

No, it doesn't work. There is a difference between the uefi standard and edk2 supporting it, and a driver existing for a particular device.

I started implementing the RTC, on the official CM4 IO board, but never finished. I guess we need another "stuff to finish" list. The point though is that you only strictly need it to work in UEFI because the existing firmware has the framework in place to support the UEFI RTC runtime services used by most OS's. So, DT doesn't need to get involved. I have another one of the inexpensive boards like that one you point out around here also on my own personal TODO, but if someone else gets to it first, great!

@zap8600
Copy link
Author

zap8600 commented Feb 2, 2022

Thanks!

@paulwratt
Copy link

@zap8600 make sure to post back with progress/fix/patch or repo link.

@zap8600
Copy link
Author

zap8600 commented Feb 17, 2022

I'm not sure if I'll make a driver. Someone already said that the UEFI has standard RTC support.

@jlinton
Copy link
Member

jlinton commented Jun 2, 2022

I think that thing might be compatible with the Ds1307, which has a driver already, and is have working).

So see if this branch helps any: https://github.com/jlinton/edk2-platforms/tree/cppc6-various-fixes-vc4aml-mailboxspinlock-xhcipci-clocktweaks-spiv5

@asunekants
Copy link

@jlinton - Not a dev here, but really interested in getting the RTC to work on RPI4; How would one go about building a firmware using your branch?
Thanks :)

@jlinton
Copy link
Member

jlinton commented Apr 3, 2023

There are usually binary images checked into those branches ex: https://github.com/jlinton/edk2-platforms/blob/cppc6-various-fixes-vc4aml-mailboxspinlock-xhcipci-clocktweaks-spiv6-FPDT-GPUHACKING/RPI_EFI.fd

But they can also be built with the standard edk2 build instructions. I have another repo https://github.com/jlinton/rpi_efi_build which has a couple of shell scripts that checkout and build TFA and EDK2 if your running on fedora.

At some point I'm actually going to start upstreaming that stuff, but I have some GPU hacking that eats my rpi4 hacking time.

@andreamtp
Copy link

andreamtp commented Dec 29, 2023

Hi @jlinton I'm unsure if it's the latest release, but I've tested this build from you:

https://github.com/jlinton/edk2-platforms/blob/cppc8/RPI_EFI.fd

and my DV3231 has been correctly used by tianocore as RTC!
My system booted like a charm:

[    0.271758] rtc-efi rtc-efi.0: registered as rtc0
[    0.276862] rtc-efi rtc-efi.0: setting system clock to 2023-12-29T16:30:12 UTC (1703867412)

👏 thank you!

Any chance to add a PR here or upstream to make it available to everybody?

@jlinton
Copy link
Member

jlinton commented Jan 3, 2024

Yes, I've been cleaning up this and a few other commits in that repo for upstreaming last month, but got stalled debugging a shim/etc problem. Once that is cleared up I will start posting the set. Which should be late next week, assuming everything goes a planned.

@andreamtp
Copy link

Hi @jlinton thanks for your effort: is there any progress about the upstreaming of your code?

@Roeda
Copy link

Roeda commented Apr 6, 2024

Yes, I've been cleaning up this and a few other commits in that repo for upstreaming last month, but got stalled debugging a shim/etc problem. Once that is cleared up I will start posting the set. Which should be late next week, assuming everything goes a planned.

indeed I've been looking for a solution like yours for sometime, as Coreos (ignition file based) is a mess without a proper RTC.
@jlinton any recommendation on how to use your branch, or is it better to wait for your upstreaming ? (I shall first quickly buy a DS1307)

@Roeda
Copy link

Roeda commented Apr 6, 2024

Hi @jlinton I'm unsure if it's the latest release, but I've tested this build from you:

https://github.com/jlinton/edk2-platforms/blob/cppc8/RPI_EFI.fd

and my DV3231 has been correctly used by tianocore as RTC! My system booted like a charm:

[    0.271758] rtc-efi rtc-efi.0: registered as rtc0
[    0.276862] rtc-efi rtc-efi.0: setting system clock to 2023-12-29T16:30:12 UTC (1703867412)

👏 thank you!

Any chance to add a PR here or upstream to make it available to everybody?

@andreamtp could you please share your built uefi image for rpi4 that has the RTC working ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants