[2/3] arm/dt: add very basic dts file for babbage board

Message ID 1298016730-22761-3-git-send-email-r64343@freescale.com
State New
Headers show

Commit Message

Jason Liu Feb. 18, 2011, 8:12 a.m.
Signed-off-by: Jason Liu <r64343@freescale.com>
---
 arch/arm/boot/dts/babbage.dts |  117 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 117 insertions(+), 0 deletions(-)

Comments

Shawn Guo Feb. 21, 2011, 9:46 a.m. | #1
Here is what I copied from booting-without-of.txt.

=====
  f) the /soc<SOCname> node

  This node is used to represent a system-on-a-chip (SoC) and must be
  present if the processor is a SoC. The top-level soc node contains
  information that is global to all devices on the SoC. The node name
  should contain a unit address for the SoC, which is the base address
  of the memory-mapped register set for the SoC. The name of an SoC
  node should start with "soc", and the remainder of the name should
  represent the part number for the soc.  For example, the MPC8540's
  soc node would be called "soc8540".

  Required properties:

    - ranges : Should be defined as specified in 1) to describe the
      translation of SoC addresses for memory mapped SoC registers.
    - bus-frequency: Contains the bus frequency for the SoC node.
      Typically, the value of this field is filled in by the boot
      loader.
    - compatible : Exact model of the SoC


  Recommended properties:

    - reg : This property defines the address and size of the
      memory-mapped registers that are used for the SOC node itself.
      It does not include the child device registers - these will be
      defined inside each child node.  The address specified in the
      "reg" property should match the unit address of the SOC node.
    - #address-cells : Address representation for "soc" devices.  The
      format of this field may vary depending on whether or not the
      device registers are memory mapped.  For memory mapped
      registers, this field represents the number of cells needed to
      represent the address of the registers.  For SOCs that do not
      use MMIO, a special address format should be defined that
      contains enough cells to represent the required information.
      See 1) above for more details on defining #address-cells.
    - #size-cells : Size representation for "soc" devices
    - #interrupt-cells : Defines the width of cells used to represent
       interrupts.  Typically this value is <2>, which includes a
       32-bit number that represents the interrupt number, and a
       32-bit number that represents the interrupt sense and level.
       This field is only needed if the SOC contains an interrupt
       controller.

  The SOC node may contain child nodes for each SOC device that the
  platform uses.  Nodes should not be created for devices which exist
  on the SOC but are not used by a particular platform. See chapter VI
  for more information on how to specify devices that are part of a SOC.

  Example SOC node for the MPC8540:

        soc8540@e0000000 {
                #address-cells = <1>;
                #size-cells = <1>;
                #interrupt-cells = <2>;
                device_type = "soc";
                ranges = <00000000 e0000000 00100000>
                reg = <e0000000 00003000>;
                bus-frequency = <0>;
        }
=====

I'm seeing the babbage.dts defined "soc" so differently than the
document requires.

> +       soc {
> +               #address-cells = <0x1>;
> +               #size-cells = <0x1>;
> +               device_type = "soc";
> +               compatible = "simple-bus";
> +               ranges = <0x0 0x0 0xffffffff>;
> +
> +               tzic {
> +                       #address-cells = <0x0>;
> +                       #interrupt-cells = <0x1>;
> +                       interrupt-controller;
> +                       reg = <0xe0000000 0x1000>;
> +                       compatible = "fsl,tzic";
> +                       device_type = "tzic";
> +                       phandle = <0x1>;
> +               };
> +       };

* The soc node name has neither part number nor base address
* Even required property "bus-frequency" is missing
* The document "Appendix A - Sample SOC node for MPC8540" defines
every device node under "soc", while babbage.dts has most devices
outside the "soc" node.

Are what the document describes requirements we must follow or just
suggestions we can take or not?

Besides the overall question above, some nitpicking embedded below ...

