Re: Raspberry Pi 4 support on 32 bit earmv7hf GENERIC kernel
Izumi Tsutsui <[email protected]> Sat, 4 Apr 2026 06:58:27 +0900
| Newsgroups | gmane.os.netbsd.ports.arm |
|---|---|
| Message-ID | <[email protected]> |
> [email protected] (Izumi Tsutsui) writes: > > >> >I'm not familiar FDT or Raspberry Pi firmware, but ofctl says: > >> > >> Yes. It has been deleted in "our" dtb file. > > >Sorry, I don't see your point. What's your actual suggestion? > >To revert some NetBSD's change in dts files?? > > > My point is that with a suitable fdt, you already have support > for the framebuffer. That's the easiest way and works since > many years. > > % ofctl -p /soc/fb > [Caching 235 nodes and 1235 properties] > compatible 6272636d 2c62636d 32383335 2d666200 "brcm,bcm2835-fb" > name 666200.. ........ ........ ........ "fb" > phandle 0000008f ........ ........ ........ .... > status 6f6b00.. ........ ........ ........ ok. > > genfb0 at simplebus1: switching to framebuffer console I think there may still be two different framebuffer paths mixed together here. I understand the point about /soc/fb and brcm,bcm2835-fb, but when I look at the current DTS files in src/sys/external/gpl2/dts, "brcm,bcm2835-fb" comes only from bcm2835-common.dtsi: --- % grep bcm2835-fb * bcm2835-common.dtsi: compatible = "brcm,bcm2835-fb"; mirage-% grep bcm2835-common.dtsi * bcm2835.dtsi:#include "bcm2835-common.dtsi" bcm2836.dtsi:#include "bcm2835-common.dtsi" bcm2837.dtsi:#include "bcm2835-common.dtsi" mirage-% egrep 'bcm283[567]\.dtsi' * bcm2835-rpi-a-plus.dts:#include "bcm2835.dtsi" bcm2835-rpi-a.dts:#include "bcm2835.dtsi" bcm2835-rpi-b-plus.dts:#include "bcm2835.dtsi" bcm2835-rpi-b-rev2.dts:#include "bcm2835.dtsi" bcm2835-rpi-b.dts:#include "bcm2835.dtsi" bcm2835-rpi-cm1.dtsi:#include "bcm2835.dtsi" bcm2835-rpi-zero-w.dts:#include "bcm2835.dtsi" bcm2835-rpi-zero.dts:#include "bcm2835.dtsi" bcm2836-rpi-2-b.dts:#include "bcm2836.dtsi" bcm2837-rpi-3-a-plus.dts:#include "bcm2837.dtsi" bcm2837-rpi-3-b-plus.dts:#include "bcm2837.dtsi" bcm2837-rpi-3-b.dts:#include "bcm2837.dtsi" bcm2837-rpi-cm3.dtsi:#include "bcm2837.dtsi" bcm2837-rpi-zero-2-w.dts:#include "bcm2837.dtsi" bcm283x.dtsi: * bcm2835.dtsi and bcm2836.dtsi. % --- For Raspberry Pi 4 (with BCM2711): - bcm2711-rpi-4-b.dts includes bcm2711.dtsi - bcm2711-rpi-400.dts includes bcm2711-rpi-4-b.dts - bcm2711-rpi-cm4.dtsi includes bcm2711.dtsi - bcm2711-rpi-cm4-io.dts includes bcm2711-rpi-cm4.dtsi I do not see any "brcm,bcm2835-fb" node in that bcm2711 DTS paths. There is no override .dts file for rpi-4/bcm2711 variants in src/sys/arch/arm/dts/ either: https://nxr.netbsd.org/xref/src/sys/arch/arm/dts/ So, at least from what I can see in the current tree, this still looks like a separate /chosen/simple-framebuffer enumeration issue on RPi4. What I am tryingto handle in this thread is this simple-framebuffer case. As noted in my past post, Raspberry Pi 4 firmware (start4.elf) populates /chosen dynamically, places "simple-framebuffer" under it, and also gives "/chosen" node the non-standard compatible string "simple_bus". Currently fdt_match() in src/sys/dev/fdt/fdtbus.c matches compatible "simple-bus" or "/chosen node without a compatible property" so "/chosen" with compatible string "simple_bus" in this rpi-4 case is not attached as simplebus. That is why the patch below only extends the existing /chosen special case to cover /chosen with compatible "simple_bus". https://github.com/NetBSD/src/commit/8d680e0d7b993a09afb7234286cf48554f824e24 --- diff --git a/sys/dev/fdt/fdtbus.c b/sys/dev/fdt/fdtbus.c index e557b0c6479a..828b673353a8 100644 --- a/sys/dev/fdt/fdtbus.c +++ b/sys/dev/fdt/fdtbus.c @@ -93,6 +93,11 @@ static const struct device_compatible_entry compat_data[] = { DEVICE_COMPAT_EOL }; +static const struct device_compatible_entry chosen_compat_data[] = { + { .compat = "simple_bus" }, + DEVICE_COMPAT_EOL +}; + CFATTACH_DECL2_NEW(simplebus, sizeof(struct fdt_softc), fdt_match, fdt_attach, NULL, NULL, fdt_rescan, fdt_childdet); @@ -116,6 +121,15 @@ fdt_match(device_t parent, cfdata_t cf, void *aux) return 1; } + /* + * Raspberry Pi 4 firmware (start4.elf) may populate /chosen node + * dynamically and set a non-standard compatible string "simple_bus". + * Treat that case like the existing /chosen special case above. + */ + if (OF_finddevice("/chosen") == phandle && + of_compatible_match(phandle, chosen_compat_data)) + return 1; + /* Always match the root node */ return OF_finddevice("/") == phandle; } --- If there is another bcm2711-side framebuffer path I should be looking at instead, I would appreciate a pointer. Otherwise, unless there are objections, I am inclined to proceed with this narrow /chosen-specific workaround. Thanks, --- Izumi Tsutsui