Re: Raspberry Pi POE+ hat overlay

Mark Millard <[email protected]>
Newsgroups gmane.os.freebsd.devel.arm
Message-ID <[email protected]>
On May 12, 2023, at 10:11, Mark Millard <[email protected]> wrote:

> On May 12, 2023, at 09:38, Doug Rabson <[email protected]> wrote:
> 
>> On Fri, 12 May 2023 at 17:27, Mark Millard <[email protected]> wrote:
>> On May 12, 2023, at 08:43, Doug Rabson <[email protected]> wrote:
>> 
>>> I have a pi4 with the official POE+ hat which I want to run FreeBSD on. One thing I noticed is that the fan doesn't run in FreeBSD so I decided to try and write a little driver for it. First step seems to be to load the corresponding devicetree overlay by adding something like this to /boot/msdos/config.txt:
>>> 
>>> dtoverlay=rpi-poe-plus
>>> dtparam=poe_fan_temp0=45000,dtparam=poe_fan_temp0_hyst=3000
>>> dtparam=poe_fan_temp1=50000,dtparam=poe_fan_temp1_hyst=3000
>>> dtparam=poe_fan_temp2=62000,dtparam=poe_fan_temp2_hyst=4000
>>> dtparam=poe_fan_temp3=70000,dtparam=poe_fan_temp3_hyst=5000
>>> 
>>> Unfortunately this is where I'm stuck - the overlay is not present in the final DTB given to the kernel so there isn't anything to hook a driver to. Are dtoverlays supposed to work on FreeBSD?
>> 
>> The RPi* firwmare version that FreeBSD has in ports and uses
>> in making snapshots and other images does not have that overlay:
>> 
>> # ls -Tld /usr/local/share/rpi-firmware/overlays/rpi*
>> -rw-r--r--  1 root  wheel   489 Mar  3 05:29:57 2021 /usr/local/share/rpi-firmware/overlays/rpi-backlight.dtbo
>> -rw-r--r--  1 root  wheel  4081 Mar  3 05:29:57 2021 /usr/local/share/rpi-firmware/overlays/rpi-cirrus-wm5102.dtbo
>> -rw-r--r--  1 root  wheel   643 Mar  3 05:29:57 2021 /usr/local/share/rpi-firmware/overlays/rpi-dac.dtbo
>> -rw-r--r--  1 root  wheel  2574 Mar  3 05:29:57 2021 /usr/local/share/rpi-firmware/overlays/rpi-display.dtbo
>> -rw-r--r--  1 root  wheel   842 Mar  3 05:29:57 2021 /usr/local/share/rpi-firmware/overlays/rpi-ft5406.dtbo
>> -rw-r--r--  1 root  wheel  2937 Mar  3 05:29:57 2021 /usr/local/share/rpi-firmware/overlays/rpi-poe.dtbo
>> -rw-r--r--  1 root  wheel   771 Mar  3 05:29:57 2021 /usr/local/share/rpi-firmware/overlays/rpi-proto.dtbo
>> -rw-r--r--  1 root  wheel   893 Mar  3 05:29:57 2021 /usr/local/share/rpi-firmware/overlays/rpi-sense.dtbo
>> -rw-r--r--  1 root  wheel   567 Mar  3 05:29:57 2021 /usr/local/share/rpi-firmware/overlays/rpi-tv.dtbo
>> -rw-r--r--  1 root  wheel  1226 Mar  3 05:29:57 2021 /usr/local/share/rpi-firmware/overlays/rpivid-v4l2.dtbo
>> 
>> You do not mention establishing a copy of overlays/rpi-poe-plus.dtbo .
>> 
>> I copied the file from a rasbian install I had for another project. Perhaps I should find the corresponding source for it and build it with the device tree source from FreeBSD.
>> 
>> You also do not mention what version of FreeBSD you are using
>> on the RPi4B. The output of the command:
>> 
>> I'm running 13.2-RELEASE-p0
> 
> That limits the range of firmware you can experiment with
> but the following tagged vintages should be compatible and
> also have an overlays/rpi-poe-plus.dtbo present:
> 
> 1.20210527/boot/overlays/rpi-poe-plus.dtbo
> 1.20210727/boot/overlays/rpi-poe-plus.dtbo
> 1.20210805/boot/overlays/rpi-poe-plus.dtbo
> 
> So extracting a consistent/full set of firmware and trying
> it is a possibility.
> 
> The first 3 tags links on:
> 
> https://github.com/raspberrypi/linux/tags?after=1.20210831
> 
> are for the above 3 firmware versions.
> 
> Anything newer will lead to a FreeBSD kernel crash for
> 13.2-RELEASE-p0 due to mishandling the .dtb file that
> would be used.
> 
> As an example of what is in . . ./boot/ from one of those 3:
> 
> # ls -Tld firmware-1.20210805/boot/*
> -rw-rw-r--  1 root  wheel    18693 Aug  5 04:11:18 2021 firmware-1.20210805/boot/COPYING.linux
> -rw-rw-r--  1 root  wheel     1594 Aug  5 04:11:18 2021 firmware-1.20210805/boot/LICENCE.broadcom
> -rw-rw-r--  1 root  wheel    26401 Aug  5 04:11:18 2021 firmware-1.20210805/boot/bcm2708-rpi-b-plus.dtb
> -rw-rw-r--  1 root  wheel    25749 Aug  5 04:11:18 2021 firmware-1.20210805/boot/bcm2708-rpi-b-rev1.dtb
> -rw-rw-r--  1 root  wheel    26138 Aug  5 04:11:18 2021 firmware-1.20210805/boot/bcm2708-rpi-b.dtb
> -rw-rw-r--  1 root  wheel    26060 Aug  5 04:11:18 2021 firmware-1.20210805/boot/bcm2708-rpi-cm.dtb
> -rw-rw-r--  1 root  wheel    27076 Aug  5 04:11:18 2021 firmware-1.20210805/boot/bcm2708-rpi-zero-w.dtb
> -rw-rw-r--  1 root  wheel    25883 Aug  5 04:11:18 2021 firmware-1.20210805/boot/bcm2708-rpi-zero.dtb
> -rw-rw-r--  1 root  wheel    27276 Aug  5 04:11:18 2021 firmware-1.20210805/boot/bcm2709-rpi-2-b.dtb
> -rw-rw-r--  1 root  wheel    27425 Aug  5 04:11:18 2021 firmware-1.20210805/boot/bcm2710-rpi-2-b.dtb
> -rw-rw-r--  1 root  wheel    29542 Aug  5 04:11:18 2021 firmware-1.20210805/boot/bcm2710-rpi-3-b-plus.dtb
> -rw-rw-r--  1 root  wheel    28923 Aug  5 04:11:18 2021 firmware-1.20210805/boot/bcm2710-rpi-3-b.dtb
> -rw-rw-r--  1 root  wheel    27421 Aug  5 04:11:18 2021 firmware-1.20210805/boot/bcm2710-rpi-cm3.dtb
> -rw-rw-r--  1 root  wheel    49825 Aug  5 04:11:18 2021 firmware-1.20210805/boot/bcm2711-rpi-4-b.dtb
> -rw-rw-r--  1 root  wheel    49821 Aug  5 04:11:18 2021 firmware-1.20210805/boot/bcm2711-rpi-400.dtb
> -rw-rw-r--  1 root  wheel    50499 Aug  5 04:11:18 2021 firmware-1.20210805/boot/bcm2711-rpi-cm4.dtb
> -rw-rw-r--  1 root  wheel    52456 Aug  5 04:11:18 2021 firmware-1.20210805/boot/bootcode.bin
> -rw-rw-r--  1 root  wheel     7278 Aug  5 04:11:18 2021 firmware-1.20210805/boot/fixup.dat
> -rw-rw-r--  1 root  wheel     5407 Aug  5 04:11:18 2021 firmware-1.20210805/boot/fixup4.dat
> -rw-rw-r--  1 root  wheel     3211 Aug  5 04:11:18 2021 firmware-1.20210805/boot/fixup4cd.dat
> -rw-rw-r--  1 root  wheel     8416 Aug  5 04:11:18 2021 firmware-1.20210805/boot/fixup4db.dat
> -rw-rw-r--  1 root  wheel     8418 Aug  5 04:11:18 2021 firmware-1.20210805/boot/fixup4x.dat
> -rw-rw-r--  1 root  wheel     3211 Aug  5 04:11:18 2021 firmware-1.20210805/boot/fixup_cd.dat
> -rw-rw-r--  1 root  wheel    10262 Aug  5 04:11:18 2021 firmware-1.20210805/boot/fixup_db.dat
> -rw-rw-r--  1 root  wheel    10262 Aug  5 04:11:18 2021 firmware-1.20210805/boot/fixup_x.dat
> drwxrwxr-x  2 root  wheel      236 Aug  5 04:11:18 2021 firmware-1.20210805/boot/overlays
> -rw-rw-r--  1 root  wheel  2959904 Aug  5 04:11:18 2021 firmware-1.20210805/boot/start.elf
> -rw-rw-r--  1 root  wheel  2235712 Aug  5 04:11:18 2021 firmware-1.20210805/boot/start4.elf
> -rw-rw-r--  1 root  wheel   799964 Aug  5 04:11:18 2021 firmware-1.20210805/boot/start4cd.elf
> -rw-rw-r--  1 root  wheel  3731528 Aug  5 04:11:18 2021 firmware-1.20210805/boot/start4db.elf
> -rw-rw-r--  1 root  wheel  2987720 Aug  5 04:11:18 2021 firmware-1.20210805/boot/start4x.elf
> -rw-rw-r--  1 root  wheel   799964 Aug  5 04:11:18 2021 firmware-1.20210805/boot/start_cd.elf
> -rw-rw-r--  1 root  wheel  4803496 Aug  5 04:11:18 2021 firmware-1.20210805/boot/start_db.elf
> -rw-rw-r--  1 root  wheel  3711432 Aug  5 04:11:18 2021 firmware-1.20210805/boot/start_x.elf

Note the lack of config.txt , armstub8-gic.bin , and
armstub8.bin .

> (I'll not list the overlays/* .)
> 
> I've no clue to the consequences of mixing and matching
> materials from different vintages of the firmware. It
> does appear that:
> 
> 1.20210727/boot/overlays/rpi-poe-plus.dtbo
> 1.20210805/boot/overlays/rpi-poe-plus.dtbo
> 
> (the newer 2 of th3 3) are the same by content but that:
> 
> 1.20210527/boot/overlays/rpi-poe-plus.dtbo
> 
> is distinct in its older content.

Be warned that the sys-utils/rpi-firmware port installs a
couple of files that are not based on
https://github.com/raspberrypi/ materials:

# ls -Tld /boot/efi/armstub8*
-rwxr-xr-x  1 root  wheel  5888 Apr 20 19:25:22 2022 /boot/efi/armstub8-gic.bin
-rwxr-xr-x  1 root  wheel  5888 Apr 20 19:25:22 2022 /boot/efi/armstub8.bin

Be sure to keep those 2 files in place (for at least
armstub8-gic.bin ). A similar point goes for your
config.txt .

===
Mark Millard
marklmi at yahoo.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.