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
F103483431: D25572.diff
Mon, Nov 25, 2:57 PM
Unknown Object (File)
Fri, Nov 22, 1:52 PM
Unknown Object (File)
Wed, Nov 20, 8:01 PM
Unknown Object (File)
Wed, Nov 20, 2:35 AM
Unknown Object (File)
Thu, Nov 14, 12:04 AM
Unknown Object (File)
Oct 25 2024, 1:25 AM
Unknown Object (File)
Oct 25 2024, 1:25 AM
Unknown Object (File)
Oct 25 2024, 1:25 AM
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

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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 ↗(On Diff #74193)

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.