1 Booting the Linux/ppc kernel without Open Firmware
2 --------------------------------------------------
4 (c) 2005 Benjamin Herrenschmidt <benh at kernel.crashing.org>,
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
15 1) Entry point for arch/powerpc
18 II - The DT block format
20 2) Device tree generalities
21 3) Device tree "structure" block
22 4) Device tree "strings" block
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
33 d) the /memory node(s)
35 f) the /soc<SOCname> node
37 IV - "dtc", the device tree compiler
39 V - Recommendations for a bootloader
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
46 b) Gianfar-compatible ethernet nodes
47 d) Interrupt controllers
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)
55 VII - Specifying interrupt information for devices
56 1) interrupts property
57 2) interrupt-parent property
58 3) OpenPIC Interrupt Controllers
59 4) ISA Interrupt Controllers
61 Appendix A - Sample SOC node for MPC8540
67 May 18, 2005: Rev 0.1 - Initial draft, no chapter III yet.
69 May 19, 2005: Rev 0.2 - Add chapter III and bits & pieces here or
70 clarifies the fact that a lot of things are
71 optional, the kernel only requires a very
72 small device tree, though it is encouraged
73 to provide an as complete one as possible.
75 May 24, 2005: Rev 0.3 - Precise that DT block has to be in RAM
77 - Define version 3 and new format version 16
78 for the DT block (version 16 needs kernel
79 patches, will be fwd separately).
80 String block now has a size, and full path
81 is replaced by unit name for more
83 linux,phandle is made optional, only nodes
84 that are referenced by other nodes need it.
85 "name" property is now automatically
86 deduced from the unit name
88 June 1, 2005: Rev 0.4 - Correct confusion between OF_DT_END and
89 OF_DT_END_NODE in structure definition.
90 - Change version 16 format to always align
91 property data to 4 bytes. Since tokens are
92 already aligned, that means no specific
93 required alignment between property size
94 and property data. The old style variable
95 alignment would make it impossible to do
96 "simple" insertion of properties using
97 memmove (thanks Milton for
98 noticing). Updated kernel patch as well
99 - Correct a few more alignment constraints
100 - Add a chapter about the device-tree
101 compiler and the textural representation of
102 the tree that can be "compiled" by dtc.
104 November 21, 2005: Rev 0.5
105 - Additions/generalizations for 32-bit
106 - Changed to reflect the new arch/powerpc
112 - Add some definitions of interrupt tree (simple/complex)
113 - Add some definitions for PCI host bridges
114 - Add some common address format examples
115 - Add definitions for standard properties and "compatible"
116 names for cells that are not already defined by the existing
118 - Compare FSL SOC use of PCI to standard and make sure no new
119 node definition required.
120 - Add more information about node definitions for SOC devices
121 that currently have no standard, like the FSL CPM.
127 During the recent development of the Linux/ppc64 kernel, and more
128 specifically, the addition of new platform types outside of the old
129 IBM pSeries/iSeries pair, it was decided to enforce some strict rules
130 regarding the kernel entry and bootloader <-> kernel interfaces, in
131 order to avoid the degeneration that had become the ppc32 kernel entry
132 point and the way a new platform should be added to the kernel. The
133 legacy iSeries platform breaks those rules as it predates this scheme,
134 but no new board support will be accepted in the main tree that
135 doesn't follows them properly. In addition, since the advent of the
136 arch/powerpc merged architecture for ppc32 and ppc64, new 32-bit
137 platforms and 32-bit platforms which move into arch/powerpc will be
138 required to use these rules as well.
140 The main requirement that will be defined in more detail below is
141 the presence of a device-tree whose format is defined after Open
142 Firmware specification. However, in order to make life easier
143 to embedded board vendors, the kernel doesn't require the device-tree
144 to represent every device in the system and only requires some nodes
145 and properties to be present. This will be described in detail in
146 section III, but, for example, the kernel does not require you to
147 create a node for every PCI device in the system. It is a requirement
148 to have a node for PCI host bridges in order to provide interrupt
149 routing informations and memory/IO ranges, among others. It is also
150 recommended to define nodes for on chip devices and other busses that
151 don't specifically fit in an existing OF specification. This creates a
152 great flexibility in the way the kernel can then probe those and match
153 drivers to device, without having to hard code all sorts of tables. It
154 also makes it more flexible for board vendors to do minor hardware
155 upgrades without significantly impacting the kernel code or cluttering
156 it with special cases.
159 1) Entry point for arch/powerpc
160 -------------------------------
162 There is one and one single entry point to the kernel, at the start
163 of the kernel image. That entry point supports two calling
166 a) Boot from Open Firmware. If your firmware is compatible
167 with Open Firmware (IEEE 1275) or provides an OF compatible
168 client interface API (support for "interpret" callback of
169 forth words isn't required), you can enter the kernel with:
171 r5 : OF callback pointer as defined by IEEE 1275
172 bindings to powerpc. Only the 32-bit client interface
173 is currently supported
175 r3, r4 : address & length of an initrd if any or 0
177 The MMU is either on or off; the kernel will run the
178 trampoline located in arch/powerpc/kernel/prom_init.c to
179 extract the device-tree and other information from open
180 firmware and build a flattened device-tree as described
181 in b). prom_init() will then re-enter the kernel using
182 the second method. This trampoline code runs in the
183 context of the firmware, which is supposed to handle all
184 exceptions during that time.
186 b) Direct entry with a flattened device-tree block. This entry
187 point is called by a) after the OF trampoline and can also be
188 called directly by a bootloader that does not support the Open
189 Firmware client interface. It is also used by "kexec" to
190 implement "hot" booting of a new kernel from a previous
191 running one. This method is what I will describe in more
192 details in this document, as method a) is simply standard Open
193 Firmware, and thus should be implemented according to the
194 various standard documents defining it and its binding to the
195 PowerPC platform. The entry point definition then becomes:
197 r3 : physical pointer to the device-tree block
198 (defined in chapter II) in RAM
200 r4 : physical pointer to the kernel itself. This is
201 used by the assembly code to properly disable the MMU
202 in case you are entering the kernel with MMU enabled
203 and a non-1:1 mapping.
205 r5 : NULL (as to differentiate with method a)
207 Note about SMP entry: Either your firmware puts your other
208 CPUs in some sleep loop or spin loop in ROM where you can get
209 them out via a soft reset or some other means, in which case
210 you don't need to care, or you'll have to enter the kernel
211 with all CPUs. The way to do that with method b) will be
212 described in a later revision of this document.
220 Board supports (platforms) are not exclusive config options. An
221 arbitrary set of board supports can be built in a single kernel
222 image. The kernel will "know" what set of functions to use for a
223 given platform based on the content of the device-tree. Thus, you
226 a) add your platform support as a _boolean_ option in
227 arch/powerpc/Kconfig, following the example of PPC_PSERIES,
228 PPC_PMAC and PPC_MAPLE. The later is probably a good
229 example of a board support to start from.
231 b) create your main platform file as
232 "arch/powerpc/platforms/myplatform/myboard_setup.c" and add it
233 to the Makefile under the condition of your CONFIG_
234 option. This file will define a structure of type "ppc_md"
235 containing the various callbacks that the generic code will
236 use to get to your platform specific code
238 c) Add a reference to your "ppc_md" structure in the
239 "machines" table in arch/powerpc/kernel/setup_64.c if you are
242 d) request and get assigned a platform number (see PLATFORM_*
243 constants in include/asm-powerpc/processor.h
245 32-bit embedded kernels:
247 Currently, board support is essentially an exclusive config option.
248 The kernel is configured for a single platform. Part of the reason
249 for this is to keep kernels on embedded systems small and efficient;
250 part of this is due to the fact the code is already that way. In the
251 future, a kernel may support multiple platforms, but only if the
252 platforms feature the same core architecture. A single kernel build
253 cannot support both configurations with Book E and configurations
254 with classic Powerpc architectures.
256 32-bit embedded platforms that are moved into arch/powerpc using a
257 flattened device tree should adopt the merged tree practice of
258 setting ppc_md up dynamically, even though the kernel is currently
259 built with support for only a single platform at a time. This allows
260 unification of the setup code, and will make it easier to go to a
261 multiple-platform-support model in the future.
263 NOTE: I believe the above will be true once Ben's done with the merge
264 of the boot sequences.... someone speak up if this is wrong!
266 To add a 32-bit embedded platform support, follow the instructions
267 for 64-bit platforms above, with the exception that the Kconfig
268 option should be set up such that the kernel builds exclusively for
269 the platform selected. The processor type for the platform should
270 enable another config option to select the specific board
273 NOTE: If Ben doesn't merge the setup files, may need to change this to
277 I will describe later the boot process and various callbacks that
278 your platform should implement.
281 II - The DT block format
282 ========================
285 This chapter defines the actual format of the flattened device-tree
286 passed to the kernel. The actual content of it and kernel requirements
287 are described later. You can find example of code manipulating that
288 format in various places, including arch/powerpc/kernel/prom_init.c
289 which will generate a flattened device-tree from the Open Firmware
290 representation, or the fs2dt utility which is part of the kexec tools
291 which will generate one from a filesystem representation. It is
292 expected that a bootloader like uboot provides a bit more support,
293 that will be discussed later as well.
295 Note: The block has to be in main memory. It has to be accessible in
296 both real mode and virtual mode with no mapping other than main
297 memory. If you are writing a simple flash bootloader, it should copy
298 the block to RAM before passing it to the kernel.
304 The kernel is entered with r3 pointing to an area of memory that is
305 roughly described in include/asm-powerpc/prom.h by the structure
308 struct boot_param_header {
309 u32 magic; /* magic word OF_DT_HEADER */
310 u32 totalsize; /* total size of DT block */
311 u32 off_dt_struct; /* offset to structure */
312 u32 off_dt_strings; /* offset to strings */
313 u32 off_mem_rsvmap; /* offset to memory reserve map
315 u32 version; /* format version */
316 u32 last_comp_version; /* last compatible version */
318 /* version 2 fields below */
319 u32 boot_cpuid_phys; /* Which physical CPU id we're
321 /* version 3 fields below */
322 u32 size_dt_strings; /* size of the strings block */
324 /* version 17 fields below */
325 u32 size_dt_struct; /* size of the DT structure block */
328 Along with the constants:
330 /* Definitions used by the flattened device tree */
331 #define OF_DT_HEADER 0xd00dfeed /* 4: version,
333 #define OF_DT_BEGIN_NODE 0x1 /* Start node: full name
335 #define OF_DT_END_NODE 0x2 /* End node */
336 #define OF_DT_PROP 0x3 /* Property: name off,
338 #define OF_DT_END 0x9
340 All values in this header are in big endian format, the various
341 fields in this header are defined more precisely below. All
342 "offset" values are in bytes from the start of the header; that is
343 from the value of r3.
347 This is a magic value that "marks" the beginning of the
348 device-tree block header. It contains the value 0xd00dfeed and is
349 defined by the constant OF_DT_HEADER
353 This is the total size of the DT block including the header. The
354 "DT" block should enclose all data structures defined in this
355 chapter (who are pointed to by offsets in this header). That is,
356 the device-tree structure, strings, and the memory reserve map.
360 This is an offset from the beginning of the header to the start
361 of the "structure" part the device tree. (see 2) device tree)
365 This is an offset from the beginning of the header to the start
366 of the "strings" part of the device-tree
370 This is an offset from the beginning of the header to the start
371 of the reserved memory map. This map is a list of pairs of 64-
372 bit integers. Each pair is a physical address and a size. The
373 list is terminated by an entry of size 0. This map provides the
374 kernel with a list of physical memory areas that are "reserved"
375 and thus not to be used for memory allocations, especially during
376 early initialization. The kernel needs to allocate memory during
377 boot for things like un-flattening the device-tree, allocating an
378 MMU hash table, etc... Those allocations must be done in such a
379 way to avoid overriding critical things like, on Open Firmware
380 capable machines, the RTAS instance, or on some pSeries, the TCE
381 tables used for the iommu. Typically, the reserve map should
382 contain _at least_ this DT block itself (header,total_size). If
383 you are passing an initrd to the kernel, you should reserve it as
384 well. You do not need to reserve the kernel image itself. The map
385 should be 64-bit aligned.
389 This is the version of this structure. Version 1 stops
390 here. Version 2 adds an additional field boot_cpuid_phys.
391 Version 3 adds the size of the strings block, allowing the kernel
392 to reallocate it easily at boot and free up the unused flattened
393 structure after expansion. Version 16 introduces a new more
394 "compact" format for the tree itself that is however not backward
395 compatible. Version 17 adds an additional field, size_dt_struct,
396 allowing it to be reallocated or moved more easily (this is
397 particularly useful for bootloaders which need to make
398 adjustments to a device tree based on probed information). You
399 should always generate a structure of the highest version defined
400 at the time of your implementation. Currently that is version 17,
401 unless you explicitly aim at being backward compatible.
405 Last compatible version. This indicates down to what version of
406 the DT block you are backward compatible. For example, version 2
407 is backward compatible with version 1 (that is, a kernel build
408 for version 1 will be able to boot with a version 2 format). You
409 should put a 1 in this field if you generate a device tree of
410 version 1 to 3, or 16 if you generate a tree of version 16 or 17
411 using the new unit name format.
415 This field only exist on version 2 headers. It indicate which
416 physical CPU ID is calling the kernel entry point. This is used,
417 among others, by kexec. If you are on an SMP system, this value
418 should match the content of the "reg" property of the CPU node in
419 the device-tree corresponding to the CPU calling the kernel entry
420 point (see further chapters for more informations on the required
421 device-tree contents)
425 This field only exists on version 3 and later headers. It
426 gives the size of the "strings" section of the device tree (which
427 starts at the offset given by off_dt_strings).
431 This field only exists on version 17 and later headers. It gives
432 the size of the "structure" section of the device tree (which
433 starts at the offset given by off_dt_struct).
435 So the typical layout of a DT block (though the various parts don't
436 need to be in that order) looks like this (addresses go from top to
440 ------------------------------
441 r3 -> | struct boot_param_header |
442 ------------------------------
443 | (alignment gap) (*) |
444 ------------------------------
445 | memory reserve map |
446 ------------------------------
448 ------------------------------
450 | device-tree structure |
452 ------------------------------
454 ------------------------------
456 | device-tree strings |
458 -----> ------------------------------
463 (*) The alignment gaps are not necessarily present; their presence
464 and size are dependent on the various alignment requirements of
465 the individual data blocks.
468 2) Device tree generalities
469 ---------------------------
471 This device-tree itself is separated in two different blocks, a
472 structure block and a strings block. Both need to be aligned to a 4
475 First, let's quickly describe the device-tree concept before detailing
476 the storage format. This chapter does _not_ describe the detail of the
477 required types of nodes & properties for the kernel, this is done
478 later in chapter III.
480 The device-tree layout is strongly inherited from the definition of
481 the Open Firmware IEEE 1275 device-tree. It's basically a tree of
482 nodes, each node having two or more named properties. A property can
485 It is a tree, so each node has one and only one parent except for the
486 root node who has no parent.
488 A node has 2 names. The actual node name is generally contained in a
489 property of type "name" in the node property list whose value is a
490 zero terminated string and is mandatory for version 1 to 3 of the
491 format definition (as it is in Open Firmware). Version 16 makes it
492 optional as it can generate it from the unit name defined below.
494 There is also a "unit name" that is used to differentiate nodes with
495 the same name at the same level, it is usually made of the node
496 names, the "@" sign, and a "unit address", which definition is
497 specific to the bus type the node sits on.
499 The unit name doesn't exist as a property per-se but is included in
500 the device-tree structure. It is typically used to represent "path" in
501 the device-tree. More details about the actual format of these will be
504 The kernel powerpc generic code does not make any formal use of the
505 unit address (though some board support code may do) so the only real
506 requirement here for the unit address is to ensure uniqueness of
507 the node unit name at a given level of the tree. Nodes with no notion
508 of address and no possible sibling of the same name (like /memory or
509 /cpus) may omit the unit address in the context of this specification,
510 or use the "@0" default unit address. The unit name is used to define
511 a node "full path", which is the concatenation of all parent node
512 unit names separated with "/".
514 The root node doesn't have a defined name, and isn't required to have
515 a name property either if you are using version 3 or earlier of the
516 format. It also has no unit address (no @ symbol followed by a unit
517 address). The root node unit name is thus an empty string. The full
518 path to the root node is "/".
520 Every node which actually represents an actual device (that is, a node
521 which isn't only a virtual "container" for more nodes, like "/cpus"
522 is) is also required to have a "device_type" property indicating the
525 Finally, every node that can be referenced from a property in another
526 node is required to have a "linux,phandle" property. Real open
527 firmware implementations provide a unique "phandle" value for every
528 node that the "prom_init()" trampoline code turns into
529 "linux,phandle" properties. However, this is made optional if the
530 flattened device tree is used directly. An example of a node
531 referencing another node via "phandle" is when laying out the
532 interrupt tree which will be described in a further version of this
535 This "linux, phandle" property is a 32-bit value that uniquely
536 identifies a node. You are free to use whatever values or system of
537 values, internal pointers, or whatever to generate these, the only
538 requirement is that every node for which you provide that property has
539 a unique value for it.
541 Here is an example of a simple device-tree. In this example, an "o"
542 designates a node followed by the node unit name. Properties are
543 presented with their name followed by their content. "content"
544 represents an ASCII string (zero terminated) value, while <content>
545 represents a 32-bit hexadecimal value. The various nodes in this
546 example will be discussed in a later chapter. At this point, it is
547 only meant to give you a idea of what a device-tree looks like. I have
548 purposefully kept the "name" and "linux,phandle" properties which
549 aren't necessary in order to give you a better idea of what the tree
550 looks like in practice.
553 |- name = "device-tree"
554 |- model = "MyBoardName"
555 |- compatible = "MyBoardFamilyName"
556 |- #address-cells = <2>
558 |- linux,phandle = <0>
562 | | - linux,phandle = <1>
563 | | - #address-cells = <1>
564 | | - #size-cells = <0>
567 | |- name = "PowerPC,970"
568 | |- device_type = "cpu"
570 | |- clock-frequency = <5f5e1000>
572 | |- linux,phandle = <2>
576 | |- device_type = "memory"
577 | |- reg = <00000000 00000000 00000000 20000000>
578 | |- linux,phandle = <3>
582 |- bootargs = "root=/dev/sda2"
583 |- linux,phandle = <4>
585 This tree is almost a minimal tree. It pretty much contains the
586 minimal set of required nodes and properties to boot a linux kernel;
587 that is, some basic model informations at the root, the CPUs, and the
588 physical memory layout. It also includes misc information passed
589 through /chosen, like in this example, the platform type (mandatory)
590 and the kernel command line arguments (optional).
592 The /cpus/PowerPC,970@0/64-bit property is an example of a
593 property without a value. All other properties have a value. The
594 significance of the #address-cells and #size-cells properties will be
595 explained in chapter IV which defines precisely the required nodes and
596 properties and their content.
599 3) Device tree "structure" block
601 The structure of the device tree is a linearized tree structure. The
602 "OF_DT_BEGIN_NODE" token starts a new node, and the "OF_DT_END_NODE"
603 ends that node definition. Child nodes are simply defined before
604 "OF_DT_END_NODE" (that is nodes within the node). A 'token' is a 32
605 bit value. The tree has to be "finished" with a OF_DT_END token
607 Here's the basic structure of a single node:
609 * token OF_DT_BEGIN_NODE (that is 0x00000001)
610 * for version 1 to 3, this is the node full path as a zero
611 terminated string, starting with "/". For version 16 and later,
612 this is the node unit name only (or an empty string for the
614 * [align gap to next 4 bytes boundary]
616 * token OF_DT_PROP (that is 0x00000003)
617 * 32-bit value of property value size in bytes (or 0 if no
619 * 32-bit value of offset in string block of property name
620 * property value data if any
621 * [align gap to next 4 bytes boundary]
622 * [child nodes if any]
623 * token OF_DT_END_NODE (that is 0x00000002)
625 So the node content can be summarized as a start token, a full path,
626 a list of properties, a list of child nodes, and an end token. Every
627 child node is a full node structure itself as defined above.
629 NOTE: The above definition requires that all property definitions for
630 a particular node MUST precede any subnode definitions for that node.
631 Although the structure would not be ambiguous if properties and
632 subnodes were intermingled, the kernel parser requires that the
633 properties come first (up until at least 2.6.22). Any tools
634 manipulating a flattened tree must take care to preserve this
637 4) Device tree "strings" block
639 In order to save space, property names, which are generally redundant,
640 are stored separately in the "strings" block. This block is simply the
641 whole bunch of zero terminated strings for all property names
642 concatenated together. The device-tree property definitions in the
643 structure block will contain offset values from the beginning of the
647 III - Required content of the device tree
648 =========================================
650 WARNING: All "linux,*" properties defined in this document apply only
651 to a flattened device-tree. If your platform uses a real
652 implementation of Open Firmware or an implementation compatible with
653 the Open Firmware client interface, those properties will be created
654 by the trampoline code in the kernel's prom_init() file. For example,
655 that's where you'll have to add code to detect your board model and
656 set the platform number. However, when using the flattened device-tree
657 entry point, there is no prom_init() pass, and thus you have to
658 provide those properties yourself.
661 1) Note about cells and address representation
662 ----------------------------------------------
664 The general rule is documented in the various Open Firmware
665 documentations. If you choose to describe a bus with the device-tree
666 and there exist an OF bus binding, then you should follow the
667 specification. However, the kernel does not require every single
668 device or bus to be described by the device tree.
670 In general, the format of an address for a device is defined by the
671 parent bus type, based on the #address-cells and #size-cells
672 property. In the absence of such a property, the parent's parent
673 values are used, etc... The kernel requires the root node to have
674 those properties defining addresses format for devices directly mapped
675 on the processor bus.
677 Those 2 properties define 'cells' for representing an address and a
678 size. A "cell" is a 32-bit number. For example, if both contain 2
679 like the example tree given above, then an address and a size are both
680 composed of 2 cells, and each is a 64-bit number (cells are
681 concatenated and expected to be in big endian format). Another example
682 is the way Apple firmware defines them, with 2 cells for an address
683 and one cell for a size. Most 32-bit implementations should define
684 #address-cells and #size-cells to 1, which represents a 32-bit value.
685 Some 32-bit processors allow for physical addresses greater than 32
686 bits; these processors should define #address-cells as 2.
688 "reg" properties are always a tuple of the type "address size" where
689 the number of cells of address and size is specified by the bus
690 #address-cells and #size-cells. When a bus supports various address
691 spaces and other flags relative to a given address allocation (like
692 prefetchable, etc...) those flags are usually added to the top level
693 bits of the physical address. For example, a PCI physical address is
694 made of 3 cells, the bottom two containing the actual address itself
695 while the top cell contains address space indication, flags, and pci
696 bus & device numbers.
698 For busses that support dynamic allocation, it's the accepted practice
699 to then not provide the address in "reg" (keep it 0) though while
700 providing a flag indicating the address is dynamically allocated, and
701 then, to provide a separate "assigned-addresses" property that
702 contains the fully allocated addresses. See the PCI OF bindings for
705 In general, a simple bus with no address space bits and no dynamic
706 allocation is preferred if it reflects your hardware, as the existing
707 kernel address parsing functions will work out of the box. If you
708 define a bus type with a more complex address format, including things
709 like address space bits, you'll have to add a bus translator to the
710 prom_parse.c file of the recent kernels for your bus type.
712 The "reg" property only defines addresses and sizes (if #size-cells
713 is non-0) within a given bus. In order to translate addresses upward
714 (that is into parent bus addresses, and possibly into CPU physical
715 addresses), all busses must contain a "ranges" property. If the
716 "ranges" property is missing at a given level, it's assumed that
717 translation isn't possible. The format of the "ranges" property for a
720 bus address, parent bus address, size
722 "bus address" is in the format of the bus this bus node is defining,
723 that is, for a PCI bridge, it would be a PCI address. Thus, (bus
724 address, size) defines a range of addresses for child devices. "parent
725 bus address" is in the format of the parent bus of this bus. For
726 example, for a PCI host controller, that would be a CPU address. For a
727 PCI<->ISA bridge, that would be a PCI address. It defines the base
728 address in the parent bus where the beginning of that range is mapped.
730 For a new 64-bit powerpc board, I recommend either the 2/2 format or
731 Apple's 2/1 format which is slightly more compact since sizes usually
732 fit in a single 32-bit word. New 32-bit powerpc boards should use a
733 1/1 format, unless the processor supports physical addresses greater
734 than 32-bits, in which case a 2/1 format is recommended.
737 2) Note about "compatible" properties
738 -------------------------------------
740 These properties are optional, but recommended in devices and the root
741 node. The format of a "compatible" property is a list of concatenated
742 zero terminated strings. They allow a device to express its
743 compatibility with a family of similar devices, in some cases,
744 allowing a single driver to match against several devices regardless
745 of their actual names.
747 3) Note about "name" properties
748 -------------------------------
750 While earlier users of Open Firmware like OldWorld macintoshes tended
751 to use the actual device name for the "name" property, it's nowadays
752 considered a good practice to use a name that is closer to the device
753 class (often equal to device_type). For example, nowadays, ethernet
754 controllers are named "ethernet", an additional "model" property
755 defining precisely the chip type/model, and "compatible" property
756 defining the family in case a single driver can driver more than one
757 of these chips. However, the kernel doesn't generally put any
758 restriction on the "name" property; it is simply considered good
759 practice to follow the standard and its evolutions as closely as
762 Note also that the new format version 16 makes the "name" property
763 optional. If it's absent for a node, then the node's unit name is then
764 used to reconstruct the name. That is, the part of the unit name
765 before the "@" sign is used (or the entire unit name if no "@" sign
768 4) Note about node and property names and character set
769 -------------------------------------------------------
771 While open firmware provides more flexible usage of 8859-1, this
772 specification enforces more strict rules. Nodes and properties should
773 be comprised only of ASCII characters 'a' to 'z', '0' to
774 '9', ',', '.', '_', '+', '#', '?', and '-'. Node names additionally
775 allow uppercase characters 'A' to 'Z' (property names should be
776 lowercase. The fact that vendors like Apple don't respect this rule is
777 irrelevant here). Additionally, node and property names should always
778 begin with a character in the range 'a' to 'z' (or 'A' to 'Z' for node
781 The maximum number of characters for both nodes and property names
782 is 31. In the case of node names, this is only the leftmost part of
783 a unit name (the pure "name" property), it doesn't include the unit
784 address which can extend beyond that limit.
787 5) Required nodes and properties
788 --------------------------------
789 These are all that are currently required. However, it is strongly
790 recommended that you expose PCI host bridges as documented in the
791 PCI binding to open firmware, and your interrupt tree as documented
792 in OF interrupt tree specification.
796 The root node requires some properties to be present:
798 - model : this is your board name/model
799 - #address-cells : address representation for "root" devices
800 - #size-cells: the size representation for "root" devices
801 - device_type : This property shouldn't be necessary. However, if
802 you decide to create a device_type for your root node, make sure it
803 is _not_ "chrp" unless your platform is a pSeries or PAPR compliant
804 one for 64-bit, or a CHRP-type machine for 32-bit as this will
805 matched by the kernel this way.
807 Additionally, some recommended properties are:
809 - compatible : the board "family" generally finds its way here,
810 for example, if you have 2 board models with a similar layout,
811 that typically get driven by the same platform code in the
812 kernel, you would use a different "model" property but put a
813 value in "compatible". The kernel doesn't directly use that
814 value but it is generally useful.
816 The root node is also generally where you add additional properties
817 specific to your board like the serial number if any, that sort of
818 thing. It is recommended that if you add any "custom" property whose
819 name may clash with standard defined ones, you prefix them with your
820 vendor name and a comma.
824 This node is the parent of all individual CPU nodes. It doesn't
825 have any specific requirements, though it's generally good practice
828 #address-cells = <00000001>
829 #size-cells = <00000000>
831 This defines that the "address" for a CPU is a single cell, and has
832 no meaningful size. This is not necessary but the kernel will assume
833 that format when reading the "reg" properties of a CPU node, see
838 So under /cpus, you are supposed to create a node for every CPU on
839 the machine. There is no specific restriction on the name of the
840 CPU, though It's common practice to call it PowerPC,<name>. For
841 example, Apple uses PowerPC,G5 while IBM uses PowerPC,970FX.
845 - device_type : has to be "cpu"
846 - reg : This is the physical CPU number, it's a single 32-bit cell
847 and is also used as-is as the unit number for constructing the
848 unit name in the full path. For example, with 2 CPUs, you would
850 /cpus/PowerPC,970FX@0
851 /cpus/PowerPC,970FX@1
852 (unit addresses do not require leading zeroes)
853 - d-cache-line-size : one cell, L1 data cache line size in bytes
854 - i-cache-line-size : one cell, L1 instruction cache line size in
856 - d-cache-size : one cell, size of L1 data cache in bytes
857 - i-cache-size : one cell, size of L1 instruction cache in bytes
859 Recommended properties:
861 - timebase-frequency : a cell indicating the frequency of the
862 timebase in Hz. This is not directly used by the generic code,
863 but you are welcome to copy/paste the pSeries code for setting
864 the kernel timebase/decrementer calibration based on this
866 - clock-frequency : a cell indicating the CPU core clock frequency
867 in Hz. A new property will be defined for 64-bit values, but if
868 your frequency is < 4Ghz, one cell is enough. Here as well as
869 for the above, the common code doesn't use that property, but
870 you are welcome to re-use the pSeries or Maple one. A future
871 kernel version might provide a common function for this.
873 You are welcome to add any property you find relevant to your board,
874 like some information about the mechanism used to soft-reset the
875 CPUs. For example, Apple puts the GPIO number for CPU soft reset
876 lines in there as a "soft-reset" property since they start secondary
877 CPUs by soft-resetting them.
880 d) the /memory node(s)
882 To define the physical memory layout of your board, you should
883 create one or more memory node(s). You can either create a single
884 node with all memory ranges in its reg property, or you can create
885 several nodes, as you wish. The unit address (@ part) used for the
886 full path is the address of the first range of memory defined by a
887 given node. If you use a single memory node, this will typically be
892 - device_type : has to be "memory"
893 - reg : This property contains all the physical memory ranges of
894 your board. It's a list of addresses/sizes concatenated
895 together, with the number of cells of each defined by the
896 #address-cells and #size-cells of the root node. For example,
897 with both of these properties being 2 like in the example given
898 earlier, a 970 based machine with 6Gb of RAM could typically
899 have a "reg" property here that looks like:
901 00000000 00000000 00000000 80000000
902 00000001 00000000 00000001 00000000
904 That is a range starting at 0 of 0x80000000 bytes and a range
905 starting at 0x100000000 and of 0x100000000 bytes. You can see
906 that there is no memory covering the IO hole between 2Gb and
907 4Gb. Some vendors prefer splitting those ranges into smaller
908 segments, but the kernel doesn't care.
912 This node is a bit "special". Normally, that's where open firmware
913 puts some variable environment information, like the arguments, or
914 the default input/output devices.
916 This specification makes a few of these mandatory, but also defines
917 some linux-specific properties that would be normally constructed by
918 the prom_init() trampoline when booting with an OF client interface,
919 but that you have to provide yourself when using the flattened format.
921 Recommended properties:
923 - bootargs : This zero-terminated string is passed as the kernel
925 - linux,stdout-path : This is the full path to your standard
926 console device if any. Typically, if you have serial devices on
927 your board, you may want to put the full path to the one set as
928 the default console in the firmware here, for the kernel to pick
929 it up as its own default console. If you look at the function
930 set_preferred_console() in arch/ppc64/kernel/setup.c, you'll see
931 that the kernel tries to find out the default console and has
932 knowledge of various types like 8250 serial ports. You may want
933 to extend this function to add your own.
935 Note that u-boot creates and fills in the chosen node for platforms
938 (Note: a practice that is now obsolete was to include a property
939 under /chosen called interrupt-controller which had a phandle value
940 that pointed to the main interrupt controller)
942 f) the /soc<SOCname> node
944 This node is used to represent a system-on-a-chip (SOC) and must be
945 present if the processor is a SOC. The top-level soc node contains
946 information that is global to all devices on the SOC. The node name
947 should contain a unit address for the SOC, which is the base address
948 of the memory-mapped register set for the SOC. The name of an soc
949 node should start with "soc", and the remainder of the name should
950 represent the part number for the soc. For example, the MPC8540's
951 soc node would be called "soc8540".
955 - device_type : Should be "soc"
956 - ranges : Should be defined as specified in 1) to describe the
957 translation of SOC addresses for memory mapped SOC registers.
958 - bus-frequency: Contains the bus frequency for the SOC node.
959 Typically, the value of this field is filled in by the boot
963 Recommended properties:
965 - reg : This property defines the address and size of the
966 memory-mapped registers that are used for the SOC node itself.
967 It does not include the child device registers - these will be
968 defined inside each child node. The address specified in the
969 "reg" property should match the unit address of the SOC node.
970 - #address-cells : Address representation for "soc" devices. The
971 format of this field may vary depending on whether or not the
972 device registers are memory mapped. For memory mapped
973 registers, this field represents the number of cells needed to
974 represent the address of the registers. For SOCs that do not
975 use MMIO, a special address format should be defined that
976 contains enough cells to represent the required information.
977 See 1) above for more details on defining #address-cells.
978 - #size-cells : Size representation for "soc" devices
979 - #interrupt-cells : Defines the width of cells used to represent
980 interrupts. Typically this value is <2>, which includes a
981 32-bit number that represents the interrupt number, and a
982 32-bit number that represents the interrupt sense and level.
983 This field is only needed if the SOC contains an interrupt
986 The SOC node may contain child nodes for each SOC device that the
987 platform uses. Nodes should not be created for devices which exist
988 on the SOC but are not used by a particular platform. See chapter VI
989 for more information on how to specify devices that are part of a SOC.
991 Example SOC node for the MPC8540:
994 #address-cells = <1>;
996 #interrupt-cells = <2>;
998 ranges = <00000000 e0000000 00100000>
999 reg = <e0000000 00003000>;
1000 bus-frequency = <0>;
1005 IV - "dtc", the device tree compiler
1006 ====================================
1009 dtc source code can be found at
1010 <http://ozlabs.org/~dgibson/dtc/dtc.tar.gz>
1012 WARNING: This version is still in early development stage; the
1013 resulting device-tree "blobs" have not yet been validated with the
1014 kernel. The current generated bloc lacks a useful reserve map (it will
1015 be fixed to generate an empty one, it's up to the bootloader to fill
1016 it up) among others. The error handling needs work, bugs are lurking,
1019 dtc basically takes a device-tree in a given format and outputs a
1020 device-tree in another format. The currently supported formats are:
1025 - "dtb": "blob" format, that is a flattened device-tree block
1027 header all in a binary blob.
1028 - "dts": "source" format. This is a text file containing a
1029 "source" for a device-tree. The format is defined later in this
1031 - "fs" format. This is a representation equivalent to the
1032 output of /proc/device-tree, that is nodes are directories and
1033 properties are files
1038 - "dtb": "blob" format
1039 - "dts": "source" format
1040 - "asm": assembly language file. This is a file that can be
1041 sourced by gas to generate a device-tree "blob". That file can
1042 then simply be added to your Makefile. Additionally, the
1043 assembly file exports some symbols that can be used.
1046 The syntax of the dtc tool is
1048 dtc [-I <input-format>] [-O <output-format>]
1049 [-o output-filename] [-V output_version] input_filename
1052 The "output_version" defines what version of the "blob" format will be
1053 generated. Supported versions are 1,2,3 and 16. The default is
1054 currently version 3 but that may change in the future to version 16.
1056 Additionally, dtc performs various sanity checks on the tree, like the
1057 uniqueness of linux, phandle properties, validity of strings, etc...
1059 The format of the .dts "source" file is "C" like, supports C and C++
1065 The above is the "device-tree" definition. It's the only statement
1066 supported currently at the toplevel.
1069 property1 = "string_value"; /* define a property containing a 0
1073 property2 = <1234abcd>; /* define a property containing a
1074 * numerical 32-bit value (hexadecimal)
1077 property3 = <12345678 12345678 deadbeef>;
1078 /* define a property containing 3
1079 * numerical 32-bit values (cells) in
1082 property4 = [0a 0b 0c 0d de ea ad be ef];
1083 /* define a property whose content is
1084 * an arbitrary array of bytes
1087 childnode@addresss { /* define a child node named "childnode"
1088 * whose unit name is "childnode at
1092 childprop = "hello\n"; /* define a property "childprop" of
1093 * childnode (in this case, a string)
1098 Nodes can contain other nodes etc... thus defining the hierarchical
1099 structure of the tree.
1101 Strings support common escape sequences from C: "\n", "\t", "\r",
1102 "\(octal value)", "\x(hex value)".
1104 It is also suggested that you pipe your source file through cpp (gcc
1105 preprocessor) so you can use #include's, #define for constants, etc...
1107 Finally, various options are planned but not yet implemented, like
1108 automatic generation of phandles, labels (exported to the asm file so
1109 you can point to a property content and change it easily from whatever
1110 you link the device-tree with), label or path instead of numeric value
1111 in some cells to "point" to a node (replaced by a phandle at compile
1112 time), export of reserve map address to the asm file, ability to
1113 specify reserve map content at compile time, etc...
1115 We may provide a .h include file with common definitions of that
1116 proves useful for some properties (like building PCI properties or
1117 interrupt maps) though it may be better to add a notion of struct
1118 definitions to the compiler...
1121 V - Recommendations for a bootloader
1122 ====================================
1125 Here are some various ideas/recommendations that have been proposed
1126 while all this has been defined and implemented.
1128 - The bootloader may want to be able to use the device-tree itself
1129 and may want to manipulate it (to add/edit some properties,
1130 like physical memory size or kernel arguments). At this point, 2
1131 choices can be made. Either the bootloader works directly on the
1132 flattened format, or the bootloader has its own internal tree
1133 representation with pointers (similar to the kernel one) and
1134 re-flattens the tree when booting the kernel. The former is a bit
1135 more difficult to edit/modify, the later requires probably a bit
1136 more code to handle the tree structure. Note that the structure
1137 format has been designed so it's relatively easy to "insert"
1138 properties or nodes or delete them by just memmoving things
1139 around. It contains no internal offsets or pointers for this
1142 - An example of code for iterating nodes & retrieving properties
1143 directly from the flattened tree format can be found in the kernel
1144 file arch/ppc64/kernel/prom.c, look at scan_flat_dt() function,
1145 its usage in early_init_devtree(), and the corresponding various
1146 early_init_dt_scan_*() callbacks. That code can be re-used in a
1147 GPL bootloader, and as the author of that code, I would be happy
1148 to discuss possible free licensing to any vendor who wishes to
1149 integrate all or part of this code into a non-GPL bootloader.
1153 VI - System-on-a-chip devices and nodes
1154 =======================================
1156 Many companies are now starting to develop system-on-a-chip
1157 processors, where the processor core (CPU) and many peripheral devices
1158 exist on a single piece of silicon. For these SOCs, an SOC node
1159 should be used that defines child nodes for the devices that make
1160 up the SOC. While platforms are not required to use this model in
1161 order to boot the kernel, it is highly encouraged that all SOC
1162 implementations define as complete a flat-device-tree as possible to
1163 describe the devices on the SOC. This will allow for the
1164 genericization of much of the kernel code.
1167 1) Defining child nodes of an SOC
1168 ---------------------------------
1170 Each device that is part of an SOC may have its own node entry inside
1171 the SOC node. For each device that is included in the SOC, the unit
1172 address property represents the address offset for this device's
1173 memory-mapped registers in the parent's address space. The parent's
1174 address space is defined by the "ranges" property in the top-level soc
1175 node. The "reg" property for each node that exists directly under the
1176 SOC node should contain the address mapping from the child address space
1177 to the parent SOC address space and the size of the device's
1178 memory-mapped register file.
1180 For many devices that may exist inside an SOC, there are predefined
1181 specifications for the format of the device tree node. All SOC child
1182 nodes should follow these specifications, except where noted in this
1185 See appendix A for an example partial SOC node definition for the
1189 2) Representing devices without a current OF specification
1190 ----------------------------------------------------------
1192 Currently, there are many devices on SOCs that do not have a standard
1193 representation pre-defined as part of the open firmware
1194 specifications, mainly because the boards that contain these SOCs are
1195 not currently booted using open firmware. This section contains
1196 descriptions for the SOC devices for which new nodes have been
1197 defined; this list will expand as more and more SOC-containing
1198 platforms are moved over to use the flattened-device-tree model.
1202 The MDIO is a bus to which the PHY devices are connected. For each
1203 device that exists on this bus, a child node should be created. See
1204 the definition of the PHY node below for an example of how to define
1207 Required properties:
1208 - reg : Offset and length of the register set for the device
1209 - device_type : Should be "mdio"
1210 - compatible : Should define the compatible device type for the
1211 mdio. Currently, this is most likely to be "gianfar"
1217 device_type = "mdio";
1218 compatible = "gianfar";
1226 b) Gianfar-compatible ethernet nodes
1228 Required properties:
1230 - device_type : Should be "network"
1231 - model : Model of the device. Can be "TSEC", "eTSEC", or "FEC"
1232 - compatible : Should be "gianfar"
1233 - reg : Offset and length of the register set for the device
1234 - mac-address : List of bytes representing the ethernet address of
1236 - interrupts : <a b> where a is the interrupt number and b is a
1237 field that represents an encoding of the sense and level
1238 information for the interrupt. This should be encoded based on
1239 the information in section 2) depending on the type of interrupt
1240 controller you have.
1241 - interrupt-parent : the phandle for the interrupt controller that
1242 services interrupts for this device.
1243 - phy-handle : The phandle for the PHY connected to this ethernet
1246 Recommended properties:
1248 - linux,network-index : This is the intended "index" of this
1249 network device. This is used by the bootwrapper to interpret
1250 MAC addresses passed by the firmware when no information other
1251 than indices is available to associate an address with a device.
1257 device_type = "network";
1259 compatible = "gianfar";
1261 mac-address = [ 00 E0 0C 00 73 00 ];
1262 interrupts = <d 3 e 3 12 3>;
1263 interrupt-parent = <40000>;
1264 phy-handle = <2452000>
1271 Required properties:
1273 - device_type : Should be "ethernet-phy"
1274 - interrupts : <a b> where a is the interrupt number and b is a
1275 field that represents an encoding of the sense and level
1276 information for the interrupt. This should be encoded based on
1277 the information in section 2) depending on the type of interrupt
1278 controller you have.
1279 - interrupt-parent : the phandle for the interrupt controller that
1280 services interrupts for this device.
1281 - reg : The ID number for the phy, usually a small integer
1282 - linux,phandle : phandle for this node; likely referenced by an
1283 ethernet controller node.
1289 linux,phandle = <2452000>
1290 interrupt-parent = <40000>;
1291 interrupts = <35 1>;
1293 device_type = "ethernet-phy";
1297 d) Interrupt controllers
1299 Some SOC devices contain interrupt controllers that are different
1300 from the standard Open PIC specification. The SOC device nodes for
1301 these types of controllers should be specified just like a standard
1302 OpenPIC controller. Sense and level information should be encoded
1303 as specified in section 2) of this chapter for each device that
1304 specifies an interrupt.
1309 linux,phandle = <40000>;
1310 clock-frequency = <0>;
1311 interrupt-controller;
1312 #address-cells = <0>;
1313 reg = <40000 40000>;
1315 compatible = "chrp,open-pic";
1316 device_type = "open-pic";
1323 Required properties :
1325 - device_type : Should be "i2c"
1326 - reg : Offset and length of the register set for the device
1328 Recommended properties :
1330 - compatible : Should be "fsl-i2c" for parts compatible with
1331 Freescale I2C specifications.
1332 - interrupts : <a b> where a is the interrupt number and b is a
1333 field that represents an encoding of the sense and level
1334 information for the interrupt. This should be encoded based on
1335 the information in section 2) depending on the type of interrupt
1336 controller you have.
1337 - interrupt-parent : the phandle for the interrupt controller that
1338 services interrupts for this device.
1339 - dfsrr : boolean; if defined, indicates that this I2C device has
1340 a digital filter sampling rate register
1341 - fsl5200-clocking : boolean; if defined, indicated that this device
1342 uses the FSL 5200 clocking mechanism.
1347 interrupt-parent = <40000>;
1348 interrupts = <1b 3>;
1350 device_type = "i2c";
1351 compatible = "fsl-i2c";
1356 f) Freescale SOC USB controllers
1358 The device node for a USB controller that is part of a Freescale
1359 SOC is as described in the document "Open Firmware Recommended
1360 Practice : Universal Serial Bus" with the following modifications
1363 Required properties :
1364 - compatible : Should be "fsl-usb2-mph" for multi port host USB
1365 controllers, or "fsl-usb2-dr" for dual role USB controllers
1366 - phy_type : For multi port host USB controllers, should be one of
1367 "ulpi", or "serial". For dual role USB controllers, should be
1368 one of "ulpi", "utmi", "utmi_wide", or "serial".
1369 - reg : Offset and length of the register set for the device
1370 - port0 : boolean; if defined, indicates port0 is connected for
1371 fsl-usb2-mph compatible controllers. Either this property or
1372 "port1" (or both) must be defined for "fsl-usb2-mph" compatible
1374 - port1 : boolean; if defined, indicates port1 is connected for
1375 fsl-usb2-mph compatible controllers. Either this property or
1376 "port0" (or both) must be defined for "fsl-usb2-mph" compatible
1378 - dr_mode : indicates the working mode for "fsl-usb2-dr" compatible
1379 controllers. Can be "host", "peripheral", or "otg". Default to
1380 "host" if not defined for backward compatibility.
1382 Recommended properties :
1383 - interrupts : <a b> where a is the interrupt number and b is a
1384 field that represents an encoding of the sense and level
1385 information for the interrupt. This should be encoded based on
1386 the information in section 2) depending on the type of interrupt
1387 controller you have.
1388 - interrupt-parent : the phandle for the interrupt controller that
1389 services interrupts for this device.
1391 Example multi port host USB controller device node :
1393 device_type = "usb";
1394 compatible = "fsl-usb2-mph";
1396 #address-cells = <1>;
1398 interrupt-parent = <700>;
1399 interrupts = <27 1>;
1405 Example dual role USB controller device node :
1407 device_type = "usb";
1408 compatible = "fsl-usb2-dr";
1410 #address-cells = <1>;
1412 interrupt-parent = <700>;
1413 interrupts = <26 1>;
1419 g) Freescale SOC SEC Security Engines
1421 Required properties:
1423 - device_type : Should be "crypto"
1424 - model : Model of the device. Should be "SEC1" or "SEC2"
1425 - compatible : Should be "talitos"
1426 - reg : Offset and length of the register set for the device
1427 - interrupts : <a b> where a is the interrupt number and b is a
1428 field that represents an encoding of the sense and level
1429 information for the interrupt. This should be encoded based on
1430 the information in section 2) depending on the type of interrupt
1431 controller you have.
1432 - interrupt-parent : the phandle for the interrupt controller that
1433 services interrupts for this device.
1434 - num-channels : An integer representing the number of channels
1436 - channel-fifo-len : An integer representing the number of
1437 descriptor pointers each channel fetch fifo can hold.
1438 - exec-units-mask : The bitmask representing what execution units
1439 (EUs) are available. It's a single 32-bit cell. EU information
1440 should be encoded following the SEC's Descriptor Header Dword
1441 EU_SEL0 field documentation, i.e. as follows:
1443 bit 0 = reserved - should be 0
1444 bit 1 = set if SEC has the ARC4 EU (AFEU)
1445 bit 2 = set if SEC has the DES/3DES EU (DEU)
1446 bit 3 = set if SEC has the message digest EU (MDEU)
1447 bit 4 = set if SEC has the random number generator EU (RNG)
1448 bit 5 = set if SEC has the public key EU (PKEU)
1449 bit 6 = set if SEC has the AES EU (AESU)
1450 bit 7 = set if SEC has the Kasumi EU (KEU)
1452 bits 8 through 31 are reserved for future SEC EUs.
1454 - descriptor-types-mask : The bitmask representing what descriptors
1455 are available. It's a single 32-bit cell. Descriptor type
1456 information should be encoded following the SEC's Descriptor
1457 Header Dword DESC_TYPE field documentation, i.e. as follows:
1459 bit 0 = set if SEC supports the aesu_ctr_nonsnoop desc. type
1460 bit 1 = set if SEC supports the ipsec_esp descriptor type
1461 bit 2 = set if SEC supports the common_nonsnoop desc. type
1462 bit 3 = set if SEC supports the 802.11i AES ccmp desc. type
1463 bit 4 = set if SEC supports the hmac_snoop_no_afeu desc. type
1464 bit 5 = set if SEC supports the srtp descriptor type
1465 bit 6 = set if SEC supports the non_hmac_snoop_no_afeu desc.type
1466 bit 7 = set if SEC supports the pkeu_assemble descriptor type
1467 bit 8 = set if SEC supports the aesu_key_expand_output desc.type
1468 bit 9 = set if SEC supports the pkeu_ptmul descriptor type
1469 bit 10 = set if SEC supports the common_nonsnoop_afeu desc. type
1470 bit 11 = set if SEC supports the pkeu_ptadd_dbl descriptor type
1472 ..and so on and so forth.
1478 device_type = "crypto";
1480 compatible = "talitos";
1481 reg = <30000 10000>;
1482 interrupts = <1d 3>;
1483 interrupt-parent = <40000>;
1485 channel-fifo-len = <18>;
1486 exec-units-mask = <000000fe>;
1487 descriptor-types-mask = <012b0ebf>;
1490 h) Board Control and Status (BCSR)
1492 Required properties:
1494 - device_type : Should be "board-control"
1495 - reg : Offset and length of the register set for the device
1500 device_type = "board-control";
1501 reg = <f8000000 8000>;
1504 i) Freescale QUICC Engine module (QE)
1505 This represents qe module that is installed on PowerQUICC II Pro.
1506 Hopefully it will merge backward compatibility with CPM/CPM2.
1507 Basically, it is a bus of devices, that could act more or less
1508 as a complete entity (UCC, USB etc ). All of them should be siblings on
1509 the "root" qe node, using the common properties from there.
1510 The description below applies to the qe of MPC8360 and
1511 more nodes and properties would be extended in the future.
1515 Required properties:
1516 - device_type : should be "qe";
1517 - model : precise model of the QE, Can be "QE", "CPM", or "CPM2"
1518 - reg : offset and length of the device registers.
1519 - bus-frequency : the clock frequency for QUICC Engine.
1521 Recommended properties
1522 - brg-frequency : the internal clock source frequency for baud-rate
1527 #address-cells = <1>;
1529 #interrupt-cells = <2>;
1532 ranges = <0 e0100000 00100000>;
1533 reg = <e0100000 480>;
1534 brg-frequency = <0>;
1535 bus-frequency = <179A7B00>;
1539 ii) SPI (Serial Peripheral Interface)
1541 Required properties:
1542 - device_type : should be "spi".
1543 - compatible : should be "fsl_spi".
1544 - mode : the SPI operation mode, it can be "cpu" or "qe".
1545 - reg : Offset and length of the register set for the device
1546 - interrupts : <a b> where a is the interrupt number and b is a
1547 field that represents an encoding of the sense and level
1548 information for the interrupt. This should be encoded based on
1549 the information in section 2) depending on the type of interrupt
1550 controller you have.
1551 - interrupt-parent : the phandle for the interrupt controller that
1552 services interrupts for this device.
1556 device_type = "spi";
1557 compatible = "fsl_spi";
1559 interrupts = <82 0>;
1560 interrupt-parent = <700>;
1565 iii) USB (Universal Serial Bus Controller)
1567 Required properties:
1568 - device_type : should be "usb".
1569 - compatible : could be "qe_udc" or "fhci-hcd".
1570 - mode : the could be "host" or "slave".
1571 - reg : Offset and length of the register set for the device
1572 - interrupts : <a b> where a is the interrupt number and b is a
1573 field that represents an encoding of the sense and level
1574 information for the interrupt. This should be encoded based on
1575 the information in section 2) depending on the type of interrupt
1576 controller you have.
1577 - interrupt-parent : the phandle for the interrupt controller that
1578 services interrupts for this device.
1582 device_type = "usb";
1583 compatible = "qe_udc";
1585 interrupts = <8b 0>;
1586 interrupt-parent = <700>;
1591 iv) UCC (Unified Communications Controllers)
1593 Required properties:
1594 - device_type : should be "network", "hldc", "uart", "transparent"
1596 - compatible : could be "ucc_geth" or "fsl_atm" and so on.
1597 - model : should be "UCC".
1598 - device-id : the ucc number(1-8), corresponding to UCCx in UM.
1599 - reg : Offset and length of the register set for the device
1600 - interrupts : <a b> where a is the interrupt number and b is a
1601 field that represents an encoding of the sense and level
1602 information for the interrupt. This should be encoded based on
1603 the information in section 2) depending on the type of interrupt
1604 controller you have.
1605 - interrupt-parent : the phandle for the interrupt controller that
1606 services interrupts for this device.
1607 - pio-handle : The phandle for the Parallel I/O port configuration.
1608 - rx-clock : represents the UCC receive clock source.
1609 0x00 : clock source is disabled;
1610 0x1~0x10 : clock source is BRG1~BRG16 respectively;
1611 0x11~0x28: clock source is QE_CLK1~QE_CLK24 respectively.
1612 - tx-clock: represents the UCC transmit clock source;
1613 0x00 : clock source is disabled;
1614 0x1~0x10 : clock source is BRG1~BRG16 respectively;
1615 0x11~0x28: clock source is QE_CLK1~QE_CLK24 respectively.
1617 Required properties for network device_type:
1618 - mac-address : list of bytes representing the ethernet address.
1619 - phy-handle : The phandle for the PHY connected to this controller.
1621 Recommended properties:
1622 - linux,network-index : This is the intended "index" of this
1623 network device. This is used by the bootwrapper to interpret
1624 MAC addresses passed by the firmware when no information other
1625 than indices is available to associate an address with a device.
1626 - phy-connection-type : a string naming the controller/PHY interface type,
1627 i.e., "mii" (default), "rmii", "gmii", "rgmii", "rgmii-id", "tbi",
1632 device_type = "network";
1633 compatible = "ucc_geth";
1637 interrupts = <a0 0>;
1638 interrupt-parent = <700>;
1639 mac-address = [ 00 04 9f 00 23 23 ];
1642 phy-handle = <212000>;
1643 phy-connection-type = "gmii";
1644 pio-handle = <140001>;
1648 v) Parallel I/O Ports
1650 This node configures Parallel I/O ports for CPUs with QE support.
1651 The node should reside in the "soc" node of the tree. For each
1652 device that using parallel I/O ports, a child node should be created.
1653 See the definition of the Pin configuration nodes below for more
1656 Required properties:
1657 - device_type : should be "par_io".
1658 - reg : offset to the register set and its length.
1659 - num-ports : number of Parallel I/O ports
1664 #address-cells = <1>;
1666 device_type = "par_io";
1673 vi) Pin configuration nodes
1675 Required properties:
1676 - linux,phandle : phandle of this node; likely referenced by a QE
1678 - pio-map : array of pin configurations. Each pin is defined by 6
1679 integers. The six numbers are respectively: port, pin, dir,
1680 open_drain, assignment, has_irq.
1681 - port : port number of the pin; 0-6 represent port A-G in UM.
1682 - pin : pin number in the port.
1683 - dir : direction of the pin, should encode as follows:
1685 0 = The pin is disabled
1686 1 = The pin is an output
1687 2 = The pin is an input
1690 - open_drain : indicates the pin is normal or wired-OR:
1692 0 = The pin is actively driven as an output
1693 1 = The pin is an open-drain driver. As an output, the pin is
1694 driven active-low, otherwise it is three-stated.
1696 - assignment : function number of the pin according to the Pin Assignment
1697 tables in User Manual. Each pin can have up to 4 possible functions in
1698 QE and two options for CPM.
1699 - has_irq : indicates if the pin is used as source of external
1704 linux,phandle = <140001>;
1706 /* port pin dir open_drain assignment has_irq */
1707 0 3 1 0 1 0 /* TxD0 */
1708 0 4 1 0 1 0 /* TxD1 */
1709 0 5 1 0 1 0 /* TxD2 */
1710 0 6 1 0 1 0 /* TxD3 */
1711 1 6 1 0 3 0 /* TxD4 */
1712 1 7 1 0 1 0 /* TxD5 */
1713 1 9 1 0 2 0 /* TxD6 */
1714 1 a 1 0 2 0 /* TxD7 */
1715 0 9 2 0 1 0 /* RxD0 */
1716 0 a 2 0 1 0 /* RxD1 */
1717 0 b 2 0 1 0 /* RxD2 */
1718 0 c 2 0 1 0 /* RxD3 */
1719 0 d 2 0 1 0 /* RxD4 */
1720 1 1 2 0 2 0 /* RxD5 */
1721 1 0 2 0 2 0 /* RxD6 */
1722 1 4 2 0 2 0 /* RxD7 */
1723 0 7 1 0 1 0 /* TX_EN */
1724 0 8 1 0 1 0 /* TX_ER */
1725 0 f 2 0 1 0 /* RX_DV */
1726 0 10 2 0 1 0 /* RX_ER */
1727 0 0 2 0 1 0 /* RX_CLK */
1728 2 9 1 0 3 0 /* GTX_CLK - CLK10 */
1729 2 8 2 0 1 0>; /* GTX125 - CLK9 */
1732 vii) Multi-User RAM (MURAM)
1734 Required properties:
1735 - device_type : should be "muram".
1736 - mode : the could be "host" or "slave".
1737 - ranges : Should be defined as specified in 1) to describe the
1738 translation of MURAM addresses.
1739 - data-only : sub-node which defines the address area under MURAM
1740 bus that can be allocated as data/parameter
1745 device_type = "muram";
1746 ranges = <0 00010000 0000c000>;
1755 Flash chips (Memory Technology Devices) are often used for solid state
1756 file systems on embedded devices.
1758 Required properties:
1760 - device_type : has to be "rom"
1761 - compatible : Should specify what this flash device is compatible with.
1762 Currently, this is most likely to be "direct-mapped" (which
1763 corresponds to the MTD physmap mapping driver).
1764 - reg : Offset and length of the register set (or memory mapping) for
1766 - bank-width : Width of the flash data bus in bytes. Required
1767 for the NOR flashes (compatible == "direct-mapped" and others) ONLY.
1769 Recommended properties :
1771 - partitions : Several pairs of 32-bit values where the first value is
1772 partition's offset from the start of the device and the second one is
1773 partition size in bytes with LSB used to signify a read only
1774 partition (so, the partition size should always be an even number).
1775 - partition-names : The list of concatenated zero terminated strings
1776 representing the partition names.
1777 - probe-type : The type of probe which should be done for the chip
1778 (JEDEC vs CFI actually). Valid ONLY for NOR flashes.
1783 device_type = "rom";
1784 compatible = "direct-mapped";
1786 reg = <ff000000 01000000>;
1788 partitions = <00000000 00f80000
1790 partition-names = "fs\0firmware";
1793 More devices will be defined as this spec matures.
1795 VII - Specifying interrupt information for devices
1796 ===================================================
1798 The device tree represents the busses and devices of a hardware
1799 system in a form similar to the physical bus topology of the
1802 In addition, a logical 'interrupt tree' exists which represents the
1803 hierarchy and routing of interrupts in the hardware.
1805 The interrupt tree model is fully described in the
1806 document "Open Firmware Recommended Practice: Interrupt
1807 Mapping Version 0.9". The document is available at:
1808 <http://playground.sun.com/1275/practice>.
1810 1) interrupts property
1811 ----------------------
1813 Devices that generate interrupts to a single interrupt controller
1814 should use the conventional OF representation described in the
1815 OF interrupt mapping documentation.
1817 Each device which generates interrupts must have an 'interrupt'
1818 property. The interrupt property value is an arbitrary number of
1819 of 'interrupt specifier' values which describe the interrupt or
1820 interrupts for the device.
1822 The encoding of an interrupt specifier is determined by the
1823 interrupt domain in which the device is located in the
1824 interrupt tree. The root of an interrupt domain specifies in
1825 its #interrupt-cells property the number of 32-bit cells
1826 required to encode an interrupt specifier. See the OF interrupt
1827 mapping documentation for a detailed description of domains.
1829 For example, the binding for the OpenPIC interrupt controller
1830 specifies an #interrupt-cells value of 2 to encode the interrupt
1831 number and level/sense information. All interrupt children in an
1832 OpenPIC interrupt domain use 2 cells per interrupt in their interrupts
1835 The PCI bus binding specifies a #interrupt-cell value of 1 to encode
1836 which interrupt pin (INTA,INTB,INTC,INTD) is used.
1838 2) interrupt-parent property
1839 ----------------------------
1841 The interrupt-parent property is specified to define an explicit
1842 link between a device node and its interrupt parent in
1843 the interrupt tree. The value of interrupt-parent is the
1844 phandle of the parent node.
1846 If the interrupt-parent property is not defined for a node, it's
1847 interrupt parent is assumed to be an ancestor in the node's
1848 _device tree_ hierarchy.
1850 3) OpenPIC Interrupt Controllers
1851 --------------------------------
1853 OpenPIC interrupt controllers require 2 cells to encode
1854 interrupt information. The first cell defines the interrupt
1855 number. The second cell defines the sense and level
1858 Sense and level information should be encoded as follows:
1860 0 = low to high edge sensitive type enabled
1861 1 = active low level sensitive type enabled
1862 2 = active high level sensitive type enabled
1863 3 = high to low edge sensitive type enabled
1865 4) ISA Interrupt Controllers
1866 ----------------------------
1868 ISA PIC interrupt controllers require 2 cells to encode
1869 interrupt information. The first cell defines the interrupt
1870 number. The second cell defines the sense and level
1873 ISA PIC interrupt controllers should adhere to the ISA PIC
1874 encodings listed below:
1876 0 = active low level sensitive type enabled
1877 1 = active high level sensitive type enabled
1878 2 = high to low edge sensitive type enabled
1879 3 = low to high edge sensitive type enabled
1882 Appendix A - Sample SOC node for MPC8540
1883 ========================================
1885 Note that the #address-cells and #size-cells for the SoC node
1886 in this example have been explicitly listed; these are likely
1887 not necessary as they are usually the same as the root node.
1890 #address-cells = <1>;
1892 #interrupt-cells = <2>;
1893 device_type = "soc";
1894 ranges = <00000000 e0000000 00100000>
1895 reg = <e0000000 00003000>;
1896 bus-frequency = <0>;
1900 device_type = "mdio";
1901 compatible = "gianfar";
1904 linux,phandle = <2452000>
1905 interrupt-parent = <40000>;
1906 interrupts = <35 1>;
1908 device_type = "ethernet-phy";
1912 linux,phandle = <2452001>
1913 interrupt-parent = <40000>;
1914 interrupts = <35 1>;
1916 device_type = "ethernet-phy";
1920 linux,phandle = <2452002>
1921 interrupt-parent = <40000>;
1922 interrupts = <35 1>;
1924 device_type = "ethernet-phy";
1931 device_type = "network";
1933 compatible = "gianfar";
1935 mac-address = [ 00 E0 0C 00 73 00 ];
1936 interrupts = <d 3 e 3 12 3>;
1937 interrupt-parent = <40000>;
1938 phy-handle = <2452000>;
1942 #address-cells = <1>;
1944 device_type = "network";
1946 compatible = "gianfar";
1948 mac-address = [ 00 E0 0C 00 73 01 ];
1949 interrupts = <13 3 14 3 18 3>;
1950 interrupt-parent = <40000>;
1951 phy-handle = <2452001>;
1955 #address-cells = <1>;
1957 device_type = "network";
1959 compatible = "gianfar";
1961 mac-address = [ 00 E0 0C 00 73 02 ];
1962 interrupts = <19 3>;
1963 interrupt-parent = <40000>;
1964 phy-handle = <2452002>;
1968 device_type = "serial";
1969 compatible = "ns16550";
1971 clock-frequency = <0>;
1972 interrupts = <1a 3>;
1973 interrupt-parent = <40000>;
1977 linux,phandle = <40000>;
1978 clock-frequency = <0>;
1979 interrupt-controller;
1980 #address-cells = <0>;
1981 reg = <40000 40000>;
1983 compatible = "chrp,open-pic";
1984 device_type = "open-pic";
1989 interrupt-parent = <40000>;
1990 interrupts = <1b 3>;
1992 device_type = "i2c";
1993 compatible = "fsl-i2c";