On Tue, Jan 28, 2020 at 3:32 PM Steven A. Falco <stevenfalco(a)gmail.com> wrote:
On 1/28/20 9:39 AM, Peter Robinson wrote:
> On Tue, Jan 28, 2020 at 1:59 PM Steven A. Falco <stevenfalco(a)gmail.com>
wrote:
>>
>> I'd like to add an RTC module to a Raspberry Pi. I see that uboot has some
support for device tree overlays, but if I'm reading the code correctly, it
doesn't seem to be enabled for the Pi.
>>
>> Is it possible to use device tree overlays at this point, or am I better off
building a custom kernel?
>
> Yes, mostly, but there's still a whole bunch of corner cases, for
> Raspberry Pi we use the Firmware provided DT and not the kernel DT.
> It's only really clean on aarch64 and completely doesn't work on RPi4
> (yet another reason there's been no announcement around RPi4 support).
I see. U-boot says it is using 0:2 /dtb/broadcom/bcm2711-rpi-4-b.dtb, and I've
confirmed that: If I hand-edit that dtb file to add the RTC (pcf8523@68) to the I2C bus
(i2c@7e804000) it works - the RTC is reported as being managed by the kernel. So it looks
like the RPi4 is using the kernel device tree rather than the firmware one.
Correct, that is the default and on the RPi4 it crashes on boot using
the firmware DT.
I have not been entirely successful rebuilding the kernel yet (using
mock on the RPi4 itself). The dtc portion of the build fails because of the gcc10 change
from -fcommon to -fno-common. I need to tweak the kernel spec file to work around that,
but my first attempt was a little too heavy-handed. Seems that a lot of stuff needs
-fno-common, but dtc needs -fcommon.
Well patches are welcome, I need to engage with upstream and I only
have so many hours in a week. As I've stated previously the RPi4 is
currently no supported and we are getting there but I do it in my own
personal time.