tech-kern archive

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

Re: question about enumeration of buses on arm systems with dtb files



> Date: Tue, 15 Mar 2022 22:37:15 +0000
> From: Dave Tyson <dtyson%anduin.org.uk@localhost>
> 
> I am trying to understand the enumeration of the GPIO pins on a RPI-zero-2 
> which boots up and runs under current.

Did you get any answers?  I didn't see any on-list, and this isn't my
area of expertise, but...

> The DTS lists i2c0 with gpio pins 0 & 1 and i2c1 with gpio pin 2 & 3. These 
> appear to be the only i2c interfaces defined (unless there are others hidden 
> in the dtsi files). These gpio pins are exposed on the 40 pin connector.

Which dts file are you looking at?

> So it would appear that NetBSD maps /dev/iic1 to gpio iic0 and /dev/iic2 to 
> gpio iic1 which is not intuitive...
>  
> So how does the kernel map its devices to those listed in the dtb?

I think usually it's first-come-first-serve according to the ordering
in the device tree (that is, in a pre-order traversal, which is the
same as the sequential order in the .dts file) -- not necessarily the
numbers in the device tree node names.  So if there device tree lists
nodes i2c2, i2c0, i2c1, in that order, then it'll be

/dev/iic0 -> i2c2
/dev/iic1 -> i2c0
/dev/iic2 -> i2c1

I see in bcm2835-common.dtsi that there is an i2c2 node -- this file
might be included before any board-specific .dts files define their
i2c0 or i2c1 nodes.

> I wonder what  /dev/iic0 is mapped to :-) 

You can probably find out by using ofctl(8) to dump the device tree.

> From the RPI documentation it would appear that you can add overrides in
> /boot/config.txt to override the dts config - I am guessing this is picked up 
> by linux, but there is no NetBSD support.

That, I have no idea!


Home | Main Index | Thread Index | Old Index