From nobody Fri May 12 16:18:53 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 4QHv8p0pFdz4BBwc for ; Fri, 12 May 2023 16:19:06 +0000 (UTC) (envelope-from dfr@rabson.org) Received: from mail-yb1-xb2d.google.com (mail-yb1-xb2d.google.com [IPv6:2607:f8b0:4864:20::b2d]) (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 4QHv8n0QZTz4JWD for ; Fri, 12 May 2023 16:19:05 +0000 (UTC) (envelope-from dfr@rabson.org) Authentication-Results: mx1.freebsd.org; none Received: by mail-yb1-xb2d.google.com with SMTP id 3f1490d57ef6-b99489836aaso8734318276.0 for ; Fri, 12 May 2023 09:19:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rabson-org.20221208.gappssmtp.com; s=20221208; t=1683908344; x=1686500344; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=v/4aNwvwUjHJSkgo6K7QY34ZsBQujNqEapt3bR0tVgE=; b=w3JLWd+BNhpdhjKU+kaIlBeaPWgSz3q4Bj7ejVNAlSwJTNHp5U7awlm0DA7kaZNt74 IKwyWgqg34/V8sHJs9zvrWJV4aKE7fLj12GbGrYJfLLqjwZuJuke2Ox8a7KZLhY8n6JV 0GkRZY3cbwpOLO1g3tAkEH6eKefT/qyf0ZxMlS+pElX5QcuYsA3fgoRAbpkJ4yaIIRAG HVzIqjOuIU31SSKtf247vt8LOeBYhcW0Ba88K/W+UOJqKBRe071yqo+10bouY+evzQ/c +s3/gyx/67wjH5FUx9aBVKnunVbboS0boXWFr09jgHoQkqpCUbQJVL8r8YYZq/yC4qnT 6KZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683908344; x=1686500344; 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=v/4aNwvwUjHJSkgo6K7QY34ZsBQujNqEapt3bR0tVgE=; b=ikageZL/D/VrbBUji0WotPRLMI+p0blNw4pW88I+IBg8sUvVOdLzH2+7Mwh5pRzDPA UBzPq4fzTCW1FDGokZv/OtvbYTPJ01PCj/Fa2+nvXbugH6+8Q1BnDAGU3QQmd/pv4ZY7 ma4uUu5NLkv0iHSN3mJHbqFVw5ulLTcodZU4sxyt6/oESUGyCfsU8fMUPqn14yv+5Szv W+XbLQQ4hGzrzYV+YeXR+A5Q7df9MoqT8UrWe/vBvZGGb665Z7jiZNzQ7sHkNR/bOpKG t4Eh00JQxL6RO0wBt26stumL1LDrlTT0IVanDLnxgrx/e7tqSP/SiCKPLJX7Nvf8zdIb YQDg== X-Gm-Message-State: AC+VfDysm5OmHnMYCh9+pq69ljHlW7QPLggbirx5D20EJLfxPcFi0Zpg BSsyrQtt1ETM1CSsYrRZ53FLj9deN072OwBKAX6GzRfrkJfDBkGWVkwl6w== X-Google-Smtp-Source: ACHHUZ5VOkD4amR2QPtSl/LHcQlRcI1hyQJHF11DVQ46KXLNffPxkuRvSEgHKpkxPEzoi2hnQjn6Fb41eZb4nNTFVZU= X-Received: by 2002:a25:7394:0:b0:ba7:1a2d:7749 with SMTP id o142-20020a257394000000b00ba71a2d7749mr1530306ybc.51.1683908344164; Fri, 12 May 2023 09:19:04 -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: <20230512180949.5ea314b166e0b9975eeb0535@bidouilliste.com> In-Reply-To: <20230512180949.5ea314b166e0b9975eeb0535@bidouilliste.com> From: Doug Rabson Date: Fri, 12 May 2023 17:18:53 +0100 Message-ID: Subject: Re: Raspberry Pi POE+ hat overlay To: Emmanuel Vadot Cc: freebsd-arm@freebsd.org Content-Type: multipart/alternative; boundary="000000000000b04e2705fb8176c2" X-Rspamd-Queue-Id: 4QHv8n0QZTz4JWD 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 --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 wrote: > On Fri, 12 May 2023 16:43:55 +0100 > 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? > > 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 > --000000000000b04e2705fb8176c2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Yes - I copied it from a random Linux distro I had lying a= round:

$ ls /boot/msdos/overlays
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

I'm won= dering if it's something to so with the compatible settings on the over= lay. Disassembling it with dtc looks like this:

/d= ts-v1/;

/ =C2=A0{

=C2=A0 =C2=A0 =C2=A0 =C2=A0 compatible =3D = "brcm,bcm2835";
=C2=A0 =C2=A0 =C2=A0 =C2=A0 fragment@0 {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 target-path =3D &= quot;/";
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 __= overlay__ {

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

=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 "pwm-fan";
=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 <0x0 0x20 0x40 0x80 0xff>;
=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 <0x2>;
=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 <0x1 0x0 0x13880>;
=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 <0x3>;
=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 =C2=A0 =C2=A0 =C2=A0 =C2=A0 };
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 };
...

On Fri, 12 May 2023 at 17:09, E= mmanuel Vadot <manu@bidouillist= e.com> wrote:
On Fri, 12 May 2023 16:43:55= +0100
Doug Rabson <dfr@rab= son.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 decide= d 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=3Drpi-poe-plus
> dtparam=3Dpoe_fan_temp0=3D45000,dtparam=3Dpoe_fan_temp0_hyst=3D3000 > dtparam=3Dpoe_fan_temp1=3D50000,dtparam=3Dpoe_fan_temp1_hyst=3D3000 > dtparam=3Dpoe_fan_temp2=3D62000,dtparam=3Dpoe_fan_temp2_hyst=3D4000 > dtparam=3Dpoe_fan_temp3=3D70000,dtparam=3Dpoe_fan_temp3_hyst=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 anything to hook a dr= iver to.
> Are dtoverlays supposed to work on FreeBSD?

DT Overlays works fine, the process of them on RPI is:

=C2=A0- Firmware loads the DTB
=C2=A0- Parse the config.txt and load/apply the overlays
=C2=A0- The DTB is passed to u-boot which in turn pass it to loader/kernel<= br>
=C2=A0Stupid question but did you copy the rpi-poe-plus.dtbo on the fat
partition ?

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