From nobody Sat May 13 12:45:55 2023 X-Original-To: freebsd-arm@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4QJQNc1vS4z4BLf3 for ; Sat, 13 May 2023 12:46:08 +0000 (UTC) (envelope-from dfr@rabson.org) Received: from mail-yw1-x112c.google.com (mail-yw1-x112c.google.com [IPv6:2607:f8b0:4864:20::112c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QJQNc0PbDz43qk for ; Sat, 13 May 2023 12:46:08 +0000 (UTC) (envelope-from dfr@rabson.org) Authentication-Results: mx1.freebsd.org; none Received: by mail-yw1-x112c.google.com with SMTP id 00721157ae682-55a1462f9f6so107542657b3.3 for ; Sat, 13 May 2023 05:46:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rabson-org.20221208.gappssmtp.com; s=20221208; t=1683981967; x=1686573967; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=UkuF+uhc9dQpSPfeKTJzZOx7hkCpO7yrR0KiAOx/C2w=; b=0jlr6AQmfVb7RYjCEad/A4++Yq5QzKoZ6KqX5PQr9ckCA1JeizqNYgo2gmR7RWs5f0 UJhTgg6L8W7OJeryk8A3w5Ydq+EfC7LrCOItyqD4Ln368zkJO2S8y3l4QE8RwPK9eBU7 A7RfLAe2emVuhXRhpm5SLgGnZ8fPF+xGIeC3c/W7L0tuPxbfDYp2Z0OKOTOXbUQpPweR zZgH6i2YpaQ3YYD8x3qcm+GwL8J5t4HIAk6kQEzqYq6/VK/cmGuAQUdZa8rgmkThJMAB V4DIJItNjCJr4Lnn1jcL8Wnn0a0e6bJXAQA1Gn4Pk1dMaTwdgRLpPkZOiRnS1tHy6F/5 sVeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683981967; x=1686573967; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=UkuF+uhc9dQpSPfeKTJzZOx7hkCpO7yrR0KiAOx/C2w=; b=JFb0UgU6ChyXdmUQj4rgg975EZAEML+Hp1iPVBdRMsd1Cj7vn/pVST/ds/OT8V7NaQ gWf2PIqQmAC3TivU4OH7bFvsbNlYuXGzoaKuE1ziSTMDb10sldirsml0N1i1s8cQrtrk kbC02HnYeNCWS55jHLTB3QaSgrc+BSbA/xIUy9YWyYdBjpsH5vhXwF4cfsDbV56+lkWN i+n264hsga1iA4QjOfkeYTinh4g7PiQJlF/Aq0KQhPP96QHb/LLee1gFeMuWhzmuDKQS l0rU7XhDqQ5KvaUfOM7wKxQTW0JdrXPGpsGs+h9R1mhXy6YQKgXSg4G6t8n0/IsLZPey 0J6A== X-Gm-Message-State: AC+VfDz9hbjX27dW/D5FQ038MlQKuAMcoumeot8EKUnX32X/Vqnsw6CF pmAZYpJ79x1vPy+myUubT7cv4z5RJOXmb5nCn9Z4iQyd/atQgxO0HtSa6w== X-Google-Smtp-Source: ACHHUZ7vrtZMtSf1DgdGSWqziVmX0Lzift0K5O5XBEBv1SAbv92Tm04bJMvmufqw5byfvH/mbT6hhFlHtlXColDmbnU= X-Received: by 2002:a25:6906:0:b0:ba7:36de:754e with SMTP id e6-20020a256906000000b00ba736de754emr2878529ybc.9.1683981966771; Sat, 13 May 2023 05:46:06 -0700 (PDT) List-Id: Porting FreeBSD to ARM processors List-Archive: https://lists.freebsd.org/archives/freebsd-arm List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-arm@freebsd.org MIME-Version: 1.0 References: <77CD0716-3BC8-47EB-8743-F2BD9CA43D31@yahoo.com> <432A1A16-9FE5-4339-AB38-8F3E03A5D4EF@yahoo.com> In-Reply-To: <432A1A16-9FE5-4339-AB38-8F3E03A5D4EF@yahoo.com> From: Doug Rabson Date: Sat, 13 May 2023 13:45:55 +0100 Message-ID: Subject: Re: Raspberry Pi POE+ hat overlay To: Mark Millard Cc: freebsd-arm@freebsd.org Content-Type: multipart/alternative; boundary="000000000000f01f5405fb929a0b" X-Rspamd-Queue-Id: 4QJQNc0PbDz43qk X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N --000000000000f01f5405fb929a0b Content-Type: text/plain; charset="UTF-8" I was able to build an updated rpi-firmware port based on 1.20210805 and this boots successfully on pi400 as well as rpi4. With this, I can load the rpi-poe-plus overlay and I just need to try and reverse engineer the undocumented mailbox API by reading the Linux code. diff --git a/sysutils/rpi-firmware/Makefile b/sysutils/rpi-firmware/Makefile index e82ab20ebc74..4fbb5df6d743 100644 --- a/sysutils/rpi-firmware/Makefile +++ b/sysutils/rpi-firmware/Makefile @@ -1,5 +1,5 @@ PORTNAME= rpi-firmware -PORTVERSION= 1.20210303.g20210303 +PORTVERSION= 1.20210805.g20210805 CATEGORIES= sysutils MAINTAINER= uboot@FreeBSD.org @@ -17,7 +17,7 @@ USE_GITHUB= yes GH_ACCOUNT= raspberrypi gonzoua:pscimon GH_PROJECT= firmware rpi3-psci-monitor:pscimon -FW_TAG= fcf8d2f +FW_TAG= 8939bde PSCI_TAG= 558620c GH_TAGNAME= ${FW_TAG} ${PSCI_TAG}:pscimon diff --git a/sysutils/rpi-firmware/distinfo b/sysutils/rpi-firmware/distinfo index 2e1e0c92066a..27a0eb8c9fa3 100644 --- a/sysutils/rpi-firmware/distinfo +++ b/sysutils/rpi-firmware/distinfo @@ -1,5 +1,5 @@ -TIMESTAMP = 1614939753 -SHA256 (raspberrypi-firmware-1.20210303.g20210303-fcf8d2f_GH0.tar.gz) = 5a0d7247490e0207f0fc32baabcec25a0e97ebdab9cbee216bf9537a1de22e69 -SIZE (raspberrypi-firmware-1.20210303.g20210303-fcf8d2f_GH0.tar.gz) = 192233875 +TIMESTAMP = 1683975782 +SHA256 (raspberrypi-firmware-1.20210805.g20210805-8939bde_GH0.tar.gz) = 2069df5b1dff340c78e393e4cc10feba395524d26cf5db475876d62b7a0507b2 +SIZE (raspberrypi-firmware-1.20210805.g20210805-8939bde_GH0.tar.gz) = 193244754 SHA256 (gonzoua-rpi3-psci-monitor-558620c_GH0.tar.gz) = 7621db7933eedaa17a03c282ef8a50be597bd14366149dfa93172d1b3985dbb7 SIZE (gonzoua-rpi3-psci-monitor-558620c_GH0.tar.gz) = 5614 diff --git a/sysutils/rpi-firmware/pkg-plist b/sysutils/rpi-firmware/pkg-plist index 7661a0a13cb2..02a41640a0be 100644 --- a/sysutils/rpi-firmware/pkg-plist +++ b/sysutils/rpi-firmware/pkg-plist @@ -183,6 +183,7 @@ %%DATADIR%%/overlays/rpi-display.dtbo %%DATADIR%%/overlays/rpi-ft5406.dtbo %%DATADIR%%/overlays/rpi-poe.dtbo +%%DATADIR%%/overlays/rpi-poe-plus.dtbo %%DATADIR%%/overlays/rpi-proto.dtbo %%DATADIR%%/overlays/rpi-sense.dtbo %%DATADIR%%/overlays/rpi-tv.dtbo On Fri, 12 May 2023 at 18:41, Mark Millard wrote: > On May 12, 2023, at 10:19, Mark Millard wrote: > > > On May 12, 2023, at 10:11, Mark Millard wrote: > > > >> On May 12, 2023, at 09:38, Doug Rabson wrote: > >> > >>> On Fri, 12 May 2023 at 17:27, Mark Millard wrote: > >>> On May 12, 2023, at 08:43, Doug Rabson 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 > > That was likely a wasteful reference for me to supply. Trying > again: > > https://github.com/raspberrypi/firmware/tags?after=1.20210831 > > likely avoids ending up with a full set of linux materials > to go along with the firmware (smaller download with a smaller > expansion). > > >> 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 > > --000000000000f01f5405fb929a0b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I was able to build an updated rpi-firmware port based on = 1.20210805 and this boots successfully on pi400 as well as rpi4. With this,= I can load the rpi-poe-plus overlay and I just need to try and reverse eng= ineer the undocumented mailbox API by reading the Linux code.

diff --git a/sysutils/rpi-firmware/Makefile b/sysutils/rpi-firmware/M= akefile
index e82ab20ebc74..4fbb5df6d743 100644
--- a/sysutils/rpi-fi= rmware/Makefile
+++ b/sysutils/rpi-firmware/Makefile
@@ -1,5 +1,5 @@<= br>=C2=A0PORTNAME=3D rpi-firmware
-PORTVERSION=3D 1.20210303.g20210303+PORTVERSION=3D 1.20210805.g20210805
=C2=A0CATEGORIES=3D sysutils
<= br>=C2=A0MAINTAINER=3D uboot@FreeBSD.org
@@ -17,7 +17,7 @@ USE_GITHUB=3D= yes

=C2=A0GH_ACCOUNT=3D raspberrypi gonzoua:pscimon
=C2=A0GH_PRO= JECT=3D firmware rpi3-psci-monitor:pscimon
-FW_TAG=3D fcf8d2f
+FW_TA= G=3D 8939bde
=C2=A0PSCI_TAG=3D 558620c
=C2=A0GH_TAGNAME=3D ${FW_TAG}= ${PSCI_TAG}:pscimon

diff --git a/sysutils/rpi-firmware/distinfo b/s= ysutils/rpi-firmware/distinfo
index 2e1e0c92066a..27a0eb8c9fa3 100644--- a/sysutils/rpi-firmware/distinfo
+++ b/sysutils/rpi-firmware/distin= fo
@@ -1,5 +1,5 @@
-TIMESTAMP =3D 1614939753
-SHA256 (raspberrypi-= firmware-1.20210303.g20210303-fcf8d2f_GH0.tar.gz) =3D 5a0d7247490e0207f0fc3= 2baabcec25a0e97ebdab9cbee216bf9537a1de22e69
-SIZE (raspberrypi-firmware-= 1.20210303.g20210303-fcf8d2f_GH0.tar.gz) =3D 192233875
+TIMESTAMP =3D 16= 83975782
+SHA256 (raspberrypi-firmware-1.20210805.g20210805-8939bde_GH0.= tar.gz) =3D 2069df5b1dff340c78e393e4cc10feba395524d26cf5db475876d62b7a0507b= 2
+SIZE (raspberrypi-firmware-1.20210805.g20210805-8939bde_GH0.tar.gz) = =3D 193244754
=C2=A0SHA256 (gonzoua-rpi3-psci-monitor-558620c_GH0.tar.gz= ) =3D 7621db7933eedaa17a03c282ef8a50be597bd14366149dfa93172d1b3985dbb7
= =C2=A0SIZE (gonzoua-rpi3-psci-monitor-558620c_GH0.tar.gz) =3D 5614
diff = --git a/sysutils/rpi-firmware/pkg-plist b/sysutils/rpi-firmware/pkg-plistindex 7661a0a13cb2..02a41640a0be 100644
--- a/sysutils/rpi-firmware/pk= g-plist
+++ b/sysutils/rpi-firmware/pkg-plist
@@ -183,6 +183,7 @@
= =C2=A0%%DATADIR%%/overlays/rpi-display.dtbo
=C2=A0%%DATADIR%%/overlays/r= pi-ft5406.dtbo
=C2=A0%%DATADIR%%/overlays/rpi-poe.dtbo
+%%DATADIR%%/o= verlays/rpi-poe-plus.dtbo
=C2=A0%%DATADIR%%/overlays/rpi-proto.dtbo
= =C2=A0%%DATADIR%%/overlays/rpi-sense.dtbo
=C2=A0%%DATADIR%%/overlays/rpi= -tv.dtbo

On Fri, 12 May 2023 at 18:41, Mark Millard <marklmi@yahoo.com> wrote:
On May 12, 2023, at 10:19, Mark Millard <marklmi@yahoo.com> wrote:

> On May 12, 2023, at 10:11, Mark Millard <marklmi@yahoo.com> wrote:
>
>> On May 12, 2023, at 09:38, Doug Rabson <dfr@rabson.org> wrote:
>>
>>> On Fri, 12 May 2023 at 17:27, Mark Millard <marklmi@yahoo.com> wrote: >>> On May 12, 2023, at 08:43, Doug Rabson <dfr@rabson.org> wrote:
>>>
>>>> I have a pi4 with the official POE+ hat which I want to ru= n FreeBSD on. One thing I noticed is that the fan doesn't run in FreeBS= D 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 t= his to /boot/msdos/config.txt:
>>>>
>>>> dtoverlay=3Drpi-poe-plus
>>>> dtparam=3Dpoe_fan_temp0=3D45000,dtparam=3Dpoe_fan_temp0_hy= st=3D3000
>>>> dtparam=3Dpoe_fan_temp1=3D50000,dtparam=3Dpoe_fan_temp1_hy= st=3D3000
>>>> dtparam=3Dpoe_fan_temp2=3D62000,dtparam=3Dpoe_fan_temp2_hy= st=3D4000
>>>> dtparam=3Dpoe_fan_temp3=3D70000,dtparam=3Dpoe_fan_temp3_hy= st=3D5000
>>>>
>>>> Unfortunately this is where I'm stuck - the overlay is= not present in the final DTB given to the kernel so there isn't anythi= ng 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 overla= y:
>>>
>>> # ls -Tld /usr/local/share/rpi-firmware/overlays/rpi*
>>> -rw-r--r--=C2=A0 1 root=C2=A0 wheel=C2=A0 =C2=A0489 Mar=C2=A0 = 3 05:29:57 2021 /usr/local/share/rpi-firmware/overlays/rpi-backlight.dtbo >>> -rw-r--r--=C2=A0 1 root=C2=A0 wheel=C2=A0 4081 Mar=C2=A0 3 05:= 29:57 2021 /usr/local/share/rpi-firmware/overlays/rpi-cirrus-wm5102.dtbo >>> -rw-r--r--=C2=A0 1 root=C2=A0 wheel=C2=A0 =C2=A0643 Mar=C2=A0 = 3 05:29:57 2021 /usr/local/share/rpi-firmware/overlays/rpi-dac.dtbo
>>> -rw-r--r--=C2=A0 1 root=C2=A0 wheel=C2=A0 2574 Mar=C2=A0 3 05:= 29:57 2021 /usr/local/share/rpi-firmware/overlays/rpi-display.dtbo
>>> -rw-r--r--=C2=A0 1 root=C2=A0 wheel=C2=A0 =C2=A0842 Mar=C2=A0 = 3 05:29:57 2021 /usr/local/share/rpi-firmware/overlays/rpi-ft5406.dtbo
>>> -rw-r--r--=C2=A0 1 root=C2=A0 wheel=C2=A0 2937 Mar=C2=A0 3 05:= 29:57 2021 /usr/local/share/rpi-firmware/overlays/rpi-poe.dtbo
>>> -rw-r--r--=C2=A0 1 root=C2=A0 wheel=C2=A0 =C2=A0771 Mar=C2=A0 = 3 05:29:57 2021 /usr/local/share/rpi-firmware/overlays/rpi-proto.dtbo
>>> -rw-r--r--=C2=A0 1 root=C2=A0 wheel=C2=A0 =C2=A0893 Mar=C2=A0 = 3 05:29:57 2021 /usr/local/share/rpi-firmware/overlays/rpi-sense.dtbo
>>> -rw-r--r--=C2=A0 1 root=C2=A0 wheel=C2=A0 =C2=A0567 Mar=C2=A0 = 3 05:29:57 2021 /usr/local/share/rpi-firmware/overlays/rpi-tv.dtbo
>>> -rw-r--r--=C2=A0 1 root=C2=A0 wheel=C2=A0 1226 Mar=C2=A0 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-plu= s.dtbo .
>>>
>>> I copied the file from a rasbian install I had for another pro= ject. Perhaps I should find the corresponding source for it and build it wi= th the device tree source from FreeBSD.
>>>
>>> You also do not mention what version of FreeBSD you are using<= br> >>> 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=3D1.20210831

That was likely a wasteful reference for me to supply. Trying
again:

https://github.com/raspberrypi/firmwa= re/tags?after=3D1.20210831

likely avoids ending up with a full set of linux materials
to go along with the firmware (smaller download with a smaller
expansion).

>> 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--=C2=A0 1 root=C2=A0 wheel=C2=A0 =C2=A0 18693 Aug=C2=A0 5= 04:11:18 2021 firmware-1.20210805/boot/COPYING.linux
>> -rw-rw-r--=C2=A0 1 root=C2=A0 wheel=C2=A0 =C2=A0 =C2=A01594 Aug=C2= =A0 5 04:11:18 2021 firmware-1.20210805/boot/LICENCE.broadcom
>> -rw-rw-r--=C2=A0 1 root=C2=A0 wheel=C2=A0 =C2=A0 26401 Aug=C2=A0 5= 04:11:18 2021 firmware-1.20210805/boot/bcm2708-rpi-b-plus.dtb
>> -rw-rw-r--=C2=A0 1 root=C2=A0 wheel=C2=A0 =C2=A0 25749 Aug=C2=A0 5= 04:11:18 2021 firmware-1.20210805/boot/bcm2708-rpi-b-rev1.dtb
>> -rw-rw-r--=C2=A0 1 root=C2=A0 wheel=C2=A0 =C2=A0 26138 Aug=C2=A0 5= 04:11:18 2021 firmware-1.20210805/boot/bcm2708-rpi-b.dtb
>> -rw-rw-r--=C2=A0 1 root=C2=A0 wheel=C2=A0 =C2=A0 26060 Aug=C2=A0 5= 04:11:18 2021 firmware-1.20210805/boot/bcm2708-rpi-cm.dtb
>> -rw-rw-r--=C2=A0 1 root=C2=A0 wheel=C2=A0 =C2=A0 27076 Aug=C2=A0 5= 04:11:18 2021 firmware-1.20210805/boot/bcm2708-rpi-zero-w.dtb
>> -rw-rw-r--=C2=A0 1 root=C2=A0 wheel=C2=A0 =C2=A0 25883 Aug=C2=A0 5= 04:11:18 2021 firmware-1.20210805/boot/bcm2708-rpi-zero.dtb
>> -rw-rw-r--=C2=A0 1 root=C2=A0 wheel=C2=A0 =C2=A0 27276 Aug=C2=A0 5= 04:11:18 2021 firmware-1.20210805/boot/bcm2709-rpi-2-b.dtb
>> -rw-rw-r--=C2=A0 1 root=C2=A0 wheel=C2=A0 =C2=A0 27425 Aug=C2=A0 5= 04:11:18 2021 firmware-1.20210805/boot/bcm2710-rpi-2-b.dtb
>> -rw-rw-r--=C2=A0 1 root=C2=A0 wheel=C2=A0 =C2=A0 29542 Aug=C2=A0 5= 04:11:18 2021 firmware-1.20210805/boot/bcm2710-rpi-3-b-plus.dtb
>> -rw-rw-r--=C2=A0 1 root=C2=A0 wheel=C2=A0 =C2=A0 28923 Aug=C2=A0 5= 04:11:18 2021 firmware-1.20210805/boot/bcm2710-rpi-3-b.dtb
>> -rw-rw-r--=C2=A0 1 root=C2=A0 wheel=C2=A0 =C2=A0 27421 Aug=C2=A0 5= 04:11:18 2021 firmware-1.20210805/boot/bcm2710-rpi-cm3.dtb
>> -rw-rw-r--=C2=A0 1 root=C2=A0 wheel=C2=A0 =C2=A0 49825 Aug=C2=A0 5= 04:11:18 2021 firmware-1.20210805/boot/bcm2711-rpi-4-b.dtb
>> -rw-rw-r--=C2=A0 1 root=C2=A0 wheel=C2=A0 =C2=A0 49821 Aug=C2=A0 5= 04:11:18 2021 firmware-1.20210805/boot/bcm2711-rpi-400.dtb
>> -rw-rw-r--=C2=A0 1 root=C2=A0 wheel=C2=A0 =C2=A0 50499 Aug=C2=A0 5= 04:11:18 2021 firmware-1.20210805/boot/bcm2711-rpi-cm4.dtb
>> -rw-rw-r--=C2=A0 1 root=C2=A0 wheel=C2=A0 =C2=A0 52456 Aug=C2=A0 5= 04:11:18 2021 firmware-1.20210805/boot/bootcode.bin
>> -rw-rw-r--=C2=A0 1 root=C2=A0 wheel=C2=A0 =C2=A0 =C2=A07278 Aug=C2= =A0 5 04:11:18 2021 firmware-1.20210805/boot/fixup.dat
>> -rw-rw-r--=C2=A0 1 root=C2=A0 wheel=C2=A0 =C2=A0 =C2=A05407 Aug=C2= =A0 5 04:11:18 2021 firmware-1.20210805/boot/fixup4.dat
>> -rw-rw-r--=C2=A0 1 root=C2=A0 wheel=C2=A0 =C2=A0 =C2=A03211 Aug=C2= =A0 5 04:11:18 2021 firmware-1.20210805/boot/fixup4cd.dat
>> -rw-rw-r--=C2=A0 1 root=C2=A0 wheel=C2=A0 =C2=A0 =C2=A08416 Aug=C2= =A0 5 04:11:18 2021 firmware-1.20210805/boot/fixup4db.dat
>> -rw-rw-r--=C2=A0 1 root=C2=A0 wheel=C2=A0 =C2=A0 =C2=A08418 Aug=C2= =A0 5 04:11:18 2021 firmware-1.20210805/boot/fixup4x.dat
>> -rw-rw-r--=C2=A0 1 root=C2=A0 wheel=C2=A0 =C2=A0 =C2=A03211 Aug=C2= =A0 5 04:11:18 2021 firmware-1.20210805/boot/fixup_cd.dat
>> -rw-rw-r--=C2=A0 1 root=C2=A0 wheel=C2=A0 =C2=A0 10262 Aug=C2=A0 5= 04:11:18 2021 firmware-1.20210805/boot/fixup_db.dat
>> -rw-rw-r--=C2=A0 1 root=C2=A0 wheel=C2=A0 =C2=A0 10262 Aug=C2=A0 5= 04:11:18 2021 firmware-1.20210805/boot/fixup_x.dat
>> drwxrwxr-x=C2=A0 2 root=C2=A0 wheel=C2=A0 =C2=A0 =C2=A0 236 Aug=C2= =A0 5 04:11:18 2021 firmware-1.20210805/boot/overlays
>> -rw-rw-r--=C2=A0 1 root=C2=A0 wheel=C2=A0 2959904 Aug=C2=A0 5 04:1= 1:18 2021 firmware-1.20210805/boot/start.elf
>> -rw-rw-r--=C2=A0 1 root=C2=A0 wheel=C2=A0 2235712 Aug=C2=A0 5 04:1= 1:18 2021 firmware-1.20210805/boot/start4.elf
>> -rw-rw-r--=C2=A0 1 root=C2=A0 wheel=C2=A0 =C2=A0799964 Aug=C2=A0 5= 04:11:18 2021 firmware-1.20210805/boot/start4cd.elf
>> -rw-rw-r--=C2=A0 1 root=C2=A0 wheel=C2=A0 3731528 Aug=C2=A0 5 04:1= 1:18 2021 firmware-1.20210805/boot/start4db.elf
>> -rw-rw-r--=C2=A0 1 root=C2=A0 wheel=C2=A0 2987720 Aug=C2=A0 5 04:1= 1:18 2021 firmware-1.20210805/boot/start4x.elf
>> -rw-rw-r--=C2=A0 1 root=C2=A0 wheel=C2=A0 =C2=A0799964 Aug=C2=A0 5= 04:11:18 2021 firmware-1.20210805/boot/start_cd.elf
>> -rw-rw-r--=C2=A0 1 root=C2=A0 wheel=C2=A0 4803496 Aug=C2=A0 5 04:1= 1:18 2021 firmware-1.20210805/boot/start_db.elf
>> -rw-rw-r--=C2=A0 1 root=C2=A0 wheel=C2=A0 3711432 Aug=C2=A0 5 04:1= 1: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=C2=A0 1 root=C2=A0 wheel=C2=A0 5888 Apr 20 19:25:22 2022 /b= oot/efi/armstub8-gic.bin
> -rwxr-xr-x=C2=A0 1 root=C2=A0 wheel=C2=A0 5888 Apr 20 19:25:22 2022 /b= oot/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 .


=3D=3D=3D
Mark Millard
marklmi at yahoo.com

--000000000000f01f5405fb929a0b--