Page MenuHomeFreeBSD

Add a driver to talk to the Raspberry Pi firmware
ClosedPublic

Authored by andrew on Jul 6 2020, 5:19 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 4 2024, 2:15 AM
Unknown Object (File)
Mar 4 2024, 2:15 AM
Unknown Object (File)
Mar 4 2024, 2:15 AM
Unknown Object (File)
Jan 14 2024, 3:43 PM
Unknown Object (File)
Jan 13 2024, 3:26 AM
Unknown Object (File)
Dec 20 2023, 5:07 AM
Unknown Object (File)
Nov 15 2023, 7:24 AM
Unknown Object (File)
Oct 18 2023, 6:43 PM
Subscribers

Details

Summary

Communicating with the Raspberry Pi firmware is currently handled by
each driver calling into the mbox driver, however the device tree is
structured such that they should be calling into a firmware driver.

Add a driver for this node with an interface to communicate to the
firmware via the mbox interface.

There is a sysctl to get the firmware revision. This is a unix date
so can be parsed with:

root@generic:~ # date -j -f '%s' sysctl -n dev.bcm2835_firmware.0.revision
Tue Nov 19 16:40:28 UTC 2019

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 32200
Build 29697: arc lint + arc unit

Event Timeline

andrew requested review of this revision.Jul 6 2020, 5:19 PM

Since dts node obtain the firmware xref via the firmware prop it would be better to design a proper interface.
Maybe reuse nvmem one ?

The dts doesn't always provide a proper xref, e.g. the vchiq node doesn't have one. The bcm2835_cpufreq driver also needs to search for it as it needs to be a child of the cpu driver for the common cpufreq driver to attach, however there is no fdt node to provide an xref.

The dts doesn't always provide a proper xref, e.g. the vchiq node doesn't have one. The bcm2835_cpufreq driver also needs to search for it as it needs to be a child of the cpu driver for the common cpufreq driver to attach, however there is no fdt node to provide an xref.

What linux does is that it searches the node based on the compatible to get the xref to the firmware, that's something we could do too.

In my updated bcm2835_cpufreq driver I have the following to find the driver:

+       sc->firmware = devclass_get_device(
+           devclass_find("bcm2835_firmware"), 0);
  • Add an ofw xref
  • Remove an old function signature that's not needed

In my updated bcm2835_cpufreq driver I have the following to find the driver:

+       sc->firmware = devclass_get_device(
+           devclass_find("bcm2835_firmware"), 0);

Ok, I guess that will be enough for now.

sys/arm/broadcom/bcm2835/bcm2835_firmware.c
85

Anything that prevent you to get the mboxes id to store it into the softc ?
Even if it's not used in the mbox interface for now.

Read the mbixes peoperty to find the mbox to use

This revision is now accepted and ready to land.Jul 9 2020, 3:44 PM
This revision was automatically updated to reflect the committed changes.