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

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 12 May 2023 17:18:53 +0100
Doug Rabson <dfr@rabson.org> wrote:

> 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";

 No idea how the rpi firmware checks things but this seems to be for
the first RPI and if the firmware is doing the right thing this will
not be applied.
 You can check in u-boot if the DTB is correctly patched btw using the
'fdt' command.

>         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>
> >


-- 
Emmanuel Vadot <manu@bidouilliste.com> <manu@freebsd.org>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20230512182310.56fb513ac2271ef78c5ac1d3>