On 18 February 2011 16:12, Jason Liu <r64343@freescale.com> wrote:
> Signed-off-by: Jason Liu <r64343@freescale.com>
> ---
>  arch/arm/boot/dts/babbage.dts |  117 +++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 117 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/boot/dts/babbage.dts b/arch/arm/boot/dts/babbage.dts
> new file mode 100644
> index 0000000..7ee26f1
> --- /dev/null
> +++ b/arch/arm/boot/dts/babbage.dts
> @@ -0,0 +1,117 @@
> +/dts-v1/;
> +
> +/ {
> +       model = "mx51_babbage";
> +       compatible = "fsl,mx51_babbage";
> +       #address-cells = <0x1>;
> +       #size-cells = <0x1>;
> +       #interrupt-cells = <0x1>;
> +       interrupt-parent = <0x1>;
> +
> +       memory {
> +               device_type = "memory";
> +               reg = <0x90000000 0x20000000>;
> +       };
> +
> +       chosen {
> +               bootargs = "console=ttymxc1,115200n8 debug earlyprintk";
> +       };
> +
> +       soc {
> +               #address-cells = <0x1>;
> +               #size-cells = <0x1>;
> +               device_type = "soc";
> +               compatible = "simple-bus";
> +               ranges = <0x0 0x0 0xffffffff>;
> +
> +               tzic {
> +                       #address-cells = <0x0>;
> +                       #interrupt-cells = <0x1>;
> +                       interrupt-controller;
> +                       reg = <0xe0000000 0x1000>;
> +                       compatible = "fsl,tzic";
> +                       device_type = "tzic";
> +                       phandle = <0x1>;
> +               };
> +       };
> +
> +       clocks {
> +               #address-cells = <1>;
> +               #size-cells = <0>;
> +

Can we use hex value here to keep the consistency throughout the file?

> +               uart_clk0: uart@0 {
> +                       compatible = "clock";
> +                       clock-outputs = "imx-uart.0";
> +               };
> +
> +               uart_clk1: uart@1{

Can we put a space before "{" to keep the consistency throughout the file?

> +                       compatible = "clock";
> +                       clock-outputs = "imx-uart.1";
> +               };
> +
> +               uart_clk2: uart@2{

ditto

> +                       compatible = "clock";
> +                       clock-outputs = "imx-uart.2";
> +               };
> +
> +               fec_clk: @0{

ditto

> +                       compatible = "clock";
> +                       clock-outputs = "fec.0";
> +               };
> +       };
> +
> +       spba@70000000 {
> +               #address-cells = <0x1>;
> +               #size-cells = <0x1>;
> +               device_type = "soc";
> +               compatible = "simple-bus";
> +               ranges = <0x0 0x70000000 0x100000>;
> +
> +               imx-uart@C000 {

Use lowercase for all address/offset to keep consistency throughout the file?

> +                       compatible = "imx-uart";
> +                       reg = <0xc000 0x1000>;
> +                       interrupts = <0x21>;
> +                       rts-cts;
> +                       uart-clock = < &uart_clk2 >, "uart";

Remove the space after "<" and before ">" to keep consistency
throughout the file?

> +               };
> +       };
> +
> +       aips@73f00000 {
> +               #address-cells = <0x1>;
> +               #size-cells = <0x1>;
> +               device_type = "soc";
> +               compatible = "simple-bus";
> +               ranges = <0x0 0x73f00000 0x100000>;
> +
> +               imx-uart@BC000 {

ditto

> +                       compatible = "imx-uart";
> +                       reg = <0xbc000 0x1000>;
> +                       interrupts = <0x1f>;
> +                       rts-cts;
> +                       uart-clock = < &uart_clk0 >, "uart";

Remove the space after "<" and before ">"?

> +               };
> +
> +               imx-uart@C0000 {

Lowercase for offset?

> +                       compatible = "imx-uart";
> +                       reg = <0xc0000 0x1000>;
> +                       interrupts = <0x20>;
> +                       rts-cts;
> +                       uart-clock = <&uart_clk1>, "uart";
> +               };
> +       };
> +
> +       aips@83f00000 {
> +               #address-cells = <0x1>;
> +               #size-cells = <0x1>;
> +               device_type = "soc";
> +               compatible = "simple-bus";
> +               ranges = <0x0 0x83f00000 0x100000>;
> +
> +               fec@EC000 {

ditto

> +                       compatible = "fec";
> +                       reg = <0xec000 0x1000>;
> +                       interrupts = <0x57>;
> +                       fec_clk-clock = < &fec_clk >, "fec";
> +               };
> +       };
> +};
> --
> 1.7.0.4
>
Grant Likely Feb. 21, 2011, 5:10 p.m. | #2
On Mon, Feb 21, 2011 at 2:46 AM, Shawn Guo <shawn.guo@linaro.org> wrote:
> Here is what I copied from booting-without-of.txt.
>
> =====
>  f) the /soc<SOCname> node
>
>  This node is used to represent a system-on-a-chip (SoC) and must be
>  present if the processor is a SoC. The top-level soc node contains
>  information that is global to all devices on the SoC. The node name
>  should contain a unit address for the SoC, which is the base address
>  of the memory-mapped register set for the SoC. The name of an SoC
>  node should start with "soc", and the remainder of the name should
>  represent the part number for the soc.  For example, the MPC8540's
>  soc node would be called "soc8540".
>
>  Required properties:
>
>    - ranges : Should be defined as specified in 1) to describe the
>      translation of SoC addresses for memory mapped SoC registers.
>    - bus-frequency: Contains the bus frequency for the SoC node.
>      Typically, the value of this field is filled in by the boot
>      loader.
>    - compatible : Exact model of the SoC
>
>
>  Recommended properties:
>
>    - reg : This property defines the address and size of the
>      memory-mapped registers that are used for the SOC node itself.
>      It does not include the child device registers - these will be
>      defined inside each child node.  The address specified in the
>      "reg" property should match the unit address of the SOC node.
>    - #address-cells : Address representation for "soc" devices.  The
>      format of this field may vary depending on whether or not the
>      device registers are memory mapped.  For memory mapped
>      registers, this field represents the number of cells needed to
>      represent the address of the registers.  For SOCs that do not
>      use MMIO, a special address format should be defined that
>      contains enough cells to represent the required information.
>      See 1) above for more details on defining #address-cells.
>    - #size-cells : Size representation for "soc" devices
>    - #interrupt-cells : Defines the width of cells used to represent
>       interrupts.  Typically this value is <2>, which includes a
>       32-bit number that represents the interrupt number, and a
>       32-bit number that represents the interrupt sense and level.
>       This field is only needed if the SOC contains an interrupt
>       controller.
>
>  The SOC node may contain child nodes for each SOC device that the
>  platform uses.  Nodes should not be created for devices which exist
>  on the SOC but are not used by a particular platform. See chapter VI
>  for more information on how to specify devices that are part of a SOC.
>
>  Example SOC node for the MPC8540:
>
>        soc8540@e0000000 {
>                #address-cells = <1>;
>                #size-cells = <1>;
>                #interrupt-cells = <2>;
>                device_type = "soc";
>                ranges = <00000000 e0000000 00100000>
>                reg = <e0000000 00003000>;
>                bus-frequency = <0>;
>        }
> =====
>
> I'm seeing the babbage.dts defined "soc" so differently than the
> document requires.
>
>> +       soc {
>> +               #address-cells = <0x1>;
>> +               #size-cells = <0x1>;
>> +               device_type = "soc";
>> +               compatible = "simple-bus";
>> +               ranges = <0x0 0x0 0xffffffff>;
>> +
>> +               tzic {
>> +                       #address-cells = <0x0>;
>> +                       #interrupt-cells = <0x1>;
>> +                       interrupt-controller;
>> +                       reg = <0xe0000000 0x1000>;
>> +                       compatible = "fsl,tzic";
>> +                       device_type = "tzic";
>> +                       phandle = <0x1>;
>> +               };
>> +       };
>

