Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 May 2023 17:18:53 +0100
From:      Doug Rabson <dfr@rabson.org>
To:        Emmanuel Vadot <manu@bidouilliste.com>
Cc:        freebsd-arm@freebsd.org
Subject:   Re: Raspberry Pi POE+ hat overlay
Message-ID:  <CACA0VUjSf=o29Zo5f2MpKO4M%2B5=avf=bhNoSStzTEyumy%2BPJrw@mail.gmail.com>
In-Reply-To: <20230512180949.5ea314b166e0b9975eeb0535@bidouilliste.com>
References:  <CACA0VUh9-7o55pXcyn=Ep9mPexAkgjKLEKUh6HqMovTxe2_R0Q@mail.gmail.com> <20230512180949.5ea314b166e0b9975eeb0535@bidouilliste.com>

next in thread | previous in thread | raw e-mail | index | archive | help
--000000000000b04e2705fb8176c2
Content-Type: text/plain; charset="UTF-8"

Yes - I copied it from a random Linux distro I had lying around:

$ ls /boot/msdos/overlays
disable-bt.dtbo   mmc.dtbo          pwm.dtbo          rpi-poe-plus.dtbo

I'm wondering if it's something to so with the compatible settings on the
overlay. Disassembling it with dtc looks like this:

/dts-v1/;

/  {

        compatible = "brcm,bcm2835";
        fragment@0 {

                target-path = "/";
                __overlay__ {

                        pwm-fan {

                                compatible = "pwm-fan";
                                cooling-levels = <0x0 0x20 0x40 0x80 0xff>;
                                #cooling-cells = <0x2>;
                                pwms = <0x1 0x0 0x13880>;
                                phandle = <0x3>;
                        };
                };
        };
...

On Fri, 12 May 2023 at 17:09, Emmanuel Vadot <manu@bidouilliste.com> wrote:

> On Fri, 12 May 2023 16:43:55 +0100
> Doug Rabson <dfr@rabson.org> 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?
>
> DT Overlays works fine, the process of them on RPI is:
>
>  - Firmware loads the DTB
>  - Parse the config.txt and load/apply the overlays
>  - The DTB is passed to u-boot which in turn pass it to loader/kernel
>
>  Stupid question but did you copy the rpi-poe-plus.dtbo on the fat
> partition ?
>
> --
> Emmanuel Vadot <manu@bidouilliste.com> <manu@freebsd.org>
>

--000000000000b04e2705fb8176c2
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Yes - I copied it from a random Linux distro I had lying a=
round:<div><br></div><div>$ ls /boot/msdos/overlays<br>disable-bt.dtbo =C2=
=A0 mmc.dtbo =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pwm.dtbo =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0rpi-poe-plus.dtbo<br></div><div><br></div><div>I&#39;m won=
dering if it&#39;s something to so with the compatible settings on the over=
lay. Disassembling it with dtc looks like this:</div><div><br></div><div>/d=
ts-v1/;<br><br>/ =C2=A0{<br><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 compatible =3D =
&quot;brcm,bcm2835&quot;;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 fragment@0 {<br><b=
r>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 target-path =3D &=
quot;/&quot;;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 __=
overlay__ {<br><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 pwm-fan {<br><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 compatible =3D &quot;pwm-fan&quot;;<br>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 cooling-levels =3D &lt;0x0 0x20 0x40 0x80 0xff&gt;;<br>=C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 #cooling-cells =3D &lt;0x2&gt;;<br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 pwms =3D &lt;0x1 0x0 0x13880&gt;;<br>=C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 phandle =3D &lt;0x3&gt;;<br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 };<br=
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 };<br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 };<br></div><div>...</div></div><br><div class=3D"gmail_q=
uote"><div dir=3D"ltr" class=3D"gmail_attr">On Fri, 12 May 2023 at 17:09, E=
mmanuel Vadot &lt;<a href=3D"mailto:manu@bidouilliste.com">manu@bidouillist=
e.com</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"ma=
rgin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border=
-left-color:rgb(204,204,204);padding-left:1ex">On Fri, 12 May 2023 16:43:55=
 +0100<br>
Doug Rabson &lt;<a href=3D"mailto:dfr@rabson.org" target=3D"_blank">dfr@rab=
son.org</a>&gt; wrote:<br>
<br>
&gt; I have a pi4 with the official POE+ hat which I want to run FreeBSD on=
. One<br>
&gt; thing I noticed is that the fan doesn&#39;t run in FreeBSD so I decide=
d to try<br>
&gt; and write a little driver for it. First step seems to be to load the<b=
r>
&gt; corresponding devicetree overlay by adding something like this to<br>
&gt; /boot/msdos/config.txt:<br>
&gt; <br>
&gt; dtoverlay=3Drpi-poe-plus<br>
&gt; dtparam=3Dpoe_fan_temp0=3D45000,dtparam=3Dpoe_fan_temp0_hyst=3D3000<br=
>
&gt; dtparam=3Dpoe_fan_temp1=3D50000,dtparam=3Dpoe_fan_temp1_hyst=3D3000<br=
>
&gt; dtparam=3Dpoe_fan_temp2=3D62000,dtparam=3Dpoe_fan_temp2_hyst=3D4000<br=
>
&gt; dtparam=3Dpoe_fan_temp3=3D70000,dtparam=3Dpoe_fan_temp3_hyst=3D5000<br=
>
&gt; <br>
&gt; Unfortunately this is where I&#39;m stuck - the overlay is not present=
 in the<br>
&gt; final DTB given to the kernel so there isn&#39;t anything to hook a dr=
iver to.<br>
&gt; Are dtoverlays supposed to work on FreeBSD?<br>
<br>
DT Overlays works fine, the process of them on RPI is:<br>
<br>
=C2=A0- Firmware loads the DTB<br>
=C2=A0- Parse the config.txt and load/apply the overlays<br>
=C2=A0- The DTB is passed to u-boot which in turn pass it to loader/kernel<=
br>
<br>
=C2=A0Stupid question but did you copy the rpi-poe-plus.dtbo on the fat<br>
partition ?<br>
<br>
-- <br>
Emmanuel Vadot &lt;<a href=3D"mailto:manu@bidouilliste.com" target=3D"_blan=
k">manu@bidouilliste.com</a>&gt; &lt;<a href=3D"mailto:manu@freebsd.org" ta=
rget=3D"_blank">manu@freebsd.org</a>&gt;<br>
</blockquote></div>

--000000000000b04e2705fb8176c2--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACA0VUjSf=o29Zo5f2MpKO4M%2B5=avf=bhNoSStzTEyumy%2BPJrw>