From nobody Fri May 12 16:23:10 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 4QHvFY6nr9z4BC9b for ; Fri, 12 May 2023 16:23:13 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mx.blih.net (mx.blih.net [212.83.155.74]) (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 (2048 bits) client-digest SHA256) (Client CN "mx.blih.net", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QHvFY4FN5z4KN8 for ; Fri, 12 May 2023 16:23:13 +0000 (UTC) (envelope-from manu@bidouilliste.com) Authentication-Results: mx1.freebsd.org; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com; s=mx; t=1683908592; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0KM1v6BH0lyakLqFNi+SpsRtzVOAKpxYiPu9KeonnMc=; b=eQ7GDUGzudMWq3iT2/fc5K3iFlblAczc4L5iQuiDAQN06ARHK/0bsBZ0z61VL08BcBerIM rvW6jUC+gVf9S4gUn136Vk6ChE+XdjuLmxCTrJKIasURtuIm7jfHjjQUzMZtEwnEm56ltZ Af7RNTLBxdRF1FP9ID1WR90fdGmpy4s= Received: from skull.home.blih.net (lfbn-lyo-1-2174-135.w90-66.abo.wanadoo.fr [90.66.97.135]) by mx.blih.net (OpenSMTPD) with ESMTPSA id ee59c2ed (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 12 May 2023 16:23:11 +0000 (UTC) Date: Fri, 12 May 2023 18:23:10 +0200 From: Emmanuel Vadot To: Doug Rabson Cc: freebsd-arm@freebsd.org Subject: Re: Raspberry Pi POE+ hat overlay Message-Id: <20230512182310.56fb513ac2271ef78c5ac1d3@bidouilliste.com> In-Reply-To: References: <20230512180949.5ea314b166e0b9975eeb0535@bidouilliste.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; amd64-portbld-freebsd14.0) 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 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4QHvFY4FN5z4KN8 X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:12876, ipnet:212.83.128.0/19, country:FR] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N On Fri, 12 May 2023 17:18:53 +0100 Doug Rabson 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 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 > > -- Emmanuel Vadot