Port-arm archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Raspberry Pi 4 support on 32 bit earmv7hf GENERIC kernel



> >> This seems completely wrong.
> >> 
> >> Perhaps the DTS need patching with
> >> 
> >> bcm2711.dtsi:           enable-method = "brcm,bcm2836-smp"; // for ARM 32-bit
> >> 
> >> s/brcm,bcm2836-smp/brcm,bcm2711-smp/
> > 
> > I have no idea if we should patch DTS for maintainability.
> 
> Well there is a way to fix upstream DTS (it can and does have bugs) without
> changing sys/external/gpl2/dts/dist
> 
> See sys/arch/arm/dts

Well, it's a bit hard to see how local changes should be applied,
but I'll check them later. (Any documentation?)

> >>> diff --git a/sys/dev/fdt/fdtbus.c b/sys/dev/fdt/fdtbus.c
> >>> index e557b0c6479a..fc244ef1e88a 100644
> >>> --- a/sys/dev/fdt/fdtbus.c
> >>> +++ b/sys/dev/fdt/fdtbus.c
> >>> @@ -90,6 +90,7 @@ static void fdt_post_attach(struct fdt_node *);
> >>>  static const struct device_compatible_entry compat_data[] = {
> >>>   { .compat = "simple-bus" },
> >>>   { .compat = "simple-pm-bus" },
> >>> + { .compat = "simple_bus" },
> >>>   DEVICE_COMPAT_EOL
> >>>  };
> >> 
> >> Are you using vendor DTS? Please don't.
> > 
> > I'm not sure what "vendor DTS" means, but I'm using armv7.img.gz
> > from NetBSD 11.0_RC2 and only the kernel is built on -current tree.
> > (I have not tried -current image)
> 
> Where did you get your dtb?
> 
> ~/netbsd/nbcvs/src % grep -r simple_bus sys/external/gpl2/dts/dist
> ~/netbsd/nbcvs/src %

Not sure, I'm just using netbsd-11 (/s/netbsd-11/src) and
github trunk tree (/s/tsutsui/netbsd/src) bht neighter has
"simple_bus" in sys/external/gpl2/dts/dist:
---
mirage-% grep -r simple_bus /s/netbsd-11/src/sys/external/gpl2/dts/dist
mirage-% grep -r simple_bus /s/tsutsui/netbsd/src/sys/external/gpl2/dts/dist
mirage-% 
---

I forgot to mention details in my GitHub log what ofctl(8) said:
 https://github.com/tsutsui/netbsd-src/commit/bc1c34ddd123b3f61f89fcfd30e57aed6eeda189
---
fdt: match "simple_bus" reported by Rasberry Pi 4B on /chosen node

arm64# ofctl -p /chosen name compatible
[Caching 258 nodes and 1436 properties]
name                    63686f73 656e00.. ........ ........   "chosen"
compatible              73696d70 6c655f62 757300.. ........   "simple_bus"
---

It looks src/external/broadcom/rpi-firmware/dist/start4.elf has
"simple_bus" strings:

---
mirage-% ftp https://cdn.netbsd.org/pub/NetBSD/NetBSD-release-11/src/external/broadcom/rpi-firmware/dist/start4.elf && strings start4.elf|grep simple
Trying [2a04:4e42:15::262]:443 ...
Requesting https://cdn.netbsd.org/pub/NetBSD/NetBSD-release-11/src/external/broadcom/rpi-firmware/dist/start4.elf
100% |***********************************|  2202 KiB    3.52 MiB/s    00:00 ETA
2254944 bytes retrieved in 00:00 (3.52 MiB/s)
simple_bus
simple-framebuffer
simple_mode
simple_gpio_flash
simple
mirage-% ftp https://cdn.netbsd.org/pub/NetBSD/NetBSD-current/src/external/broadcom/rpi-firmware/dist/start4.elf && strings start4.elf | grep simple
Trying [2a04:4e42:15::262]:443 ...
Requesting https://cdn.netbsd.org/pub/NetBSD/NetBSD-current/src/external/broadcom/rpi-firmware/dist/start4.elf
100% |***********************************|  2202 KiB    3.50 MiB/s    00:00 ETA
2254944 bytes retrieved in 00:00 (3.50 MiB/s)
simple_bus
simple-framebuffer
simple_mode
simple_gpio_flash
simple
mirage-% 

---

The upstream initial version also contains the "simple_bus" strings:
 https://github.com/raspberrypi/firmware/blob/64b5649a41b69d09bfe0ed05448d28a66be3edfd/boot/start4.elf

A custom "start4.elf" binary with patched strings from the original
"simple_bus" to "simple-bus" makes ofctl(8) return "simple-bus":

---
armv7# strings /boot/start4.elf.orig | grep simple
simple_bus
simple-framebuffer
simple_mode
simple_gpio_flash
simple
armv7# strings /boot/start4.elf | grep simple
simple-bus
simple-framebuffer
simple_mode
simple_gpio_flash
simple
armv7# ofctl -p /chosen name compatible
[Caching 258 nodes and 1436 properties]
name                    63686f73 656e00.. ........ ........   "chosen"
compatible              73696d70 6c652d62 757300.. ........   "simple-bus"
armv7# 
---

(not sure how this should be handled)

It looks Raspberry Pi OS checks "/chosen/framebuffer" directly,
not via /chosen node as "simple-bus".

 https://github.com/torvalds/linux/blob/113ae7b4decc6c2d95bdbbe52e615a0137ef7f9f/drivers/of/platform.c#L575
---
		node = of_get_compatible_child(of_chosen, "simple-framebuffer");
---

> >> Just use BUS_ADDR_{LO,HI}32
> > 
> > I see.
> > (Note several other drivers like sys/dev/ic/dwc_eqos.c also use
> > "(uint32_t)((uint64_t)paddr >> 32)" formats)
> 
> They're equally fugly and should use BUS_ADDR_{LO,HI}32

Sure, I'll fix them when I will be motivated.

Thanks,
---
Izumi Tsutsui


Home | Main Index | Thread Index | Old Index