Page MenuHomeFreeBSD

Allow Raspberry Pi platform code and drivers to be configured with upstream DTBs
ClosedPublic

Authored by sylvain_sylvaingarrigues.com on Sep 13 2017, 4:10 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 10, 9:09 PM
Unknown Object (File)
Wed, Apr 10, 3:20 AM
Unknown Object (File)
Feb 16 2024, 12:07 AM
Unknown Object (File)
Feb 4 2024, 5:59 PM
Unknown Object (File)
Feb 4 2024, 5:46 PM
Unknown Object (File)
Jan 26 2024, 7:31 AM
Unknown Object (File)
Jan 23 2024, 5:43 PM
Unknown Object (File)
Dec 25 2023, 3:29 PM
Subscribers

Details

Summary
  • Added more compatibility strings to drivers not yet ported
  • Added new RPI platform code compatibility string to match the ones used upstream
  • Adapted RPI and RPI2 DTS to match the new platform code compatibility string

The goal of these changes are to be able to use the upstream DTBs as a replacement for our custom one. This is now possible with these changes.

Additionally, as the RPI firmware automatically chooses the right DTB for us, this would allow to have one common armv6 kernel for RPI0 and RPI1 (BCM2835-based), and one common armv7 kernel for RPI2 v1.1 (BCM2836-based), and RPI2 v1.2 / RPI3 (BCM2837-based).

Test Plan

Do something like this to get the latest firmware and DTBs:

firmware_commit=master
files="bootcode.bin fixup.dat start.elf fixup_cd.dat start_cd.elf bcm2708-rpi-b.dtb bcm2708-rpi-b-plus.dtb bcm2709-rpi-2-b.dtb bcm2710-rpi-3-b.dtb overlays/pi3-disable-bt.dtbo overlays/mmc.dtbo"
mkdir fat/overlays
for f in $files
do
   fetch -o "fat/$f" "https://raw.githubusercontent.com/raspberrypi/firmware/$firmware_commit/boot/$f"
done

Copy kernel.bin to kernel7.img on the fat partition for RPI2/3, or kernel.img for a RPI0/1.

Write this in config.txt:

dtparam=audio=on,i2c_arm=on,spi=on,random=on
dtoverlay=mmc
dtoverlay=pi3-disable-bt
kernel_address=0x200000

Boot your PI.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

When uploading a diff through the website can you include context. There are commands you can use at https://wiki.freebsd.org/Phabricator#Create_a_Revision_via_Web_Interface

sys/arm/broadcom/bcm2835/bcm2835_machdep.c
136

You should keep the old compat string here to allow for people to use an old DTB with a new kernel. For this you can use FDT_PLATFORM_DEF2. You can see imx6_machdep.c for an example on using it.

152

And here.

Use two FDT_PLATFORM_DEF2 directives instead of changing the FDT_PLATFORM_DEF one to allow compatibility with previous compatibility strings.

sys/arm/broadcom/bcm2835/bcm2835_machdep.c
136–137

There is an extra argument in FDT_PLATFORM_DEF2 to add the variable name to use.

sylvain_sylvaingarrigues.com marked 2 inline comments as done.

Fixed previous patch which misused the FDT_PLATFORM_DEF2 macro.

sylvain_sylvaingarrigues.com retitled this revision from Allow our Raspberry Pi platform code and drivers to be configured with upstream DTBs to Allow Raspberry Pi platform code and drivers to be configured with upstream DTBs.
sylvain_sylvaingarrigues.com edited the summary of this revision. (Show Details)

Fix indentation of compat_data in RNG driver.

sylvain_sylvaingarrigues.com marked an inline comment as done.

Fix indentation (use tabs instead of spaces) of compat_data per style(9)

This revision is now accepted and ready to land.Oct 2 2017, 12:25 AM
This revision was automatically updated to reflect the committed changes.