The document is a little out of date in that it doesn't reflect all of
the current best practices.  It does need to be updated, but I'll
respond to the specific questions here...

> * The soc node name has neither part number nor base address

Part number isn't necessary because the 'compatible' property is
supposed to be used to identify the exact device.  Base address must
be part of any node that has a 'reg' property.  In this particular
example, neither is the case so it is okay.

> * Even required property "bus-frequency" is missing

bus-frequency isn't required.

> * The document "Appendix A - Sample SOC node for MPC8540" defines
> every device node under "soc", while babbage.dts has most devices
> outside the "soc" node.

The 'soc' node thing was something we started when new PowerPC SoC
machines were created.  However, it doesn't necessarily reflect the
best practice.  Ideally, the dt structure will match the physical
structure of the chip.  So, if a chip has multiple internal busses,
then the dts should probably have a node for each bus, and then each
device a child of the bus node.  However, having a single containing
'soc' node for all on-chip busses and devices is probably a good thing
to preserve.

>
> Are what the document describes requirements we must follow or just
> suggestions we can take or not?

Crafting a .dts file and device tree bindings are as much an art as a
science.  There are some things that aren't hard rules, but there are
reasons behind why most are done in a certain way.  The best way to
develop a new .dts file is to draft up your best effort, post it for
review, and listen to the comments that come back.  :-)

