linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* I don't understand #size-cells = <0>
@ 2007-02-01  0:22 Andrew Klossner
  2007-02-01  0:25 ` David Gibson
  2007-02-04 23:43 ` Benjamin Herrenschmidt
  0 siblings, 2 replies; 4+ messages in thread
From: Andrew Klossner @ 2007-02-01  0:22 UTC (permalink / raw)
  To: linuxppc-dev

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?

I saw Ben's mention last June of a "degenerate range", but I can't
find that term used anywhere else.

What are the real semantics of #size-cells = <0> ?

Thanks,
Andrew Klossner

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: I don't understand #size-cells = <0>
  2007-02-01  0:22 I don't understand #size-cells = <0> Andrew Klossner
@ 2007-02-01  0:25 ` David Gibson
  2007-02-01 15:08   ` Yoder Stuart-B08248
  2007-02-04 23:43 ` Benjamin Herrenschmidt
  1 sibling, 1 reply; 4+ messages in thread
From: David Gibson @ 2007-02-01  0:25 UTC (permalink / raw)
  To: Andrew Klossner; +Cc: linuxppc-dev

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: I don't understand #size-cells = <0>
  2007-02-01  0:25 ` David Gibson
@ 2007-02-01 15:08   ` Yoder Stuart-B08248
  0 siblings, 0 replies; 4+ messages in thread
From: Yoder Stuart-B08248 @ 2007-02-01 15:08 UTC (permalink / raw)
  To: Andrew Klossner; +Cc: linuxppc-dev


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

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

       PowerPC,7447A@0 {
          device_type =3D "cpu";
          reg =3D <0>;
       }
=20
       PowerPC,7447A@1 {
          device_type =3D "cpu";
          reg =3D <1>;
       }
    }

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

Stuart

> -----Original Message-----
> From: linuxppc-dev-bounces+b08248=3Dfreescale.com@ozlabs.org=20
> [mailto:linuxppc-dev-bounces+b08248=3Dfreescale.com@ozlabs.org]=20
> On Behalf Of David Gibson
> Sent: Wednesday, January 31, 2007 6:26 PM
> To: Andrew Klossner
> Cc: linuxppc-dev@ozlabs.org
> Subject: Re: I don't understand #size-cells =3D <0>
>=20
> 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.
> >=20
> > Rev 0.5 of booting-without-of.txt says:
> >=20
> > 	"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.
> >=20
> > but in the examples, we see
> >=20
> > 		reg =3D <22000 1000>;
> > 		#address-cells =3D <1>;
> > 		#size-cells =3D <0>;
> >=20
> > The number of cells of address is 1.  The number of cells=20
> of size is 0.
> > 1+0=3D1, so how can the reg property have a tuple of size 2?
>=20
> 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.
>=20
> 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.
>=20
> --=20
> David Gibson			| I'll have my music baroque,=20
> and my code
> david AT gibson.dropbear.id.au	| minimalist, thank=20
> you.  NOT _the_ _other_
> 				| _way_ _around_!
> http://www.ozlabs.org/~dgibson
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
>=20

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: I don't understand #size-cells = <0>
  2007-02-01  0:22 I don't understand #size-cells = <0> Andrew Klossner
  2007-02-01  0:25 ` David Gibson
@ 2007-02-04 23:43 ` Benjamin Herrenschmidt
  1 sibling, 0 replies; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2007-02-04 23:43 UTC (permalink / raw)
  To: Andrew Klossner; +Cc: linuxppc-dev

On Wed, 2007-01-31 at 16:22 -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?

Regardless of #size-cell of #address-cell, you are getting one basic
assumption wrong: those properties don't apply to the node itself but to
-children- of that node.

They are typically in a bus node to define the format of the "reg"
properties of nodes -under- that bus node.

Now, there are a few cases where #size-cells is 0, mostly it is an
unofficial and common way to say that devices on that bus aren't mmio
mapped. For example, take an i2c bus. Devices decode one and only one
address (ok, maybe 2, but the concept of "range" is irrelevant) and
there is no direct MMIO translation. This is typically a case where
#size-cells is 0. Another common example is /cpus (which is the parent
for all cores in the system). The cpus themselves have a reg property
that contain their physical ID, there is no concept of ranges of
addresses, thus #size-cell is 0.

Ben.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-02-04 23:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-01  0:22 I don't understand #size-cells = <0> Andrew Klossner
2007-02-01  0:25 ` David Gibson
2007-02-01 15:08   ` Yoder Stuart-B08248
2007-02-04 23:43 ` Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).