[POWERPC] Device tree bindings for Xilinx devices
[safe/jmp/linux-2.6] / Documentation / powerpc / booting-without-of.txt
1            Booting the Linux/ppc kernel without Open Firmware
2            --------------------------------------------------
3
4 (c) 2005 Benjamin Herrenschmidt <benh at kernel.crashing.org>,
5     IBM Corp.
6 (c) 2005 Becky Bruce <becky.bruce at freescale.com>,
7     Freescale Semiconductor, FSL SOC and 32-bit additions
8 (c) 2006 MontaVista Software, Inc.
9     Flash chip node definition
10
11 Table of Contents
12 =================
13
14   I - Introduction
15     1) Entry point for arch/powerpc
16     2) Board support
17
18   II - The DT block format
19     1) Header
20     2) Device tree generalities
21     3) Device tree "structure" block
22     4) Device tree "strings" block
23
24   III - Required content of the device tree
25     1) Note about cells and address representation
26     2) Note about "compatible" properties
27     3) Note about "name" properties
28     4) Note about node and property names and character set
29     5) Required nodes and properties
30       a) The root node
31       b) The /cpus node
32       c) The /cpus/* nodes
33       d) the /memory node(s)
34       e) The /chosen node
35       f) the /soc<SOCname> node
36
37   IV - "dtc", the device tree compiler
38
39   V - Recommendations for a bootloader
40
41   VI - System-on-a-chip devices and nodes
42     1) Defining child nodes of an SOC
43     2) Representing devices without a current OF specification
44       a) MDIO IO device
45       b) Gianfar-compatible ethernet nodes
46       c) PHY nodes
47       d) Interrupt controllers
48       e) I2C
49       f) Freescale SOC USB controllers
50       g) Freescale SOC SEC Security Engines
51       h) Board Control and Status (BCSR)
52       i) Freescale QUICC Engine module (QE)
53       j) CFI or JEDEC memory-mapped NOR flash
54       k) Global Utilities Block
55       l) Xilinx IP cores
56
57   VII - Specifying interrupt information for devices
58     1) interrupts property
59     2) interrupt-parent property
60     3) OpenPIC Interrupt Controllers
61     4) ISA Interrupt Controllers
62
63   Appendix A - Sample SOC node for MPC8540
64
65
66 Revision Information
67 ====================
68
69    May 18, 2005: Rev 0.1 - Initial draft, no chapter III yet.
70
71    May 19, 2005: Rev 0.2 - Add chapter III and bits & pieces here or
72                            clarifies the fact that a lot of things are
73                            optional, the kernel only requires a very
74                            small device tree, though it is encouraged
75                            to provide an as complete one as possible.
76
77    May 24, 2005: Rev 0.3 - Precise that DT block has to be in RAM
78                          - Misc fixes
79                          - Define version 3 and new format version 16
80                            for the DT block (version 16 needs kernel
81                            patches, will be fwd separately).
82                            String block now has a size, and full path
83                            is replaced by unit name for more
84                            compactness.
85                            linux,phandle is made optional, only nodes
86                            that are referenced by other nodes need it.
87                            "name" property is now automatically
88                            deduced from the unit name
89
90    June 1, 2005: Rev 0.4 - Correct confusion between OF_DT_END and
91                            OF_DT_END_NODE in structure definition.
92                          - Change version 16 format to always align
93                            property data to 4 bytes. Since tokens are
94                            already aligned, that means no specific
95                            required alignment between property size
96                            and property data. The old style variable
97                            alignment would make it impossible to do
98                            "simple" insertion of properties using
99                            memmove (thanks Milton for
100                            noticing). Updated kernel patch as well
101                          - Correct a few more alignment constraints
102                          - Add a chapter about the device-tree
103                            compiler and the textural representation of
104                            the tree that can be "compiled" by dtc.
105
106    November 21, 2005: Rev 0.5
107                          - Additions/generalizations for 32-bit
108                          - Changed to reflect the new arch/powerpc
109                            structure
110                          - Added chapter VI
111
112
113  ToDo:
114         - Add some definitions of interrupt tree (simple/complex)
115         - Add some definitions for PCI host bridges
116         - Add some common address format examples
117         - Add definitions for standard properties and "compatible"
118           names for cells that are not already defined by the existing
119           OF spec.
120         - Compare FSL SOC use of PCI to standard and make sure no new
121           node definition required.
122         - Add more information about node definitions for SOC devices
123           that currently have no standard, like the FSL CPM.
124
125
126 I - Introduction
127 ================
128
129 During the recent development of the Linux/ppc64 kernel, and more
130 specifically, the addition of new platform types outside of the old
131 IBM pSeries/iSeries pair, it was decided to enforce some strict rules
132 regarding the kernel entry and bootloader <-> kernel interfaces, in
133 order to avoid the degeneration that had become the ppc32 kernel entry
134 point and the way a new platform should be added to the kernel. The
135 legacy iSeries platform breaks those rules as it predates this scheme,
136 but no new board support will be accepted in the main tree that
137 doesn't follows them properly.  In addition, since the advent of the
138 arch/powerpc merged architecture for ppc32 and ppc64, new 32-bit
139 platforms and 32-bit platforms which move into arch/powerpc will be
140 required to use these rules as well.
141
142 The main requirement that will be defined in more detail below is
143 the presence of a device-tree whose format is defined after Open
144 Firmware specification. However, in order to make life easier
145 to embedded board vendors, the kernel doesn't require the device-tree
146 to represent every device in the system and only requires some nodes
147 and properties to be present. This will be described in detail in
148 section III, but, for example, the kernel does not require you to
149 create a node for every PCI device in the system. It is a requirement
150 to have a node for PCI host bridges in order to provide interrupt
151 routing informations and memory/IO ranges, among others. It is also
152 recommended to define nodes for on chip devices and other busses that
153 don't specifically fit in an existing OF specification. This creates a
154 great flexibility in the way the kernel can then probe those and match
155 drivers to device, without having to hard code all sorts of tables. It
156 also makes it more flexible for board vendors to do minor hardware
157 upgrades without significantly impacting the kernel code or cluttering
158 it with special cases.
159
160
161 1) Entry point for arch/powerpc
162 -------------------------------
163
164    There is one and one single entry point to the kernel, at the start
165    of the kernel image. That entry point supports two calling
166    conventions:
167
168         a) Boot from Open Firmware. If your firmware is compatible
169         with Open Firmware (IEEE 1275) or provides an OF compatible
170         client interface API (support for "interpret" callback of
171         forth words isn't required), you can enter the kernel with:
172
173               r5 : OF callback pointer as defined by IEEE 1275
174               bindings to powerpc. Only the 32-bit client interface
175               is currently supported
176
177               r3, r4 : address & length of an initrd if any or 0
178
179               The MMU is either on or off; the kernel will run the
180               trampoline located in arch/powerpc/kernel/prom_init.c to
181               extract the device-tree and other information from open
182               firmware and build a flattened device-tree as described
183               in b). prom_init() will then re-enter the kernel using
184               the second method. This trampoline code runs in the
185               context of the firmware, which is supposed to handle all
186               exceptions during that time.
187
188         b) Direct entry with a flattened device-tree block. This entry
189         point is called by a) after the OF trampoline and can also be
190         called directly by a bootloader that does not support the Open
191         Firmware client interface. It is also used by "kexec" to
192         implement "hot" booting of a new kernel from a previous
193         running one. This method is what I will describe in more
194         details in this document, as method a) is simply standard Open
195         Firmware, and thus should be implemented according to the
196         various standard documents defining it and its binding to the
197         PowerPC platform. The entry point definition then becomes:
198
199                 r3 : physical pointer to the device-tree block
200                 (defined in chapter II) in RAM
201
202                 r4 : physical pointer to the kernel itself. This is
203                 used by the assembly code to properly disable the MMU
204                 in case you are entering the kernel with MMU enabled
205                 and a non-1:1 mapping.
206
207                 r5 : NULL (as to differentiate with method a)
208
209         Note about SMP entry: Either your firmware puts your other
210         CPUs in some sleep loop or spin loop in ROM where you can get
211         them out via a soft reset or some other means, in which case
212         you don't need to care, or you'll have to enter the kernel
213         with all CPUs. The way to do that with method b) will be
214         described in a later revision of this document.
215
216
217 2) Board support
218 ----------------
219
220 64-bit kernels:
221
222    Board supports (platforms) are not exclusive config options. An
223    arbitrary set of board supports can be built in a single kernel
224    image. The kernel will "know" what set of functions to use for a
225    given platform based on the content of the device-tree. Thus, you
226    should:
227
228         a) add your platform support as a _boolean_ option in
229         arch/powerpc/Kconfig, following the example of PPC_PSERIES,
230         PPC_PMAC and PPC_MAPLE. The later is probably a good
231         example of a board support to start from.
232
233         b) create your main platform file as
234         "arch/powerpc/platforms/myplatform/myboard_setup.c" and add it
235         to the Makefile under the condition of your CONFIG_
236         option. This file will define a structure of type "ppc_md"
237         containing the various callbacks that the generic code will
238         use to get to your platform specific code
239
240         c) Add a reference to your "ppc_md" structure in the
241         "machines" table in arch/powerpc/kernel/setup_64.c if you are
242         a 64-bit platform.
243
244         d) request and get assigned a platform number (see PLATFORM_*
245         constants in include/asm-powerpc/processor.h
246
247 32-bit embedded kernels:
248
249   Currently, board support is essentially an exclusive config option.
250   The kernel is configured for a single platform.  Part of the reason
251   for this is to keep kernels on embedded systems small and efficient;
252   part of this is due to the fact the code is already that way. In the
253   future, a kernel may support multiple platforms, but only if the
254   platforms feature the same core architecture.  A single kernel build
255   cannot support both configurations with Book E and configurations
256   with classic Powerpc architectures.
257
258   32-bit embedded platforms that are moved into arch/powerpc using a
259   flattened device tree should adopt the merged tree practice of
260   setting ppc_md up dynamically, even though the kernel is currently
261   built with support for only a single platform at a time.  This allows
262   unification of the setup code, and will make it easier to go to a
263   multiple-platform-support model in the future.
264
265 NOTE: I believe the above will be true once Ben's done with the merge
266 of the boot sequences.... someone speak up if this is wrong!
267
268   To add a 32-bit embedded platform support, follow the instructions
269   for 64-bit platforms above, with the exception that the Kconfig
270   option should be set up such that the kernel builds exclusively for
271   the platform selected.  The processor type for the platform should
272   enable another config option to select the specific board
273   supported.
274
275 NOTE: If Ben doesn't merge the setup files, may need to change this to
276 point to setup_32.c
277
278
279    I will describe later the boot process and various callbacks that
280    your platform should implement.
281
282
283 II - The DT block format
284 ========================
285
286
287 This chapter defines the actual format of the flattened device-tree
288 passed to the kernel. The actual content of it and kernel requirements
289 are described later. You can find example of code manipulating that
290 format in various places, including arch/powerpc/kernel/prom_init.c
291 which will generate a flattened device-tree from the Open Firmware
292 representation, or the fs2dt utility which is part of the kexec tools
293 which will generate one from a filesystem representation. It is
294 expected that a bootloader like uboot provides a bit more support,
295 that will be discussed later as well.
296
297 Note: The block has to be in main memory. It has to be accessible in
298 both real mode and virtual mode with no mapping other than main
299 memory. If you are writing a simple flash bootloader, it should copy
300 the block to RAM before passing it to the kernel.
301
302
303 1) Header
304 ---------
305
306    The kernel is entered with r3 pointing to an area of memory that is
307    roughly described in include/asm-powerpc/prom.h by the structure
308    boot_param_header:
309
310 struct boot_param_header {
311         u32     magic;                  /* magic word OF_DT_HEADER */
312         u32     totalsize;              /* total size of DT block */
313         u32     off_dt_struct;          /* offset to structure */
314         u32     off_dt_strings;         /* offset to strings */
315         u32     off_mem_rsvmap;         /* offset to memory reserve map
316                                            */
317         u32     version;                /* format version */
318         u32     last_comp_version;      /* last compatible version */
319
320         /* version 2 fields below */
321         u32     boot_cpuid_phys;        /* Which physical CPU id we're
322                                            booting on */
323         /* version 3 fields below */
324         u32     size_dt_strings;        /* size of the strings block */
325
326         /* version 17 fields below */
327         u32     size_dt_struct;         /* size of the DT structure block */
328 };
329
330    Along with the constants:
331
332 /* Definitions used by the flattened device tree */
333 #define OF_DT_HEADER            0xd00dfeed      /* 4: version,
334                                                    4: total size */
335 #define OF_DT_BEGIN_NODE        0x1             /* Start node: full name
336                                                    */
337 #define OF_DT_END_NODE          0x2             /* End node */
338 #define OF_DT_PROP              0x3             /* Property: name off,
339                                                    size, content */
340 #define OF_DT_END               0x9
341
342    All values in this header are in big endian format, the various
343    fields in this header are defined more precisely below. All
344    "offset" values are in bytes from the start of the header; that is
345    from the value of r3.
346
347    - magic
348
349      This is a magic value that "marks" the beginning of the
350      device-tree block header. It contains the value 0xd00dfeed and is
351      defined by the constant OF_DT_HEADER
352
353    - totalsize
354
355      This is the total size of the DT block including the header. The
356      "DT" block should enclose all data structures defined in this
357      chapter (who are pointed to by offsets in this header). That is,
358      the device-tree structure, strings, and the memory reserve map.
359
360    - off_dt_struct
361
362      This is an offset from the beginning of the header to the start
363      of the "structure" part the device tree. (see 2) device tree)
364
365    - off_dt_strings
366
367      This is an offset from the beginning of the header to the start
368      of the "strings" part of the device-tree
369
370    - off_mem_rsvmap
371
372      This is an offset from the beginning of the header to the start
373      of the reserved memory map. This map is a list of pairs of 64-
374      bit integers. Each pair is a physical address and a size. The
375      list is terminated by an entry of size 0. This map provides the
376      kernel with a list of physical memory areas that are "reserved"
377      and thus not to be used for memory allocations, especially during
378      early initialization. The kernel needs to allocate memory during
379      boot for things like un-flattening the device-tree, allocating an
380      MMU hash table, etc... Those allocations must be done in such a
381      way to avoid overriding critical things like, on Open Firmware
382      capable machines, the RTAS instance, or on some pSeries, the TCE
383      tables used for the iommu. Typically, the reserve map should
384      contain _at least_ this DT block itself (header,total_size). If
385      you are passing an initrd to the kernel, you should reserve it as
386      well. You do not need to reserve the kernel image itself. The map
387      should be 64-bit aligned.
388
389    - version
390
391      This is the version of this structure. Version 1 stops
392      here. Version 2 adds an additional field boot_cpuid_phys.
393      Version 3 adds the size of the strings block, allowing the kernel
394      to reallocate it easily at boot and free up the unused flattened
395      structure after expansion. Version 16 introduces a new more
396      "compact" format for the tree itself that is however not backward
397      compatible. Version 17 adds an additional field, size_dt_struct,
398      allowing it to be reallocated or moved more easily (this is
399      particularly useful for bootloaders which need to make
400      adjustments to a device tree based on probed information). You
401      should always generate a structure of the highest version defined
402      at the time of your implementation. Currently that is version 17,
403      unless you explicitly aim at being backward compatible.
404
405    - last_comp_version
406
407      Last compatible version. This indicates down to what version of
408      the DT block you are backward compatible. For example, version 2
409      is backward compatible with version 1 (that is, a kernel build
410      for version 1 will be able to boot with a version 2 format). You
411      should put a 1 in this field if you generate a device tree of
412      version 1 to 3, or 16 if you generate a tree of version 16 or 17
413      using the new unit name format.
414
415    - boot_cpuid_phys
416
417      This field only exist on version 2 headers. It indicate which
418      physical CPU ID is calling the kernel entry point. This is used,
419      among others, by kexec. If you are on an SMP system, this value
420      should match the content of the "reg" property of the CPU node in
421      the device-tree corresponding to the CPU calling the kernel entry
422      point (see further chapters for more informations on the required
423      device-tree contents)
424
425    - size_dt_strings
426
427      This field only exists on version 3 and later headers.  It
428      gives the size of the "strings" section of the device tree (which
429      starts at the offset given by off_dt_strings).
430
431    - size_dt_struct
432
433      This field only exists on version 17 and later headers.  It gives
434      the size of the "structure" section of the device tree (which
435      starts at the offset given by off_dt_struct).
436
437    So the typical layout of a DT block (though the various parts don't
438    need to be in that order) looks like this (addresses go from top to
439    bottom):
440
441
442              ------------------------------
443        r3 -> |  struct boot_param_header  |
444              ------------------------------
445              |      (alignment gap) (*)   |
446              ------------------------------
447              |      memory reserve map    |
448              ------------------------------
449              |      (alignment gap)       |
450              ------------------------------
451              |                            |
452              |    device-tree structure   |
453              |                            |
454              ------------------------------
455              |      (alignment gap)       |
456              ------------------------------
457              |                            |
458              |     device-tree strings    |
459              |                            |
460       -----> ------------------------------
461       |
462       |
463       --- (r3 + totalsize)
464
465   (*) The alignment gaps are not necessarily present; their presence
466       and size are dependent on the various alignment requirements of
467       the individual data blocks.
468
469
470 2) Device tree generalities
471 ---------------------------
472
473 This device-tree itself is separated in two different blocks, a
474 structure block and a strings block. Both need to be aligned to a 4
475 byte boundary.
476
477 First, let's quickly describe the device-tree concept before detailing
478 the storage format. This chapter does _not_ describe the detail of the
479 required types of nodes & properties for the kernel, this is done
480 later in chapter III.
481
482 The device-tree layout is strongly inherited from the definition of
483 the Open Firmware IEEE 1275 device-tree. It's basically a tree of
484 nodes, each node having two or more named properties. A property can
485 have a value or not.
486
487 It is a tree, so each node has one and only one parent except for the
488 root node who has no parent.
489
490 A node has 2 names. The actual node name is generally contained in a
491 property of type "name" in the node property list whose value is a
492 zero terminated string and is mandatory for version 1 to 3 of the
493 format definition (as it is in Open Firmware). Version 16 makes it
494 optional as it can generate it from the unit name defined below.
495
496 There is also a "unit name" that is used to differentiate nodes with
497 the same name at the same level, it is usually made of the node
498 names, the "@" sign, and a "unit address", which definition is
499 specific to the bus type the node sits on.
500
501 The unit name doesn't exist as a property per-se but is included in
502 the device-tree structure. It is typically used to represent "path" in
503 the device-tree. More details about the actual format of these will be
504 below.
505
506 The kernel powerpc generic code does not make any formal use of the
507 unit address (though some board support code may do) so the only real
508 requirement here for the unit address is to ensure uniqueness of
509 the node unit name at a given level of the tree. Nodes with no notion
510 of address and no possible sibling of the same name (like /memory or
511 /cpus) may omit the unit address in the context of this specification,
512 or use the "@0" default unit address. The unit name is used to define
513 a node "full path", which is the concatenation of all parent node
514 unit names separated with "/".
515
516 The root node doesn't have a defined name, and isn't required to have
517 a name property either if you are using version 3 or earlier of the
518 format. It also has no unit address (no @ symbol followed by a unit
519 address). The root node unit name is thus an empty string. The full
520 path to the root node is "/".
521
522 Every node which actually represents an actual device (that is, a node
523 which isn't only a virtual "container" for more nodes, like "/cpus"
524 is) is also required to have a "device_type" property indicating the
525 type of node .
526
527 Finally, every node that can be referenced from a property in another
528 node is required to have a "linux,phandle" property. Real open
529 firmware implementations provide a unique "phandle" value for every
530 node that the "prom_init()" trampoline code turns into
531 "linux,phandle" properties. However, this is made optional if the
532 flattened device tree is used directly. An example of a node
533 referencing another node via "phandle" is when laying out the
534 interrupt tree which will be described in a further version of this
535 document.
536
537 This "linux, phandle" property is a 32-bit value that uniquely
538 identifies a node. You are free to use whatever values or system of
539 values, internal pointers, or whatever to generate these, the only
540 requirement is that every node for which you provide that property has
541 a unique value for it.
542
543 Here is an example of a simple device-tree. In this example, an "o"
544 designates a node followed by the node unit name. Properties are
545 presented with their name followed by their content. "content"
546 represents an ASCII string (zero terminated) value, while <content>
547 represents a 32-bit hexadecimal value. The various nodes in this
548 example will be discussed in a later chapter. At this point, it is
549 only meant to give you a idea of what a device-tree looks like. I have
550 purposefully kept the "name" and "linux,phandle" properties which
551 aren't necessary in order to give you a better idea of what the tree
552 looks like in practice.
553
554   / o device-tree
555       |- name = "device-tree"
556       |- model = "MyBoardName"
557       |- compatible = "MyBoardFamilyName"
558       |- #address-cells = <2>
559       |- #size-cells = <2>
560       |- linux,phandle = <0>
561       |
562       o cpus
563       | | - name = "cpus"
564       | | - linux,phandle = <1>
565       | | - #address-cells = <1>
566       | | - #size-cells = <0>
567       | |
568       | o PowerPC,970@0
569       |   |- name = "PowerPC,970"
570       |   |- device_type = "cpu"
571       |   |- reg = <0>
572       |   |- clock-frequency = <5f5e1000>
573       |   |- 64-bit
574       |   |- linux,phandle = <2>
575       |
576       o memory@0
577       | |- name = "memory"
578       | |- device_type = "memory"
579       | |- reg = <00000000 00000000 00000000 20000000>
580       | |- linux,phandle = <3>
581       |
582       o chosen
583         |- name = "chosen"
584         |- bootargs = "root=/dev/sda2"
585         |- linux,phandle = <4>
586
587 This tree is almost a minimal tree. It pretty much contains the
588 minimal set of required nodes and properties to boot a linux kernel;
589 that is, some basic model informations at the root, the CPUs, and the
590 physical memory layout.  It also includes misc information passed
591 through /chosen, like in this example, the platform type (mandatory)
592 and the kernel command line arguments (optional).
593
594 The /cpus/PowerPC,970@0/64-bit property is an example of a
595 property without a value. All other properties have a value. The
596 significance of the #address-cells and #size-cells properties will be
597 explained in chapter IV which defines precisely the required nodes and
598 properties and their content.
599
600
601 3) Device tree "structure" block
602
603 The structure of the device tree is a linearized tree structure. The
604 "OF_DT_BEGIN_NODE" token starts a new node, and the "OF_DT_END_NODE"
605 ends that node definition. Child nodes are simply defined before
606 "OF_DT_END_NODE" (that is nodes within the node). A 'token' is a 32
607 bit value. The tree has to be "finished" with a OF_DT_END token
608
609 Here's the basic structure of a single node:
610
611      * token OF_DT_BEGIN_NODE (that is 0x00000001)
612      * for version 1 to 3, this is the node full path as a zero
613        terminated string, starting with "/". For version 16 and later,
614        this is the node unit name only (or an empty string for the
615        root node)
616      * [align gap to next 4 bytes boundary]
617      * for each property:
618         * token OF_DT_PROP (that is 0x00000003)
619         * 32-bit value of property value size in bytes (or 0 if no
620           value)
621         * 32-bit value of offset in string block of property name
622         * property value data if any
623         * [align gap to next 4 bytes boundary]
624      * [child nodes if any]
625      * token OF_DT_END_NODE (that is 0x00000002)
626
627 So the node content can be summarized as a start token, a full path,
628 a list of properties, a list of child nodes, and an end token. Every
629 child node is a full node structure itself as defined above.
630
631 NOTE: The above definition requires that all property definitions for
632 a particular node MUST precede any subnode definitions for that node.
633 Although the structure would not be ambiguous if properties and
634 subnodes were intermingled, the kernel parser requires that the
635 properties come first (up until at least 2.6.22).  Any tools
636 manipulating a flattened tree must take care to preserve this
637 constraint.
638
639 4) Device tree "strings" block
640
641 In order to save space, property names, which are generally redundant,
642 are stored separately in the "strings" block. This block is simply the
643 whole bunch of zero terminated strings for all property names
644 concatenated together. The device-tree property definitions in the
645 structure block will contain offset values from the beginning of the
646 strings block.
647
648
649 III - Required content of the device tree
650 =========================================
651
652 WARNING: All "linux,*" properties defined in this document apply only
653 to a flattened device-tree. If your platform uses a real
654 implementation of Open Firmware or an implementation compatible with
655 the Open Firmware client interface, those properties will be created
656 by the trampoline code in the kernel's prom_init() file. For example,
657 that's where you'll have to add code to detect your board model and
658 set the platform number. However, when using the flattened device-tree
659 entry point, there is no prom_init() pass, and thus you have to
660 provide those properties yourself.
661
662
663 1) Note about cells and address representation
664 ----------------------------------------------
665
666 The general rule is documented in the various Open Firmware
667 documentations. If you choose to describe a bus with the device-tree
668 and there exist an OF bus binding, then you should follow the
669 specification. However, the kernel does not require every single
670 device or bus to be described by the device tree.
671
672 In general, the format of an address for a device is defined by the
673 parent bus type, based on the #address-cells and #size-cells
674 property. In the absence of such a property, the parent's parent
675 values are used, etc... The kernel requires the root node to have
676 those properties defining addresses format for devices directly mapped
677 on the processor bus.
678
679 Those 2 properties define 'cells' for representing an address and a
680 size. A "cell" is a 32-bit number. For example, if both contain 2
681 like the example tree given above, then an address and a size are both
682 composed of 2 cells, and each is a 64-bit number (cells are
683 concatenated and expected to be in big endian format). Another example
684 is the way Apple firmware defines them, with 2 cells for an address
685 and one cell for a size.  Most 32-bit implementations should define
686 #address-cells and #size-cells to 1, which represents a 32-bit value.
687 Some 32-bit processors allow for physical addresses greater than 32
688 bits; these processors should define #address-cells as 2.
689
690 "reg" properties are always a tuple of the type "address size" where
691 the number of cells of address and size is specified by the bus
692 #address-cells and #size-cells. When a bus supports various address
693 spaces and other flags relative to a given address allocation (like
694 prefetchable, etc...) those flags are usually added to the top level
695 bits of the physical address. For example, a PCI physical address is
696 made of 3 cells, the bottom two containing the actual address itself
697 while the top cell contains address space indication, flags, and pci
698 bus & device numbers.
699
700 For busses that support dynamic allocation, it's the accepted practice
701 to then not provide the address in "reg" (keep it 0) though while
702 providing a flag indicating the address is dynamically allocated, and
703 then, to provide a separate "assigned-addresses" property that
704 contains the fully allocated addresses. See the PCI OF bindings for
705 details.
706
707 In general, a simple bus with no address space bits and no dynamic
708 allocation is preferred if it reflects your hardware, as the existing
709 kernel address parsing functions will work out of the box. If you
710 define a bus type with a more complex address format, including things
711 like address space bits, you'll have to add a bus translator to the
712 prom_parse.c file of the recent kernels for your bus type.
713
714 The "reg" property only defines addresses and sizes (if #size-cells
715 is non-0) within a given bus. In order to translate addresses upward
716 (that is into parent bus addresses, and possibly into CPU physical
717 addresses), all busses must contain a "ranges" property. If the
718 "ranges" property is missing at a given level, it's assumed that
719 translation isn't possible. The format of the "ranges" property for a
720 bus is a list of:
721
722         bus address, parent bus address, size
723
724 "bus address" is in the format of the bus this bus node is defining,
725 that is, for a PCI bridge, it would be a PCI address. Thus, (bus
726 address, size) defines a range of addresses for child devices. "parent
727 bus address" is in the format of the parent bus of this bus. For
728 example, for a PCI host controller, that would be a CPU address. For a
729 PCI<->ISA bridge, that would be a PCI address. It defines the base
730 address in the parent bus where the beginning of that range is mapped.
731
732 For a new 64-bit powerpc board, I recommend either the 2/2 format or
733 Apple's 2/1 format which is slightly more compact since sizes usually
734 fit in a single 32-bit word.   New 32-bit powerpc boards should use a
735 1/1 format, unless the processor supports physical addresses greater
736 than 32-bits, in which case a 2/1 format is recommended.
737
738
739 2) Note about "compatible" properties
740 -------------------------------------
741
742 These properties are optional, but recommended in devices and the root
743 node. The format of a "compatible" property is a list of concatenated
744 zero terminated strings. They allow a device to express its
745 compatibility with a family of similar devices, in some cases,
746 allowing a single driver to match against several devices regardless
747 of their actual names.
748
749 3) Note about "name" properties
750 -------------------------------
751
752 While earlier users of Open Firmware like OldWorld macintoshes tended
753 to use the actual device name for the "name" property, it's nowadays
754 considered a good practice to use a name that is closer to the device
755 class (often equal to device_type). For example, nowadays, ethernet
756 controllers are named "ethernet", an additional "model" property
757 defining precisely the chip type/model, and "compatible" property
758 defining the family in case a single driver can driver more than one
759 of these chips. However, the kernel doesn't generally put any
760 restriction on the "name" property; it is simply considered good
761 practice to follow the standard and its evolutions as closely as
762 possible.
763
764 Note also that the new format version 16 makes the "name" property
765 optional. If it's absent for a node, then the node's unit name is then
766 used to reconstruct the name. That is, the part of the unit name
767 before the "@" sign is used (or the entire unit name if no "@" sign
768 is present).
769
770 4) Note about node and property names and character set
771 -------------------------------------------------------
772
773 While open firmware provides more flexible usage of 8859-1, this
774 specification enforces more strict rules. Nodes and properties should
775 be comprised only of ASCII characters 'a' to 'z', '0' to
776 '9', ',', '.', '_', '+', '#', '?', and '-'. Node names additionally
777 allow uppercase characters 'A' to 'Z' (property names should be
778 lowercase. The fact that vendors like Apple don't respect this rule is
779 irrelevant here). Additionally, node and property names should always
780 begin with a character in the range 'a' to 'z' (or 'A' to 'Z' for node
781 names).
782
783 The maximum number of characters for both nodes and property names
784 is 31. In the case of node names, this is only the leftmost part of
785 a unit name (the pure "name" property), it doesn't include the unit
786 address which can extend beyond that limit.
787
788
789 5) Required nodes and properties
790 --------------------------------
791   These are all that are currently required. However, it is strongly
792   recommended that you expose PCI host bridges as documented in the
793   PCI binding to open firmware, and your interrupt tree as documented
794   in OF interrupt tree specification.
795
796   a) The root node
797
798   The root node requires some properties to be present:
799
800     - model : this is your board name/model
801     - #address-cells : address representation for "root" devices
802     - #size-cells: the size representation for "root" devices
803     - device_type : This property shouldn't be necessary. However, if
804       you decide to create a device_type for your root node, make sure it
805       is _not_ "chrp" unless your platform is a pSeries or PAPR compliant
806       one for 64-bit, or a CHRP-type machine for 32-bit as this will
807       matched by the kernel this way.
808
809   Additionally, some recommended properties are:
810
811     - compatible : the board "family" generally finds its way here,
812       for example, if you have 2 board models with a similar layout,
813       that typically get driven by the same platform code in the
814       kernel, you would use a different "model" property but put a
815       value in "compatible". The kernel doesn't directly use that
816       value but it is generally useful.
817
818   The root node is also generally where you add additional properties
819   specific to your board like the serial number if any, that sort of
820   thing. It is recommended that if you add any "custom" property whose
821   name may clash with standard defined ones, you prefix them with your
822   vendor name and a comma.
823
824   b) The /cpus node
825
826   This node is the parent of all individual CPU nodes. It doesn't
827   have any specific requirements, though it's generally good practice
828   to have at least:
829
830                #address-cells = <00000001>
831                #size-cells    = <00000000>
832
833   This defines that the "address" for a CPU is a single cell, and has
834   no meaningful size. This is not necessary but the kernel will assume
835   that format when reading the "reg" properties of a CPU node, see
836   below
837
838   c) The /cpus/* nodes
839
840   So under /cpus, you are supposed to create a node for every CPU on
841   the machine. There is no specific restriction on the name of the
842   CPU, though It's common practice to call it PowerPC,<name>. For
843   example, Apple uses PowerPC,G5 while IBM uses PowerPC,970FX.
844
845   Required properties:
846
847     - device_type : has to be "cpu"
848     - reg : This is the physical CPU number, it's a single 32-bit cell
849       and is also used as-is as the unit number for constructing the
850       unit name in the full path. For example, with 2 CPUs, you would
851       have the full path:
852         /cpus/PowerPC,970FX@0
853         /cpus/PowerPC,970FX@1
854       (unit addresses do not require leading zeroes)
855     - d-cache-line-size : one cell, L1 data cache line size in bytes
856     - i-cache-line-size : one cell, L1 instruction cache line size in
857       bytes
858     - d-cache-size : one cell, size of L1 data cache in bytes
859     - i-cache-size : one cell, size of L1 instruction cache in bytes
860
861   Recommended properties:
862
863     - timebase-frequency : a cell indicating the frequency of the
864       timebase in Hz. This is not directly used by the generic code,
865       but you are welcome to copy/paste the pSeries code for setting
866       the kernel timebase/decrementer calibration based on this
867       value.
868     - clock-frequency : a cell indicating the CPU core clock frequency
869       in Hz. A new property will be defined for 64-bit values, but if
870       your frequency is < 4Ghz, one cell is enough. Here as well as
871       for the above, the common code doesn't use that property, but
872       you are welcome to re-use the pSeries or Maple one. A future
873       kernel version might provide a common function for this.
874
875   You are welcome to add any property you find relevant to your board,
876   like some information about the mechanism used to soft-reset the
877   CPUs. For example, Apple puts the GPIO number for CPU soft reset
878   lines in there as a "soft-reset" property since they start secondary
879   CPUs by soft-resetting them.
880
881
882   d) the /memory node(s)
883
884   To define the physical memory layout of your board, you should
885   create one or more memory node(s). You can either create a single
886   node with all memory ranges in its reg property, or you can create
887   several nodes, as you wish. The unit address (@ part) used for the
888   full path is the address of the first range of memory defined by a
889   given node. If you use a single memory node, this will typically be
890   @0.
891
892   Required properties:
893
894     - device_type : has to be "memory"
895     - reg : This property contains all the physical memory ranges of
896       your board. It's a list of addresses/sizes concatenated
897       together, with the number of cells of each defined by the
898       #address-cells and #size-cells of the root node. For example,
899       with both of these properties being 2 like in the example given
900       earlier, a 970 based machine with 6Gb of RAM could typically
901       have a "reg" property here that looks like:
902
903       00000000 00000000 00000000 80000000
904       00000001 00000000 00000001 00000000
905
906       That is a range starting at 0 of 0x80000000 bytes and a range
907       starting at 0x100000000 and of 0x100000000 bytes. You can see
908       that there is no memory covering the IO hole between 2Gb and
909       4Gb. Some vendors prefer splitting those ranges into smaller
910       segments, but the kernel doesn't care.
911
912   e) The /chosen node
913
914   This node is a bit "special". Normally, that's where open firmware
915   puts some variable environment information, like the arguments, or
916   the default input/output devices.
917
918   This specification makes a few of these mandatory, but also defines
919   some linux-specific properties that would be normally constructed by
920   the prom_init() trampoline when booting with an OF client interface,
921   but that you have to provide yourself when using the flattened format.
922
923   Recommended properties:
924
925     - bootargs : This zero-terminated string is passed as the kernel
926       command line
927     - linux,stdout-path : This is the full path to your standard
928       console device if any. Typically, if you have serial devices on
929       your board, you may want to put the full path to the one set as
930       the default console in the firmware here, for the kernel to pick
931       it up as its own default console. If you look at the function
932       set_preferred_console() in arch/ppc64/kernel/setup.c, you'll see
933       that the kernel tries to find out the default console and has
934       knowledge of various types like 8250 serial ports. You may want
935       to extend this function to add your own.
936
937   Note that u-boot creates and fills in the chosen node for platforms
938   that use it.
939
940   (Note: a practice that is now obsolete was to include a property
941   under /chosen called interrupt-controller which had a phandle value
942   that pointed to the main interrupt controller)
943
944   f) the /soc<SOCname> node
945
946   This node is used to represent a system-on-a-chip (SOC) and must be
947   present if the processor is a SOC. The top-level soc node contains
948   information that is global to all devices on the SOC. The node name
949   should contain a unit address for the SOC, which is the base address
950   of the memory-mapped register set for the SOC. The name of an soc
951   node should start with "soc", and the remainder of the name should
952   represent the part number for the soc.  For example, the MPC8540's
953   soc node would be called "soc8540".
954
955   Required properties:
956
957     - device_type : Should be "soc"
958     - ranges : Should be defined as specified in 1) to describe the
959       translation of SOC addresses for memory mapped SOC registers.
960     - bus-frequency: Contains the bus frequency for the SOC node.
961       Typically, the value of this field is filled in by the boot
962       loader. 
963
964
965   Recommended properties:
966
967     - reg : This property defines the address and size of the
968       memory-mapped registers that are used for the SOC node itself.
969       It does not include the child device registers - these will be
970       defined inside each child node.  The address specified in the
971       "reg" property should match the unit address of the SOC node.
972     - #address-cells : Address representation for "soc" devices.  The
973       format of this field may vary depending on whether or not the
974       device registers are memory mapped.  For memory mapped
975       registers, this field represents the number of cells needed to
976       represent the address of the registers.  For SOCs that do not
977       use MMIO, a special address format should be defined that
978       contains enough cells to represent the required information.
979       See 1) above for more details on defining #address-cells.
980     - #size-cells : Size representation for "soc" devices
981     - #interrupt-cells : Defines the width of cells used to represent
982        interrupts.  Typically this value is <2>, which includes a
983        32-bit number that represents the interrupt number, and a
984        32-bit number that represents the interrupt sense and level.
985        This field is only needed if the SOC contains an interrupt
986        controller.
987
988   The SOC node may contain child nodes for each SOC device that the
989   platform uses.  Nodes should not be created for devices which exist
990   on the SOC but are not used by a particular platform. See chapter VI
991   for more information on how to specify devices that are part of a SOC.
992
993   Example SOC node for the MPC8540:
994
995         soc8540@e0000000 {
996                 #address-cells = <1>;
997                 #size-cells = <1>;
998                 #interrupt-cells = <2>;
999                 device_type = "soc";
1000                 ranges = <00000000 e0000000 00100000>
1001                 reg = <e0000000 00003000>;
1002                 bus-frequency = <0>;
1003         }
1004
1005
1006
1007 IV - "dtc", the device tree compiler
1008 ====================================
1009
1010
1011 dtc source code can be found at
1012 <http://ozlabs.org/~dgibson/dtc/dtc.tar.gz>
1013
1014 WARNING: This version is still in early development stage; the
1015 resulting device-tree "blobs" have not yet been validated with the
1016 kernel. The current generated bloc lacks a useful reserve map (it will
1017 be fixed to generate an empty one, it's up to the bootloader to fill
1018 it up) among others. The error handling needs work, bugs are lurking,
1019 etc...
1020
1021 dtc basically takes a device-tree in a given format and outputs a
1022 device-tree in another format. The currently supported formats are:
1023
1024   Input formats:
1025   -------------
1026
1027      - "dtb": "blob" format, that is a flattened device-tree block
1028        with
1029         header all in a binary blob.
1030      - "dts": "source" format. This is a text file containing a
1031        "source" for a device-tree. The format is defined later in this
1032         chapter.
1033      - "fs" format. This is a representation equivalent to the
1034         output of /proc/device-tree, that is nodes are directories and
1035         properties are files
1036
1037  Output formats:
1038  ---------------
1039
1040      - "dtb": "blob" format
1041      - "dts": "source" format
1042      - "asm": assembly language file. This is a file that can be
1043        sourced by gas to generate a device-tree "blob". That file can
1044        then simply be added to your Makefile. Additionally, the
1045        assembly file exports some symbols that can be used.
1046
1047
1048 The syntax of the dtc tool is
1049
1050     dtc [-I <input-format>] [-O <output-format>]
1051         [-o output-filename] [-V output_version] input_filename
1052
1053
1054 The "output_version" defines what version of the "blob" format will be
1055 generated. Supported versions are 1,2,3 and 16. The default is
1056 currently version 3 but that may change in the future to version 16.
1057
1058 Additionally, dtc performs various sanity checks on the tree, like the
1059 uniqueness of linux, phandle properties, validity of strings, etc...
1060
1061 The format of the .dts "source" file is "C" like, supports C and C++
1062 style comments.
1063
1064 / {
1065 }
1066
1067 The above is the "device-tree" definition. It's the only statement
1068 supported currently at the toplevel.
1069
1070 / {
1071   property1 = "string_value";   /* define a property containing a 0
1072                                  * terminated string
1073                                  */
1074
1075   property2 = <1234abcd>;       /* define a property containing a
1076                                  * numerical 32-bit value (hexadecimal)
1077                                  */
1078
1079   property3 = <12345678 12345678 deadbeef>;
1080                                 /* define a property containing 3
1081                                  * numerical 32-bit values (cells) in
1082                                  * hexadecimal
1083                                  */
1084   property4 = [0a 0b 0c 0d de ea ad be ef];
1085                                 /* define a property whose content is
1086                                  * an arbitrary array of bytes
1087                                  */
1088
1089   childnode@addresss {  /* define a child node named "childnode"
1090                                  * whose unit name is "childnode at
1091                                  * address"
1092                                  */
1093
1094     childprop = "hello\n";      /* define a property "childprop" of
1095                                  * childnode (in this case, a string)
1096                                  */
1097   };
1098 };
1099
1100 Nodes can contain other nodes etc... thus defining the hierarchical
1101 structure of the tree.
1102
1103 Strings support common escape sequences from C: "\n", "\t", "\r",
1104 "\(octal value)", "\x(hex value)".
1105
1106 It is also suggested that you pipe your source file through cpp (gcc
1107 preprocessor) so you can use #include's, #define for constants, etc...
1108
1109 Finally, various options are planned but not yet implemented, like
1110 automatic generation of phandles, labels (exported to the asm file so
1111 you can point to a property content and change it easily from whatever
1112 you link the device-tree with), label or path instead of numeric value
1113 in some cells to "point" to a node (replaced by a phandle at compile
1114 time), export of reserve map address to the asm file, ability to
1115 specify reserve map content at compile time, etc...
1116
1117 We may provide a .h include file with common definitions of that
1118 proves useful for some properties (like building PCI properties or
1119 interrupt maps) though it may be better to add a notion of struct
1120 definitions to the compiler...
1121
1122
1123 V - Recommendations for a bootloader
1124 ====================================
1125
1126
1127 Here are some various ideas/recommendations that have been proposed
1128 while all this has been defined and implemented.
1129
1130   - The bootloader may want to be able to use the device-tree itself
1131     and may want to manipulate it (to add/edit some properties,
1132     like physical memory size or kernel arguments). At this point, 2
1133     choices can be made. Either the bootloader works directly on the
1134     flattened format, or the bootloader has its own internal tree
1135     representation with pointers (similar to the kernel one) and
1136     re-flattens the tree when booting the kernel. The former is a bit
1137     more difficult to edit/modify, the later requires probably a bit
1138     more code to handle the tree structure. Note that the structure
1139     format has been designed so it's relatively easy to "insert"
1140     properties or nodes or delete them by just memmoving things
1141     around. It contains no internal offsets or pointers for this
1142     purpose.
1143
1144   - An example of code for iterating nodes & retrieving properties
1145     directly from the flattened tree format can be found in the kernel
1146     file arch/ppc64/kernel/prom.c, look at scan_flat_dt() function,
1147     its usage in early_init_devtree(), and the corresponding various
1148     early_init_dt_scan_*() callbacks. That code can be re-used in a
1149     GPL bootloader, and as the author of that code, I would be happy
1150     to discuss possible free licensing to any vendor who wishes to
1151     integrate all or part of this code into a non-GPL bootloader.
1152
1153
1154
1155 VI - System-on-a-chip devices and nodes
1156 =======================================
1157
1158 Many companies are now starting to develop system-on-a-chip
1159 processors, where the processor core (CPU) and many peripheral devices
1160 exist on a single piece of silicon.  For these SOCs, an SOC node
1161 should be used that defines child nodes for the devices that make
1162 up the SOC. While platforms are not required to use this model in
1163 order to boot the kernel, it is highly encouraged that all SOC
1164 implementations define as complete a flat-device-tree as possible to
1165 describe the devices on the SOC.  This will allow for the
1166 genericization of much of the kernel code.
1167
1168
1169 1) Defining child nodes of an SOC
1170 ---------------------------------
1171
1172 Each device that is part of an SOC may have its own node entry inside
1173 the SOC node.  For each device that is included in the SOC, the unit
1174 address property represents the address offset for this device's
1175 memory-mapped registers in the parent's address space.  The parent's
1176 address space is defined by the "ranges" property in the top-level soc
1177 node. The "reg" property for each node that exists directly under the
1178 SOC node should contain the address mapping from the child address space
1179 to the parent SOC address space and the size of the device's
1180 memory-mapped register file.
1181
1182 For many devices that may exist inside an SOC, there are predefined
1183 specifications for the format of the device tree node.  All SOC child
1184 nodes should follow these specifications, except where noted in this
1185 document.
1186
1187 See appendix A for an example partial SOC node definition for the
1188 MPC8540.
1189
1190
1191 2) Representing devices without a current OF specification
1192 ----------------------------------------------------------
1193
1194 Currently, there are many devices on SOCs that do not have a standard
1195 representation pre-defined as part of the open firmware
1196 specifications, mainly because the boards that contain these SOCs are
1197 not currently booted using open firmware.   This section contains
1198 descriptions for the SOC devices for which new nodes have been
1199 defined; this list will expand as more and more SOC-containing
1200 platforms are moved over to use the flattened-device-tree model.
1201
1202   a) MDIO IO device
1203
1204   The MDIO is a bus to which the PHY devices are connected.  For each
1205   device that exists on this bus, a child node should be created.  See
1206   the definition of the PHY node below for an example of how to define
1207   a PHY.
1208
1209   Required properties:
1210     - reg : Offset and length of the register set for the device
1211     - device_type : Should be "mdio"
1212     - compatible : Should define the compatible device type for the
1213       mdio.  Currently, this is most likely to be "gianfar"
1214
1215   Example:
1216
1217         mdio@24520 {
1218                 reg = <24520 20>;
1219                 device_type = "mdio"; 
1220                 compatible = "gianfar";
1221
1222                 ethernet-phy@0 {
1223                         ......
1224                 };
1225         };
1226
1227
1228   b) Gianfar-compatible ethernet nodes
1229
1230   Required properties:
1231
1232     - device_type : Should be "network"
1233     - model : Model of the device.  Can be "TSEC", "eTSEC", or "FEC"
1234     - compatible : Should be "gianfar"
1235     - reg : Offset and length of the register set for the device
1236     - mac-address : List of bytes representing the ethernet address of
1237       this controller
1238     - interrupts : <a b> where a is the interrupt number and b is a
1239       field that represents an encoding of the sense and level
1240       information for the interrupt.  This should be encoded based on
1241       the information in section 2) depending on the type of interrupt
1242       controller you have.
1243     - interrupt-parent : the phandle for the interrupt controller that
1244       services interrupts for this device.
1245     - phy-handle : The phandle for the PHY connected to this ethernet
1246       controller.
1247
1248   Recommended properties:
1249
1250     - linux,network-index : This is the intended "index" of this
1251       network device.  This is used by the bootwrapper to interpret
1252       MAC addresses passed by the firmware when no information other
1253       than indices is available to associate an address with a device.
1254     - phy-connection-type : a string naming the controller/PHY interface type,
1255       i.e., "mii" (default), "rmii", "gmii", "rgmii", "rgmii-id", "sgmii",
1256       "tbi", or "rtbi".  This property is only really needed if the connection
1257       is of type "rgmii-id", as all other connection types are detected by
1258       hardware.
1259
1260
1261   Example:
1262
1263         ethernet@24000 {
1264                 #size-cells = <0>;
1265                 device_type = "network";
1266                 model = "TSEC";
1267                 compatible = "gianfar";
1268                 reg = <24000 1000>;
1269                 mac-address = [ 00 E0 0C 00 73 00 ];
1270                 interrupts = <d 3 e 3 12 3>;
1271                 interrupt-parent = <40000>;
1272                 phy-handle = <2452000>
1273         };
1274
1275
1276
1277    c) PHY nodes
1278
1279    Required properties:
1280
1281     - device_type : Should be "ethernet-phy"
1282     - interrupts : <a b> where a is the interrupt number and b is a
1283       field that represents an encoding of the sense and level
1284       information for the interrupt.  This should be encoded based on
1285       the information in section 2) depending on the type of interrupt
1286       controller you have.
1287     - interrupt-parent : the phandle for the interrupt controller that
1288       services interrupts for this device.
1289     - reg : The ID number for the phy, usually a small integer
1290     - linux,phandle :  phandle for this node; likely referenced by an
1291       ethernet controller node.
1292
1293
1294    Example:
1295
1296         ethernet-phy@0 {
1297                 linux,phandle = <2452000>
1298                 interrupt-parent = <40000>;
1299                 interrupts = <35 1>;
1300                 reg = <0>;
1301                 device_type = "ethernet-phy";
1302         };
1303
1304
1305    d) Interrupt controllers
1306
1307    Some SOC devices contain interrupt controllers that are different
1308    from the standard Open PIC specification.  The SOC device nodes for
1309    these types of controllers should be specified just like a standard
1310    OpenPIC controller.  Sense and level information should be encoded
1311    as specified in section 2) of this chapter for each device that
1312    specifies an interrupt.
1313
1314    Example :
1315
1316         pic@40000 {
1317                 linux,phandle = <40000>;
1318                 clock-frequency = <0>;
1319                 interrupt-controller;
1320                 #address-cells = <0>;
1321                 reg = <40000 40000>;
1322                 built-in;
1323                 compatible = "chrp,open-pic";
1324                 device_type = "open-pic";
1325                 big-endian;
1326         };
1327
1328
1329    e) I2C
1330
1331    Required properties :
1332
1333     - device_type : Should be "i2c"
1334     - reg : Offset and length of the register set for the device
1335
1336    Recommended properties :
1337
1338     - compatible : Should be "fsl-i2c" for parts compatible with
1339       Freescale I2C specifications.
1340     - interrupts : <a b> where a is the interrupt number and b is a
1341       field that represents an encoding of the sense and level
1342       information for the interrupt.  This should be encoded based on
1343       the information in section 2) depending on the type of interrupt
1344       controller you have.
1345     - interrupt-parent : the phandle for the interrupt controller that
1346       services interrupts for this device.
1347     - dfsrr : boolean; if defined, indicates that this I2C device has
1348       a digital filter sampling rate register
1349     - fsl5200-clocking : boolean; if defined, indicated that this device
1350       uses the FSL 5200 clocking mechanism.
1351
1352    Example :
1353
1354         i2c@3000 {
1355                 interrupt-parent = <40000>;
1356                 interrupts = <1b 3>;
1357                 reg = <3000 18>;
1358                 device_type = "i2c";
1359                 compatible  = "fsl-i2c";
1360                 dfsrr;
1361         };
1362
1363
1364    f) Freescale SOC USB controllers
1365
1366    The device node for a USB controller that is part of a Freescale
1367    SOC is as described in the document "Open Firmware Recommended
1368    Practice : Universal Serial Bus" with the following modifications
1369    and additions :  
1370
1371    Required properties :
1372     - compatible : Should be "fsl-usb2-mph" for multi port host USB
1373       controllers, or "fsl-usb2-dr" for dual role USB controllers
1374     - phy_type : For multi port host USB controllers, should be one of
1375       "ulpi", or "serial". For dual role USB controllers, should be
1376       one of "ulpi", "utmi", "utmi_wide", or "serial".
1377     - reg : Offset and length of the register set for the device
1378     - port0 : boolean; if defined, indicates port0 is connected for
1379       fsl-usb2-mph compatible controllers.  Either this property or
1380       "port1" (or both) must be defined for "fsl-usb2-mph" compatible 
1381       controllers.
1382     - port1 : boolean; if defined, indicates port1 is connected for
1383       fsl-usb2-mph compatible controllers.  Either this property or
1384       "port0" (or both) must be defined for "fsl-usb2-mph" compatible 
1385       controllers.
1386     - dr_mode : indicates the working mode for "fsl-usb2-dr" compatible
1387       controllers.  Can be "host", "peripheral", or "otg".  Default to
1388       "host" if not defined for backward compatibility.
1389
1390    Recommended properties :
1391     - interrupts : <a b> where a is the interrupt number and b is a
1392       field that represents an encoding of the sense and level
1393       information for the interrupt.  This should be encoded based on
1394       the information in section 2) depending on the type of interrupt
1395       controller you have.
1396     - interrupt-parent : the phandle for the interrupt controller that
1397       services interrupts for this device.
1398
1399    Example multi port host USB controller device node :
1400         usb@22000 {
1401                 device_type = "usb";
1402                 compatible = "fsl-usb2-mph";
1403                 reg = <22000 1000>;
1404                 #address-cells = <1>;
1405                 #size-cells = <0>;
1406                 interrupt-parent = <700>;
1407                 interrupts = <27 1>;
1408                 phy_type = "ulpi";
1409                 port0;
1410                 port1;
1411         };
1412
1413    Example dual role USB controller device node :
1414         usb@23000 {
1415                 device_type = "usb";
1416                 compatible = "fsl-usb2-dr";
1417                 reg = <23000 1000>;
1418                 #address-cells = <1>;
1419                 #size-cells = <0>;
1420                 interrupt-parent = <700>;
1421                 interrupts = <26 1>;
1422                 dr_mode = "otg";
1423                 phy = "ulpi";
1424         };
1425
1426
1427    g) Freescale SOC SEC Security Engines
1428
1429    Required properties:
1430
1431     - device_type : Should be "crypto"
1432     - model : Model of the device.  Should be "SEC1" or "SEC2"
1433     - compatible : Should be "talitos"
1434     - reg : Offset and length of the register set for the device
1435     - interrupts : <a b> where a is the interrupt number and b is a
1436       field that represents an encoding of the sense and level
1437       information for the interrupt.  This should be encoded based on
1438       the information in section 2) depending on the type of interrupt
1439       controller you have.
1440     - interrupt-parent : the phandle for the interrupt controller that
1441       services interrupts for this device.
1442     - num-channels : An integer representing the number of channels
1443       available.
1444     - channel-fifo-len : An integer representing the number of
1445       descriptor pointers each channel fetch fifo can hold.
1446     - exec-units-mask : The bitmask representing what execution units
1447       (EUs) are available. It's a single 32-bit cell. EU information
1448       should be encoded following the SEC's Descriptor Header Dword
1449       EU_SEL0 field documentation, i.e. as follows:
1450
1451         bit 0 = reserved - should be 0
1452         bit 1 = set if SEC has the ARC4 EU (AFEU)
1453         bit 2 = set if SEC has the DES/3DES EU (DEU)
1454         bit 3 = set if SEC has the message digest EU (MDEU)
1455         bit 4 = set if SEC has the random number generator EU (RNG)
1456         bit 5 = set if SEC has the public key EU (PKEU)
1457         bit 6 = set if SEC has the AES EU (AESU)
1458         bit 7 = set if SEC has the Kasumi EU (KEU)
1459
1460       bits 8 through 31 are reserved for future SEC EUs.
1461
1462     - descriptor-types-mask : The bitmask representing what descriptors
1463       are available. It's a single 32-bit cell. Descriptor type
1464       information should be encoded following the SEC's Descriptor
1465       Header Dword DESC_TYPE field documentation, i.e. as follows:
1466
1467         bit 0  = set if SEC supports the aesu_ctr_nonsnoop desc. type
1468         bit 1  = set if SEC supports the ipsec_esp descriptor type
1469         bit 2  = set if SEC supports the common_nonsnoop desc. type
1470         bit 3  = set if SEC supports the 802.11i AES ccmp desc. type
1471         bit 4  = set if SEC supports the hmac_snoop_no_afeu desc. type
1472         bit 5  = set if SEC supports the srtp descriptor type
1473         bit 6  = set if SEC supports the non_hmac_snoop_no_afeu desc.type
1474         bit 7  = set if SEC supports the pkeu_assemble descriptor type
1475         bit 8  = set if SEC supports the aesu_key_expand_output desc.type
1476         bit 9  = set if SEC supports the pkeu_ptmul descriptor type
1477         bit 10 = set if SEC supports the common_nonsnoop_afeu desc. type
1478         bit 11 = set if SEC supports the pkeu_ptadd_dbl descriptor type
1479
1480       ..and so on and so forth.
1481
1482    Example:
1483
1484        /* MPC8548E */
1485        crypto@30000 {
1486                device_type = "crypto";
1487                model = "SEC2";
1488                compatible = "talitos";
1489                reg = <30000 10000>;
1490                interrupts = <1d 3>;
1491                interrupt-parent = <40000>;
1492                num-channels = <4>;
1493                channel-fifo-len = <18>;
1494                exec-units-mask = <000000fe>;
1495                descriptor-types-mask = <012b0ebf>;
1496        };
1497
1498    h) Board Control and Status (BCSR)
1499
1500    Required properties:
1501
1502     - device_type : Should be "board-control"
1503     - reg : Offset and length of the register set for the device
1504
1505     Example:
1506
1507         bcsr@f8000000 {
1508                 device_type = "board-control";
1509                 reg = <f8000000 8000>;
1510         };
1511
1512    i) Freescale QUICC Engine module (QE)
1513    This represents qe module that is installed on PowerQUICC II Pro.
1514
1515    NOTE:  This is an interim binding; it should be updated to fit
1516    in with the CPM binding later in this document.
1517
1518    Basically, it is a bus of devices, that could act more or less
1519    as a complete entity (UCC, USB etc ). All of them should be siblings on
1520    the "root" qe node, using the common properties from there.
1521    The description below applies to the qe of MPC8360 and
1522    more nodes and properties would be extended in the future.
1523
1524    i) Root QE device
1525
1526    Required properties:
1527    - device_type : should be "qe";
1528    - model : precise model of the QE, Can be "QE", "CPM", or "CPM2"
1529    - reg : offset and length of the device registers.
1530    - bus-frequency : the clock frequency for QUICC Engine.
1531
1532    Recommended properties
1533    - brg-frequency : the internal clock source frequency for baud-rate
1534      generators in Hz.
1535
1536    Example:
1537         qe@e0100000 {
1538                 #address-cells = <1>;
1539                 #size-cells = <1>;
1540                 #interrupt-cells = <2>;
1541                 device_type = "qe";
1542                 model = "QE";
1543                 ranges = <0 e0100000 00100000>;
1544                 reg = <e0100000 480>;
1545                 brg-frequency = <0>;
1546                 bus-frequency = <179A7B00>;
1547         }
1548
1549
1550    ii) SPI (Serial Peripheral Interface)
1551
1552    Required properties:
1553    - device_type : should be "spi".
1554    - compatible : should be "fsl_spi".
1555    - mode : the SPI operation mode, it can be "cpu" or "cpu-qe".
1556    - reg : Offset and length of the register set for the device
1557    - interrupts : <a b> where a is the interrupt number and b is a
1558      field that represents an encoding of the sense and level
1559      information for the interrupt.  This should be encoded based on
1560      the information in section 2) depending on the type of interrupt
1561      controller you have.
1562    - interrupt-parent : the phandle for the interrupt controller that
1563      services interrupts for this device.
1564
1565    Example:
1566         spi@4c0 {
1567                 device_type = "spi";
1568                 compatible = "fsl_spi";
1569                 reg = <4c0 40>;
1570                 interrupts = <82 0>;
1571                 interrupt-parent = <700>;
1572                 mode = "cpu";
1573         };
1574
1575
1576    iii) USB (Universal Serial Bus Controller)
1577
1578    Required properties:
1579    - device_type : should be "usb".
1580    - compatible : could be "qe_udc" or "fhci-hcd".
1581    - mode : the could be "host" or "slave".
1582    - reg : Offset and length of the register set for the device
1583    - interrupts : <a b> where a is the interrupt number and b is a
1584      field that represents an encoding of the sense and level
1585      information for the interrupt.  This should be encoded based on
1586      the information in section 2) depending on the type of interrupt
1587      controller you have.
1588    - interrupt-parent : the phandle for the interrupt controller that
1589      services interrupts for this device.
1590
1591    Example(slave):
1592         usb@6c0 {
1593                 device_type = "usb";
1594                 compatible = "qe_udc";
1595                 reg = <6c0 40>;
1596                 interrupts = <8b 0>;
1597                 interrupt-parent = <700>;
1598                 mode = "slave";
1599         };
1600
1601
1602    iv) UCC (Unified Communications Controllers)
1603
1604    Required properties:
1605    - device_type : should be "network", "hldc", "uart", "transparent"
1606     "bisync" or "atm".
1607    - compatible : could be "ucc_geth" or "fsl_atm" and so on.
1608    - model : should be "UCC".
1609    - device-id : the ucc number(1-8), corresponding to UCCx in UM.
1610    - reg : Offset and length of the register set for the device
1611    - interrupts : <a b> where a is the interrupt number and b is a
1612      field that represents an encoding of the sense and level
1613      information for the interrupt.  This should be encoded based on
1614      the information in section 2) depending on the type of interrupt
1615      controller you have.
1616    - interrupt-parent : the phandle for the interrupt controller that
1617      services interrupts for this device.
1618    - pio-handle : The phandle for the Parallel I/O port configuration.
1619    - rx-clock : represents the UCC receive clock source.
1620      0x00 : clock source is disabled;
1621      0x1~0x10 : clock source is BRG1~BRG16 respectively;
1622      0x11~0x28: clock source is QE_CLK1~QE_CLK24 respectively.
1623    - tx-clock: represents the UCC transmit clock source;
1624      0x00 : clock source is disabled;
1625      0x1~0x10 : clock source is BRG1~BRG16 respectively;
1626      0x11~0x28: clock source is QE_CLK1~QE_CLK24 respectively.
1627
1628    Required properties for network device_type:
1629    - mac-address : list of bytes representing the ethernet address.
1630    - phy-handle : The phandle for the PHY connected to this controller.
1631
1632    Recommended properties:
1633    - linux,network-index : This is the intended "index" of this
1634      network device.  This is used by the bootwrapper to interpret
1635      MAC addresses passed by the firmware when no information other
1636      than indices is available to associate an address with a device.
1637    - phy-connection-type : a string naming the controller/PHY interface type,
1638      i.e., "mii" (default), "rmii", "gmii", "rgmii", "rgmii-id", "tbi",
1639      or "rtbi".
1640
1641    Example:
1642         ucc@2000 {
1643                 device_type = "network";
1644                 compatible = "ucc_geth";
1645                 model = "UCC";
1646                 device-id = <1>;
1647                 reg = <2000 200>;
1648                 interrupts = <a0 0>;
1649                 interrupt-parent = <700>;
1650                 mac-address = [ 00 04 9f 00 23 23 ];
1651                 rx-clock = "none";
1652                 tx-clock = "clk9";
1653                 phy-handle = <212000>;
1654                 phy-connection-type = "gmii";
1655                 pio-handle = <140001>;
1656         };
1657
1658
1659    v) Parallel I/O Ports
1660
1661    This node configures Parallel I/O ports for CPUs with QE support.
1662    The node should reside in the "soc" node of the tree.  For each
1663    device that using parallel I/O ports, a child node should be created.
1664    See the definition of the Pin configuration nodes below for more
1665    information.
1666
1667    Required properties:
1668    - device_type : should be "par_io".
1669    - reg : offset to the register set and its length.
1670    - num-ports : number of Parallel I/O ports
1671
1672    Example:
1673         par_io@1400 {
1674                 reg = <1400 100>;
1675                 #address-cells = <1>;
1676                 #size-cells = <0>;
1677                 device_type = "par_io";
1678                 num-ports = <7>;
1679                 ucc_pin@01 {
1680                         ......
1681                 };
1682
1683
1684    vi) Pin configuration nodes
1685
1686    Required properties:
1687    - linux,phandle : phandle of this node; likely referenced by a QE
1688      device.
1689    - pio-map : array of pin configurations.  Each pin is defined by 6
1690      integers.  The six numbers are respectively: port, pin, dir,
1691      open_drain, assignment, has_irq.
1692      - port : port number of the pin; 0-6 represent port A-G in UM.
1693      - pin : pin number in the port.
1694      - dir : direction of the pin, should encode as follows:
1695
1696         0 = The pin is disabled
1697         1 = The pin is an output
1698         2 = The pin is an input
1699         3 = The pin is I/O
1700
1701      - open_drain : indicates the pin is normal or wired-OR:
1702
1703         0 = The pin is actively driven as an output
1704         1 = The pin is an open-drain driver. As an output, the pin is
1705             driven active-low, otherwise it is three-stated.
1706
1707      - assignment : function number of the pin according to the Pin Assignment
1708        tables in User Manual.  Each pin can have up to 4 possible functions in
1709        QE and two options for CPM.
1710      - has_irq : indicates if the pin is used as source of external
1711        interrupts.
1712
1713    Example:
1714         ucc_pin@01 {
1715                 linux,phandle = <140001>;
1716                 pio-map = <
1717                 /* port  pin  dir  open_drain  assignment  has_irq */
1718                         0  3  1  0  1  0        /* TxD0 */
1719                         0  4  1  0  1  0        /* TxD1 */
1720                         0  5  1  0  1  0        /* TxD2 */
1721                         0  6  1  0  1  0        /* TxD3 */
1722                         1  6  1  0  3  0        /* TxD4 */
1723                         1  7  1  0  1  0        /* TxD5 */
1724                         1  9  1  0  2  0        /* TxD6 */
1725                         1  a  1  0  2  0        /* TxD7 */
1726                         0  9  2  0  1  0        /* RxD0 */
1727                         0  a  2  0  1  0        /* RxD1 */
1728                         0  b  2  0  1  0        /* RxD2 */
1729                         0  c  2  0  1  0        /* RxD3 */
1730                         0  d  2  0  1  0        /* RxD4 */
1731                         1  1  2  0  2  0        /* RxD5 */
1732                         1  0  2  0  2  0        /* RxD6 */
1733                         1  4  2  0  2  0        /* RxD7 */
1734                         0  7  1  0  1  0        /* TX_EN */
1735                         0  8  1  0  1  0        /* TX_ER */
1736                         0  f  2  0  1  0        /* RX_DV */
1737                         0  10 2  0  1  0        /* RX_ER */
1738                         0  0  2  0  1  0        /* RX_CLK */
1739                         2  9  1  0  3  0        /* GTX_CLK - CLK10 */
1740                         2  8  2  0  1  0>;      /* GTX125 - CLK9 */
1741         };
1742
1743    vii) Multi-User RAM (MURAM)
1744
1745    Required properties:
1746    - device_type : should be "muram".
1747    - mode : the could be "host" or "slave".
1748    - ranges : Should be defined as specified in 1) to describe the
1749       translation of MURAM addresses.
1750    - data-only : sub-node which defines the address area under MURAM
1751       bus that can be allocated as data/parameter
1752
1753    Example:
1754
1755         muram@10000 {
1756                 device_type = "muram";
1757                 ranges = <0 00010000 0000c000>;
1758
1759                 data-only@0{
1760                         reg = <0 c000>;
1761                 };
1762         };
1763
1764    j) CFI or JEDEC memory-mapped NOR flash
1765
1766     Flash chips (Memory Technology Devices) are often used for solid state
1767     file systems on embedded devices.
1768
1769      - compatible : should contain the specific model of flash chip(s)
1770        used, if known, followed by either "cfi-flash" or "jedec-flash"
1771      - reg : Address range of the flash chip
1772      - bank-width : Width (in bytes) of the flash bank.  Equal to the
1773        device width times the number of interleaved chips.
1774      - device-width : (optional) Width of a single flash chip.  If
1775        omitted, assumed to be equal to 'bank-width'.
1776      - #address-cells, #size-cells : Must be present if the flash has
1777        sub-nodes representing partitions (see below).  In this case
1778        both #address-cells and #size-cells must be equal to 1.
1779
1780     For JEDEC compatible devices, the following additional properties
1781     are defined:
1782
1783      - vendor-id : Contains the flash chip's vendor id (1 byte).
1784      - device-id : Contains the flash chip's device id (1 byte).
1785
1786     In addition to the information on the flash bank itself, the
1787     device tree may optionally contain additional information
1788     describing partitions of the flash address space.  This can be
1789     used on platforms which have strong conventions about which
1790     portions of the flash are used for what purposes, but which don't
1791     use an on-flash partition table such as RedBoot.
1792
1793     Each partition is represented as a sub-node of the flash device.
1794     Each node's name represents the name of the corresponding
1795     partition of the flash device.
1796
1797     Flash partitions
1798      - reg : The partition's offset and size within the flash bank.
1799      - label : (optional) The label / name for this flash partition.
1800        If omitted, the label is taken from the node name (excluding
1801        the unit address).
1802      - read-only : (optional) This parameter, if present, is a hint to
1803        Linux that this flash partition should only be mounted
1804        read-only.  This is usually used for flash partitions
1805        containing early-boot firmware images or data which should not
1806        be clobbered.
1807
1808     Example:
1809
1810         flash@ff000000 {
1811                 compatible = "amd,am29lv128ml", "cfi-flash";
1812                 reg = <ff000000 01000000>;
1813                 bank-width = <4>;
1814                 device-width = <1>;
1815                 #address-cells = <1>;
1816                 #size-cells = <1>;
1817                 fs@0 {
1818                         label = "fs";
1819                         reg = <0 f80000>;
1820                 };
1821                 firmware@f80000 {
1822                         label ="firmware";
1823                         reg = <f80000 80000>;
1824                         read-only;
1825                 };
1826         };
1827
1828    k) Global Utilities Block
1829
1830    The global utilities block controls power management, I/O device
1831    enabling, power-on-reset configuration monitoring, general-purpose
1832    I/O signal configuration, alternate function selection for multiplexed
1833    signals, and clock control.
1834
1835    Required properties:
1836
1837     - compatible : Should define the compatible device type for
1838       global-utilities.
1839     - reg : Offset and length of the register set for the device.
1840
1841   Recommended properties:
1842
1843     - fsl,has-rstcr : Indicates that the global utilities register set
1844       contains a functioning "reset control register" (i.e. the board
1845       is wired to reset upon setting the HRESET_REQ bit in this register).
1846
1847     Example:
1848
1849         global-utilities@e0000 {        /* global utilities block */
1850                 compatible = "fsl,mpc8548-guts";
1851                 reg = <e0000 1000>;
1852                 fsl,has-rstcr;
1853         };
1854
1855    l) Freescale Communications Processor Module
1856
1857    NOTE: This is an interim binding, and will likely change slightly,
1858    as more devices are supported.  The QE bindings especially are
1859    incomplete.
1860
1861    i) Root CPM node
1862
1863    Properties:
1864    - compatible : "fsl,cpm1", "fsl,cpm2", or "fsl,qe".
1865    - reg : A 48-byte region beginning with CPCR.
1866
1867    Example:
1868         cpm@119c0 {
1869                 #address-cells = <1>;
1870                 #size-cells = <1>;
1871                 #interrupt-cells = <2>;
1872                 compatible = "fsl,mpc8272-cpm", "fsl,cpm2";
1873                 reg = <119c0 30>;
1874         }
1875
1876    ii) Properties common to mulitple CPM/QE devices
1877
1878    - fsl,cpm-command : This value is ORed with the opcode and command flag
1879                        to specify the device on which a CPM command operates.
1880
1881    - fsl,cpm-brg : Indicates which baud rate generator the device
1882                    is associated with.  If absent, an unused BRG
1883                    should be dynamically allocated.  If zero, the
1884                    device uses an external clock rather than a BRG.
1885
1886    - reg : Unless otherwise specified, the first resource represents the
1887            scc/fcc/ucc registers, and the second represents the device's
1888            parameter RAM region (if it has one).
1889
1890    iii) Serial
1891
1892    Currently defined compatibles:
1893    - fsl,cpm1-smc-uart
1894    - fsl,cpm2-smc-uart
1895    - fsl,cpm1-scc-uart
1896    - fsl,cpm2-scc-uart
1897    - fsl,qe-uart
1898
1899    Example:
1900
1901         serial@11a00 {
1902                 device_type = "serial";
1903                 compatible = "fsl,mpc8272-scc-uart",
1904                              "fsl,cpm2-scc-uart";
1905                 reg = <11a00 20 8000 100>;
1906                 interrupts = <28 8>;
1907                 interrupt-parent = <&PIC>;
1908                 fsl,cpm-brg = <1>;
1909                 fsl,cpm-command = <00800000>;
1910         };
1911
1912    iii) Network
1913
1914    Currently defined compatibles:
1915    - fsl,cpm1-scc-enet
1916    - fsl,cpm2-scc-enet
1917    - fsl,cpm1-fec-enet
1918    - fsl,cpm2-fcc-enet (third resource is GFEMR)
1919    - fsl,qe-enet
1920
1921    Example:
1922
1923         ethernet@11300 {
1924                 device_type = "network";
1925                 compatible = "fsl,mpc8272-fcc-enet",
1926                              "fsl,cpm2-fcc-enet";
1927                 reg = <11300 20 8400 100 11390 1>;
1928                 local-mac-address = [ 00 00 00 00 00 00 ];
1929                 interrupts = <20 8>;
1930                 interrupt-parent = <&PIC>;
1931                 phy-handle = <&PHY0>;
1932                 linux,network-index = <0>;
1933                 fsl,cpm-command = <12000300>;
1934         };
1935
1936    iv) MDIO
1937
1938    Currently defined compatibles:
1939    fsl,pq1-fec-mdio (reg is same as first resource of FEC device)
1940    fsl,cpm2-mdio-bitbang (reg is port C registers)
1941
1942    Properties for fsl,cpm2-mdio-bitbang:
1943    fsl,mdio-pin : pin of port C controlling mdio data
1944    fsl,mdc-pin : pin of port C controlling mdio clock
1945
1946    Example:
1947
1948         mdio@10d40 {
1949                 device_type = "mdio";
1950                 compatible = "fsl,mpc8272ads-mdio-bitbang",
1951                              "fsl,mpc8272-mdio-bitbang",
1952                              "fsl,cpm2-mdio-bitbang";
1953                 reg = <10d40 14>;
1954                 #address-cells = <1>;
1955                 #size-cells = <0>;
1956                 fsl,mdio-pin = <12>;
1957                 fsl,mdc-pin = <13>;
1958         };
1959
1960    v) Baud Rate Generators
1961
1962    Currently defined compatibles:
1963    fsl,cpm-brg
1964    fsl,cpm1-brg
1965    fsl,cpm2-brg
1966
1967    Properties:
1968    - reg : There may be an arbitrary number of reg resources; BRG
1969      numbers are assigned to these in order.
1970    - clock-frequency : Specifies the base frequency driving
1971      the BRG.
1972
1973    Example:
1974
1975         brg@119f0 {
1976                 compatible = "fsl,mpc8272-brg",
1977                              "fsl,cpm2-brg",
1978                              "fsl,cpm-brg";
1979                 reg = <119f0 10 115f0 10>;
1980                 clock-frequency = <d#25000000>;
1981         };
1982
1983    vi) Interrupt Controllers
1984
1985    Currently defined compatibles:
1986    - fsl,cpm1-pic
1987      - only one interrupt cell
1988    - fsl,pq1-pic
1989    - fsl,cpm2-pic
1990      - second interrupt cell is level/sense:
1991        - 2 is falling edge
1992        - 8 is active low
1993
1994    Example:
1995
1996         interrupt-controller@10c00 {
1997                 #interrupt-cells = <2>;
1998                 interrupt-controller;
1999                 reg = <10c00 80>;
2000                 compatible = "mpc8272-pic", "fsl,cpm2-pic";
2001         };
2002
2003    vii) USB (Universal Serial Bus Controller)
2004
2005    Properties:
2006    - compatible : "fsl,cpm1-usb", "fsl,cpm2-usb", "fsl,qe-usb"
2007
2008    Example:
2009         usb@11bc0 {
2010                 #address-cells = <1>;
2011                 #size-cells = <0>;
2012                 compatible = "fsl,cpm2-usb";
2013                 reg = <11b60 18 8b00 100>;
2014                 interrupts = <b 8>;
2015                 interrupt-parent = <&PIC>;
2016                 fsl,cpm-command = <2e600000>;
2017         };
2018
2019    viii) Multi-User RAM (MURAM)
2020
2021    The multi-user/dual-ported RAM is expressed as a bus under the CPM node.
2022
2023    Ranges must be set up subject to the following restrictions:
2024
2025    - Children's reg nodes must be offsets from the start of all muram, even
2026      if the user-data area does not begin at zero.
2027    - If multiple range entries are used, the difference between the parent
2028      address and the child address must be the same in all, so that a single
2029      mapping can cover them all while maintaining the ability to determine
2030      CPM-side offsets with pointer subtraction.  It is recommended that
2031      multiple range entries not be used.
2032    - A child address of zero must be translatable, even if no reg resources
2033      contain it.
2034
2035    A child "data" node must exist, compatible with "fsl,cpm-muram-data", to
2036    indicate the portion of muram that is usable by the OS for arbitrary
2037    purposes.  The data node may have an arbitrary number of reg resources,
2038    all of which contribute to the allocatable muram pool.
2039
2040    Example, based on mpc8272:
2041
2042         muram@0 {
2043                 #address-cells = <1>;
2044                 #size-cells = <1>;
2045                 ranges = <0 0 10000>;
2046
2047                 data@0 {
2048                         compatible = "fsl,cpm-muram-data";
2049                         reg = <0 2000 9800 800>;
2050                 };
2051         };
2052
2053    m) Chipselect/Local Bus
2054
2055    Properties:
2056    - name : Should be localbus
2057    - #address-cells : Should be either two or three.  The first cell is the
2058                       chipselect number, and the remaining cells are the
2059                       offset into the chipselect.
2060    - #size-cells : Either one or two, depending on how large each chipselect
2061                    can be.
2062    - ranges : Each range corresponds to a single chipselect, and cover
2063               the entire access window as configured.
2064
2065    Example:
2066         localbus@f0010100 {
2067                 compatible = "fsl,mpc8272ads-localbus",
2068                              "fsl,mpc8272-localbus",
2069                              "fsl,pq2-localbus";
2070                 #address-cells = <2>;
2071                 #size-cells = <1>;
2072                 reg = <f0010100 40>;
2073
2074                 ranges = <0 0 fe000000 02000000
2075                           1 0 f4500000 00008000>;
2076
2077                 flash@0,0 {
2078                         compatible = "jedec-flash";
2079                         reg = <0 0 2000000>;
2080                         bank-width = <4>;
2081                         device-width = <1>;
2082                 };
2083
2084                 board-control@1,0 {
2085                         reg = <1 0 20>;
2086                         compatible = "fsl,mpc8272ads-bcsr";
2087                 };
2088         };
2089
2090
2091     n) 4xx/Axon EMAC ethernet nodes
2092
2093     The EMAC ethernet controller in IBM and AMCC 4xx chips, and also
2094     the Axon bridge.  To operate this needs to interact with a ths
2095     special McMAL DMA controller, and sometimes an RGMII or ZMII
2096     interface.  In addition to the nodes and properties described
2097     below, the node for the OPB bus on which the EMAC sits must have a
2098     correct clock-frequency property.
2099
2100       i) The EMAC node itself
2101
2102     Required properties:
2103     - device_type       : "network"
2104
2105     - compatible        : compatible list, contains 2 entries, first is
2106                           "ibm,emac-CHIP" where CHIP is the host ASIC (440gx,
2107                           405gp, Axon) and second is either "ibm,emac" or
2108                           "ibm,emac4".  For Axon, thus, we have: "ibm,emac-axon",
2109                           "ibm,emac4"
2110     - interrupts        : <interrupt mapping for EMAC IRQ and WOL IRQ>
2111     - interrupt-parent  : optional, if needed for interrupt mapping
2112     - reg               : <registers mapping>
2113     - local-mac-address : 6 bytes, MAC address
2114     - mal-device        : phandle of the associated McMAL node
2115     - mal-tx-channel    : 1 cell, index of the tx channel on McMAL associated
2116                           with this EMAC
2117     - mal-rx-channel    : 1 cell, index of the rx channel on McMAL associated
2118                           with this EMAC
2119     - cell-index        : 1 cell, hardware index of the EMAC cell on a given
2120                           ASIC (typically 0x0 and 0x1 for EMAC0 and EMAC1 on
2121                           each Axon chip)
2122     - max-frame-size    : 1 cell, maximum frame size supported in bytes
2123     - rx-fifo-size      : 1 cell, Rx fifo size in bytes for 10 and 100 Mb/sec
2124                           operations.
2125                           For Axon, 2048
2126     - tx-fifo-size      : 1 cell, Tx fifo size in bytes for 10 and 100 Mb/sec
2127                           operations.
2128                           For Axon, 2048.
2129     - fifo-entry-size   : 1 cell, size of a fifo entry (used to calculate
2130                           thresholds).
2131                           For Axon, 0x00000010
2132     - mal-burst-size    : 1 cell, MAL burst size (used to calculate thresholds)
2133                           in bytes.
2134                           For Axon, 0x00000100 (I think ...)
2135     - phy-mode          : string, mode of operations of the PHY interface.
2136                           Supported values are: "mii", "rmii", "smii", "rgmii",
2137                           "tbi", "gmii", rtbi", "sgmii".
2138                           For Axon on CAB, it is "rgmii"
2139     - mdio-device       : 1 cell, required iff using shared MDIO registers
2140                           (440EP).  phandle of the EMAC to use to drive the
2141                           MDIO lines for the PHY used by this EMAC.
2142     - zmii-device       : 1 cell, required iff connected to a ZMII.  phandle of
2143                           the ZMII device node
2144     - zmii-channel      : 1 cell, required iff connected to a ZMII.  Which ZMII
2145                           channel or 0xffffffff if ZMII is only used for MDIO.
2146     - rgmii-device      : 1 cell, required iff connected to an RGMII. phandle
2147                           of the RGMII device node.
2148                           For Axon: phandle of plb5/plb4/opb/rgmii
2149     - rgmii-channel     : 1 cell, required iff connected to an RGMII.  Which
2150                           RGMII channel is used by this EMAC.
2151                           Fox Axon: present, whatever value is appropriate for each
2152                           EMAC, that is the content of the current (bogus) "phy-port"
2153                           property.
2154
2155     Recommended properties:
2156     - linux,network-index : This is the intended "index" of this
2157       network device.  This is used by the bootwrapper to interpret
2158       MAC addresses passed by the firmware when no information other
2159       than indices is available to associate an address with a device.
2160
2161     Optional properties:
2162     - phy-address       : 1 cell, optional, MDIO address of the PHY. If absent,
2163                           a search is performed.
2164     - phy-map           : 1 cell, optional, bitmap of addresses to probe the PHY
2165                           for, used if phy-address is absent. bit 0x00000001 is
2166                           MDIO address 0.
2167                           For Axon it can be absent, thouugh my current driver
2168                           doesn't handle phy-address yet so for now, keep
2169                           0x00ffffff in it.
2170     - rx-fifo-size-gige : 1 cell, Rx fifo size in bytes for 1000 Mb/sec
2171                           operations (if absent the value is the same as
2172                           rx-fifo-size).  For Axon, either absent or 2048.
2173     - tx-fifo-size-gige : 1 cell, Tx fifo size in bytes for 1000 Mb/sec
2174                           operations (if absent the value is the same as
2175                           tx-fifo-size). For Axon, either absent or 2048.
2176     - tah-device        : 1 cell, optional. If connected to a TAH engine for
2177                           offload, phandle of the TAH device node.
2178     - tah-channel       : 1 cell, optional. If appropriate, channel used on the
2179                           TAH engine.
2180
2181     Example:
2182
2183         EMAC0: ethernet@40000800 {
2184                 linux,network-index = <0>;
2185                 device_type = "network";
2186                 compatible = "ibm,emac-440gp", "ibm,emac";
2187                 interrupt-parent = <&UIC1>;
2188                 interrupts = <1c 4 1d 4>;
2189                 reg = <40000800 70>;
2190                 local-mac-address = [00 04 AC E3 1B 1E];
2191                 mal-device = <&MAL0>;
2192                 mal-tx-channel = <0 1>;
2193                 mal-rx-channel = <0>;
2194                 cell-index = <0>;
2195                 max-frame-size = <5dc>;
2196                 rx-fifo-size = <1000>;
2197                 tx-fifo-size = <800>;
2198                 phy-mode = "rmii";
2199                 phy-map = <00000001>;
2200                 zmii-device = <&ZMII0>;
2201                 zmii-channel = <0>;
2202         };
2203
2204       ii) McMAL node
2205
2206     Required properties:
2207     - device_type        : "dma-controller"
2208     - compatible         : compatible list, containing 2 entries, first is
2209                            "ibm,mcmal-CHIP" where CHIP is the host ASIC (like
2210                            emac) and the second is either "ibm,mcmal" or
2211                            "ibm,mcmal2".
2212                            For Axon, "ibm,mcmal-axon","ibm,mcmal2"
2213     - interrupts         : <interrupt mapping for the MAL interrupts sources:
2214                            5 sources: tx_eob, rx_eob, serr, txde, rxde>.
2215                            For Axon: This is _different_ from the current
2216                            firmware.  We use the "delayed" interrupts for txeob
2217                            and rxeob. Thus we end up with mapping those 5 MPIC
2218                            interrupts, all level positive sensitive: 10, 11, 32,
2219                            33, 34 (in decimal)
2220     - dcr-reg            : < DCR registers range >
2221     - dcr-parent         : if needed for dcr-reg
2222     - num-tx-chans       : 1 cell, number of Tx channels
2223     - num-rx-chans       : 1 cell, number of Rx channels
2224
2225       iii) ZMII node
2226
2227     Required properties:
2228     - compatible         : compatible list, containing 2 entries, first is
2229                            "ibm,zmii-CHIP" where CHIP is the host ASIC (like
2230                            EMAC) and the second is "ibm,zmii".
2231                            For Axon, there is no ZMII node.
2232     - reg                : <registers mapping>
2233
2234       iv) RGMII node
2235
2236     Required properties:
2237     - compatible         : compatible list, containing 2 entries, first is
2238                            "ibm,rgmii-CHIP" where CHIP is the host ASIC (like
2239                            EMAC) and the second is "ibm,rgmii".
2240                            For Axon, "ibm,rgmii-axon","ibm,rgmii"
2241     - reg                : <registers mapping>
2242     - revision           : as provided by the RGMII new version register if
2243                            available.
2244                            For Axon: 0x0000012a
2245
2246    l) Xilinx IP cores
2247
2248    The Xilinx EDK toolchain ships with a set of IP cores (devices) for use
2249    in Xilinx Spartan and Virtex FPGAs.  The devices cover the whole range
2250    of standard device types (network, serial, etc.) and miscellanious
2251    devices (gpio, LCD, spi, etc).  Also, since these devices are
2252    implemented within the fpga fabric every instance of the device can be
2253    synthesised with different options that change the behaviour.
2254
2255    Each IP-core has a set of parameters which the FPGA designer can use to
2256    control how the core is synthesized.  Historically, the EDK tool would
2257    extract the device parameters relevant to device drivers and copy them
2258    into an 'xparameters.h' in the form of #define symbols.  This tells the
2259    device drivers how the IP cores are configured, but it requres the kernel
2260    to be recompiled every time the FPGA bitstream is resynthesized.
2261
2262    The new approach is to export the parameters into the device tree and
2263    generate a new device tree each time the FPGA bitstream changes.  The
2264    parameters which used to be exported as #defines will now become
2265    properties of the device node.  In general, device nodes for IP-cores
2266    will take the following form:
2267
2268         (name)@(base-address) {
2269                 compatible = "xlnx,(ip-core-name)-(HW_VER)"
2270                              [, (list of compatible devices), ...];
2271                 reg = <(baseaddr) (size)>;
2272                 interrupt-parent = <&interrupt-controller-phandle>;
2273                 interrupts = < ... >;
2274                 xlnx,(parameter1) = "(string-value)";
2275                 xlnx,(parameter2) = <(int-value)>;
2276         };
2277
2278         (ip-core-name): the name of the ip block (given after the BEGIN
2279                         directive in system.mhs).  Should be in lowercase
2280                         and all underscores '_' converted to dashes '-'.
2281         (name):         is derived from the "PARAMETER INSTANCE" value.
2282         (parameter#):   C_* parameters from system.mhs.  The C_ prefix is
2283                         dropped from the parameter name, the name is converted
2284                         to lowercase and all underscore '_' characters are
2285                         converted to dashes '-'.
2286         (baseaddr):     the C_BASEADDR parameter.
2287         (HW_VER):       from the HW_VER parameter.
2288         (size):         equals C_HIGHADDR - C_BASEADDR + 1
2289
2290    Typically, the compatible list will include the exact IP core version
2291    followed by an older IP core version which implements the same
2292    interface or any other device with the same interface.
2293
2294    'reg', 'interrupt-parent' and 'interrupts' are all optional properties.
2295
2296    For example, the following block from system.mhs:
2297
2298         BEGIN opb_uartlite
2299                 PARAMETER INSTANCE = opb_uartlite_0
2300                 PARAMETER HW_VER = 1.00.b
2301                 PARAMETER C_BAUDRATE = 115200
2302                 PARAMETER C_DATA_BITS = 8
2303                 PARAMETER C_ODD_PARITY = 0
2304                 PARAMETER C_USE_PARITY = 0
2305                 PARAMETER C_CLK_FREQ = 50000000
2306                 PARAMETER C_BASEADDR = 0xEC100000
2307                 PARAMETER C_HIGHADDR = 0xEC10FFFF
2308                 BUS_INTERFACE SOPB = opb_7
2309                 PORT OPB_Clk = CLK_50MHz
2310                 PORT Interrupt = opb_uartlite_0_Interrupt
2311                 PORT RX = opb_uartlite_0_RX
2312                 PORT TX = opb_uartlite_0_TX
2313                 PORT OPB_Rst = sys_bus_reset_0
2314         END
2315
2316    becomes the following device tree node:
2317
2318         opb-uartlite-0@ec100000 {
2319                 device_type = "serial";
2320                 compatible = "xlnx,opb-uartlite-1.00.b";
2321                 reg = <ec100000 10000>;
2322                 interrupt-parent = <&opb-intc>;
2323                 interrupts = <1 0>; // got this from the opb_intc parameters
2324                 current-speed = <d#115200>;     // standard serial device prop
2325                 clock-frequency = <d#50000000>; // standard serial device prop
2326                 xlnx,data-bits = <8>;
2327                 xlnx,odd-parity = <0>;
2328                 xlnx,use-parity = <0>;
2329         };
2330
2331    Some IP cores actually implement 2 or more logical devices.  In this case,
2332    the device should still describe the whole IP core with a single node
2333    and add a child node for each logical device.  The ranges property can
2334    be used to translate from parent IP-core to the registers of each device.
2335    (Note: this makes the assumption that both logical devices have the same
2336    bus binding.  If this is not true, then separate nodes should be used for
2337    each logical device).  The 'cell-index' property can be used to enumerate
2338    logical devices within an IP core.  For example, the following is the
2339    system.mhs entry for the dual ps2 controller found on the ml403 reference
2340    design.
2341
2342         BEGIN opb_ps2_dual_ref
2343                 PARAMETER INSTANCE = opb_ps2_dual_ref_0
2344                 PARAMETER HW_VER = 1.00.a
2345                 PARAMETER C_BASEADDR = 0xA9000000
2346                 PARAMETER C_HIGHADDR = 0xA9001FFF
2347                 BUS_INTERFACE SOPB = opb_v20_0
2348                 PORT Sys_Intr1 = ps2_1_intr
2349                 PORT Sys_Intr2 = ps2_2_intr
2350                 PORT Clkin1 = ps2_clk_rx_1
2351                 PORT Clkin2 = ps2_clk_rx_2
2352                 PORT Clkpd1 = ps2_clk_tx_1
2353                 PORT Clkpd2 = ps2_clk_tx_2
2354                 PORT Rx1 = ps2_d_rx_1
2355                 PORT Rx2 = ps2_d_rx_2
2356                 PORT Txpd1 = ps2_d_tx_1
2357                 PORT Txpd2 = ps2_d_tx_2
2358         END
2359
2360    It would result in the following device tree nodes:
2361
2362         opb_ps2_dual_ref_0@a9000000 {
2363                 ranges = <0 a9000000 2000>;
2364                 // If this device had extra parameters, then they would
2365                 // go here.
2366                 ps2@0 {
2367                         compatible = "xlnx,opb-ps2-dual-ref-1.00.a";
2368                         reg = <0 40>;
2369                         interrupt-parent = <&opb-intc>;
2370                         interrupts = <3 0>;
2371                         cell-index = <0>;
2372                 };
2373                 ps2@1000 {
2374                         compatible = "xlnx,opb-ps2-dual-ref-1.00.a";
2375                         reg = <1000 40>;
2376                         interrupt-parent = <&opb-intc>;
2377                         interrupts = <3 0>;
2378                         cell-index = <0>;
2379                 };
2380         };
2381
2382    Also, the system.mhs file defines bus attachments from the processor
2383    to the devices.  The device tree structure should reflect the bus
2384    attachments.  Again an example; this system.mhs fragment:
2385
2386         BEGIN ppc405_virtex4
2387                 PARAMETER INSTANCE = ppc405_0
2388                 PARAMETER HW_VER = 1.01.a
2389                 BUS_INTERFACE DPLB = plb_v34_0
2390                 BUS_INTERFACE IPLB = plb_v34_0
2391         END
2392
2393         BEGIN opb_intc
2394                 PARAMETER INSTANCE = opb_intc_0
2395                 PARAMETER HW_VER = 1.00.c
2396                 PARAMETER C_BASEADDR = 0xD1000FC0
2397                 PARAMETER C_HIGHADDR = 0xD1000FDF
2398                 BUS_INTERFACE SOPB = opb_v20_0
2399         END
2400
2401         BEGIN opb_uart16550
2402                 PARAMETER INSTANCE = opb_uart16550_0
2403                 PARAMETER HW_VER = 1.00.d
2404                 PARAMETER C_BASEADDR = 0xa0000000
2405                 PARAMETER C_HIGHADDR = 0xa0001FFF
2406                 BUS_INTERFACE SOPB = opb_v20_0
2407         END
2408
2409         BEGIN plb_v34
2410                 PARAMETER INSTANCE = plb_v34_0
2411                 PARAMETER HW_VER = 1.02.a
2412         END
2413
2414         BEGIN plb_bram_if_cntlr
2415                 PARAMETER INSTANCE = plb_bram_if_cntlr_0
2416                 PARAMETER HW_VER = 1.00.b
2417                 PARAMETER C_BASEADDR = 0xFFFF0000
2418                 PARAMETER C_HIGHADDR = 0xFFFFFFFF
2419                 BUS_INTERFACE SPLB = plb_v34_0
2420         END
2421
2422         BEGIN plb2opb_bridge
2423                 PARAMETER INSTANCE = plb2opb_bridge_0
2424                 PARAMETER HW_VER = 1.01.a
2425                 PARAMETER C_RNG0_BASEADDR = 0x20000000
2426                 PARAMETER C_RNG0_HIGHADDR = 0x3FFFFFFF
2427                 PARAMETER C_RNG1_BASEADDR = 0x60000000
2428                 PARAMETER C_RNG1_HIGHADDR = 0x7FFFFFFF
2429                 PARAMETER C_RNG2_BASEADDR = 0x80000000
2430                 PARAMETER C_RNG2_HIGHADDR = 0xBFFFFFFF
2431                 PARAMETER C_RNG3_BASEADDR = 0xC0000000
2432                 PARAMETER C_RNG3_HIGHADDR = 0xDFFFFFFF
2433                 BUS_INTERFACE SPLB = plb_v34_0
2434                 BUS_INTERFACE MOPB = opb_v20_0
2435         END
2436
2437    Gives this device tree (some properties removed for clarity):
2438
2439         plb-v34-0 {
2440                 #address-cells = <1>;
2441                 #size-cells = <1>;
2442                 device_type = "ibm,plb";
2443                 ranges; // 1:1 translation
2444
2445                 plb-bram-if-cntrl-0@ffff0000 {
2446                         reg = <ffff0000 10000>;
2447                 }
2448
2449                 opb-v20-0 {
2450                         #address-cells = <1>;
2451                         #size-cells = <1>;
2452                         ranges = <20000000 20000000 20000000
2453                                   60000000 60000000 20000000
2454                                   80000000 80000000 40000000
2455                                   c0000000 c0000000 20000000>;
2456
2457                         opb-uart16550-0@a0000000 {
2458                                 reg = <a00000000 2000>;
2459                         };
2460
2461                         opb-intc-0@d1000fc0 {
2462                                 reg = <d1000fc0 20>;
2463                         };
2464                 };
2465         };
2466
2467    That covers the general approach to binding xilinx IP cores into the
2468    device tree.  The following are bindings for specific devices:
2469
2470       i) Xilinx ML300 Framebuffer
2471
2472       Simple framebuffer device from the ML300 reference design (also on the
2473       ML403 reference design as well as others).
2474
2475       Optional properties:
2476        - resolution = <xres yres> : pixel resolution of framebuffer.  Some
2477                                     implementations use a different resolution.
2478                                     Default is <d#640 d#480>
2479        - virt-resolution = <xvirt yvirt> : Size of framebuffer in memory.
2480                                            Default is <d#1024 d#480>.
2481        - rotate-display (empty) : rotate display 180 degrees.
2482
2483       ii) Xilinx SystemACE
2484
2485       The Xilinx SystemACE device is used to program FPGAs from an FPGA
2486       bitstream stored on a CF card.  It can also be used as a generic CF
2487       interface device.
2488
2489       Optional properties:
2490        - 8-bit (empty) : Set this property for SystemACE in 8 bit mode
2491
2492       iii) Xilinx EMAC and Xilinx TEMAC
2493
2494       Xilinx Ethernet devices.  In addition to general xilinx properties
2495       listed above, nodes for these devices should include a phy-handle
2496       property, and may include other common network device properties
2497       like local-mac-address.
2498       
2499       iv) Xilinx Uartlite
2500
2501       Xilinx uartlite devices are simple fixed speed serial ports.
2502
2503       Requred properties:
2504        - current-speed : Baud rate of uartlite
2505
2506    More devices will be defined as this spec matures.
2507
2508 VII - Specifying interrupt information for devices
2509 ===================================================
2510
2511 The device tree represents the busses and devices of a hardware
2512 system in a form similar to the physical bus topology of the
2513 hardware.
2514
2515 In addition, a logical 'interrupt tree' exists which represents the
2516 hierarchy and routing of interrupts in the hardware.
2517
2518 The interrupt tree model is fully described in the
2519 document "Open Firmware Recommended Practice: Interrupt
2520 Mapping Version 0.9".  The document is available at:
2521 <http://playground.sun.com/1275/practice>.
2522
2523 1) interrupts property
2524 ----------------------
2525
2526 Devices that generate interrupts to a single interrupt controller
2527 should use the conventional OF representation described in the
2528 OF interrupt mapping documentation.
2529
2530 Each device which generates interrupts must have an 'interrupt'
2531 property.  The interrupt property value is an arbitrary number of
2532 of 'interrupt specifier' values which describe the interrupt or
2533 interrupts for the device.
2534
2535 The encoding of an interrupt specifier is determined by the
2536 interrupt domain in which the device is located in the
2537 interrupt tree.  The root of an interrupt domain specifies in
2538 its #interrupt-cells property the number of 32-bit cells
2539 required to encode an interrupt specifier.  See the OF interrupt
2540 mapping documentation for a detailed description of domains.
2541
2542 For example, the binding for the OpenPIC interrupt controller
2543 specifies  an #interrupt-cells value of 2 to encode the interrupt
2544 number and level/sense information. All interrupt children in an
2545 OpenPIC interrupt domain use 2 cells per interrupt in their interrupts
2546 property.
2547
2548 The PCI bus binding specifies a #interrupt-cell value of 1 to encode
2549 which interrupt pin (INTA,INTB,INTC,INTD) is used.
2550
2551 2) interrupt-parent property
2552 ----------------------------
2553
2554 The interrupt-parent property is specified to define an explicit
2555 link between a device node and its interrupt parent in
2556 the interrupt tree.  The value of interrupt-parent is the
2557 phandle of the parent node.
2558
2559 If the interrupt-parent property is not defined for a node, it's
2560 interrupt parent is assumed to be an ancestor in the node's
2561 _device tree_ hierarchy.
2562
2563 3) OpenPIC Interrupt Controllers
2564 --------------------------------
2565
2566 OpenPIC interrupt controllers require 2 cells to encode
2567 interrupt information.  The first cell defines the interrupt
2568 number.  The second cell defines the sense and level
2569 information.
2570
2571 Sense and level information should be encoded as follows:
2572
2573         0 = low to high edge sensitive type enabled
2574         1 = active low level sensitive type enabled
2575         2 = active high level sensitive type enabled
2576         3 = high to low edge sensitive type enabled
2577
2578 4) ISA Interrupt Controllers
2579 ----------------------------
2580
2581 ISA PIC interrupt controllers require 2 cells to encode
2582 interrupt information.  The first cell defines the interrupt
2583 number.  The second cell defines the sense and level
2584 information.
2585
2586 ISA PIC interrupt controllers should adhere to the ISA PIC
2587 encodings listed below:
2588
2589         0 =  active low level sensitive type enabled
2590         1 =  active high level sensitive type enabled
2591         2 =  high to low edge sensitive type enabled
2592         3 =  low to high edge sensitive type enabled
2593
2594
2595 Appendix A - Sample SOC node for MPC8540
2596 ========================================
2597
2598 Note that the #address-cells and #size-cells for the SoC node
2599 in this example have been explicitly listed; these are likely
2600 not necessary as they are usually the same as the root node.
2601
2602         soc8540@e0000000 {
2603                 #address-cells = <1>;
2604                 #size-cells = <1>;
2605                 #interrupt-cells = <2>;
2606                 device_type = "soc";
2607                 ranges = <00000000 e0000000 00100000>
2608                 reg = <e0000000 00003000>;
2609                 bus-frequency = <0>;
2610
2611                 mdio@24520 {
2612                         reg = <24520 20>;
2613                         device_type = "mdio";
2614                         compatible = "gianfar";
2615
2616                         ethernet-phy@0 {
2617                                 linux,phandle = <2452000>
2618                                 interrupt-parent = <40000>;
2619                                 interrupts = <35 1>;
2620                                 reg = <0>;
2621                                 device_type = "ethernet-phy";
2622                         };
2623
2624                         ethernet-phy@1 {
2625                                 linux,phandle = <2452001>
2626                                 interrupt-parent = <40000>;
2627                                 interrupts = <35 1>;
2628                                 reg = <1>;
2629                                 device_type = "ethernet-phy";
2630                         };
2631
2632                         ethernet-phy@3 {
2633                                 linux,phandle = <2452002>
2634                                 interrupt-parent = <40000>;
2635                                 interrupts = <35 1>;
2636                                 reg = <3>;
2637                                 device_type = "ethernet-phy";
2638                         };
2639
2640                 };
2641
2642                 ethernet@24000 {
2643                         #size-cells = <0>;
2644                         device_type = "network";
2645                         model = "TSEC";
2646                         compatible = "gianfar";
2647                         reg = <24000 1000>;
2648                         mac-address = [ 00 E0 0C 00 73 00 ];
2649                         interrupts = <d 3 e 3 12 3>;
2650                         interrupt-parent = <40000>;
2651                         phy-handle = <2452000>;
2652                 };
2653
2654                 ethernet@25000 {
2655                         #address-cells = <1>;
2656                         #size-cells = <0>;
2657                         device_type = "network";
2658                         model = "TSEC";
2659                         compatible = "gianfar";
2660                         reg = <25000 1000>;
2661                         mac-address = [ 00 E0 0C 00 73 01 ];
2662                         interrupts = <13 3 14 3 18 3>;
2663                         interrupt-parent = <40000>;
2664                         phy-handle = <2452001>;
2665                 };
2666
2667                 ethernet@26000 {
2668                         #address-cells = <1>;
2669                         #size-cells = <0>;
2670                         device_type = "network";
2671                         model = "FEC";
2672                         compatible = "gianfar";
2673                         reg = <26000 1000>;
2674                         mac-address = [ 00 E0 0C 00 73 02 ];
2675                         interrupts = <19 3>;
2676                         interrupt-parent = <40000>;
2677                         phy-handle = <2452002>;
2678                 };
2679
2680                 serial@4500 {
2681                         device_type = "serial";
2682                         compatible = "ns16550";
2683                         reg = <4500 100>;
2684                         clock-frequency = <0>;
2685                         interrupts = <1a 3>;
2686                         interrupt-parent = <40000>;
2687                 };
2688
2689                 pic@40000 {
2690                         linux,phandle = <40000>;
2691                         clock-frequency = <0>;
2692                         interrupt-controller;
2693                         #address-cells = <0>;
2694                         reg = <40000 40000>;
2695                         built-in;
2696                         compatible = "chrp,open-pic";
2697                         device_type = "open-pic";
2698                         big-endian;
2699                 };
2700
2701                 i2c@3000 {
2702                         interrupt-parent = <40000>;
2703                         interrupts = <1b 3>;
2704                         reg = <3000 18>;
2705                         device_type = "i2c";
2706                         compatible  = "fsl-i2c";
2707                         dfsrr;
2708                 };
2709
2710         };