>
> Besides the overall question above, some nitpicking embedded below ...
>
> On 18 February 2011 16:12, Jason Liu <r64343@freescale.com> wrote:
>> Signed-off-by: Jason Liu <r64343@freescale.com>
>> ---
>>  arch/arm/boot/dts/babbage.dts |  117 +++++++++++++++++++++++++++++++++++++++++
>>  1 files changed, 117 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/arm/boot/dts/babbage.dts b/arch/arm/boot/dts/babbage.dts
>> new file mode 100644
>> index 0000000..7ee26f1
>> --- /dev/null
>> +++ b/arch/arm/boot/dts/babbage.dts
>> @@ -0,0 +1,117 @@
>> +/dts-v1/;
>> +
>> +/ {
>> +       model = "mx51_babbage";

This is a human readable string.  You can write something like
"Freescale i.MX51 Babbage" here.

>> +       compatible = "fsl,mx51_babbage";

Use dash '-' instead of underscores '_' in compatible values.

>> +       #address-cells = <0x1>;
>> +       #size-cells = <0x1>;
>> +       #interrupt-cells = <0x1>;
>> +       interrupt-parent = <0x1>;
>> +
>> +       memory {
>> +               device_type = "memory";
>> +               reg = <0x90000000 0x20000000>;
>> +       };
>> +
>> +       chosen {
>> +               bootargs = "console=ttymxc1,115200n8 debug earlyprintk";
>> +       };
>> +
>> +       soc {
>> +               #address-cells = <0x1>;
>> +               #size-cells = <0x1>;
>> +               device_type = "soc";

Drop the "device_type" property.  It only makes sense for machines
with real Open Firmware.

>> +               compatible = "simple-bus";

Need to specify the specific chip here:

        compatible = "fsl,imx51-soc", "simple-bus";

>> +               ranges = <0x0 0x0 0xffffffff>;

one-to-one mapping of the full address range can be specified simply
with an empty ranges property:

        ranges;

>> +
>> +               tzic {

tzic@e0000000 {

>> +                       #address-cells = <0x0>;
>> +                       #interrupt-cells = <0x1>;
>> +                       interrupt-controller;
>> +                       reg = <0xe0000000 0x1000>;
>> +                       compatible = "fsl,tzic";

Specify the exact chip in the compatible property:

compatible = "fsl,imx51-tzic";

>> +                       device_type = "tzic";

Drop device type

>> +                       phandle = <0x1>;

Drop phandle; dtc adds phandles automatically.

>> +               };
>> +       };
>> +
>> +       clocks {
>> +               #address-cells = <1>;
>> +               #size-cells = <0>;
>> +
>
> Can we use hex value here to keep the consistency throughout the file?

For #address-cells and #size-cells use decimal integers.

>
>> +               uart_clk0: uart@0 {

@0 should only be specified if the node has a 'reg = <0>' property.
In this case it doesn't so either 'reg' should be added, or '@0'
should be removed.

>> +                       compatible = "clock";
>> +                       clock-outputs = "imx-uart.0";
>> +               };
>> +
>> +               uart_clk1: uart@1{
>
> Can we put a space before "{" to keep the consistency throughout the file?

Yes, please.

>
>> +                       compatible = "clock";
>> +                       clock-outputs = "imx-uart.1";
>> +               };
>> +
>> +               uart_clk2: uart@2{
>
> ditto
>
>> +                       compatible = "clock";
>> +                       clock-outputs = "imx-uart.2";
>> +               };
>> +
>> +               fec_clk: @0{

"@0" is not a valid node name.

>
> ditto
>
>> +                       compatible = "clock";
>> +                       clock-outputs = "fec.0";
>> +               };
>> +       };
>> +
>> +       spba@70000000 {
>> +               #address-cells = <0x1>;
>> +               #size-cells = <0x1>;
>> +               device_type = "soc";

Drop device type.

>> +               compatible = "simple-bus";

Specify the actual device here before "simple-bus"

>> +               ranges = <0x0 0x70000000 0x100000>;
>> +
>> +               imx-uart@C000 {
>
> Use lowercase for all address/offset to keep consistency throughout the file?

yes.

>
>> +                       compatible = "imx-uart";
>> +                       reg = <0xc000 0x1000>;
>> +                       interrupts = <0x21>;
>> +                       rts-cts;
>> +                       uart-clock = < &uart_clk2 >, "uart";
>
> Remove the space after "<" and before ">" to keep consistency
> throughout the file?
>
>> +               };
>> +       };
>> +
>> +       aips@73f00000 {
>> +               #address-cells = <0x1>;
>> +               #size-cells = <0x1>;
>> +               device_type = "soc";
>> +               compatible = "simple-bus";
>> +               ranges = <0x0 0x73f00000 0x100000>;
>> +
>> +               imx-uart@BC000 {
>
> ditto
>
>> +                       compatible = "imx-uart";
>> +                       reg = <0xbc000 0x1000>;
>> +                       interrupts = <0x1f>;
>> +                       rts-cts;
>> +                       uart-clock = < &uart_clk0 >, "uart";
>
> Remove the space after "<" and before ">"?
>
>> +               };
>> +
>> +               imx-uart@C0000 {
>
> Lowercase for offset?
>
>> +                       compatible = "imx-uart";
>> +                       reg = <0xc0000 0x1000>;
>> +                       interrupts = <0x20>;
>> +                       rts-cts;
>> +                       uart-clock = <&uart_clk1>, "uart";
>> +               };
>> +       };
>> +
>> +       aips@83f00000 {
>> +               #address-cells = <0x1>;
>> +               #size-cells = <0x1>;
>> +               device_type = "soc";
>> +               compatible = "simple-bus";
>> +               ranges = <0x0 0x83f00000 0x100000>;
>> +
>> +               fec@EC000 {
>
> ditto
>
>> +                       compatible = "fec";
>> +                       reg = <0xec000 0x1000>;
>> +                       interrupts = <0x57>;
>> +                       fec_clk-clock = < &fec_clk >, "fec";
>> +               };
>> +       };
>> +};
>> --
>> 1.7.0.4
>>
>
> --
> Regards,
> Shawn
>
> _______________________________________________
> linaro-dev mailing list
> linaro-dev@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/linaro-dev
>
Shawn Guo Feb. 22, 2011, 2:13 p.m. | #3
Hi Grant,

Thanks for the explanation in details.

One more minor doubt below ...

On Mon, Feb 21, 2011 at 10:10:24AM -0700, Grant Likely wrote:
> On Mon, Feb 21, 2011 at 2:46 AM, Shawn Guo <shawn.guo@linaro.org> wrote:
[...]
> >> +               };
> >> +       };
> >> +
> >> +       clocks {
> >> +               #address-cells = <1>;
> >> +               #size-cells = <0>;
> >> +
> >
> > Can we use hex value here to keep the consistency throughout the file?
> 
> For #address-cells and #size-cells use decimal integers.
> 
If I run 'dtc -I dts -O dts -o babbage-dtc.dts babbage.dts', I see
babbage-dtc.dts have these two decimal values written into the hex.
Grant Likely Feb. 23, 2011, 6:59 p.m. | #4
On Tue, Feb 22, 2011 at 10:13:10PM +0800, Shawn Guo wrote:
> Hi Grant,
> 
> Thanks for the explanation in details.
> 
> One more minor doubt below ...
> 
> On Mon, Feb 21, 2011 at 10:10:24AM -0700, Grant Likely wrote:
> > On Mon, Feb 21, 2011 at 2:46 AM, Shawn Guo <shawn.guo@linaro.org> wrote:
> [...]
> > >> +               };
> > >> +       };
> > >> +
> > >> +       clocks {
> > >> +               #address-cells = <1>;
> > >> +               #size-cells = <0>;
> > >> +
> > >
> > > Can we use hex value here to keep the consistency throughout the file?
> > 
> > For #address-cells and #size-cells use decimal integers.
> > 
> If I run 'dtc -I dts -O dts -o babbage-dtc.dts babbage.dts', I see
> babbage-dtc.dts have these two decimal values written into the hex.

Property values don't have any inherent type checking.  Once it is in
internal form, dtc has no way of knowing the preferred representation
and it just makes a guess.

When it comes to maintaining .dts files; humans like looking at
decimal numbers, so we use decimal for #address/#size-cells.

g.
Shawn Guo Feb. 26, 2011, 2:30 p.m. | #5
On 18 February 2011 16:12, Jason Liu <r64343@freescale.com> wrote:
> Signed-off-by: Jason Liu <r64343@freescale.com>
> ---
>  arch/arm/boot/dts/babbage.dts |  117 +++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 117 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/boot/dts/babbage.dts b/arch/arm/boot/dts/babbage.dts
> new file mode 100644
> index 0000000..7ee26f1
> --- /dev/null
> +++ b/arch/arm/boot/dts/babbage.dts
> @@ -0,0 +1,117 @@
> +/dts-v1/;
> +
> +/ {
> +       model = "mx51_babbage";
> +       compatible = "fsl,mx51_babbage";
> +       #address-cells = <0x1>;
> +       #size-cells = <0x1>;
> +       #interrupt-cells = <0x1>;
> +       interrupt-parent = <0x1>;
> +
> +       memory {
> +               device_type = "memory";
> +               reg = <0x90000000 0x20000000>;
> +       };
> +
> +       chosen {
> +               bootargs = "console=ttymxc1,115200n8 debug earlyprintk";
> +       };

I was confused by this a little bit.  We used to have ttymxc0 than
ttymxc1 here for bootargs.  Per this dts file, we have the imx uart
nodes in order of imx-uart.2 (0x7000c000) --> imx-uart.0 (0x73fbc000)
--> mx-uart.1 (0x73fc0000).  That is why we have the following message
of of_platform_bus_probe().

of_platform_bus_probe()
 starting at: /
  match: /soc
   create child: /soc/tzic
  match: /spba@70000000
   create child: /spba@70000000/imx-uart@C000
  match: /aips@73f00000
   create child: /aips@73f00000/imx-uart@BC000
   create child: /aips@73f00000/imx-uart@C0000
  match: /aips@83f00000
   create child: /aips@83f00000/fec@EC000

That is to say imx-uart.2 will get probed as the first one before
imx-uart.0.  Meanwhile, the '[PATCH 3/3] serial/imx: parse from device
tree support' assumes it's the usual order, imx-uart.0 --> imx-uart.1
--> imx-uart.2.

======
+#ifdef CONFIG_OF
+static int serial_imx_probe_dt(struct imx_port *sport,
+               struct platform_device *pdev)
+{
+       struct device_node *node = pdev->dev.of_node;
+       static int line;
+
+       if (!node)
+               return -ENODEV;
+
+       if (of_get_property(node, "rts-cts", NULL))
+               sport->have_rtscts = 1;
+
+#ifdef CONFIG_IRDA
+       if (of_get_property(node, "irda", NULL))
+               sport->use_irda = 1;
+#endif
+       sport->port.line = line++;
+
+       return 0;
+}
+#else
+static int serial_imx_probe_dt(struct imx_port *sport,
+               struct platform_device *pdev)
+{
+       return -ENODEV;
+}
+#endif
+
[...]
@@ -1236,6 +1288,12 @@ static int serial_imx_probe(struct platform_device *pdev)
       if (!sport)
               return -ENOMEM;

+       ret = serial_imx_probe_dt(sport, pdev);
+       if (ret == -ENODEV)
+               ret = serial_imx_probe_pdata(sport, pdev);
+       if (ret)
+               goto free;
+
======

That's probably we have to tell console=ttymxc1 in bootargs, however
ttymxc0 hardware is actually being used.

> +
> +       soc {
> +               #address-cells = <0x1>;
> +               #size-cells = <0x1>;
> +               device_type = "soc";
> +               compatible = "simple-bus";
> +               ranges = <0x0 0x0 0xffffffff>;
> +
> +               tzic {
> +                       #address-cells = <0x0>;
> +                       #interrupt-cells = <0x1>;
> +                       interrupt-controller;
> +                       reg = <0xe0000000 0x1000>;
> +                       compatible = "fsl,tzic";
> +                       device_type = "tzic";
> +                       phandle = <0x1>;
> +               };
> +       };
> +
> +       clocks {
> +               #address-cells = <1>;
> +               #size-cells = <0>;
> +
> +               uart_clk0: uart@0 {
> +                       compatible = "clock";
> +                       clock-outputs = "imx-uart.0";
> +               };
> +
> +               uart_clk1: uart@1{
> +                       compatible = "clock";
> +                       clock-outputs = "imx-uart.1";
> +               };
> +
> +               uart_clk2: uart@2{
> +                       compatible = "clock";
> +                       clock-outputs = "imx-uart.2";
> +               };
> +
> +               fec_clk: @0{
> +                       compatible = "clock";
> +                       clock-outputs = "fec.0";
> +               };
> +       };
> +
> +       spba@70000000 {
> +               #address-cells = <0x1>;
> +               #size-cells = <0x1>;
> +               device_type = "soc";
> +               compatible = "simple-bus";
> +               ranges = <0x0 0x70000000 0x100000>;
> +
> +               imx-uart@C000 {
> +                       compatible = "imx-uart";
> +                       reg = <0xc000 0x1000>;
> +                       interrupts = <0x21>;
> +                       rts-cts;
> +                       uart-clock = < &uart_clk2 >, "uart";
> +               };
> +       };
> +
> +       aips@73f00000 {
> +               #address-cells = <0x1>;
> +               #size-cells = <0x1>;
> +               device_type = "soc";
> +               compatible = "simple-bus";
> +               ranges = <0x0 0x73f00000 0x100000>;
> +
> +               imx-uart@BC000 {
> +                       compatible = "imx-uart";
> +                       reg = <0xbc000 0x1000>;
> +                       interrupts = <0x1f>;
> +                       rts-cts;
> +                       uart-clock = < &uart_clk0 >, "uart";
> +               };
> +
> +               imx-uart@C0000 {
> +                       compatible = "imx-uart";
> +                       reg = <0xc0000 0x1000>;
> +                       interrupts = <0x20>;
> +                       rts-cts;
> +                       uart-clock = <&uart_clk1>, "uart";
> +               };
> +       };
> +
> +       aips@83f00000 {
> +               #address-cells = <0x1>;
> +               #size-cells = <0x1>;
> +               device_type = "soc";
> +               compatible = "simple-bus";
> +               ranges = <0x0 0x83f00000 0x100000>;
> +
> +               fec@EC000 {
> +                       compatible = "fec";
> +                       reg = <0xec000 0x1000>;
> +                       interrupts = <0x57>;
> +                       fec_clk-clock = < &fec_clk >, "fec";
> +               };
> +       };
> +};
> --
> 1.7.0.4
>
>
>
> _______________________________________________
> linaro-dev mailing list
> linaro-dev@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/linaro-dev
>
Shawn Guo Feb. 28, 2011, 2:32 p.m. | #6
Hi Grant,

On Mon, Feb 21, 2011 at 10:10:24AM -0700, Grant Likely wrote:
> On Mon, Feb 21, 2011 at 2:46 AM, Shawn Guo <shawn.guo@linaro.org> wrote:
[...]
> >> +       clocks {

Do we already have a clock binding specification, which is followed
by this example?  Or the properties given here still can be discussed
and open to change?

Also to support dynamically creating and registering 'struct clk' per
dt clock nodes, I need to add a few properties to map stuff like
parent 'struct clk', con_id of 'struct clk_lookup'.  Is there any
specification to follow, or I can draft it per the needs of my work?

> >> +               #address-cells = <1>;
> >> +               #size-cells = <0>;
> >> +
> >
> > Can we use hex value here to keep the consistency throughout the file?
> 
> For #address-cells and #size-cells use decimal integers.
> 
> >
> >> +               uart_clk0: uart@0 {
> 
> @0 should only be specified if the node has a 'reg = <0>' property.
> In this case it doesn't so either 'reg' should be added, or '@0'
> should be removed.
> 
> >> +                       compatible = "clock";
> >> +                       clock-outputs = "imx-uart.0";
> >> +               };
> >> +
> >> +               uart_clk1: uart@1{
> >
> > Can we put a space before "{" to keep the consistency throughout the file?
> 
> Yes, please.
> 
> >
> >> +                       compatible = "clock";
> >> +                       clock-outputs = "imx-uart.1";
> >> +               };
> >> +
> >> +               uart_clk2: uart@2{
> >
> > ditto
> >
> >> +                       compatible = "clock";
> >> +                       clock-outputs = "imx-uart.2";
> >> +               };
Grant Likely Feb. 28, 2011, 6:09 p.m. | #7
On Mon, Feb 28, 2011 at 10:32:01PM +0800, Shawn Guo wrote:
> Hi Grant,
> 
> On Mon, Feb 21, 2011 at 10:10:24AM -0700, Grant Likely wrote:
> > On Mon, Feb 21, 2011 at 2:46 AM, Shawn Guo <shawn.guo@linaro.org> wrote:
> [...]
> > >> +       clocks {
> 
> Do we already have a clock binding specification, which is followed
> by this example?  Or the properties given here still can be discussed
> and open to change?
> 
> Also to support dynamically creating and registering 'struct clk' per
> dt clock nodes, I need to add a few properties to map stuff like
> parent 'struct clk', con_id of 'struct clk_lookup'.  Is there any
> specification to follow, or I can draft it per the needs of my work?

The clock specifications are still in draft.  I'm not willing to lock
down on a binding until we've got some real implementations to back
them up.  If you need additional properties, go ahead an propose them.

Keep in mind when defining/extending bindings, that the dt is intended
to represent hardware layout, not Linux kernel internal implementation
details.  Try to avoid describing things in a linux-specific way.


> 
> > >> +               #address-cells = <1>;
> > >> +               #size-cells = <0>;
> > >> +
> > >
> > > Can we use hex value here to keep the consistency throughout the file?
> > 
> > For #address-cells and #size-cells use decimal integers.
> > 
> > >
> > >> +               uart_clk0: uart@0 {
> > 
> > @0 should only be specified if the node has a 'reg = <0>' property.
> > In this case it doesn't so either 'reg' should be added, or '@0'
> > should be removed.
> > 
> > >> +                       compatible = "clock";
> > >> +                       clock-outputs = "imx-uart.0";
> > >> +               };
> > >> +
> > >> +               uart_clk1: uart@1{
> > >
> > > Can we put a space before "{" to keep the consistency throughout the file?
> > 
> > Yes, please.
> > 
> > >
> > >> +                       compatible = "clock";
> > >> +                       clock-outputs = "imx-uart.1";
> > >> +               };
> > >> +
> > >> +               uart_clk2: uart@2{
> > >
> > > ditto
> > >
> > >> +                       compatible = "clock";
> > >> +                       clock-outputs = "imx-uart.2";
> > >> +               };
> 
> -- 
> Regards,
> Shawn
>
Jason Hui March 7, 2011, 5:06 a.m. | #8
Hi, Grant and Shawn,

On Tue, Mar 1, 2011 at 2:09 AM, Grant Likely <grant.likely@secretlab.ca> wrote:
> On Mon, Feb 28, 2011 at 10:32:01PM +0800, Shawn Guo wrote:
>> Hi Grant,
>>
>> On Mon, Feb 21, 2011 at 10:10:24AM -0700, Grant Likely wrote:
>> > On Mon, Feb 21, 2011 at 2:46 AM, Shawn Guo <shawn.guo@linaro.org> wrote:
>> [...]
>> > >> +       clocks {
>>
>> Do we already have a clock binding specification, which is followed
>> by this example?  Or the properties given here still can be discussed
>> and open to change?
>>
>> Also to support dynamically creating and registering 'struct clk' per
>> dt clock nodes, I need to add a few properties to map stuff like
>> parent 'struct clk', con_id of 'struct clk_lookup'.  Is there any
>> specification to follow, or I can draft it per the needs of my work?
>
> The clock specifications are still in draft.  I'm not willing to lock
> down on a binding until we've got some real implementations to back
> them up.  If you need additional properties, go ahead an propose them.
>
> Keep in mind when defining/extending bindings, that the dt is intended
> to represent hardware layout, not Linux kernel internal implementation
> details.  Try to avoid describing things in a linux-specific way.

I will consider all your review comments and come up with V2 patch soon.

>
> _______________________________________________
> linaro-dev mailing list
> linaro-dev@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/linaro-dev
>

Patch

diff --git a/arch/arm/boot/dts/babbage.dts b/arch/arm/boot/dts/babbage.dts
new file mode 100644
index 0000000..7ee26f1
--- /dev/null
+++ b/arch/arm/boot/dts/babbage.dts
@@ -0,0 +1,117 @@ 
+/dts-v1/;
+
+/ {
+	model = "mx51_babbage";
+	compatible = "fsl,mx51_babbage";
+	#address-cells = <0x1>;
+	#size-cells = <0x1>;
+	#interrupt-cells = <0x1>;
+	interrupt-parent = <0x1>;
+
+	memory {
+		device_type = "memory";
+		reg = <0x90000000 0x20000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttymxc1,115200n8 debug earlyprintk";
+	};
+
+	soc {
+		#address-cells = <0x1>;
+		#size-cells = <0x1>;
+		device_type = "soc";
+		compatible = "simple-bus";
+		ranges = <0x0 0x0 0xffffffff>;
+
+		tzic {
+			#address-cells = <0x0>;
+			#interrupt-cells = <0x1>;
+			interrupt-controller;
+			reg = <0xe0000000 0x1000>;
+			compatible = "fsl,tzic";
+			device_type = "tzic";
+			phandle = <0x1>;
+		};
+	};
+
+	clocks {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		uart_clk0: uart@0 {
+			compatible = "clock";
+			clock-outputs = "imx-uart.0";
+		};
+
+		uart_clk1: uart@1{
+			compatible = "clock";
+			clock-outputs = "imx-uart.1";
+		};
+
+		uart_clk2: uart@2{
+			compatible = "clock";
+			clock-outputs = "imx-uart.2";
+		};
+
+		fec_clk: @0{
+			compatible = "clock";
+			clock-outputs = "fec.0";
+		};
+	};
+
+	spba@70000000 {
+		#address-cells = <0x1>;
+		#size-cells = <0x1>;
+		device_type = "soc";
+		compatible = "simple-bus";
+		ranges = <0x0 0x70000000 0x100000>;
+
+		imx-uart@C000 {
+			compatible = "imx-uart";
+			reg = <0xc000 0x1000>;
+			interrupts = <0x21>;
+			rts-cts;
+			uart-clock = < &uart_clk2 >, "uart";
+		};
+	};
+
+	aips@73f00000 {
+		#address-cells = <0x1>;
+		#size-cells = <0x1>;
+		device_type = "soc";
+		compatible = "simple-bus";
+		ranges = <0x0 0x73f00000 0x100000>;
+
+		imx-uart@BC000 {
+			compatible = "imx-uart";
+			reg = <0xbc000 0x1000>;
+			interrupts = <0x1f>;
+			rts-cts;
+			uart-clock = < &uart_clk0 >, "uart";
+		};
+
+		imx-uart@C0000 {
+			compatible = "imx-uart";
+			reg = <0xc0000 0x1000>;
+			interrupts = <0x20>;
+			rts-cts;
+			uart-clock = <&uart_clk1>, "uart";
+		};
+	};
+
+	aips@83f00000 {
+		#address-cells = <0x1>;
+		#size-cells = <0x1>;
+		device_type = "soc";
+		compatible = "simple-bus";
+		ranges = <0x0 0x83f00000 0x100000>;
+
+		fec@EC000 {
+			compatible = "fec";
+			reg = <0xec000 0x1000>;
+			interrupts = <0x57>;
+			fec_clk-clock = < &fec_clk >, "fec";
+		};
+	};
+};