From nobody Thu May 18 13:21:29 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 4QMVxL4g29z4BYYT for ; Thu, 18 May 2023 13:21:42 +0000 (UTC) (envelope-from eduardo@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QMVxL2v00z46x2 for ; Thu, 18 May 2023 13:21:42 +0000 (UTC) (envelope-from eduardo@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684416102; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=oz0QA6GZMbvTCzEO5sMsxz5VQIrOw4Y6cvepa5UayIE=; b=Q+DK88swdQS75GfFYwExoYbdNUdN4NJwn2+VQmQtN2Kjz77k3yjfKz2vgIIhJEtjztKpR8 NNdyQ21T3UjITI6viRiGaUes9etlW4lhxuX2/A/6dhMxuvtlbBo/JKyICY/NHxpK0dM7HV EUfda5+B5pSJWdbLQW4gKwRPTnSw8slQddI0Tz6ziqyb1hC/BGGhX8pv/bFiFVKAGjfTrp crXFfjHpJUhWvVknKQWHncvR54jLhH7BI6yPBt0e7W831mFCdzo+nytIkVM9IqhfjdWt6K UmldoAYnfEaogQ/vnWYRyCmf6ZCnizFI9/+N7IWX1Lq6N6KMeaUkoxMzi7Nxsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684416102; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=oz0QA6GZMbvTCzEO5sMsxz5VQIrOw4Y6cvepa5UayIE=; b=Zp6aZhRWDl21XIQeQft0K6Dtl5eESf6qJJ7Z6OIJKT1EpmvgVEQLde58ubUQzcDAqkNv2F ZNQnWbOIqnvXUETMvq3JJBAx58kXpl09YTAcQzJfWiTzRGYEqCRzwdqpSWFU5dRBqPKNis XNoD9tHbg6u1ieQXzxOeNiKH3ZlBfT6+KH9ZwEyDK1RPy/O6BdGt3yOp5/IPyLHVjkZ/o6 Ax2WSaFLsg/usB1Lc+xOTPrj9csmubjqYwYi0bXw28LFGtGk1H3L4B+3i5jWQ0+zexErTK dEUOcHRTyq3ire/ASD5kIdNFmpdU9SwL6Ix8e7BgZPRfVis7Cu4jHW4Xnt2d3g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1684416102; a=rsa-sha256; cv=none; b=GhK7tJ7ZgELi2///w5pQjoKFrrfpywRjwYT45xCbA/lAg4GDmItnrCVefBbAgYsiVDb5Dr iXwCsVnK1qbQZcz/AEJJUfIiNjCF0a9cnY7+zsReF3sHQnzYEzetIvGFerzCJHfHugxHqU 6qepH2CpaupOSITYKNnVtfOVR80165bwasaXhBrOO2RXSGGI4orwHpvmx5qASC514dOBoP AUQREew1l5zdi91HdPrJJi3BUmCLi/CnY7y4MQQK9ulLYwRV1Z3olFJGk3GroOgmhJyltO sPt4gh4/jqaldTeXoC+F3z8m7/fZ3Ut8sf5sxMi+1tYyRBkAI8eqDtlhWdiVZg== Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (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)) (Authenticated sender: eduardo) by smtp.freebsd.org (Postfix) with ESMTPSA id 4QMVxK6zhHzQ68 for ; Thu, 18 May 2023 13:21:41 +0000 (UTC) (envelope-from eduardo@freebsd.org) Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-1aaf21bb427so15059265ad.1 for ; Thu, 18 May 2023 06:21:41 -0700 (PDT) X-Gm-Message-State: AC+VfDw4MryVeCZ9zlzL+r0ih+6N0mWjCjp5DaT/mMuKQUCtKziijjD0 iyKRItuSjAxRQKYPG8WwQclbvoZgMdzD1k7W9EI= X-Google-Smtp-Source: ACHHUZ7c1Tfgj0ksuJAE+513ta46BmnlKlG04Skt4FXVhlD1ND1QQqgCni5erHNJKy1v/zmYGEcmq46JMD/ghZoJf08= X-Received: by 2002:a17:903:492:b0:1ae:7421:82b5 with SMTP id jj18-20020a170903049200b001ae742182b5mr752565plb.45.1684416100982; Thu, 18 May 2023 06:21:40 -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: From: Nuno Teixeira Date: Thu, 18 May 2023 14:21:29 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Raspberry Pi POE+ hat overlay To: Mark Millard Cc: Doug Rabson , freebsd-arm@freebsd.org Content-Type: multipart/alternative; boundary="0000000000005a6a4d05fbf7af32" X-ThisMailContainsUnwantedMimeParts: N --0000000000005a6a4d05fbf7af32 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable (...) Tomorrow I will take it to the max: over_voltage=3D6 arm_freq=3D2147 gpu_freq=3D750 :) Nuno Teixeira escreveu no dia quinta, 18/05/2023 =C3= =A0(s) 14:11: > (...) > > Found a nice table of overvoltage at > https://www.qengineering.eu/overclocking-the-raspberry-pi-4.html > > (also, I found too some advices that over_voltage not needed to be set in > newer firmwares. Later I will test it on raspberry linux without setting > it). > > I'm at poudriere building www/node18 with with -J4 cores and freq from > 1500->2000 temperature changes from ~46C->~57C > 4 heatsinks and a case fan. > > I'm so happy! > > Thanks! > > Nuno Teixeira escreveu no dia quinta, 18/05/2023 > =C3=A0(s) 13:48: > >> Hello Mark! >> >> Indeed, voltage was the missing bit! >> >> I'm trying to setup 1800 as default now for revs >=3D 1.4 following >> https://www.raspberrypi.com/news/bullseye-bonus-1-8ghz-raspberry-pi-4/ >> that only talk about setting arm_freq=3D1800 but doesn't mention to adju= st >> voltage. >> It was nice that raspberry tell us what voltage exacly value they use fo= r >> new default 1800. >> >> What I've got now is: >> >> [pi4] >> over_voltage=3D6 >> arm_freq=3D2000 >> sdram_freq_min=3D3200 >> ### force_turbo=3D1 >> >> My tests shows that we don't need force_turbo=3D1 for a normal running a= nd >> system do an auto 600 -> 2000 change when needed. Thats nice. >> Also, arm_boost=3D1 with force_turbo or not, is ignored. >> >> sdram_freq and sdram_freq_min are set to 3200 by default, so I think I >> will not need sdram_freq_min=3D3200 here. >> >> The only thing that I can't understand is how to calculate voltage: >> >> over_voltage: 0 (1.35V, 1.2V on Raspberry Pi 1) ??? >> ( https://www.raspberrypi.com/documentation/computers/config_txt.html ) >> >> Also, "7. Take it to the max" ( >> https://magpi.raspberrypi.com/articles/how-to-overclock-raspberry-pi-4 )= : >> >> over_voltage=3D6 (?) >> arm_freq=3D2147 >> gpu_freq=3D750 >> >> Thanks, >> >> >> Mark Millard escreveu no dia quinta, 18/05/2023 =C3= =A0(s) >> 11:57: >> >>> On May 18, 2023, at 01:29, Nuno Teixeira wrote: >>> >>> > Confirmed that arm_boost is enable by default on rpi4 rev >=3D 1.4 as= I >>> checked with htop. >>> > >>> > Also, tested arm_freq=3D1800 and it crashes FreeBSD around initializi= ng >>> console/video and detecting mouse. >>> >>> Overclocking by setting the arm_freq directly involves also >>> managing over_voltage explicitly, such as: >>> >>> over_voltage=3D6 >>> >>> A sequence I use (and have used for a long time) is: >>> >>> [pi4] >>> over_voltage=3D6 >>> arm_freq=3D2000 >>> sdram_freq_min=3D3200 >>> force_turbo=3D1 >>> >>> But each RPi4B has heatsinks, a case with a fan, >>> and a power supply rated for 5.1V 3.5A (so: has >>> some extra margin). >>> >>> But the range of RPi4B's span Rev 1.1, Rev 1.4, >>> and Rev 1.5, a mix of 4 GiByte RAM and 8 GiByte >>> RAM models. All use those settings. >>> >>> As I understand, arm_boost implicitly does the >>> extra things required for its implicit frequency, >>> unlike assigning arm_freq or the like. >>> >>> If force_turbo is not used, it can be that: >>> >>> # >>> # Local addition that avoids USB3 SSD boot failures that look like: >>> # uhub_reattach_port: port ? reset failed, error=3DUSB_ERR_TIMEOUT >>> # uhub_reattach_port: device problem (USB_ERR_TIMEOUT), disabling por= t >>> ? >>> initial_turbo=3D60 >>> >>> is required for USB based booting. But this also >>> gets into if the notation is supported or not for >>> the firmware vintage used. >>> >>> The initial_turbo use happens to avoid frequency >>> variability during boot and it appears that FreeBSD >>> does not necessarily tolerate such variability in >>> that time frame. >>> >>> Also: I happen to have USB3 boot media for which use >>> of usb_pgood_delay=3D2000 is sufficient but without >>> some such in/for U-Boot, U-Boot has problems >>> recognizing the device (before FreeBSD is even >>> involved). I build the U-Boot port with the >>> assignment built in. >>> >>> > As linux config.txt says: >>> > --- >>> > [pi4] >>> > # Run as fast as firmware / board allows >>> > arm_boost=3D1 >>> > --- >>> > firmware must be updated to support this feature for sure. >>> >>> I'm not aware of a dated list of when the various >>> config.txt notations were first supported (firmware >>> version). This makes it messier to use the web's >>> published information, if one is using the firmware >>> vintage that FreeBSD has in its port for the >>> firmware. >>> >>> The notation that I use has been around for a long >>> time. >>> >>> > Cheers, >>> > >>> > Nuno Teixeira escreveu no dia quarta, >>> 17/05/2023 =C3=A0(s) 14:08: >>> > (...) >>> > >>> > I was meant using 13.2 not 12.3 :) >>> > >>> > Doug Rabson escreveu no dia quarta, 17/05/2023 =C3= =A0(s) >>> 13:47: >>> > I'm not sure about 12.3 either - you could try with 13.2 and see if >>> that makes a difference. >>> > >>> > On Wed, 17 May 2023 at 13:45, Nuno Teixeira >>> wrote: >>> > Hey, >>> > >>> > Ok. I'm new to rpi4 and arm in general but tomorrow I will force >>> 'arm_freq=3D1800' again just to see it it crashes again. >>> > I will check too what values linux shows. >>> > >>> > I don't know if firmware/uboot version included in 12.3 supports this >>> feature. >>> > >>> > Cheers, >>> > >>> > Doug Rabson escreveu no dia quarta, 17/05/2023 =C3= =A0(s) >>> 13:11: >>> > Hi Nuno, >>> > >>> > I'm not sure where to start - I just happened to notice in the >>> documentation here: >>> https://www.raspberrypi.com/documentation/computers/config_txt.html >>> that the cpu frequency Pi4B R1.4 was listed as 1800 if arm_boot=3D1 so = I >>> tried it. >>> > >>> > Doug. >>> > >>> > >>> > >>> > On Wed, 17 May 2023 at 11:11, Nuno Teixeira >>> wrote: >>> > Hello Doug, >>> > >>> > I have too a 1.5 rpi but arm_boost=3D1 isn't doing anything, htop sho= ws >>> 1500Mhz when doing something intensive. >>> > I'm running 13.2 stable >>> > >>> > Do I missing something? >>> > >>> > Could you take a look at my setup? >>> > >>> > Thanks, >>> > >>> > Doug Rabson escreveu no dia ter=C3=A7a, 16/05/2023 = =C3=A0(s) >>> 17:19: >>> > >>> > On Sat, 13 May 2023 at 13:45, Doug Rabson wrote: >>> > 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 th= e >>> undocumented mailbox API by reading the Linux code. >>> > >>> > I have a first approximation of a fan driver which works with the >>> 1.20210805 firmware (actually, I substituted rpi-poe-plus.dtbo from >>> 1.20210831 which just changes the fan levels for the POE+). I'm testing >>> with an rpi4B rev 1.5 with 'make -j4 buildworld' and the fan is keeping= the >>> cpu temperature below 65 degrees which is nice, especially since I set >>> arm_boost=3D1 in config.txt which boosts the cpu frequency up to 1800 f= or >>> this board. >>> > >>> > Does anyone have a pointer to the problem with firmware later than >>> 20210805? Would it make any kind of sense to try to get the fix into >>> releng/13.2 as an errata? >>> > >>> >>> >>> =3D=3D=3D >>> Mark Millard >>> marklmi at yahoo.com >>> >>> >> >> -- >> Nuno Teixeira >> FreeBSD Committer (ports) >> > > > -- > Nuno Teixeira > FreeBSD Committer (ports) > --=20 Nuno Teixeira FreeBSD Committer (ports) --0000000000005a6a4d05fbf7af32 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
(...)

Tomorrow I will take i= t to the max:

over_voltage=3D6
arm_freq=3D2147<= br>gpu_freq=3D750

:)

Nuno Teixeira <eduardo@freebsd.org> escreveu n= o dia quinta, 18/05/2023 =C3=A0(s) 14:11:
(...)

<= div>Found a nice table of overvoltage at https://www.qe= ngineering.eu/overclocking-the-raspberry-pi-4.html

=
(also, I found too some advices that over_voltage not needed to be set= in newer firmwares. Later I will test it on raspberry linux without settin= g it).

I'm at poudriere building www/node18 wi= th with -J4 cores and freq from 1500->2000 temperature changes from ~46C= ->~57C
4 heatsinks and a case fan.

I&= #39;m so happy!

Thanks!

Nuno Teixeira &l= t;eduardo@freebsd.= org> escreveu no dia quinta, 18/05/2023 =C3=A0(s) 13:48:
Hello= Mark!

Indeed, voltage was the missing bit!
<= div>
I'm trying to setup 1800 as default now for revs >= ;=3D 1.4 following https://www.raspberrypi.com/ne= ws/bullseye-bonus-1-8ghz-raspberry-pi-4/ that only talk about setting a= rm_freq=3D1800 but doesn't mention to adjust voltage.
It was = nice that raspberry tell us what voltage exacly value they use for new defa= ult 1800.

What I've got now is:
=
[pi4]
over_voltage=3D6
arm_freq=3D2000
sdram_freq_min=3D3200
### force_turbo=3D1

My tests shows that we don'= ;t need force_turbo=3D1 for a normal running and system do an auto 600 ->= ; 2000 change when needed. Thats nice.
Also, arm_boost=3D1 wi= th force_turbo or not, is ignored.

sdram_freq and = sdram_freq_min are set to 3200 by default, so I think I will not need sdram= _freq_min=3D3200 here.

The only thing that I can&#= 39;t understand is how to calculate voltage:

over_= voltage: 0 (1.35V, 1.2V on Raspberry Pi 1) ???


over_voltage=3D6 (?)
arm_freq= =3D2147
gpu_freq=3D750

Thanks,


Mark Millard <m= arklmi@yahoo.com> escreveu no dia quinta, 18/05/2023 =C3=A0(s) 11:57= :
On May 18, 202= 3, at 01:29, Nuno Teixeira <eduardo@freebsd.org> wrote:

> Confirmed that arm_boost is enable by default on rpi4 rev >=3D 1.4 = as I checked with htop.
>
> Also, tested arm_freq=3D1800 and it crashes FreeBSD around initializin= g console/video and detecting mouse.

Overclocking by setting the arm_freq directly involves also
managing over_voltage explicitly, such as:

over_voltage=3D6

A sequence I use (and have used for a long time) is:

[pi4]
over_voltage=3D6
arm_freq=3D2000
sdram_freq_min=3D3200
force_turbo=3D1

But each RPi4B has heatsinks, a case with a fan,
and a power supply rated for 5.1V 3.5A (so: has
some extra margin).

But the range of RPi4B's span Rev 1.1, Rev 1.4,
and Rev 1.5, a mix of 4 GiByte RAM and 8 GiByte
RAM models. All use those settings.

As I understand, arm_boost implicitly does the
extra things required for its implicit frequency,
unlike assigning arm_freq or the like.

If force_turbo is not used, it can be that:

#
# Local addition that avoids USB3 SSD boot failures that look like:
#=C2=A0 =C2=A0uhub_reattach_port: port ? reset failed, error=3DUSB_ERR_TIME= OUT
#=C2=A0 =C2=A0uhub_reattach_port: device problem (USB_ERR_TIMEOUT), disabli= ng port ?
initial_turbo=3D60

is required for USB based booting. But this also
gets into if the notation is supported or not for
the firmware vintage used.

The initial_turbo use happens to avoid frequency
variability during boot and it appears that FreeBSD
does not necessarily tolerate such variability in
that time frame.

Also: I happen to have USB3 boot media for which use
of usb_pgood_delay=3D2000 is sufficient but without
some such in/for U-Boot, U-Boot has problems
recognizing the device (before FreeBSD is even
involved). I build the U-Boot port with the
assignment built in.

> As linux config.txt says:
> ---
> [pi4]
> # Run as fast as firmware / board allows
> arm_boost=3D1
> ---
> firmware must be updated to support this feature for sure.

I'm not aware of a dated list of when the various
config.txt notations were first supported (firmware
version). This makes it messier to use the web's
published information, if one is using the firmware
vintage that FreeBSD has in its port for the
firmware.

The notation that I use has been around for a long
time.

> Cheers,
>
> Nuno Teixeira <eduardo@freebsd.org> escreveu no dia quarta, 17/05/2023 =C3=A0(= s) 14:08:
> (...)
>
> I was meant using 13.2 not 12.3 :)
>
> Doug Rabson <df= r@rabson.org> escreveu no dia quarta, 17/05/2023 =C3=A0(s) 13:47: > I'm not sure about 12.3 either - you could try with 13.2 and see i= f that makes a difference.
>
> On Wed, 17 May 2023 at 13:45, Nuno Teixeira <eduardo@freebsd.org> wrote:
> Hey,
>
> Ok. I'm new to rpi4 and arm in general but tomorrow I will force &= #39;arm_freq=3D1800' again just to see it it crashes again.
> I will check too what values linux shows.
>
> I don't know if firmware/uboot version included in 12.3 supports t= his feature.
>
> Cheers,
>
> Doug Rabson <df= r@rabson.org> escreveu no dia quarta, 17/05/2023 =C3=A0(s) 13:11: > Hi Nuno,
>
> I'm not sure where to start - I just happened to notice in the doc= umentation here: https://www.rasp= berrypi.com/documentation/computers/config_txt.html that the cpu freque= ncy Pi4B R1.4 was listed as 1800 if arm_boot=3D1 so I tried it.
>
> Doug.
>
>
>
> On Wed, 17 May 2023 at 11:11, Nuno Teixeira <eduardo@freebsd.org> wrote:
> Hello Doug,
>
> I have too a 1.5 rpi but arm_boost=3D1 isn't doing anything, htop = shows 1500Mhz when doing something intensive.
> I'm running 13.2 stable
>
> Do I missing something?
>
> Could you take a look at my setup?
>
> Thanks,
>
> Doug Rabson <df= r@rabson.org> escreveu no dia ter=C3=A7a, 16/05/2023 =C3=A0(s) 17:19= :
>
> On Sat, 13 May 2023 at 13:45, Doug Rabson <dfr@rabson.org> wrote:
> I was able to build an updated rpi-firmware port based on 1.20210805 a= nd 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 un= documented mailbox API by reading the Linux code.
>
> I have a first approximation of a fan driver which works with the 1.20= 210805 firmware (actually, I substituted rpi-poe-plus.dtbo from 1.20210831 = which just changes the fan levels for the POE+). I'm testing with an rp= i4B rev 1.5 with 'make -j4 buildworld' and the fan is keeping the c= pu temperature below 65 degrees which is nice, especially since I set arm_b= oost=3D1 in config.txt which boosts the cpu frequency up to 1800 for this b= oard.
>
> Does anyone have a pointer to the problem with firmware later than 202= 10805? Would it make any kind of sense to try to get the fix into releng/13= .2 as an errata?
>


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



--
Nuno TeixeiraFreeBSD Committer (ports)


--
Nuno TeixeiraFreeBSD Committer (ports)


--
Nuno Teixeira
FreeBSD Committ= er (ports)
--0000000000005a6a4d05fbf7af32--