I don't understand #size-cells = <0>

Yoder Stuart-B08248 stuart.yoder at freescale.com
Fri Feb 2 02:08:31 EST 2007


A specific example of #size-cells = <0> would be for 
the cpus node:

    cpus {
       #address-cells = <1>;
       #size-cells = <0>;

       PowerPC,7447A at 0 {
          device_type = "cpu";
          reg = <0>;
       }
 
       PowerPC,7447A at 1 {
          device_type = "cpu";
          reg = <1>;
       }
    }

The "reg" field for a cpu node does not have a size
field.

Stuart

> -----Original Message-----
> From: linuxppc-dev-bounces+b08248=freescale.com at ozlabs.org 
> [mailto:linuxppc-dev-bounces+b08248=freescale.com at ozlabs.org] 
> On Behalf Of David Gibson
> Sent: Wednesday, January 31, 2007 6:26 PM
> To: Andrew Klossner
> Cc: linuxppc-dev at ozlabs.org
> Subject: Re: I don't understand #size-cells = <0>
> 
> On Wed, Jan 31, 2007 at 04:22:12PM -0800, Andrew Klossner wrote:
> > I'm porting the kernel to an 8548-based board whose boot loader does
> > not provide a device tree, so I'm rolling my own.
> > 
> > Rev 0.5 of booting-without-of.txt says:
> > 
> > 	"reg" properties are always a tuple of the type "address size"
> > 	where the number of cells of address and size is specified by
> > 	the bus #address-cells and #size-cells.
> > 
> > but in the examples, we see
> > 
> > 		reg = <22000 1000>;
> > 		#address-cells = <1>;
> > 		#size-cells = <0>;
> > 
> > The number of cells of address is 1.  The number of cells 
> of size is 0.
> > 1+0=1, so how can the reg property have a tuple of size 2?
> 
> The #address-cells and #size-cells properties apply to children of the
> node they appear in, but not in the node itself.  So the "reg" here
> uses the #address-cells and #size-cells values from its parent.
> 
> This is so that a bridge to a different bus (say, PCI<->USB) can have
> a reg property in the format of its parent bus for the control
> registers, but define a new address format for things on the
> subordinate bus.
> 
> -- 
> David Gibson			| I'll have my music baroque, 
> and my code
> david AT gibson.dropbear.id.au	| minimalist, thank 
> you.  NOT _the_ _other_
> 				| _way_ _around_!
> http://www.ozlabs.org/~dgibson
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev at ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
> 



More information about the Linuxppc-dev mailing list