Port-arm archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Unexpected device ordering from FDT node sorting
Hi NetBSD folks,
Following up on my discussion with Chris (bad@) at EuroBSDCon '26.
While tinkering with NetBSD on RPi Zero I have found that the order of
i2c buses is different from Linux and OpenBSD because NetBSD is sorting
FDT nodes by phandle (see fdt_get_order in sys/dev/fdt/fdtbus.c).
In the BCM2835 datasheet:
There are three BSC masters inside BCM. The register addresses
starts from
* BSC0: 0x7E20_5000
* BSC1: 0x7E80_4000
* BSC2 : 0x7E80_5000
In the DTB:
$ grep i2c@ bcm2835-rpi-zero-w.dts
i2c@7e205000 {
i2c@7e804000 {
i2c@7e805000 {
i2c0 = "/soc/i2c@7e205000";
i2c1 = "/soc/i2c@7e804000";
i2c2 = "/soc/i2c@7e805000";
A basic debug log in `bsciic_fdt_attach` shows the following:
[ 1.000000] bsciic0: SERGII Attaching a BSC at <0x7e805000 0x1000>
[ 1.000000] bsciic1: SERGII Attaching a BSC at <0x7e205000 0x200>
[ 1.000000] bsciic2: SERGII Attaching a BSC at <0x7e804000 0x1000>
It guess it is just a cheap way to avoid topological sorting of FDT
nodes, but the resulting order of devices is confusing.
I realize that _changing_ this behavior is also tricky because upon
NetBSD upgrade it will suddenly change the device order for everyone who
relies on the current behavior. Yet, Chris has persuaded me to share my
findings, so here I am :)
Best regards,
Sergii
Home |
Main Index |
Thread Index |
Old Index