blob: 46a9dba11f2f003334f2ef44d275895b2477856f [file] [log] [blame]
David Gibsonc125a182006-02-01 03:05:22 -08001 Booting the Linux/ppc kernel without Open Firmware
2 --------------------------------------------------
3
David Gibsonc125a182006-02-01 03:05:22 -08004(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
Vitaly Wool28f9ec32006-11-20 16:32:39 +03008(c) 2006 MontaVista Software, Inc.
9 Flash chip node definition
David Gibsonc125a182006-02-01 03:05:22 -080010
Stuart Yoder5e1e9ba2007-06-06 04:29:14 +100011Table 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
Stuart Yoder5e1e9ba2007-06-06 04:29:14 +100045 b) Gianfar-compatible ethernet nodes
Roy Zanga4ecaba2007-06-19 15:19:31 +080046 c) PHY nodes
Stuart Yoder5e1e9ba2007-06-06 04:29:14 +100047 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)
David Gibson20991722007-09-07 13:23:53 +100053 j) CFI or JEDEC memory-mapped NOR flash
Roy Zang3b824f82007-06-19 15:19:18 +080054 k) Global Utilities Block
Timur Tabibc556ba2008-01-08 10:30:58 -060055 l) Freescale Communications Processor Module
56 m) Chipselect/Local Bus
57 n) 4xx/Axon EMAC ethernet nodes
58 o) Xilinx IP cores
Timur Tabic7d24a22008-01-18 09:24:53 -060059 p) Freescale Synchronous Serial Interface
Valentine Barshak41abd682007-09-25 05:27:56 +100060 q) USB EHCI controllers
Laurent Pincharta5edecc2008-05-26 11:53:21 +020061 r) MDIO on GPIOs
Stuart Yoder5e1e9ba2007-06-06 04:29:14 +100062
Dale Farnsworthf5412c42008-04-08 08:12:07 +100063 VII - Marvell Discovery mv64[345]6x System Controller chips
64 1) The /system-controller node
65 2) Child nodes of /system-controller
66 a) Marvell Discovery MDIO bus
67 b) Marvell Discovery ethernet controller
68 c) Marvell Discovery PHY nodes
69 d) Marvell Discovery SDMA nodes
70 e) Marvell Discovery BRG nodes
71 f) Marvell Discovery CUNIT nodes
72 g) Marvell Discovery MPSCROUTING nodes
73 h) Marvell Discovery MPSCINTR nodes
74 i) Marvell Discovery MPSC nodes
75 j) Marvell Discovery Watch Dog Timer nodes
76 k) Marvell Discovery I2C nodes
77 l) Marvell Discovery PIC (Programmable Interrupt Controller) nodes
78 m) Marvell Discovery MPP (Multipurpose Pins) multiplexing nodes
79 n) Marvell Discovery GPP (General Purpose Pins) nodes
80 o) Marvell Discovery PCI host bridge node
81 p) Marvell Discovery CPU Error nodes
82 q) Marvell Discovery SRAM Controller nodes
83 r) Marvell Discovery PCI Error Handler nodes
84 s) Marvell Discovery Memory Controller nodes
85
86 VIII - Specifying interrupt information for devices
Stuart Yoder5e1e9ba2007-06-06 04:29:14 +100087 1) interrupts property
88 2) interrupt-parent property
89 3) OpenPIC Interrupt Controllers
90 4) ISA Interrupt Controllers
91
Anton Vorontsovb7ce3412008-04-11 23:06:36 +100092 VIII - Specifying GPIO information for devices
93 1) gpios property
94 2) gpio-controller nodes
95
Stuart Yoder5e1e9ba2007-06-06 04:29:14 +100096 Appendix A - Sample SOC node for MPC8540
97
98
99Revision Information
100====================
101
David Gibsonc125a182006-02-01 03:05:22 -0800102 May 18, 2005: Rev 0.1 - Initial draft, no chapter III yet.
103
104 May 19, 2005: Rev 0.2 - Add chapter III and bits & pieces here or
105 clarifies the fact that a lot of things are
106 optional, the kernel only requires a very
107 small device tree, though it is encouraged
108 to provide an as complete one as possible.
109
110 May 24, 2005: Rev 0.3 - Precise that DT block has to be in RAM
111 - Misc fixes
112 - Define version 3 and new format version 16
113 for the DT block (version 16 needs kernel
114 patches, will be fwd separately).
115 String block now has a size, and full path
116 is replaced by unit name for more
117 compactness.
118 linux,phandle is made optional, only nodes
119 that are referenced by other nodes need it.
120 "name" property is now automatically
121 deduced from the unit name
122
123 June 1, 2005: Rev 0.4 - Correct confusion between OF_DT_END and
124 OF_DT_END_NODE in structure definition.
125 - Change version 16 format to always align
126 property data to 4 bytes. Since tokens are
127 already aligned, that means no specific
Matt LaPlante5d3f0832006-11-30 05:21:10 +0100128 required alignment between property size
David Gibsonc125a182006-02-01 03:05:22 -0800129 and property data. The old style variable
130 alignment would make it impossible to do
131 "simple" insertion of properties using
Domen Puncer5dd60162007-03-02 21:44:45 +1100132 memmove (thanks Milton for
David Gibsonc125a182006-02-01 03:05:22 -0800133 noticing). Updated kernel patch as well
Matt LaPlante5d3f0832006-11-30 05:21:10 +0100134 - Correct a few more alignment constraints
David Gibsonc125a182006-02-01 03:05:22 -0800135 - Add a chapter about the device-tree
136 compiler and the textural representation of
137 the tree that can be "compiled" by dtc.
138
David Gibsonc125a182006-02-01 03:05:22 -0800139 November 21, 2005: Rev 0.5
140 - Additions/generalizations for 32-bit
141 - Changed to reflect the new arch/powerpc
142 structure
143 - Added chapter VI
144
145
146 ToDo:
147 - Add some definitions of interrupt tree (simple/complex)
Domen Puncer5dd60162007-03-02 21:44:45 +1100148 - Add some definitions for PCI host bridges
David Gibsonc125a182006-02-01 03:05:22 -0800149 - Add some common address format examples
150 - Add definitions for standard properties and "compatible"
151 names for cells that are not already defined by the existing
152 OF spec.
153 - Compare FSL SOC use of PCI to standard and make sure no new
154 node definition required.
155 - Add more information about node definitions for SOC devices
156 that currently have no standard, like the FSL CPM.
157
158
159I - Introduction
160================
161
162During the recent development of the Linux/ppc64 kernel, and more
163specifically, the addition of new platform types outside of the old
164IBM pSeries/iSeries pair, it was decided to enforce some strict rules
165regarding the kernel entry and bootloader <-> kernel interfaces, in
166order to avoid the degeneration that had become the ppc32 kernel entry
167point and the way a new platform should be added to the kernel. The
168legacy iSeries platform breaks those rules as it predates this scheme,
169but no new board support will be accepted in the main tree that
170doesn't follows them properly. In addition, since the advent of the
171arch/powerpc merged architecture for ppc32 and ppc64, new 32-bit
172platforms and 32-bit platforms which move into arch/powerpc will be
173required to use these rules as well.
174
175The main requirement that will be defined in more detail below is
176the presence of a device-tree whose format is defined after Open
177Firmware specification. However, in order to make life easier
178to embedded board vendors, the kernel doesn't require the device-tree
179to represent every device in the system and only requires some nodes
180and properties to be present. This will be described in detail in
181section III, but, for example, the kernel does not require you to
182create a node for every PCI device in the system. It is a requirement
183to have a node for PCI host bridges in order to provide interrupt
184routing informations and memory/IO ranges, among others. It is also
185recommended to define nodes for on chip devices and other busses that
186don't specifically fit in an existing OF specification. This creates a
187great flexibility in the way the kernel can then probe those and match
188drivers to device, without having to hard code all sorts of tables. It
189also makes it more flexible for board vendors to do minor hardware
190upgrades without significantly impacting the kernel code or cluttering
191it with special cases.
192
193
1941) Entry point for arch/powerpc
195-------------------------------
196
197 There is one and one single entry point to the kernel, at the start
198 of the kernel image. That entry point supports two calling
199 conventions:
200
201 a) Boot from Open Firmware. If your firmware is compatible
202 with Open Firmware (IEEE 1275) or provides an OF compatible
203 client interface API (support for "interpret" callback of
204 forth words isn't required), you can enter the kernel with:
205
206 r5 : OF callback pointer as defined by IEEE 1275
Domen Puncer5dd60162007-03-02 21:44:45 +1100207 bindings to powerpc. Only the 32-bit client interface
David Gibsonc125a182006-02-01 03:05:22 -0800208 is currently supported
209
210 r3, r4 : address & length of an initrd if any or 0
211
212 The MMU is either on or off; the kernel will run the
213 trampoline located in arch/powerpc/kernel/prom_init.c to
214 extract the device-tree and other information from open
215 firmware and build a flattened device-tree as described
216 in b). prom_init() will then re-enter the kernel using
217 the second method. This trampoline code runs in the
218 context of the firmware, which is supposed to handle all
219 exceptions during that time.
220
221 b) Direct entry with a flattened device-tree block. This entry
222 point is called by a) after the OF trampoline and can also be
223 called directly by a bootloader that does not support the Open
224 Firmware client interface. It is also used by "kexec" to
225 implement "hot" booting of a new kernel from a previous
226 running one. This method is what I will describe in more
227 details in this document, as method a) is simply standard Open
228 Firmware, and thus should be implemented according to the
229 various standard documents defining it and its binding to the
230 PowerPC platform. The entry point definition then becomes:
231
232 r3 : physical pointer to the device-tree block
233 (defined in chapter II) in RAM
234
235 r4 : physical pointer to the kernel itself. This is
236 used by the assembly code to properly disable the MMU
237 in case you are entering the kernel with MMU enabled
238 and a non-1:1 mapping.
239
Matt LaPlante2fe0ae72006-10-03 22:50:39 +0200240 r5 : NULL (as to differentiate with method a)
David Gibsonc125a182006-02-01 03:05:22 -0800241
242 Note about SMP entry: Either your firmware puts your other
243 CPUs in some sleep loop or spin loop in ROM where you can get
244 them out via a soft reset or some other means, in which case
245 you don't need to care, or you'll have to enter the kernel
246 with all CPUs. The way to do that with method b) will be
247 described in a later revision of this document.
248
249
2502) Board support
251----------------
252
25364-bit kernels:
254
255 Board supports (platforms) are not exclusive config options. An
256 arbitrary set of board supports can be built in a single kernel
257 image. The kernel will "know" what set of functions to use for a
258 given platform based on the content of the device-tree. Thus, you
259 should:
260
261 a) add your platform support as a _boolean_ option in
262 arch/powerpc/Kconfig, following the example of PPC_PSERIES,
263 PPC_PMAC and PPC_MAPLE. The later is probably a good
264 example of a board support to start from.
265
266 b) create your main platform file as
267 "arch/powerpc/platforms/myplatform/myboard_setup.c" and add it
268 to the Makefile under the condition of your CONFIG_
269 option. This file will define a structure of type "ppc_md"
270 containing the various callbacks that the generic code will
271 use to get to your platform specific code
272
273 c) Add a reference to your "ppc_md" structure in the
274 "machines" table in arch/powerpc/kernel/setup_64.c if you are
275 a 64-bit platform.
276
277 d) request and get assigned a platform number (see PLATFORM_*
278 constants in include/asm-powerpc/processor.h
279
28032-bit embedded kernels:
281
282 Currently, board support is essentially an exclusive config option.
283 The kernel is configured for a single platform. Part of the reason
284 for this is to keep kernels on embedded systems small and efficient;
285 part of this is due to the fact the code is already that way. In the
286 future, a kernel may support multiple platforms, but only if the
Domen Puncer5dd60162007-03-02 21:44:45 +1100287 platforms feature the same core architecture. A single kernel build
David Gibsonc125a182006-02-01 03:05:22 -0800288 cannot support both configurations with Book E and configurations
289 with classic Powerpc architectures.
290
291 32-bit embedded platforms that are moved into arch/powerpc using a
292 flattened device tree should adopt the merged tree practice of
293 setting ppc_md up dynamically, even though the kernel is currently
294 built with support for only a single platform at a time. This allows
295 unification of the setup code, and will make it easier to go to a
296 multiple-platform-support model in the future.
297
298NOTE: I believe the above will be true once Ben's done with the merge
299of the boot sequences.... someone speak up if this is wrong!
300
301 To add a 32-bit embedded platform support, follow the instructions
302 for 64-bit platforms above, with the exception that the Kconfig
303 option should be set up such that the kernel builds exclusively for
304 the platform selected. The processor type for the platform should
305 enable another config option to select the specific board
306 supported.
307
Domen Puncer5dd60162007-03-02 21:44:45 +1100308NOTE: If Ben doesn't merge the setup files, may need to change this to
David Gibsonc125a182006-02-01 03:05:22 -0800309point to setup_32.c
310
311
312 I will describe later the boot process and various callbacks that
313 your platform should implement.
314
315
316II - The DT block format
317========================
318
319
320This chapter defines the actual format of the flattened device-tree
321passed to the kernel. The actual content of it and kernel requirements
322are described later. You can find example of code manipulating that
323format in various places, including arch/powerpc/kernel/prom_init.c
324which will generate a flattened device-tree from the Open Firmware
325representation, or the fs2dt utility which is part of the kexec tools
326which will generate one from a filesystem representation. It is
327expected that a bootloader like uboot provides a bit more support,
328that will be discussed later as well.
329
330Note: The block has to be in main memory. It has to be accessible in
331both real mode and virtual mode with no mapping other than main
332memory. If you are writing a simple flash bootloader, it should copy
333the block to RAM before passing it to the kernel.
334
335
3361) Header
337---------
338
339 The kernel is entered with r3 pointing to an area of memory that is
Matt LaPlanted6bc8ac2006-10-03 22:54:15 +0200340 roughly described in include/asm-powerpc/prom.h by the structure
David Gibsonc125a182006-02-01 03:05:22 -0800341 boot_param_header:
342
343struct boot_param_header {
344 u32 magic; /* magic word OF_DT_HEADER */
345 u32 totalsize; /* total size of DT block */
346 u32 off_dt_struct; /* offset to structure */
347 u32 off_dt_strings; /* offset to strings */
348 u32 off_mem_rsvmap; /* offset to memory reserve map
Domen Puncer5dd60162007-03-02 21:44:45 +1100349 */
David Gibsonc125a182006-02-01 03:05:22 -0800350 u32 version; /* format version */
351 u32 last_comp_version; /* last compatible version */
352
353 /* version 2 fields below */
354 u32 boot_cpuid_phys; /* Which physical CPU id we're
355 booting on */
356 /* version 3 fields below */
357 u32 size_dt_strings; /* size of the strings block */
David Gibson0e0293c2007-03-14 11:50:40 +1100358
359 /* version 17 fields below */
360 u32 size_dt_struct; /* size of the DT structure block */
David Gibsonc125a182006-02-01 03:05:22 -0800361};
362
363 Along with the constants:
364
365/* Definitions used by the flattened device tree */
366#define OF_DT_HEADER 0xd00dfeed /* 4: version,
367 4: total size */
368#define OF_DT_BEGIN_NODE 0x1 /* Start node: full name
Domen Puncer5dd60162007-03-02 21:44:45 +1100369 */
David Gibsonc125a182006-02-01 03:05:22 -0800370#define OF_DT_END_NODE 0x2 /* End node */
371#define OF_DT_PROP 0x3 /* Property: name off,
372 size, content */
373#define OF_DT_END 0x9
374
375 All values in this header are in big endian format, the various
376 fields in this header are defined more precisely below. All
377 "offset" values are in bytes from the start of the header; that is
378 from the value of r3.
379
380 - magic
381
382 This is a magic value that "marks" the beginning of the
383 device-tree block header. It contains the value 0xd00dfeed and is
384 defined by the constant OF_DT_HEADER
385
386 - totalsize
387
388 This is the total size of the DT block including the header. The
389 "DT" block should enclose all data structures defined in this
390 chapter (who are pointed to by offsets in this header). That is,
391 the device-tree structure, strings, and the memory reserve map.
392
393 - off_dt_struct
394
395 This is an offset from the beginning of the header to the start
396 of the "structure" part the device tree. (see 2) device tree)
397
398 - off_dt_strings
399
400 This is an offset from the beginning of the header to the start
401 of the "strings" part of the device-tree
402
403 - off_mem_rsvmap
404
405 This is an offset from the beginning of the header to the start
Domen Puncer5dd60162007-03-02 21:44:45 +1100406 of the reserved memory map. This map is a list of pairs of 64-
David Gibsonc125a182006-02-01 03:05:22 -0800407 bit integers. Each pair is a physical address and a size. The
David Gibsonc125a182006-02-01 03:05:22 -0800408 list is terminated by an entry of size 0. This map provides the
409 kernel with a list of physical memory areas that are "reserved"
410 and thus not to be used for memory allocations, especially during
411 early initialization. The kernel needs to allocate memory during
412 boot for things like un-flattening the device-tree, allocating an
413 MMU hash table, etc... Those allocations must be done in such a
414 way to avoid overriding critical things like, on Open Firmware
415 capable machines, the RTAS instance, or on some pSeries, the TCE
416 tables used for the iommu. Typically, the reserve map should
417 contain _at least_ this DT block itself (header,total_size). If
418 you are passing an initrd to the kernel, you should reserve it as
419 well. You do not need to reserve the kernel image itself. The map
Domen Puncer5dd60162007-03-02 21:44:45 +1100420 should be 64-bit aligned.
David Gibsonc125a182006-02-01 03:05:22 -0800421
422 - version
423
424 This is the version of this structure. Version 1 stops
425 here. Version 2 adds an additional field boot_cpuid_phys.
426 Version 3 adds the size of the strings block, allowing the kernel
427 to reallocate it easily at boot and free up the unused flattened
428 structure after expansion. Version 16 introduces a new more
429 "compact" format for the tree itself that is however not backward
David Gibson0e0293c2007-03-14 11:50:40 +1100430 compatible. Version 17 adds an additional field, size_dt_struct,
431 allowing it to be reallocated or moved more easily (this is
432 particularly useful for bootloaders which need to make
433 adjustments to a device tree based on probed information). You
434 should always generate a structure of the highest version defined
435 at the time of your implementation. Currently that is version 17,
436 unless you explicitly aim at being backward compatible.
David Gibsonc125a182006-02-01 03:05:22 -0800437
438 - last_comp_version
439
440 Last compatible version. This indicates down to what version of
441 the DT block you are backward compatible. For example, version 2
442 is backward compatible with version 1 (that is, a kernel build
443 for version 1 will be able to boot with a version 2 format). You
444 should put a 1 in this field if you generate a device tree of
David Gibson0e0293c2007-03-14 11:50:40 +1100445 version 1 to 3, or 16 if you generate a tree of version 16 or 17
David Gibsonc125a182006-02-01 03:05:22 -0800446 using the new unit name format.
447
448 - boot_cpuid_phys
449
450 This field only exist on version 2 headers. It indicate which
451 physical CPU ID is calling the kernel entry point. This is used,
452 among others, by kexec. If you are on an SMP system, this value
453 should match the content of the "reg" property of the CPU node in
454 the device-tree corresponding to the CPU calling the kernel entry
455 point (see further chapters for more informations on the required
456 device-tree contents)
457
David Gibson0e0293c2007-03-14 11:50:40 +1100458 - size_dt_strings
459
460 This field only exists on version 3 and later headers. It
461 gives the size of the "strings" section of the device tree (which
462 starts at the offset given by off_dt_strings).
463
464 - size_dt_struct
465
466 This field only exists on version 17 and later headers. It gives
467 the size of the "structure" section of the device tree (which
468 starts at the offset given by off_dt_struct).
David Gibsonc125a182006-02-01 03:05:22 -0800469
470 So the typical layout of a DT block (though the various parts don't
471 need to be in that order) looks like this (addresses go from top to
472 bottom):
473
474
475 ------------------------------
476 r3 -> | struct boot_param_header |
477 ------------------------------
478 | (alignment gap) (*) |
479 ------------------------------
480 | memory reserve map |
481 ------------------------------
482 | (alignment gap) |
483 ------------------------------
484 | |
485 | device-tree structure |
486 | |
487 ------------------------------
488 | (alignment gap) |
489 ------------------------------
490 | |
491 | device-tree strings |
492 | |
493 -----> ------------------------------
494 |
495 |
496 --- (r3 + totalsize)
497
498 (*) The alignment gaps are not necessarily present; their presence
499 and size are dependent on the various alignment requirements of
500 the individual data blocks.
501
502
5032) Device tree generalities
504---------------------------
505
506This device-tree itself is separated in two different blocks, a
507structure block and a strings block. Both need to be aligned to a 4
508byte boundary.
509
510First, let's quickly describe the device-tree concept before detailing
511the storage format. This chapter does _not_ describe the detail of the
512required types of nodes & properties for the kernel, this is done
513later in chapter III.
514
515The device-tree layout is strongly inherited from the definition of
516the Open Firmware IEEE 1275 device-tree. It's basically a tree of
517nodes, each node having two or more named properties. A property can
518have a value or not.
519
520It is a tree, so each node has one and only one parent except for the
521root node who has no parent.
522
523A node has 2 names. The actual node name is generally contained in a
524property of type "name" in the node property list whose value is a
525zero terminated string and is mandatory for version 1 to 3 of the
David Gibson0e0293c2007-03-14 11:50:40 +1100526format definition (as it is in Open Firmware). Version 16 makes it
David Gibsonc125a182006-02-01 03:05:22 -0800527optional as it can generate it from the unit name defined below.
528
Matt LaPlante2fe0ae72006-10-03 22:50:39 +0200529There is also a "unit name" that is used to differentiate nodes with
David Gibsonc125a182006-02-01 03:05:22 -0800530the same name at the same level, it is usually made of the node
Matt LaPlante2fe0ae72006-10-03 22:50:39 +0200531names, the "@" sign, and a "unit address", which definition is
David Gibsonc125a182006-02-01 03:05:22 -0800532specific to the bus type the node sits on.
533
534The unit name doesn't exist as a property per-se but is included in
535the device-tree structure. It is typically used to represent "path" in
536the device-tree. More details about the actual format of these will be
537below.
538
539The kernel powerpc generic code does not make any formal use of the
540unit address (though some board support code may do) so the only real
541requirement here for the unit address is to ensure uniqueness of
542the node unit name at a given level of the tree. Nodes with no notion
543of address and no possible sibling of the same name (like /memory or
544/cpus) may omit the unit address in the context of this specification,
545or use the "@0" default unit address. The unit name is used to define
546a node "full path", which is the concatenation of all parent node
547unit names separated with "/".
548
549The root node doesn't have a defined name, and isn't required to have
550a name property either if you are using version 3 or earlier of the
551format. It also has no unit address (no @ symbol followed by a unit
552address). The root node unit name is thus an empty string. The full
553path to the root node is "/".
554
555Every node which actually represents an actual device (that is, a node
556which isn't only a virtual "container" for more nodes, like "/cpus"
557is) is also required to have a "device_type" property indicating the
558type of node .
559
560Finally, every node that can be referenced from a property in another
561node is required to have a "linux,phandle" property. Real open
562firmware implementations provide a unique "phandle" value for every
563node that the "prom_init()" trampoline code turns into
564"linux,phandle" properties. However, this is made optional if the
565flattened device tree is used directly. An example of a node
566referencing another node via "phandle" is when laying out the
567interrupt tree which will be described in a further version of this
568document.
569
Domen Puncer5dd60162007-03-02 21:44:45 +1100570This "linux, phandle" property is a 32-bit value that uniquely
David Gibsonc125a182006-02-01 03:05:22 -0800571identifies a node. You are free to use whatever values or system of
572values, internal pointers, or whatever to generate these, the only
573requirement is that every node for which you provide that property has
574a unique value for it.
575
576Here is an example of a simple device-tree. In this example, an "o"
577designates a node followed by the node unit name. Properties are
578presented with their name followed by their content. "content"
579represents an ASCII string (zero terminated) value, while <content>
Domen Puncer5dd60162007-03-02 21:44:45 +1100580represents a 32-bit hexadecimal value. The various nodes in this
David Gibsonc125a182006-02-01 03:05:22 -0800581example will be discussed in a later chapter. At this point, it is
582only meant to give you a idea of what a device-tree looks like. I have
583purposefully kept the "name" and "linux,phandle" properties which
584aren't necessary in order to give you a better idea of what the tree
585looks like in practice.
586
587 / o device-tree
588 |- name = "device-tree"
589 |- model = "MyBoardName"
590 |- compatible = "MyBoardFamilyName"
591 |- #address-cells = <2>
592 |- #size-cells = <2>
593 |- linux,phandle = <0>
594 |
595 o cpus
596 | | - name = "cpus"
597 | | - linux,phandle = <1>
598 | | - #address-cells = <1>
599 | | - #size-cells = <0>
600 | |
601 | o PowerPC,970@0
602 | |- name = "PowerPC,970"
603 | |- device_type = "cpu"
604 | |- reg = <0>
605 | |- clock-frequency = <5f5e1000>
Timur Tabi32aed2a2007-02-14 15:29:07 -0600606 | |- 64-bit
David Gibsonc125a182006-02-01 03:05:22 -0800607 | |- linux,phandle = <2>
608 |
609 o memory@0
610 | |- name = "memory"
611 | |- device_type = "memory"
612 | |- reg = <00000000 00000000 00000000 20000000>
613 | |- linux,phandle = <3>
614 |
615 o chosen
616 |- name = "chosen"
617 |- bootargs = "root=/dev/sda2"
David Gibsonc125a182006-02-01 03:05:22 -0800618 |- linux,phandle = <4>
619
620This tree is almost a minimal tree. It pretty much contains the
621minimal set of required nodes and properties to boot a linux kernel;
622that is, some basic model informations at the root, the CPUs, and the
623physical memory layout. It also includes misc information passed
624through /chosen, like in this example, the platform type (mandatory)
625and the kernel command line arguments (optional).
626
Timur Tabi32aed2a2007-02-14 15:29:07 -0600627The /cpus/PowerPC,970@0/64-bit property is an example of a
David Gibsonc125a182006-02-01 03:05:22 -0800628property without a value. All other properties have a value. The
629significance of the #address-cells and #size-cells properties will be
630explained in chapter IV which defines precisely the required nodes and
631properties and their content.
632
633
6343) Device tree "structure" block
635
636The structure of the device tree is a linearized tree structure. The
637"OF_DT_BEGIN_NODE" token starts a new node, and the "OF_DT_END_NODE"
638ends that node definition. Child nodes are simply defined before
639"OF_DT_END_NODE" (that is nodes within the node). A 'token' is a 32
640bit value. The tree has to be "finished" with a OF_DT_END token
641
642Here's the basic structure of a single node:
643
644 * token OF_DT_BEGIN_NODE (that is 0x00000001)
645 * for version 1 to 3, this is the node full path as a zero
646 terminated string, starting with "/". For version 16 and later,
647 this is the node unit name only (or an empty string for the
648 root node)
649 * [align gap to next 4 bytes boundary]
650 * for each property:
651 * token OF_DT_PROP (that is 0x00000003)
Domen Puncer5dd60162007-03-02 21:44:45 +1100652 * 32-bit value of property value size in bytes (or 0 if no
653 value)
654 * 32-bit value of offset in string block of property name
David Gibsonc125a182006-02-01 03:05:22 -0800655 * property value data if any
656 * [align gap to next 4 bytes boundary]
657 * [child nodes if any]
658 * token OF_DT_END_NODE (that is 0x00000002)
659
Domen Puncer5dd60162007-03-02 21:44:45 +1100660So the node content can be summarized as a start token, a full path,
Matt LaPlante53cb4722006-10-03 22:55:17 +0200661a list of properties, a list of child nodes, and an end token. Every
David Gibsonc125a182006-02-01 03:05:22 -0800662child node is a full node structure itself as defined above.
663
David Gibsoneff2ebd2007-06-28 15:56:26 +1000664NOTE: The above definition requires that all property definitions for
665a particular node MUST precede any subnode definitions for that node.
666Although the structure would not be ambiguous if properties and
667subnodes were intermingled, the kernel parser requires that the
668properties come first (up until at least 2.6.22). Any tools
669manipulating a flattened tree must take care to preserve this
670constraint.
671
Matt LaPlante53cb4722006-10-03 22:55:17 +02006724) Device tree "strings" block
David Gibsonc125a182006-02-01 03:05:22 -0800673
674In order to save space, property names, which are generally redundant,
675are stored separately in the "strings" block. This block is simply the
676whole bunch of zero terminated strings for all property names
677concatenated together. The device-tree property definitions in the
678structure block will contain offset values from the beginning of the
679strings block.
680
681
682III - Required content of the device tree
683=========================================
684
685WARNING: All "linux,*" properties defined in this document apply only
686to a flattened device-tree. If your platform uses a real
687implementation of Open Firmware or an implementation compatible with
688the Open Firmware client interface, those properties will be created
689by the trampoline code in the kernel's prom_init() file. For example,
690that's where you'll have to add code to detect your board model and
Matt LaPlantea2ffd272006-10-03 22:49:15 +0200691set the platform number. However, when using the flattened device-tree
David Gibsonc125a182006-02-01 03:05:22 -0800692entry point, there is no prom_init() pass, and thus you have to
693provide those properties yourself.
694
695
6961) Note about cells and address representation
697----------------------------------------------
698
699The general rule is documented in the various Open Firmware
Domen Puncer5dd60162007-03-02 21:44:45 +1100700documentations. If you choose to describe a bus with the device-tree
David Gibsonc125a182006-02-01 03:05:22 -0800701and there exist an OF bus binding, then you should follow the
702specification. However, the kernel does not require every single
703device or bus to be described by the device tree.
704
705In general, the format of an address for a device is defined by the
706parent bus type, based on the #address-cells and #size-cells
Mark A. Greer5b14e5f2008-01-04 02:40:47 +1100707properties. Note that the parent's parent definitions of #address-cells
708and #size-cells are not inhereted so every node with children must specify
709them. The kernel requires the root node to have those properties defining
710addresses format for devices directly mapped on the processor bus.
David Gibsonc125a182006-02-01 03:05:22 -0800711
712Those 2 properties define 'cells' for representing an address and a
Domen Puncer5dd60162007-03-02 21:44:45 +1100713size. A "cell" is a 32-bit number. For example, if both contain 2
David Gibsonc125a182006-02-01 03:05:22 -0800714like the example tree given above, then an address and a size are both
Domen Puncer5dd60162007-03-02 21:44:45 +1100715composed of 2 cells, and each is a 64-bit number (cells are
David Gibsonc125a182006-02-01 03:05:22 -0800716concatenated and expected to be in big endian format). Another example
717is the way Apple firmware defines them, with 2 cells for an address
718and one cell for a size. Most 32-bit implementations should define
719#address-cells and #size-cells to 1, which represents a 32-bit value.
720Some 32-bit processors allow for physical addresses greater than 32
721bits; these processors should define #address-cells as 2.
722
723"reg" properties are always a tuple of the type "address size" where
724the number of cells of address and size is specified by the bus
725#address-cells and #size-cells. When a bus supports various address
726spaces and other flags relative to a given address allocation (like
727prefetchable, etc...) those flags are usually added to the top level
728bits of the physical address. For example, a PCI physical address is
729made of 3 cells, the bottom two containing the actual address itself
730while the top cell contains address space indication, flags, and pci
731bus & device numbers.
732
733For busses that support dynamic allocation, it's the accepted practice
734to then not provide the address in "reg" (keep it 0) though while
735providing a flag indicating the address is dynamically allocated, and
736then, to provide a separate "assigned-addresses" property that
737contains the fully allocated addresses. See the PCI OF bindings for
738details.
739
740In general, a simple bus with no address space bits and no dynamic
741allocation is preferred if it reflects your hardware, as the existing
742kernel address parsing functions will work out of the box. If you
743define a bus type with a more complex address format, including things
744like address space bits, you'll have to add a bus translator to the
745prom_parse.c file of the recent kernels for your bus type.
746
Stephen Neuendorffere1fd1862007-12-04 12:08:57 +1100747The "reg" property only defines addresses and sizes (if #size-cells is
748non-0) within a given bus. In order to translate addresses upward
Domen Puncer5dd60162007-03-02 21:44:45 +1100749(that is into parent bus addresses, and possibly into CPU physical
David Gibsonc125a182006-02-01 03:05:22 -0800750addresses), all busses must contain a "ranges" property. If the
751"ranges" property is missing at a given level, it's assumed that
Stephen Neuendorffere1fd1862007-12-04 12:08:57 +1100752translation isn't possible, i.e., the registers are not visible on the
753parent bus. The format of the "ranges" property for a bus is a list
754of:
David Gibsonc125a182006-02-01 03:05:22 -0800755
756 bus address, parent bus address, size
757
758"bus address" is in the format of the bus this bus node is defining,
759that is, for a PCI bridge, it would be a PCI address. Thus, (bus
760address, size) defines a range of addresses for child devices. "parent
761bus address" is in the format of the parent bus of this bus. For
762example, for a PCI host controller, that would be a CPU address. For a
763PCI<->ISA bridge, that would be a PCI address. It defines the base
764address in the parent bus where the beginning of that range is mapped.
765
Domen Puncer5dd60162007-03-02 21:44:45 +1100766For a new 64-bit powerpc board, I recommend either the 2/2 format or
David Gibsonc125a182006-02-01 03:05:22 -0800767Apple's 2/1 format which is slightly more compact since sizes usually
Domen Puncer5dd60162007-03-02 21:44:45 +1100768fit in a single 32-bit word. New 32-bit powerpc boards should use a
David Gibsonc125a182006-02-01 03:05:22 -08007691/1 format, unless the processor supports physical addresses greater
770than 32-bits, in which case a 2/1 format is recommended.
771
Stephen Neuendorffere1fd1862007-12-04 12:08:57 +1100772Alternatively, the "ranges" property may be empty, indicating that the
773registers are visible on the parent bus using an identity mapping
774translation. In other words, the parent bus address space is the same
775as the child bus address space.
David Gibsonc125a182006-02-01 03:05:22 -0800776
7772) Note about "compatible" properties
778-------------------------------------
779
780These properties are optional, but recommended in devices and the root
781node. The format of a "compatible" property is a list of concatenated
782zero terminated strings. They allow a device to express its
783compatibility with a family of similar devices, in some cases,
784allowing a single driver to match against several devices regardless
785of their actual names.
786
7873) Note about "name" properties
788-------------------------------
789
790While earlier users of Open Firmware like OldWorld macintoshes tended
791to use the actual device name for the "name" property, it's nowadays
792considered a good practice to use a name that is closer to the device
793class (often equal to device_type). For example, nowadays, ethernet
794controllers are named "ethernet", an additional "model" property
795defining precisely the chip type/model, and "compatible" property
796defining the family in case a single driver can driver more than one
797of these chips. However, the kernel doesn't generally put any
798restriction on the "name" property; it is simply considered good
799practice to follow the standard and its evolutions as closely as
800possible.
801
802Note also that the new format version 16 makes the "name" property
803optional. If it's absent for a node, then the node's unit name is then
804used to reconstruct the name. That is, the part of the unit name
805before the "@" sign is used (or the entire unit name if no "@" sign
806is present).
807
8084) Note about node and property names and character set
809-------------------------------------------------------
810
Matt LaPlantea2ffd272006-10-03 22:49:15 +0200811While open firmware provides more flexible usage of 8859-1, this
David Gibsonc125a182006-02-01 03:05:22 -0800812specification enforces more strict rules. Nodes and properties should
813be comprised only of ASCII characters 'a' to 'z', '0' to
814'9', ',', '.', '_', '+', '#', '?', and '-'. Node names additionally
815allow uppercase characters 'A' to 'Z' (property names should be
816lowercase. The fact that vendors like Apple don't respect this rule is
817irrelevant here). Additionally, node and property names should always
818begin with a character in the range 'a' to 'z' (or 'A' to 'Z' for node
819names).
820
821The maximum number of characters for both nodes and property names
822is 31. In the case of node names, this is only the leftmost part of
823a unit name (the pure "name" property), it doesn't include the unit
824address which can extend beyond that limit.
825
826
8275) Required nodes and properties
828--------------------------------
829 These are all that are currently required. However, it is strongly
830 recommended that you expose PCI host bridges as documented in the
831 PCI binding to open firmware, and your interrupt tree as documented
832 in OF interrupt tree specification.
833
834 a) The root node
835
836 The root node requires some properties to be present:
837
838 - model : this is your board name/model
839 - #address-cells : address representation for "root" devices
840 - #size-cells: the size representation for "root" devices
Benjamin Herrenschmidte8222502006-03-28 23:15:54 +1100841 - device_type : This property shouldn't be necessary. However, if
842 you decide to create a device_type for your root node, make sure it
843 is _not_ "chrp" unless your platform is a pSeries or PAPR compliant
844 one for 64-bit, or a CHRP-type machine for 32-bit as this will
845 matched by the kernel this way.
David Gibsonc125a182006-02-01 03:05:22 -0800846
847 Additionally, some recommended properties are:
848
849 - compatible : the board "family" generally finds its way here,
850 for example, if you have 2 board models with a similar layout,
851 that typically get driven by the same platform code in the
852 kernel, you would use a different "model" property but put a
853 value in "compatible". The kernel doesn't directly use that
Stuart Yoder143a42d2007-02-16 11:30:29 -0600854 value but it is generally useful.
David Gibsonc125a182006-02-01 03:05:22 -0800855
856 The root node is also generally where you add additional properties
857 specific to your board like the serial number if any, that sort of
Matt LaPlante6c28f2c2006-10-03 22:46:31 +0200858 thing. It is recommended that if you add any "custom" property whose
David Gibsonc125a182006-02-01 03:05:22 -0800859 name may clash with standard defined ones, you prefix them with your
860 vendor name and a comma.
861
862 b) The /cpus node
863
864 This node is the parent of all individual CPU nodes. It doesn't
865 have any specific requirements, though it's generally good practice
866 to have at least:
867
868 #address-cells = <00000001>
869 #size-cells = <00000000>
870
871 This defines that the "address" for a CPU is a single cell, and has
872 no meaningful size. This is not necessary but the kernel will assume
873 that format when reading the "reg" properties of a CPU node, see
874 below
875
876 c) The /cpus/* nodes
877
878 So under /cpus, you are supposed to create a node for every CPU on
879 the machine. There is no specific restriction on the name of the
880 CPU, though It's common practice to call it PowerPC,<name>. For
881 example, Apple uses PowerPC,G5 while IBM uses PowerPC,970FX.
882
883 Required properties:
884
885 - device_type : has to be "cpu"
Domen Puncer5dd60162007-03-02 21:44:45 +1100886 - reg : This is the physical CPU number, it's a single 32-bit cell
David Gibsonc125a182006-02-01 03:05:22 -0800887 and is also used as-is as the unit number for constructing the
888 unit name in the full path. For example, with 2 CPUs, you would
889 have the full path:
890 /cpus/PowerPC,970FX@0
891 /cpus/PowerPC,970FX@1
892 (unit addresses do not require leading zeroes)
Benjamin Herrenschmidt20474ab2007-10-28 08:49:28 +1100893 - d-cache-block-size : one cell, L1 data cache block size in bytes (*)
894 - i-cache-block-size : one cell, L1 instruction cache block size in
David Gibsonc125a182006-02-01 03:05:22 -0800895 bytes
896 - d-cache-size : one cell, size of L1 data cache in bytes
897 - i-cache-size : one cell, size of L1 instruction cache in bytes
David Gibsonc125a182006-02-01 03:05:22 -0800898
Benjamin Herrenschmidt20474ab2007-10-28 08:49:28 +1100899(*) The cache "block" size is the size on which the cache management
900instructions operate. Historically, this document used the cache
901"line" size here which is incorrect. The kernel will prefer the cache
902block size and will fallback to cache line size for backward
903compatibility.
904
David Gibsonc125a182006-02-01 03:05:22 -0800905 Recommended properties:
906
907 - timebase-frequency : a cell indicating the frequency of the
908 timebase in Hz. This is not directly used by the generic code,
909 but you are welcome to copy/paste the pSeries code for setting
910 the kernel timebase/decrementer calibration based on this
911 value.
912 - clock-frequency : a cell indicating the CPU core clock frequency
Domen Puncer5dd60162007-03-02 21:44:45 +1100913 in Hz. A new property will be defined for 64-bit values, but if
David Gibsonc125a182006-02-01 03:05:22 -0800914 your frequency is < 4Ghz, one cell is enough. Here as well as
915 for the above, the common code doesn't use that property, but
916 you are welcome to re-use the pSeries or Maple one. A future
917 kernel version might provide a common function for this.
Benjamin Herrenschmidt20474ab2007-10-28 08:49:28 +1100918 - d-cache-line-size : one cell, L1 data cache line size in bytes
919 if different from the block size
920 - i-cache-line-size : one cell, L1 instruction cache line size in
921 bytes if different from the block size
David Gibsonc125a182006-02-01 03:05:22 -0800922
923 You are welcome to add any property you find relevant to your board,
924 like some information about the mechanism used to soft-reset the
925 CPUs. For example, Apple puts the GPIO number for CPU soft reset
926 lines in there as a "soft-reset" property since they start secondary
927 CPUs by soft-resetting them.
928
929
930 d) the /memory node(s)
931
932 To define the physical memory layout of your board, you should
933 create one or more memory node(s). You can either create a single
934 node with all memory ranges in its reg property, or you can create
935 several nodes, as you wish. The unit address (@ part) used for the
936 full path is the address of the first range of memory defined by a
937 given node. If you use a single memory node, this will typically be
938 @0.
939
940 Required properties:
941
942 - device_type : has to be "memory"
943 - reg : This property contains all the physical memory ranges of
944 your board. It's a list of addresses/sizes concatenated
945 together, with the number of cells of each defined by the
946 #address-cells and #size-cells of the root node. For example,
Matt LaPlante6c28f2c2006-10-03 22:46:31 +0200947 with both of these properties being 2 like in the example given
David Gibsonc125a182006-02-01 03:05:22 -0800948 earlier, a 970 based machine with 6Gb of RAM could typically
949 have a "reg" property here that looks like:
950
951 00000000 00000000 00000000 80000000
952 00000001 00000000 00000001 00000000
953
954 That is a range starting at 0 of 0x80000000 bytes and a range
955 starting at 0x100000000 and of 0x100000000 bytes. You can see
956 that there is no memory covering the IO hole between 2Gb and
957 4Gb. Some vendors prefer splitting those ranges into smaller
958 segments, but the kernel doesn't care.
959
960 e) The /chosen node
961
962 This node is a bit "special". Normally, that's where open firmware
963 puts some variable environment information, like the arguments, or
Stuart Yoderd1bff9e2007-02-19 11:25:05 -0600964 the default input/output devices.
David Gibsonc125a182006-02-01 03:05:22 -0800965
966 This specification makes a few of these mandatory, but also defines
967 some linux-specific properties that would be normally constructed by
968 the prom_init() trampoline when booting with an OF client interface,
969 but that you have to provide yourself when using the flattened format.
970
David Gibsonc125a182006-02-01 03:05:22 -0800971 Recommended properties:
972
973 - bootargs : This zero-terminated string is passed as the kernel
974 command line
975 - linux,stdout-path : This is the full path to your standard
976 console device if any. Typically, if you have serial devices on
977 your board, you may want to put the full path to the one set as
978 the default console in the firmware here, for the kernel to pick
Matt LaPlante5d3f0832006-11-30 05:21:10 +0100979 it up as its own default console. If you look at the function
David Gibsonc125a182006-02-01 03:05:22 -0800980 set_preferred_console() in arch/ppc64/kernel/setup.c, you'll see
981 that the kernel tries to find out the default console and has
982 knowledge of various types like 8250 serial ports. You may want
983 to extend this function to add your own.
David Gibsonc125a182006-02-01 03:05:22 -0800984
985 Note that u-boot creates and fills in the chosen node for platforms
986 that use it.
987
Stuart Yoderd1bff9e2007-02-19 11:25:05 -0600988 (Note: a practice that is now obsolete was to include a property
989 under /chosen called interrupt-controller which had a phandle value
990 that pointed to the main interrupt controller)
991
David Gibsonc125a182006-02-01 03:05:22 -0800992 f) the /soc<SOCname> node
993
994 This node is used to represent a system-on-a-chip (SOC) and must be
995 present if the processor is a SOC. The top-level soc node contains
996 information that is global to all devices on the SOC. The node name
997 should contain a unit address for the SOC, which is the base address
998 of the memory-mapped register set for the SOC. The name of an soc
999 node should start with "soc", and the remainder of the name should
1000 represent the part number for the soc. For example, the MPC8540's
1001 soc node would be called "soc8540".
1002
1003 Required properties:
1004
1005 - device_type : Should be "soc"
1006 - ranges : Should be defined as specified in 1) to describe the
1007 translation of SOC addresses for memory mapped SOC registers.
Becky Bruce7d4b95a2006-02-06 14:26:31 -06001008 - bus-frequency: Contains the bus frequency for the SOC node.
1009 Typically, the value of this field is filled in by the boot
1010 loader.
1011
David Gibsonc125a182006-02-01 03:05:22 -08001012
1013 Recommended properties:
1014
1015 - reg : This property defines the address and size of the
1016 memory-mapped registers that are used for the SOC node itself.
1017 It does not include the child device registers - these will be
1018 defined inside each child node. The address specified in the
1019 "reg" property should match the unit address of the SOC node.
1020 - #address-cells : Address representation for "soc" devices. The
1021 format of this field may vary depending on whether or not the
1022 device registers are memory mapped. For memory mapped
1023 registers, this field represents the number of cells needed to
1024 represent the address of the registers. For SOCs that do not
1025 use MMIO, a special address format should be defined that
1026 contains enough cells to represent the required information.
1027 See 1) above for more details on defining #address-cells.
1028 - #size-cells : Size representation for "soc" devices
1029 - #interrupt-cells : Defines the width of cells used to represent
1030 interrupts. Typically this value is <2>, which includes a
1031 32-bit number that represents the interrupt number, and a
1032 32-bit number that represents the interrupt sense and level.
1033 This field is only needed if the SOC contains an interrupt
1034 controller.
1035
1036 The SOC node may contain child nodes for each SOC device that the
1037 platform uses. Nodes should not be created for devices which exist
1038 on the SOC but are not used by a particular platform. See chapter VI
Domen Puncer5dd60162007-03-02 21:44:45 +11001039 for more information on how to specify devices that are part of a SOC.
David Gibsonc125a182006-02-01 03:05:22 -08001040
1041 Example SOC node for the MPC8540:
1042
1043 soc8540@e0000000 {
1044 #address-cells = <1>;
1045 #size-cells = <1>;
1046 #interrupt-cells = <2>;
1047 device_type = "soc";
1048 ranges = <00000000 e0000000 00100000>
1049 reg = <e0000000 00003000>;
Becky Bruce7d4b95a2006-02-06 14:26:31 -06001050 bus-frequency = <0>;
David Gibsonc125a182006-02-01 03:05:22 -08001051 }
1052
1053
1054
1055IV - "dtc", the device tree compiler
1056====================================
1057
1058
1059dtc source code can be found at
1060<http://ozlabs.org/~dgibson/dtc/dtc.tar.gz>
1061
1062WARNING: This version is still in early development stage; the
1063resulting device-tree "blobs" have not yet been validated with the
1064kernel. The current generated bloc lacks a useful reserve map (it will
1065be fixed to generate an empty one, it's up to the bootloader to fill
1066it up) among others. The error handling needs work, bugs are lurking,
1067etc...
1068
1069dtc basically takes a device-tree in a given format and outputs a
1070device-tree in another format. The currently supported formats are:
1071
1072 Input formats:
1073 -------------
1074
1075 - "dtb": "blob" format, that is a flattened device-tree block
1076 with
1077 header all in a binary blob.
1078 - "dts": "source" format. This is a text file containing a
1079 "source" for a device-tree. The format is defined later in this
1080 chapter.
1081 - "fs" format. This is a representation equivalent to the
1082 output of /proc/device-tree, that is nodes are directories and
1083 properties are files
1084
1085 Output formats:
1086 ---------------
1087
1088 - "dtb": "blob" format
1089 - "dts": "source" format
1090 - "asm": assembly language file. This is a file that can be
1091 sourced by gas to generate a device-tree "blob". That file can
1092 then simply be added to your Makefile. Additionally, the
Matt LaPlante6c28f2c2006-10-03 22:46:31 +02001093 assembly file exports some symbols that can be used.
David Gibsonc125a182006-02-01 03:05:22 -08001094
1095
1096The syntax of the dtc tool is
1097
1098 dtc [-I <input-format>] [-O <output-format>]
1099 [-o output-filename] [-V output_version] input_filename
1100
1101
Domen Puncer5dd60162007-03-02 21:44:45 +11001102The "output_version" defines what version of the "blob" format will be
David Gibsonc125a182006-02-01 03:05:22 -08001103generated. Supported versions are 1,2,3 and 16. The default is
1104currently version 3 but that may change in the future to version 16.
1105
1106Additionally, dtc performs various sanity checks on the tree, like the
Matt LaPlante6c28f2c2006-10-03 22:46:31 +02001107uniqueness of linux, phandle properties, validity of strings, etc...
David Gibsonc125a182006-02-01 03:05:22 -08001108
1109The format of the .dts "source" file is "C" like, supports C and C++
Matt LaPlante6c28f2c2006-10-03 22:46:31 +02001110style comments.
David Gibsonc125a182006-02-01 03:05:22 -08001111
1112/ {
1113}
1114
1115The above is the "device-tree" definition. It's the only statement
1116supported currently at the toplevel.
1117
1118/ {
1119 property1 = "string_value"; /* define a property containing a 0
1120 * terminated string
1121 */
1122
1123 property2 = <1234abcd>; /* define a property containing a
Domen Puncer5dd60162007-03-02 21:44:45 +11001124 * numerical 32-bit value (hexadecimal)
David Gibsonc125a182006-02-01 03:05:22 -08001125 */
1126
1127 property3 = <12345678 12345678 deadbeef>;
1128 /* define a property containing 3
Domen Puncer5dd60162007-03-02 21:44:45 +11001129 * numerical 32-bit values (cells) in
David Gibsonc125a182006-02-01 03:05:22 -08001130 * hexadecimal
1131 */
1132 property4 = [0a 0b 0c 0d de ea ad be ef];
1133 /* define a property whose content is
1134 * an arbitrary array of bytes
1135 */
1136
1137 childnode@addresss { /* define a child node named "childnode"
1138 * whose unit name is "childnode at
1139 * address"
1140 */
1141
1142 childprop = "hello\n"; /* define a property "childprop" of
1143 * childnode (in this case, a string)
1144 */
1145 };
1146};
1147
1148Nodes can contain other nodes etc... thus defining the hierarchical
1149structure of the tree.
1150
1151Strings support common escape sequences from C: "\n", "\t", "\r",
1152"\(octal value)", "\x(hex value)".
1153
1154It is also suggested that you pipe your source file through cpp (gcc
1155preprocessor) so you can use #include's, #define for constants, etc...
1156
1157Finally, various options are planned but not yet implemented, like
1158automatic generation of phandles, labels (exported to the asm file so
1159you can point to a property content and change it easily from whatever
1160you link the device-tree with), label or path instead of numeric value
1161in some cells to "point" to a node (replaced by a phandle at compile
1162time), export of reserve map address to the asm file, ability to
1163specify reserve map content at compile time, etc...
1164
1165We may provide a .h include file with common definitions of that
1166proves useful for some properties (like building PCI properties or
1167interrupt maps) though it may be better to add a notion of struct
1168definitions to the compiler...
1169
1170
1171V - Recommendations for a bootloader
1172====================================
1173
1174
1175Here are some various ideas/recommendations that have been proposed
1176while all this has been defined and implemented.
1177
1178 - The bootloader may want to be able to use the device-tree itself
1179 and may want to manipulate it (to add/edit some properties,
1180 like physical memory size or kernel arguments). At this point, 2
1181 choices can be made. Either the bootloader works directly on the
1182 flattened format, or the bootloader has its own internal tree
1183 representation with pointers (similar to the kernel one) and
1184 re-flattens the tree when booting the kernel. The former is a bit
1185 more difficult to edit/modify, the later requires probably a bit
1186 more code to handle the tree structure. Note that the structure
1187 format has been designed so it's relatively easy to "insert"
1188 properties or nodes or delete them by just memmoving things
1189 around. It contains no internal offsets or pointers for this
1190 purpose.
1191
Matt LaPlanted6bc8ac2006-10-03 22:54:15 +02001192 - An example of code for iterating nodes & retrieving properties
David Gibsonc125a182006-02-01 03:05:22 -08001193 directly from the flattened tree format can be found in the kernel
1194 file arch/ppc64/kernel/prom.c, look at scan_flat_dt() function,
Matt LaPlanted6bc8ac2006-10-03 22:54:15 +02001195 its usage in early_init_devtree(), and the corresponding various
David Gibsonc125a182006-02-01 03:05:22 -08001196 early_init_dt_scan_*() callbacks. That code can be re-used in a
1197 GPL bootloader, and as the author of that code, I would be happy
Domen Puncer5dd60162007-03-02 21:44:45 +11001198 to discuss possible free licensing to any vendor who wishes to
David Gibsonc125a182006-02-01 03:05:22 -08001199 integrate all or part of this code into a non-GPL bootloader.
1200
1201
1202
1203VI - System-on-a-chip devices and nodes
1204=======================================
1205
1206Many companies are now starting to develop system-on-a-chip
Domen Puncer5dd60162007-03-02 21:44:45 +11001207processors, where the processor core (CPU) and many peripheral devices
David Gibsonc125a182006-02-01 03:05:22 -08001208exist on a single piece of silicon. For these SOCs, an SOC node
1209should be used that defines child nodes for the devices that make
1210up the SOC. While platforms are not required to use this model in
1211order to boot the kernel, it is highly encouraged that all SOC
1212implementations define as complete a flat-device-tree as possible to
1213describe the devices on the SOC. This will allow for the
1214genericization of much of the kernel code.
1215
1216
12171) Defining child nodes of an SOC
1218---------------------------------
1219
1220Each device that is part of an SOC may have its own node entry inside
1221the SOC node. For each device that is included in the SOC, the unit
1222address property represents the address offset for this device's
1223memory-mapped registers in the parent's address space. The parent's
1224address space is defined by the "ranges" property in the top-level soc
1225node. The "reg" property for each node that exists directly under the
1226SOC node should contain the address mapping from the child address space
1227to the parent SOC address space and the size of the device's
1228memory-mapped register file.
1229
1230For many devices that may exist inside an SOC, there are predefined
1231specifications for the format of the device tree node. All SOC child
1232nodes should follow these specifications, except where noted in this
1233document.
1234
1235See appendix A for an example partial SOC node definition for the
1236MPC8540.
1237
1238
Stuart Yoder27565902007-03-02 13:42:33 -060012392) Representing devices without a current OF specification
David Gibsonc125a182006-02-01 03:05:22 -08001240----------------------------------------------------------
1241
1242Currently, there are many devices on SOCs that do not have a standard
1243representation pre-defined as part of the open firmware
1244specifications, mainly because the boards that contain these SOCs are
1245not currently booted using open firmware. This section contains
1246descriptions for the SOC devices for which new nodes have been
1247defined; this list will expand as more and more SOC-containing
1248platforms are moved over to use the flattened-device-tree model.
1249
1250 a) MDIO IO device
1251
1252 The MDIO is a bus to which the PHY devices are connected. For each
1253 device that exists on this bus, a child node should be created. See
1254 the definition of the PHY node below for an example of how to define
1255 a PHY.
1256
1257 Required properties:
1258 - reg : Offset and length of the register set for the device
David Gibsonc125a182006-02-01 03:05:22 -08001259 - compatible : Should define the compatible device type for the
Kumar Galae77b28e2007-12-12 00:28:35 -06001260 mdio. Currently, this is most likely to be "fsl,gianfar-mdio"
David Gibsonc125a182006-02-01 03:05:22 -08001261
1262 Example:
1263
1264 mdio@24520 {
1265 reg = <24520 20>;
Kumar Galae77b28e2007-12-12 00:28:35 -06001266 compatible = "fsl,gianfar-mdio";
David Gibsonc125a182006-02-01 03:05:22 -08001267
1268 ethernet-phy@0 {
1269 ......
1270 };
1271 };
1272
1273
1274 b) Gianfar-compatible ethernet nodes
1275
1276 Required properties:
1277
1278 - device_type : Should be "network"
1279 - model : Model of the device. Can be "TSEC", "eTSEC", or "FEC"
1280 - compatible : Should be "gianfar"
1281 - reg : Offset and length of the register set for the device
Jon Loeligerf5831652006-08-17 08:42:35 -05001282 - mac-address : List of bytes representing the ethernet address of
David Gibsonc125a182006-02-01 03:05:22 -08001283 this controller
1284 - interrupts : <a b> where a is the interrupt number and b is a
1285 field that represents an encoding of the sense and level
1286 information for the interrupt. This should be encoded based on
1287 the information in section 2) depending on the type of interrupt
1288 controller you have.
1289 - interrupt-parent : the phandle for the interrupt controller that
1290 services interrupts for this device.
1291 - phy-handle : The phandle for the PHY connected to this ethernet
1292 controller.
Vitaly Borduga21e2822007-12-07 01:51:31 +03001293 - fixed-link : <a b c d e> where a is emulated phy id - choose any,
1294 but unique to the all specified fixed-links, b is duplex - 0 half,
1295 1 full, c is link speed - d#10/d#100/d#1000, d is pause - 0 no
1296 pause, 1 pause, e is asym_pause - 0 no asym_pause, 1 asym_pause.
David Gibsonc125a182006-02-01 03:05:22 -08001297
Scott Woode0a2f282007-03-16 12:28:46 -05001298 Recommended properties:
1299
Andy Flemingcc651852007-07-10 17:28:49 -05001300 - phy-connection-type : a string naming the controller/PHY interface type,
1301 i.e., "mii" (default), "rmii", "gmii", "rgmii", "rgmii-id", "sgmii",
1302 "tbi", or "rtbi". This property is only really needed if the connection
1303 is of type "rgmii-id", as all other connection types are detected by
1304 hardware.
1305
Scott Woode0a2f282007-03-16 12:28:46 -05001306
David Gibsonc125a182006-02-01 03:05:22 -08001307 Example:
1308
1309 ethernet@24000 {
1310 #size-cells = <0>;
1311 device_type = "network";
1312 model = "TSEC";
1313 compatible = "gianfar";
1314 reg = <24000 1000>;
Jon Loeligerf5831652006-08-17 08:42:35 -05001315 mac-address = [ 00 E0 0C 00 73 00 ];
David Gibsonc125a182006-02-01 03:05:22 -08001316 interrupts = <d 3 e 3 12 3>;
1317 interrupt-parent = <40000>;
1318 phy-handle = <2452000>
1319 };
1320
1321
1322
1323 c) PHY nodes
1324
1325 Required properties:
1326
1327 - device_type : Should be "ethernet-phy"
1328 - interrupts : <a b> where a is the interrupt number and b is a
1329 field that represents an encoding of the sense and level
1330 information for the interrupt. This should be encoded based on
1331 the information in section 2) depending on the type of interrupt
1332 controller you have.
1333 - interrupt-parent : the phandle for the interrupt controller that
1334 services interrupts for this device.
1335 - reg : The ID number for the phy, usually a small integer
1336 - linux,phandle : phandle for this node; likely referenced by an
1337 ethernet controller node.
1338
1339
1340 Example:
1341
1342 ethernet-phy@0 {
1343 linux,phandle = <2452000>
1344 interrupt-parent = <40000>;
1345 interrupts = <35 1>;
1346 reg = <0>;
1347 device_type = "ethernet-phy";
1348 };
1349
1350
1351 d) Interrupt controllers
1352
1353 Some SOC devices contain interrupt controllers that are different
1354 from the standard Open PIC specification. The SOC device nodes for
1355 these types of controllers should be specified just like a standard
1356 OpenPIC controller. Sense and level information should be encoded
1357 as specified in section 2) of this chapter for each device that
1358 specifies an interrupt.
1359
1360 Example :
1361
1362 pic@40000 {
1363 linux,phandle = <40000>;
1364 clock-frequency = <0>;
1365 interrupt-controller;
1366 #address-cells = <0>;
1367 reg = <40000 40000>;
1368 built-in;
1369 compatible = "chrp,open-pic";
1370 device_type = "open-pic";
1371 big-endian;
1372 };
1373
1374
1375 e) I2C
1376
1377 Required properties :
1378
1379 - device_type : Should be "i2c"
1380 - reg : Offset and length of the register set for the device
1381
1382 Recommended properties :
1383
1384 - compatible : Should be "fsl-i2c" for parts compatible with
1385 Freescale I2C specifications.
1386 - interrupts : <a b> where a is the interrupt number and b is a
1387 field that represents an encoding of the sense and level
1388 information for the interrupt. This should be encoded based on
1389 the information in section 2) depending on the type of interrupt
1390 controller you have.
1391 - interrupt-parent : the phandle for the interrupt controller that
1392 services interrupts for this device.
1393 - dfsrr : boolean; if defined, indicates that this I2C device has
1394 a digital filter sampling rate register
1395 - fsl5200-clocking : boolean; if defined, indicated that this device
1396 uses the FSL 5200 clocking mechanism.
1397
1398 Example :
1399
1400 i2c@3000 {
1401 interrupt-parent = <40000>;
1402 interrupts = <1b 3>;
1403 reg = <3000 18>;
1404 device_type = "i2c";
1405 compatible = "fsl-i2c";
1406 dfsrr;
1407 };
1408
1409
Becky Brucead71f122006-02-07 13:44:08 -06001410 f) Freescale SOC USB controllers
1411
1412 The device node for a USB controller that is part of a Freescale
1413 SOC is as described in the document "Open Firmware Recommended
1414 Practice : Universal Serial Bus" with the following modifications
1415 and additions :
1416
1417 Required properties :
Domen Puncer5dd60162007-03-02 21:44:45 +11001418 - compatible : Should be "fsl-usb2-mph" for multi port host USB
1419 controllers, or "fsl-usb2-dr" for dual role USB controllers
1420 - phy_type : For multi port host USB controllers, should be one of
1421 "ulpi", or "serial". For dual role USB controllers, should be
Becky Brucead71f122006-02-07 13:44:08 -06001422 one of "ulpi", "utmi", "utmi_wide", or "serial".
1423 - reg : Offset and length of the register set for the device
1424 - port0 : boolean; if defined, indicates port0 is connected for
1425 fsl-usb2-mph compatible controllers. Either this property or
1426 "port1" (or both) must be defined for "fsl-usb2-mph" compatible
1427 controllers.
1428 - port1 : boolean; if defined, indicates port1 is connected for
1429 fsl-usb2-mph compatible controllers. Either this property or
1430 "port0" (or both) must be defined for "fsl-usb2-mph" compatible
1431 controllers.
Li Yangea5b7a62007-02-07 13:51:09 +08001432 - dr_mode : indicates the working mode for "fsl-usb2-dr" compatible
1433 controllers. Can be "host", "peripheral", or "otg". Default to
1434 "host" if not defined for backward compatibility.
Becky Brucead71f122006-02-07 13:44:08 -06001435
1436 Recommended properties :
1437 - interrupts : <a b> where a is the interrupt number and b is a
1438 field that represents an encoding of the sense and level
1439 information for the interrupt. This should be encoded based on
1440 the information in section 2) depending on the type of interrupt
1441 controller you have.
1442 - interrupt-parent : the phandle for the interrupt controller that
1443 services interrupts for this device.
1444
Domen Puncer5dd60162007-03-02 21:44:45 +11001445 Example multi port host USB controller device node :
Becky Brucead71f122006-02-07 13:44:08 -06001446 usb@22000 {
Becky Brucead71f122006-02-07 13:44:08 -06001447 compatible = "fsl-usb2-mph";
1448 reg = <22000 1000>;
1449 #address-cells = <1>;
1450 #size-cells = <0>;
1451 interrupt-parent = <700>;
1452 interrupts = <27 1>;
1453 phy_type = "ulpi";
1454 port0;
1455 port1;
1456 };
1457
Domen Puncer5dd60162007-03-02 21:44:45 +11001458 Example dual role USB controller device node :
Becky Brucead71f122006-02-07 13:44:08 -06001459 usb@23000 {
Becky Brucead71f122006-02-07 13:44:08 -06001460 compatible = "fsl-usb2-dr";
1461 reg = <23000 1000>;
1462 #address-cells = <1>;
1463 #size-cells = <0>;
1464 interrupt-parent = <700>;
1465 interrupts = <26 1>;
Li Yangea5b7a62007-02-07 13:51:09 +08001466 dr_mode = "otg";
Becky Brucead71f122006-02-07 13:44:08 -06001467 phy = "ulpi";
1468 };
1469
1470
Kim Phillipsb88a0b12006-03-22 14:39:03 -06001471 g) Freescale SOC SEC Security Engines
1472
1473 Required properties:
1474
1475 - device_type : Should be "crypto"
1476 - model : Model of the device. Should be "SEC1" or "SEC2"
1477 - compatible : Should be "talitos"
1478 - reg : Offset and length of the register set for the device
1479 - interrupts : <a b> where a is the interrupt number and b is a
1480 field that represents an encoding of the sense and level
1481 information for the interrupt. This should be encoded based on
1482 the information in section 2) depending on the type of interrupt
1483 controller you have.
1484 - interrupt-parent : the phandle for the interrupt controller that
1485 services interrupts for this device.
1486 - num-channels : An integer representing the number of channels
1487 available.
1488 - channel-fifo-len : An integer representing the number of
1489 descriptor pointers each channel fetch fifo can hold.
1490 - exec-units-mask : The bitmask representing what execution units
Domen Puncer5dd60162007-03-02 21:44:45 +11001491 (EUs) are available. It's a single 32-bit cell. EU information
Kim Phillipsb88a0b12006-03-22 14:39:03 -06001492 should be encoded following the SEC's Descriptor Header Dword
1493 EU_SEL0 field documentation, i.e. as follows:
1494
1495 bit 0 = reserved - should be 0
1496 bit 1 = set if SEC has the ARC4 EU (AFEU)
1497 bit 2 = set if SEC has the DES/3DES EU (DEU)
1498 bit 3 = set if SEC has the message digest EU (MDEU)
1499 bit 4 = set if SEC has the random number generator EU (RNG)
1500 bit 5 = set if SEC has the public key EU (PKEU)
1501 bit 6 = set if SEC has the AES EU (AESU)
1502 bit 7 = set if SEC has the Kasumi EU (KEU)
1503
1504 bits 8 through 31 are reserved for future SEC EUs.
1505
1506 - descriptor-types-mask : The bitmask representing what descriptors
Domen Puncer5dd60162007-03-02 21:44:45 +11001507 are available. It's a single 32-bit cell. Descriptor type
Kim Phillipsb88a0b12006-03-22 14:39:03 -06001508 information should be encoded following the SEC's Descriptor
1509 Header Dword DESC_TYPE field documentation, i.e. as follows:
1510
1511 bit 0 = set if SEC supports the aesu_ctr_nonsnoop desc. type
1512 bit 1 = set if SEC supports the ipsec_esp descriptor type
1513 bit 2 = set if SEC supports the common_nonsnoop desc. type
1514 bit 3 = set if SEC supports the 802.11i AES ccmp desc. type
1515 bit 4 = set if SEC supports the hmac_snoop_no_afeu desc. type
1516 bit 5 = set if SEC supports the srtp descriptor type
1517 bit 6 = set if SEC supports the non_hmac_snoop_no_afeu desc.type
1518 bit 7 = set if SEC supports the pkeu_assemble descriptor type
1519 bit 8 = set if SEC supports the aesu_key_expand_output desc.type
1520 bit 9 = set if SEC supports the pkeu_ptmul descriptor type
1521 bit 10 = set if SEC supports the common_nonsnoop_afeu desc. type
1522 bit 11 = set if SEC supports the pkeu_ptadd_dbl descriptor type
1523
1524 ..and so on and so forth.
1525
1526 Example:
1527
1528 /* MPC8548E */
1529 crypto@30000 {
1530 device_type = "crypto";
1531 model = "SEC2";
1532 compatible = "talitos";
1533 reg = <30000 10000>;
1534 interrupts = <1d 3>;
1535 interrupt-parent = <40000>;
1536 num-channels = <4>;
Kim Phillipscbdb54d2006-07-03 15:10:14 -05001537 channel-fifo-len = <18>;
Kim Phillipsb88a0b12006-03-22 14:39:03 -06001538 exec-units-mask = <000000fe>;
Kim Phillipscbdb54d2006-07-03 15:10:14 -05001539 descriptor-types-mask = <012b0ebf>;
Kim Phillipsb88a0b12006-03-22 14:39:03 -06001540 };
1541
Li Yang9a1ab882006-10-02 20:08:59 -05001542 h) Board Control and Status (BCSR)
1543
1544 Required properties:
1545
1546 - device_type : Should be "board-control"
1547 - reg : Offset and length of the register set for the device
1548
1549 Example:
1550
1551 bcsr@f8000000 {
1552 device_type = "board-control";
1553 reg = <f8000000 8000>;
1554 };
1555
1556 i) Freescale QUICC Engine module (QE)
1557 This represents qe module that is installed on PowerQUICC II Pro.
Scott Woode631ae32007-09-14 13:04:54 -05001558
1559 NOTE: This is an interim binding; it should be updated to fit
1560 in with the CPM binding later in this document.
1561
Li Yang9a1ab882006-10-02 20:08:59 -05001562 Basically, it is a bus of devices, that could act more or less
1563 as a complete entity (UCC, USB etc ). All of them should be siblings on
1564 the "root" qe node, using the common properties from there.
Michael Opdenacker59c51592007-05-09 08:57:56 +02001565 The description below applies to the qe of MPC8360 and
Li Yang9a1ab882006-10-02 20:08:59 -05001566 more nodes and properties would be extended in the future.
1567
1568 i) Root QE device
1569
1570 Required properties:
Anton Vorontsova2dd70a2008-01-24 18:39:59 +03001571 - compatible : should be "fsl,qe";
Li Yang9a1ab882006-10-02 20:08:59 -05001572 - model : precise model of the QE, Can be "QE", "CPM", or "CPM2"
1573 - reg : offset and length of the device registers.
1574 - bus-frequency : the clock frequency for QUICC Engine.
1575
1576 Recommended properties
1577 - brg-frequency : the internal clock source frequency for baud-rate
1578 generators in Hz.
1579
1580 Example:
1581 qe@e0100000 {
1582 #address-cells = <1>;
1583 #size-cells = <1>;
1584 #interrupt-cells = <2>;
Anton Vorontsova2dd70a2008-01-24 18:39:59 +03001585 compatible = "fsl,qe";
Li Yang9a1ab882006-10-02 20:08:59 -05001586 ranges = <0 e0100000 00100000>;
1587 reg = <e0100000 480>;
1588 brg-frequency = <0>;
1589 bus-frequency = <179A7B00>;
1590 }
1591
1592
1593 ii) SPI (Serial Peripheral Interface)
1594
1595 Required properties:
Anton Vorontsovf3a2b292008-01-24 18:40:07 +03001596 - cell-index : SPI controller index.
1597 - compatible : should be "fsl,spi".
Peter Korsgaardf023dc72007-10-03 18:29:09 +02001598 - mode : the SPI operation mode, it can be "cpu" or "cpu-qe".
Li Yang9a1ab882006-10-02 20:08:59 -05001599 - 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
1608 Example:
1609 spi@4c0 {
Anton Vorontsovf3a2b292008-01-24 18:40:07 +03001610 cell-index = <0>;
1611 compatible = "fsl,spi";
Li Yang9a1ab882006-10-02 20:08:59 -05001612 reg = <4c0 40>;
1613 interrupts = <82 0>;
1614 interrupt-parent = <700>;
1615 mode = "cpu";
1616 };
1617
1618
1619 iii) USB (Universal Serial Bus Controller)
1620
1621 Required properties:
Li Yang9a1ab882006-10-02 20:08:59 -05001622 - compatible : could be "qe_udc" or "fhci-hcd".
1623 - mode : the could be "host" or "slave".
1624 - reg : Offset and length of the register set for the device
1625 - interrupts : <a b> where a is the interrupt number and b is a
1626 field that represents an encoding of the sense and level
1627 information for the interrupt. This should be encoded based on
1628 the information in section 2) depending on the type of interrupt
1629 controller you have.
1630 - interrupt-parent : the phandle for the interrupt controller that
1631 services interrupts for this device.
1632
1633 Example(slave):
1634 usb@6c0 {
Li Yang9a1ab882006-10-02 20:08:59 -05001635 compatible = "qe_udc";
1636 reg = <6c0 40>;
1637 interrupts = <8b 0>;
1638 interrupt-parent = <700>;
1639 mode = "slave";
1640 };
1641
1642
1643 iv) UCC (Unified Communications Controllers)
1644
1645 Required properties:
1646 - device_type : should be "network", "hldc", "uart", "transparent"
Timur Tabi845cf502008-01-09 17:35:05 -06001647 "bisync", "atm", or "serial".
Li Yang9a1ab882006-10-02 20:08:59 -05001648 - compatible : could be "ucc_geth" or "fsl_atm" and so on.
Anton Vorontsov56626f32008-04-11 20:06:54 +04001649 - cell-index : the ucc number(1-8), corresponding to UCCx in UM.
Li Yang9a1ab882006-10-02 20:08:59 -05001650 - reg : Offset and length of the register set for the device
1651 - interrupts : <a b> where a is the interrupt number and b is a
1652 field that represents an encoding of the sense and level
1653 information for the interrupt. This should be encoded based on
1654 the information in section 2) depending on the type of interrupt
1655 controller you have.
1656 - interrupt-parent : the phandle for the interrupt controller that
1657 services interrupts for this device.
1658 - pio-handle : The phandle for the Parallel I/O port configuration.
Timur Tabi845cf502008-01-09 17:35:05 -06001659 - port-number : for UART drivers, the port number to use, between 0 and 3.
1660 This usually corresponds to the /dev/ttyQE device, e.g. <0> = /dev/ttyQE0.
1661 The port number is added to the minor number of the device. Unlike the
1662 CPM UART driver, the port-number is required for the QE UART driver.
1663 - soft-uart : for UART drivers, if specified this means the QE UART device
1664 driver should use "Soft-UART" mode, which is needed on some SOCs that have
1665 broken UART hardware. Soft-UART is provided via a microcode upload.
Timur Tabi174b0da2007-12-03 15:17:58 -06001666 - rx-clock-name: the UCC receive clock source
1667 "none": clock source is disabled
1668 "brg1" through "brg16": clock source is BRG1-BRG16, respectively
1669 "clk1" through "clk24": clock source is CLK1-CLK24, respectively
1670 - tx-clock-name: the UCC transmit clock source
1671 "none": clock source is disabled
1672 "brg1" through "brg16": clock source is BRG1-BRG16, respectively
1673 "clk1" through "clk24": clock source is CLK1-CLK24, respectively
1674 The following two properties are deprecated. rx-clock has been replaced
1675 with rx-clock-name, and tx-clock has been replaced with tx-clock-name.
1676 Drivers that currently use the deprecated properties should continue to
1677 do so, in order to support older device trees, but they should be updated
1678 to check for the new properties first.
Li Yang9a1ab882006-10-02 20:08:59 -05001679 - rx-clock : represents the UCC receive clock source.
1680 0x00 : clock source is disabled;
1681 0x1~0x10 : clock source is BRG1~BRG16 respectively;
1682 0x11~0x28: clock source is QE_CLK1~QE_CLK24 respectively.
1683 - tx-clock: represents the UCC transmit clock source;
1684 0x00 : clock source is disabled;
1685 0x1~0x10 : clock source is BRG1~BRG16 respectively;
1686 0x11~0x28: clock source is QE_CLK1~QE_CLK24 respectively.
1687
1688 Required properties for network device_type:
1689 - mac-address : list of bytes representing the ethernet address.
1690 - phy-handle : The phandle for the PHY connected to this controller.
1691
Scott Woode0a2f282007-03-16 12:28:46 -05001692 Recommended properties:
Kim Phillips60c19222007-04-24 07:26:10 +10001693 - phy-connection-type : a string naming the controller/PHY interface type,
Kim Phillips34be4562007-11-05 12:15:35 -06001694 i.e., "mii" (default), "rmii", "gmii", "rgmii", "rgmii-id" (Internal
1695 Delay), "rgmii-txid" (delay on TX only), "rgmii-rxid" (delay on RX only),
1696 "tbi", or "rtbi".
Scott Woode0a2f282007-03-16 12:28:46 -05001697
Li Yang9a1ab882006-10-02 20:08:59 -05001698 Example:
1699 ucc@2000 {
1700 device_type = "network";
1701 compatible = "ucc_geth";
Anton Vorontsov56626f32008-04-11 20:06:54 +04001702 cell-index = <1>;
Li Yang9a1ab882006-10-02 20:08:59 -05001703 reg = <2000 200>;
1704 interrupts = <a0 0>;
1705 interrupt-parent = <700>;
1706 mac-address = [ 00 04 9f 00 23 23 ];
1707 rx-clock = "none";
1708 tx-clock = "clk9";
1709 phy-handle = <212000>;
Kim Phillips60c19222007-04-24 07:26:10 +10001710 phy-connection-type = "gmii";
Li Yang9a1ab882006-10-02 20:08:59 -05001711 pio-handle = <140001>;
1712 };
1713
1714
1715 v) Parallel I/O Ports
1716
1717 This node configures Parallel I/O ports for CPUs with QE support.
1718 The node should reside in the "soc" node of the tree. For each
1719 device that using parallel I/O ports, a child node should be created.
1720 See the definition of the Pin configuration nodes below for more
1721 information.
1722
1723 Required properties:
1724 - device_type : should be "par_io".
1725 - reg : offset to the register set and its length.
1726 - num-ports : number of Parallel I/O ports
1727
1728 Example:
1729 par_io@1400 {
1730 reg = <1400 100>;
1731 #address-cells = <1>;
1732 #size-cells = <0>;
1733 device_type = "par_io";
1734 num-ports = <7>;
1735 ucc_pin@01 {
1736 ......
1737 };
1738
1739
1740 vi) Pin configuration nodes
1741
1742 Required properties:
1743 - linux,phandle : phandle of this node; likely referenced by a QE
1744 device.
1745 - pio-map : array of pin configurations. Each pin is defined by 6
1746 integers. The six numbers are respectively: port, pin, dir,
1747 open_drain, assignment, has_irq.
1748 - port : port number of the pin; 0-6 represent port A-G in UM.
1749 - pin : pin number in the port.
1750 - dir : direction of the pin, should encode as follows:
1751
1752 0 = The pin is disabled
1753 1 = The pin is an output
1754 2 = The pin is an input
1755 3 = The pin is I/O
1756
1757 - open_drain : indicates the pin is normal or wired-OR:
1758
1759 0 = The pin is actively driven as an output
1760 1 = The pin is an open-drain driver. As an output, the pin is
1761 driven active-low, otherwise it is three-stated.
1762
1763 - assignment : function number of the pin according to the Pin Assignment
1764 tables in User Manual. Each pin can have up to 4 possible functions in
1765 QE and two options for CPM.
Matt LaPlantea982ac02007-05-09 07:35:06 +02001766 - has_irq : indicates if the pin is used as source of external
Li Yang9a1ab882006-10-02 20:08:59 -05001767 interrupts.
1768
1769 Example:
1770 ucc_pin@01 {
1771 linux,phandle = <140001>;
1772 pio-map = <
1773 /* port pin dir open_drain assignment has_irq */
1774 0 3 1 0 1 0 /* TxD0 */
1775 0 4 1 0 1 0 /* TxD1 */
1776 0 5 1 0 1 0 /* TxD2 */
1777 0 6 1 0 1 0 /* TxD3 */
1778 1 6 1 0 3 0 /* TxD4 */
1779 1 7 1 0 1 0 /* TxD5 */
1780 1 9 1 0 2 0 /* TxD6 */
1781 1 a 1 0 2 0 /* TxD7 */
1782 0 9 2 0 1 0 /* RxD0 */
1783 0 a 2 0 1 0 /* RxD1 */
1784 0 b 2 0 1 0 /* RxD2 */
1785 0 c 2 0 1 0 /* RxD3 */
1786 0 d 2 0 1 0 /* RxD4 */
1787 1 1 2 0 2 0 /* RxD5 */
1788 1 0 2 0 2 0 /* RxD6 */
1789 1 4 2 0 2 0 /* RxD7 */
1790 0 7 1 0 1 0 /* TX_EN */
1791 0 8 1 0 1 0 /* TX_ER */
1792 0 f 2 0 1 0 /* RX_DV */
1793 0 10 2 0 1 0 /* RX_ER */
1794 0 0 2 0 1 0 /* RX_CLK */
1795 2 9 1 0 3 0 /* GTX_CLK - CLK10 */
1796 2 8 2 0 1 0>; /* GTX125 - CLK9 */
1797 };
1798
1799 vii) Multi-User RAM (MURAM)
1800
1801 Required properties:
Anton Vorontsova2dd70a2008-01-24 18:39:59 +03001802 - compatible : should be "fsl,qe-muram", "fsl,cpm-muram".
Li Yang9a1ab882006-10-02 20:08:59 -05001803 - mode : the could be "host" or "slave".
1804 - ranges : Should be defined as specified in 1) to describe the
1805 translation of MURAM addresses.
1806 - data-only : sub-node which defines the address area under MURAM
1807 bus that can be allocated as data/parameter
1808
1809 Example:
1810
1811 muram@10000 {
Anton Vorontsova2dd70a2008-01-24 18:39:59 +03001812 compatible = "fsl,qe-muram", "fsl,cpm-muram";
Li Yang9a1ab882006-10-02 20:08:59 -05001813 ranges = <0 00010000 0000c000>;
1814
1815 data-only@0{
Anton Vorontsova2dd70a2008-01-24 18:39:59 +03001816 compatible = "fsl,qe-muram-data",
1817 "fsl,cpm-muram-data";
Li Yang9a1ab882006-10-02 20:08:59 -05001818 reg = <0 c000>;
1819 };
1820 };
Kim Phillipsb88a0b12006-03-22 14:39:03 -06001821
Timur Tabibc556ba2008-01-08 10:30:58 -06001822 viii) Uploaded QE firmware
1823
1824 If a new firwmare has been uploaded to the QE (usually by the
1825 boot loader), then a 'firmware' child node should be added to the QE
1826 node. This node provides information on the uploaded firmware that
1827 device drivers may need.
1828
1829 Required properties:
1830 - id: The string name of the firmware. This is taken from the 'id'
1831 member of the qe_firmware structure of the uploaded firmware.
1832 Device drivers can search this string to determine if the
1833 firmware they want is already present.
1834 - extended-modes: The Extended Modes bitfield, taken from the
1835 firmware binary. It is a 64-bit number represented
1836 as an array of two 32-bit numbers.
1837 - virtual-traps: The virtual traps, taken from the firmware binary.
1838 It is an array of 8 32-bit numbers.
1839
1840 Example:
1841
1842 firmware {
1843 id = "Soft-UART";
1844 extended-modes = <0 0>;
1845 virtual-traps = <0 0 0 0 0 0 0 0>;
1846 }
1847
David Gibson20991722007-09-07 13:23:53 +10001848 j) CFI or JEDEC memory-mapped NOR flash
Vitaly Wool28f9ec32006-11-20 16:32:39 +03001849
1850 Flash chips (Memory Technology Devices) are often used for solid state
1851 file systems on embedded devices.
1852
David Gibson20991722007-09-07 13:23:53 +10001853 - compatible : should contain the specific model of flash chip(s)
1854 used, if known, followed by either "cfi-flash" or "jedec-flash"
1855 - reg : Address range of the flash chip
1856 - bank-width : Width (in bytes) of the flash bank. Equal to the
1857 device width times the number of interleaved chips.
1858 - device-width : (optional) Width of a single flash chip. If
1859 omitted, assumed to be equal to 'bank-width'.
1860 - #address-cells, #size-cells : Must be present if the flash has
1861 sub-nodes representing partitions (see below). In this case
1862 both #address-cells and #size-cells must be equal to 1.
Vitaly Wool28f9ec32006-11-20 16:32:39 +03001863
David Gibson20991722007-09-07 13:23:53 +10001864 For JEDEC compatible devices, the following additional properties
1865 are defined:
Vitaly Wool28f9ec32006-11-20 16:32:39 +03001866
David Gibson20991722007-09-07 13:23:53 +10001867 - vendor-id : Contains the flash chip's vendor id (1 byte).
1868 - device-id : Contains the flash chip's device id (1 byte).
Vitaly Wool28f9ec32006-11-20 16:32:39 +03001869
David Gibson20991722007-09-07 13:23:53 +10001870 In addition to the information on the flash bank itself, the
1871 device tree may optionally contain additional information
1872 describing partitions of the flash address space. This can be
1873 used on platforms which have strong conventions about which
1874 portions of the flash are used for what purposes, but which don't
1875 use an on-flash partition table such as RedBoot.
Vitaly Wool28f9ec32006-11-20 16:32:39 +03001876
David Gibson20991722007-09-07 13:23:53 +10001877 Each partition is represented as a sub-node of the flash device.
1878 Each node's name represents the name of the corresponding
1879 partition of the flash device.
Vitaly Wool28f9ec32006-11-20 16:32:39 +03001880
David Gibson20991722007-09-07 13:23:53 +10001881 Flash partitions
1882 - reg : The partition's offset and size within the flash bank.
1883 - label : (optional) The label / name for this flash partition.
1884 If omitted, the label is taken from the node name (excluding
1885 the unit address).
1886 - read-only : (optional) This parameter, if present, is a hint to
1887 Linux that this flash partition should only be mounted
1888 read-only. This is usually used for flash partitions
1889 containing early-boot firmware images or data which should not
1890 be clobbered.
1891
1892 Example:
1893
1894 flash@ff000000 {
1895 compatible = "amd,am29lv128ml", "cfi-flash";
1896 reg = <ff000000 01000000>;
1897 bank-width = <4>;
1898 device-width = <1>;
1899 #address-cells = <1>;
1900 #size-cells = <1>;
1901 fs@0 {
1902 label = "fs";
1903 reg = <0 f80000>;
1904 };
1905 firmware@f80000 {
1906 label ="firmware";
1907 reg = <f80000 80000>;
1908 read-only;
1909 };
1910 };
Vitaly Wool28f9ec32006-11-20 16:32:39 +03001911
Roy Zang3b824f82007-06-19 15:19:18 +08001912 k) Global Utilities Block
1913
1914 The global utilities block controls power management, I/O device
1915 enabling, power-on-reset configuration monitoring, general-purpose
1916 I/O signal configuration, alternate function selection for multiplexed
1917 signals, and clock control.
1918
1919 Required properties:
1920
1921 - compatible : Should define the compatible device type for
1922 global-utilities.
1923 - reg : Offset and length of the register set for the device.
1924
1925 Recommended properties:
1926
1927 - fsl,has-rstcr : Indicates that the global utilities register set
1928 contains a functioning "reset control register" (i.e. the board
1929 is wired to reset upon setting the HRESET_REQ bit in this register).
1930
1931 Example:
1932
1933 global-utilities@e0000 { /* global utilities block */
1934 compatible = "fsl,mpc8548-guts";
1935 reg = <e0000 1000>;
1936 fsl,has-rstcr;
1937 };
1938
Scott Woode631ae32007-09-14 13:04:54 -05001939 l) Freescale Communications Processor Module
David Gibson1d3bb992007-08-23 13:56:01 +10001940
Scott Woode631ae32007-09-14 13:04:54 -05001941 NOTE: This is an interim binding, and will likely change slightly,
1942 as more devices are supported. The QE bindings especially are
1943 incomplete.
1944
1945 i) Root CPM node
1946
1947 Properties:
1948 - compatible : "fsl,cpm1", "fsl,cpm2", or "fsl,qe".
Scott Wood15f8c602007-09-28 14:06:16 -05001949 - reg : A 48-byte region beginning with CPCR.
Scott Woode631ae32007-09-14 13:04:54 -05001950
1951 Example:
1952 cpm@119c0 {
1953 #address-cells = <1>;
1954 #size-cells = <1>;
1955 #interrupt-cells = <2>;
1956 compatible = "fsl,mpc8272-cpm", "fsl,cpm2";
Scott Wood15f8c602007-09-28 14:06:16 -05001957 reg = <119c0 30>;
Scott Woode631ae32007-09-14 13:04:54 -05001958 }
1959
1960 ii) Properties common to mulitple CPM/QE devices
1961
1962 - fsl,cpm-command : This value is ORed with the opcode and command flag
1963 to specify the device on which a CPM command operates.
1964
1965 - fsl,cpm-brg : Indicates which baud rate generator the device
1966 is associated with. If absent, an unused BRG
1967 should be dynamically allocated. If zero, the
1968 device uses an external clock rather than a BRG.
1969
1970 - reg : Unless otherwise specified, the first resource represents the
1971 scc/fcc/ucc registers, and the second represents the device's
1972 parameter RAM region (if it has one).
1973
1974 iii) Serial
1975
1976 Currently defined compatibles:
1977 - fsl,cpm1-smc-uart
1978 - fsl,cpm2-smc-uart
1979 - fsl,cpm1-scc-uart
1980 - fsl,cpm2-scc-uart
1981 - fsl,qe-uart
1982
1983 Example:
1984
1985 serial@11a00 {
1986 device_type = "serial";
1987 compatible = "fsl,mpc8272-scc-uart",
1988 "fsl,cpm2-scc-uart";
1989 reg = <11a00 20 8000 100>;
1990 interrupts = <28 8>;
1991 interrupt-parent = <&PIC>;
1992 fsl,cpm-brg = <1>;
1993 fsl,cpm-command = <00800000>;
1994 };
1995
1996 iii) Network
1997
1998 Currently defined compatibles:
1999 - fsl,cpm1-scc-enet
2000 - fsl,cpm2-scc-enet
2001 - fsl,cpm1-fec-enet
2002 - fsl,cpm2-fcc-enet (third resource is GFEMR)
2003 - fsl,qe-enet
2004
2005 Example:
2006
2007 ethernet@11300 {
2008 device_type = "network";
2009 compatible = "fsl,mpc8272-fcc-enet",
2010 "fsl,cpm2-fcc-enet";
2011 reg = <11300 20 8400 100 11390 1>;
2012 local-mac-address = [ 00 00 00 00 00 00 ];
2013 interrupts = <20 8>;
2014 interrupt-parent = <&PIC>;
2015 phy-handle = <&PHY0>;
Scott Woode631ae32007-09-14 13:04:54 -05002016 fsl,cpm-command = <12000300>;
2017 };
2018
2019 iv) MDIO
2020
2021 Currently defined compatibles:
2022 fsl,pq1-fec-mdio (reg is same as first resource of FEC device)
2023 fsl,cpm2-mdio-bitbang (reg is port C registers)
2024
2025 Properties for fsl,cpm2-mdio-bitbang:
2026 fsl,mdio-pin : pin of port C controlling mdio data
2027 fsl,mdc-pin : pin of port C controlling mdio clock
2028
2029 Example:
2030
2031 mdio@10d40 {
2032 device_type = "mdio";
2033 compatible = "fsl,mpc8272ads-mdio-bitbang",
2034 "fsl,mpc8272-mdio-bitbang",
2035 "fsl,cpm2-mdio-bitbang";
2036 reg = <10d40 14>;
2037 #address-cells = <1>;
2038 #size-cells = <0>;
2039 fsl,mdio-pin = <12>;
2040 fsl,mdc-pin = <13>;
2041 };
2042
2043 v) Baud Rate Generators
2044
2045 Currently defined compatibles:
2046 fsl,cpm-brg
2047 fsl,cpm1-brg
2048 fsl,cpm2-brg
2049
2050 Properties:
2051 - reg : There may be an arbitrary number of reg resources; BRG
2052 numbers are assigned to these in order.
2053 - clock-frequency : Specifies the base frequency driving
2054 the BRG.
2055
2056 Example:
2057
2058 brg@119f0 {
2059 compatible = "fsl,mpc8272-brg",
2060 "fsl,cpm2-brg",
2061 "fsl,cpm-brg";
2062 reg = <119f0 10 115f0 10>;
2063 clock-frequency = <d#25000000>;
2064 };
2065
2066 vi) Interrupt Controllers
2067
2068 Currently defined compatibles:
2069 - fsl,cpm1-pic
2070 - only one interrupt cell
2071 - fsl,pq1-pic
2072 - fsl,cpm2-pic
2073 - second interrupt cell is level/sense:
2074 - 2 is falling edge
2075 - 8 is active low
2076
2077 Example:
2078
2079 interrupt-controller@10c00 {
2080 #interrupt-cells = <2>;
2081 interrupt-controller;
2082 reg = <10c00 80>;
2083 compatible = "mpc8272-pic", "fsl,cpm2-pic";
2084 };
2085
2086 vii) USB (Universal Serial Bus Controller)
2087
2088 Properties:
2089 - compatible : "fsl,cpm1-usb", "fsl,cpm2-usb", "fsl,qe-usb"
2090
2091 Example:
2092 usb@11bc0 {
2093 #address-cells = <1>;
2094 #size-cells = <0>;
2095 compatible = "fsl,cpm2-usb";
2096 reg = <11b60 18 8b00 100>;
2097 interrupts = <b 8>;
2098 interrupt-parent = <&PIC>;
2099 fsl,cpm-command = <2e600000>;
2100 };
2101
Scott Wood15f8c602007-09-28 14:06:16 -05002102 viii) Multi-User RAM (MURAM)
2103
2104 The multi-user/dual-ported RAM is expressed as a bus under the CPM node.
2105
2106 Ranges must be set up subject to the following restrictions:
2107
2108 - Children's reg nodes must be offsets from the start of all muram, even
2109 if the user-data area does not begin at zero.
2110 - If multiple range entries are used, the difference between the parent
2111 address and the child address must be the same in all, so that a single
2112 mapping can cover them all while maintaining the ability to determine
2113 CPM-side offsets with pointer subtraction. It is recommended that
2114 multiple range entries not be used.
2115 - A child address of zero must be translatable, even if no reg resources
2116 contain it.
2117
2118 A child "data" node must exist, compatible with "fsl,cpm-muram-data", to
2119 indicate the portion of muram that is usable by the OS for arbitrary
2120 purposes. The data node may have an arbitrary number of reg resources,
2121 all of which contribute to the allocatable muram pool.
2122
2123 Example, based on mpc8272:
2124
2125 muram@0 {
2126 #address-cells = <1>;
2127 #size-cells = <1>;
2128 ranges = <0 0 10000>;
2129
2130 data@0 {
2131 compatible = "fsl,cpm-muram-data";
2132 reg = <0 2000 9800 800>;
2133 };
2134 };
2135
Scott Wood96fca1de2007-09-14 13:24:02 -05002136 m) Chipselect/Local Bus
2137
2138 Properties:
2139 - name : Should be localbus
2140 - #address-cells : Should be either two or three. The first cell is the
2141 chipselect number, and the remaining cells are the
2142 offset into the chipselect.
2143 - #size-cells : Either one or two, depending on how large each chipselect
2144 can be.
2145 - ranges : Each range corresponds to a single chipselect, and cover
2146 the entire access window as configured.
2147
2148 Example:
2149 localbus@f0010100 {
Anton Vorontsov253772b2007-12-15 05:48:26 +11002150 compatible = "fsl,mpc8272-localbus",
Scott Wood96fca1de2007-09-14 13:24:02 -05002151 "fsl,pq2-localbus";
2152 #address-cells = <2>;
2153 #size-cells = <1>;
2154 reg = <f0010100 40>;
2155
2156 ranges = <0 0 fe000000 02000000
2157 1 0 f4500000 00008000>;
2158
2159 flash@0,0 {
2160 compatible = "jedec-flash";
2161 reg = <0 0 2000000>;
2162 bank-width = <4>;
2163 device-width = <1>;
2164 };
2165
2166 board-control@1,0 {
2167 reg = <1 0 20>;
2168 compatible = "fsl,mpc8272ads-bcsr";
2169 };
2170 };
2171
2172
Linus Torvaldse8690862007-10-11 21:55:47 -07002173 n) 4xx/Axon EMAC ethernet nodes
David Gibson1d3bb992007-08-23 13:56:01 +10002174
2175 The EMAC ethernet controller in IBM and AMCC 4xx chips, and also
2176 the Axon bridge. To operate this needs to interact with a ths
2177 special McMAL DMA controller, and sometimes an RGMII or ZMII
2178 interface. In addition to the nodes and properties described
2179 below, the node for the OPB bus on which the EMAC sits must have a
2180 correct clock-frequency property.
2181
2182 i) The EMAC node itself
2183
2184 Required properties:
2185 - device_type : "network"
2186
2187 - compatible : compatible list, contains 2 entries, first is
2188 "ibm,emac-CHIP" where CHIP is the host ASIC (440gx,
2189 405gp, Axon) and second is either "ibm,emac" or
2190 "ibm,emac4". For Axon, thus, we have: "ibm,emac-axon",
2191 "ibm,emac4"
2192 - interrupts : <interrupt mapping for EMAC IRQ and WOL IRQ>
2193 - interrupt-parent : optional, if needed for interrupt mapping
2194 - reg : <registers mapping>
2195 - local-mac-address : 6 bytes, MAC address
2196 - mal-device : phandle of the associated McMAL node
2197 - mal-tx-channel : 1 cell, index of the tx channel on McMAL associated
2198 with this EMAC
2199 - mal-rx-channel : 1 cell, index of the rx channel on McMAL associated
2200 with this EMAC
2201 - cell-index : 1 cell, hardware index of the EMAC cell on a given
2202 ASIC (typically 0x0 and 0x1 for EMAC0 and EMAC1 on
2203 each Axon chip)
2204 - max-frame-size : 1 cell, maximum frame size supported in bytes
2205 - rx-fifo-size : 1 cell, Rx fifo size in bytes for 10 and 100 Mb/sec
2206 operations.
2207 For Axon, 2048
2208 - tx-fifo-size : 1 cell, Tx fifo size in bytes for 10 and 100 Mb/sec
2209 operations.
2210 For Axon, 2048.
2211 - fifo-entry-size : 1 cell, size of a fifo entry (used to calculate
2212 thresholds).
2213 For Axon, 0x00000010
2214 - mal-burst-size : 1 cell, MAL burst size (used to calculate thresholds)
2215 in bytes.
2216 For Axon, 0x00000100 (I think ...)
2217 - phy-mode : string, mode of operations of the PHY interface.
2218 Supported values are: "mii", "rmii", "smii", "rgmii",
2219 "tbi", "gmii", rtbi", "sgmii".
2220 For Axon on CAB, it is "rgmii"
2221 - mdio-device : 1 cell, required iff using shared MDIO registers
2222 (440EP). phandle of the EMAC to use to drive the
2223 MDIO lines for the PHY used by this EMAC.
2224 - zmii-device : 1 cell, required iff connected to a ZMII. phandle of
2225 the ZMII device node
2226 - zmii-channel : 1 cell, required iff connected to a ZMII. Which ZMII
2227 channel or 0xffffffff if ZMII is only used for MDIO.
2228 - rgmii-device : 1 cell, required iff connected to an RGMII. phandle
2229 of the RGMII device node.
2230 For Axon: phandle of plb5/plb4/opb/rgmii
2231 - rgmii-channel : 1 cell, required iff connected to an RGMII. Which
2232 RGMII channel is used by this EMAC.
2233 Fox Axon: present, whatever value is appropriate for each
2234 EMAC, that is the content of the current (bogus) "phy-port"
2235 property.
2236
David Gibson1d3bb992007-08-23 13:56:01 +10002237 Optional properties:
2238 - phy-address : 1 cell, optional, MDIO address of the PHY. If absent,
2239 a search is performed.
2240 - phy-map : 1 cell, optional, bitmap of addresses to probe the PHY
2241 for, used if phy-address is absent. bit 0x00000001 is
2242 MDIO address 0.
2243 For Axon it can be absent, thouugh my current driver
2244 doesn't handle phy-address yet so for now, keep
2245 0x00ffffff in it.
2246 - rx-fifo-size-gige : 1 cell, Rx fifo size in bytes for 1000 Mb/sec
2247 operations (if absent the value is the same as
2248 rx-fifo-size). For Axon, either absent or 2048.
2249 - tx-fifo-size-gige : 1 cell, Tx fifo size in bytes for 1000 Mb/sec
2250 operations (if absent the value is the same as
2251 tx-fifo-size). For Axon, either absent or 2048.
2252 - tah-device : 1 cell, optional. If connected to a TAH engine for
2253 offload, phandle of the TAH device node.
2254 - tah-channel : 1 cell, optional. If appropriate, channel used on the
2255 TAH engine.
2256
2257 Example:
2258
2259 EMAC0: ethernet@40000800 {
David Gibson1d3bb992007-08-23 13:56:01 +10002260 device_type = "network";
2261 compatible = "ibm,emac-440gp", "ibm,emac";
2262 interrupt-parent = <&UIC1>;
2263 interrupts = <1c 4 1d 4>;
2264 reg = <40000800 70>;
2265 local-mac-address = [00 04 AC E3 1B 1E];
2266 mal-device = <&MAL0>;
2267 mal-tx-channel = <0 1>;
2268 mal-rx-channel = <0>;
2269 cell-index = <0>;
2270 max-frame-size = <5dc>;
2271 rx-fifo-size = <1000>;
2272 tx-fifo-size = <800>;
2273 phy-mode = "rmii";
2274 phy-map = <00000001>;
2275 zmii-device = <&ZMII0>;
2276 zmii-channel = <0>;
2277 };
2278
2279 ii) McMAL node
2280
2281 Required properties:
2282 - device_type : "dma-controller"
2283 - compatible : compatible list, containing 2 entries, first is
2284 "ibm,mcmal-CHIP" where CHIP is the host ASIC (like
2285 emac) and the second is either "ibm,mcmal" or
2286 "ibm,mcmal2".
2287 For Axon, "ibm,mcmal-axon","ibm,mcmal2"
2288 - interrupts : <interrupt mapping for the MAL interrupts sources:
2289 5 sources: tx_eob, rx_eob, serr, txde, rxde>.
2290 For Axon: This is _different_ from the current
2291 firmware. We use the "delayed" interrupts for txeob
2292 and rxeob. Thus we end up with mapping those 5 MPIC
2293 interrupts, all level positive sensitive: 10, 11, 32,
2294 33, 34 (in decimal)
2295 - dcr-reg : < DCR registers range >
2296 - dcr-parent : if needed for dcr-reg
2297 - num-tx-chans : 1 cell, number of Tx channels
2298 - num-rx-chans : 1 cell, number of Rx channels
2299
2300 iii) ZMII node
2301
2302 Required properties:
2303 - compatible : compatible list, containing 2 entries, first is
2304 "ibm,zmii-CHIP" where CHIP is the host ASIC (like
2305 EMAC) and the second is "ibm,zmii".
2306 For Axon, there is no ZMII node.
2307 - reg : <registers mapping>
2308
2309 iv) RGMII node
2310
2311 Required properties:
2312 - compatible : compatible list, containing 2 entries, first is
2313 "ibm,rgmii-CHIP" where CHIP is the host ASIC (like
2314 EMAC) and the second is "ibm,rgmii".
2315 For Axon, "ibm,rgmii-axon","ibm,rgmii"
2316 - reg : <registers mapping>
2317 - revision : as provided by the RGMII new version register if
2318 available.
2319 For Axon: 0x0000012a
2320
Timur Tabibc556ba2008-01-08 10:30:58 -06002321 o) Xilinx IP cores
Grant Likely7ae0fa492007-10-23 14:27:41 +10002322
2323 The Xilinx EDK toolchain ships with a set of IP cores (devices) for use
2324 in Xilinx Spartan and Virtex FPGAs. The devices cover the whole range
2325 of standard device types (network, serial, etc.) and miscellanious
2326 devices (gpio, LCD, spi, etc). Also, since these devices are
2327 implemented within the fpga fabric every instance of the device can be
2328 synthesised with different options that change the behaviour.
2329
2330 Each IP-core has a set of parameters which the FPGA designer can use to
2331 control how the core is synthesized. Historically, the EDK tool would
2332 extract the device parameters relevant to device drivers and copy them
2333 into an 'xparameters.h' in the form of #define symbols. This tells the
2334 device drivers how the IP cores are configured, but it requres the kernel
2335 to be recompiled every time the FPGA bitstream is resynthesized.
2336
2337 The new approach is to export the parameters into the device tree and
2338 generate a new device tree each time the FPGA bitstream changes. The
2339 parameters which used to be exported as #defines will now become
2340 properties of the device node. In general, device nodes for IP-cores
2341 will take the following form:
2342
Stephen Neuendorfferab99eee2008-01-09 06:35:07 +11002343 (name): (generic-name)@(base-address) {
Grant Likely7ae0fa492007-10-23 14:27:41 +10002344 compatible = "xlnx,(ip-core-name)-(HW_VER)"
2345 [, (list of compatible devices), ...];
2346 reg = <(baseaddr) (size)>;
2347 interrupt-parent = <&interrupt-controller-phandle>;
2348 interrupts = < ... >;
2349 xlnx,(parameter1) = "(string-value)";
2350 xlnx,(parameter2) = <(int-value)>;
2351 };
2352
Stephen Neuendorfferab99eee2008-01-09 06:35:07 +11002353 (generic-name): an open firmware-style name that describes the
2354 generic class of device. Preferably, this is one word, such
2355 as 'serial' or 'ethernet'.
Grant Likely7ae0fa492007-10-23 14:27:41 +10002356 (ip-core-name): the name of the ip block (given after the BEGIN
2357 directive in system.mhs). Should be in lowercase
2358 and all underscores '_' converted to dashes '-'.
2359 (name): is derived from the "PARAMETER INSTANCE" value.
2360 (parameter#): C_* parameters from system.mhs. The C_ prefix is
2361 dropped from the parameter name, the name is converted
2362 to lowercase and all underscore '_' characters are
2363 converted to dashes '-'.
Stephen Neuendorfferab99eee2008-01-09 06:35:07 +11002364 (baseaddr): the baseaddr parameter value (often named C_BASEADDR).
Grant Likely7ae0fa492007-10-23 14:27:41 +10002365 (HW_VER): from the HW_VER parameter.
Stephen Neuendorfferab99eee2008-01-09 06:35:07 +11002366 (size): the address range size (often C_HIGHADDR - C_BASEADDR + 1).
Grant Likely7ae0fa492007-10-23 14:27:41 +10002367
2368 Typically, the compatible list will include the exact IP core version
2369 followed by an older IP core version which implements the same
2370 interface or any other device with the same interface.
2371
2372 'reg', 'interrupt-parent' and 'interrupts' are all optional properties.
2373
2374 For example, the following block from system.mhs:
2375
2376 BEGIN opb_uartlite
2377 PARAMETER INSTANCE = opb_uartlite_0
2378 PARAMETER HW_VER = 1.00.b
2379 PARAMETER C_BAUDRATE = 115200
2380 PARAMETER C_DATA_BITS = 8
2381 PARAMETER C_ODD_PARITY = 0
2382 PARAMETER C_USE_PARITY = 0
2383 PARAMETER C_CLK_FREQ = 50000000
2384 PARAMETER C_BASEADDR = 0xEC100000
2385 PARAMETER C_HIGHADDR = 0xEC10FFFF
2386 BUS_INTERFACE SOPB = opb_7
2387 PORT OPB_Clk = CLK_50MHz
2388 PORT Interrupt = opb_uartlite_0_Interrupt
2389 PORT RX = opb_uartlite_0_RX
2390 PORT TX = opb_uartlite_0_TX
2391 PORT OPB_Rst = sys_bus_reset_0
2392 END
2393
2394 becomes the following device tree node:
2395
Stephen Neuendorfferab99eee2008-01-09 06:35:07 +11002396 opb_uartlite_0: serial@ec100000 {
Grant Likely7ae0fa492007-10-23 14:27:41 +10002397 device_type = "serial";
2398 compatible = "xlnx,opb-uartlite-1.00.b";
2399 reg = <ec100000 10000>;
Stephen Neuendorfferab99eee2008-01-09 06:35:07 +11002400 interrupt-parent = <&opb_intc_0>;
Grant Likely7ae0fa492007-10-23 14:27:41 +10002401 interrupts = <1 0>; // got this from the opb_intc parameters
2402 current-speed = <d#115200>; // standard serial device prop
2403 clock-frequency = <d#50000000>; // standard serial device prop
2404 xlnx,data-bits = <8>;
2405 xlnx,odd-parity = <0>;
2406 xlnx,use-parity = <0>;
2407 };
2408
Stephen Neuendorfferab99eee2008-01-09 06:35:07 +11002409 Some IP cores actually implement 2 or more logical devices. In
2410 this case, the device should still describe the whole IP core with
2411 a single node and add a child node for each logical device. The
2412 ranges property can be used to translate from parent IP-core to the
2413 registers of each device. In addition, the parent node should be
2414 compatible with the bus type 'xlnx,compound', and should contain
2415 #address-cells and #size-cells, as with any other bus. (Note: this
2416 makes the assumption that both logical devices have the same bus
2417 binding. If this is not true, then separate nodes should be used
2418 for each logical device). The 'cell-index' property can be used to
2419 enumerate logical devices within an IP core. For example, the
2420 following is the system.mhs entry for the dual ps2 controller found
2421 on the ml403 reference design.
Grant Likely7ae0fa492007-10-23 14:27:41 +10002422
2423 BEGIN opb_ps2_dual_ref
2424 PARAMETER INSTANCE = opb_ps2_dual_ref_0
2425 PARAMETER HW_VER = 1.00.a
2426 PARAMETER C_BASEADDR = 0xA9000000
2427 PARAMETER C_HIGHADDR = 0xA9001FFF
2428 BUS_INTERFACE SOPB = opb_v20_0
2429 PORT Sys_Intr1 = ps2_1_intr
2430 PORT Sys_Intr2 = ps2_2_intr
2431 PORT Clkin1 = ps2_clk_rx_1
2432 PORT Clkin2 = ps2_clk_rx_2
2433 PORT Clkpd1 = ps2_clk_tx_1
2434 PORT Clkpd2 = ps2_clk_tx_2
2435 PORT Rx1 = ps2_d_rx_1
2436 PORT Rx2 = ps2_d_rx_2
2437 PORT Txpd1 = ps2_d_tx_1
2438 PORT Txpd2 = ps2_d_tx_2
2439 END
2440
2441 It would result in the following device tree nodes:
2442
Stephen Neuendorfferab99eee2008-01-09 06:35:07 +11002443 opb_ps2_dual_ref_0: opb-ps2-dual-ref@a9000000 {
2444 #address-cells = <1>;
2445 #size-cells = <1>;
2446 compatible = "xlnx,compound";
Grant Likely7ae0fa492007-10-23 14:27:41 +10002447 ranges = <0 a9000000 2000>;
2448 // If this device had extra parameters, then they would
2449 // go here.
2450 ps2@0 {
2451 compatible = "xlnx,opb-ps2-dual-ref-1.00.a";
2452 reg = <0 40>;
Stephen Neuendorfferab99eee2008-01-09 06:35:07 +11002453 interrupt-parent = <&opb_intc_0>;
Grant Likely7ae0fa492007-10-23 14:27:41 +10002454 interrupts = <3 0>;
2455 cell-index = <0>;
2456 };
2457 ps2@1000 {
2458 compatible = "xlnx,opb-ps2-dual-ref-1.00.a";
2459 reg = <1000 40>;
Stephen Neuendorfferab99eee2008-01-09 06:35:07 +11002460 interrupt-parent = <&opb_intc_0>;
Grant Likely7ae0fa492007-10-23 14:27:41 +10002461 interrupts = <3 0>;
2462 cell-index = <0>;
2463 };
2464 };
2465
2466 Also, the system.mhs file defines bus attachments from the processor
2467 to the devices. The device tree structure should reflect the bus
2468 attachments. Again an example; this system.mhs fragment:
2469
2470 BEGIN ppc405_virtex4
2471 PARAMETER INSTANCE = ppc405_0
2472 PARAMETER HW_VER = 1.01.a
2473 BUS_INTERFACE DPLB = plb_v34_0
2474 BUS_INTERFACE IPLB = plb_v34_0
2475 END
2476
2477 BEGIN opb_intc
2478 PARAMETER INSTANCE = opb_intc_0
2479 PARAMETER HW_VER = 1.00.c
2480 PARAMETER C_BASEADDR = 0xD1000FC0
2481 PARAMETER C_HIGHADDR = 0xD1000FDF
2482 BUS_INTERFACE SOPB = opb_v20_0
2483 END
2484
2485 BEGIN opb_uart16550
2486 PARAMETER INSTANCE = opb_uart16550_0
2487 PARAMETER HW_VER = 1.00.d
2488 PARAMETER C_BASEADDR = 0xa0000000
2489 PARAMETER C_HIGHADDR = 0xa0001FFF
2490 BUS_INTERFACE SOPB = opb_v20_0
2491 END
2492
2493 BEGIN plb_v34
2494 PARAMETER INSTANCE = plb_v34_0
2495 PARAMETER HW_VER = 1.02.a
2496 END
2497
2498 BEGIN plb_bram_if_cntlr
2499 PARAMETER INSTANCE = plb_bram_if_cntlr_0
2500 PARAMETER HW_VER = 1.00.b
2501 PARAMETER C_BASEADDR = 0xFFFF0000
2502 PARAMETER C_HIGHADDR = 0xFFFFFFFF
2503 BUS_INTERFACE SPLB = plb_v34_0
2504 END
2505
2506 BEGIN plb2opb_bridge
2507 PARAMETER INSTANCE = plb2opb_bridge_0
2508 PARAMETER HW_VER = 1.01.a
2509 PARAMETER C_RNG0_BASEADDR = 0x20000000
2510 PARAMETER C_RNG0_HIGHADDR = 0x3FFFFFFF
2511 PARAMETER C_RNG1_BASEADDR = 0x60000000
2512 PARAMETER C_RNG1_HIGHADDR = 0x7FFFFFFF
2513 PARAMETER C_RNG2_BASEADDR = 0x80000000
2514 PARAMETER C_RNG2_HIGHADDR = 0xBFFFFFFF
2515 PARAMETER C_RNG3_BASEADDR = 0xC0000000
2516 PARAMETER C_RNG3_HIGHADDR = 0xDFFFFFFF
2517 BUS_INTERFACE SPLB = plb_v34_0
2518 BUS_INTERFACE MOPB = opb_v20_0
2519 END
2520
2521 Gives this device tree (some properties removed for clarity):
2522
Stephen Neuendorfferab99eee2008-01-09 06:35:07 +11002523 plb@0 {
Grant Likely7ae0fa492007-10-23 14:27:41 +10002524 #address-cells = <1>;
2525 #size-cells = <1>;
Stephen Neuendorfferab99eee2008-01-09 06:35:07 +11002526 compatible = "xlnx,plb-v34-1.02.a";
Grant Likely7ae0fa492007-10-23 14:27:41 +10002527 device_type = "ibm,plb";
2528 ranges; // 1:1 translation
2529
Stephen Neuendorfferab99eee2008-01-09 06:35:07 +11002530 plb_bram_if_cntrl_0: bram@ffff0000 {
Grant Likely7ae0fa492007-10-23 14:27:41 +10002531 reg = <ffff0000 10000>;
2532 }
2533
Stephen Neuendorfferab99eee2008-01-09 06:35:07 +11002534 opb@20000000 {
Grant Likely7ae0fa492007-10-23 14:27:41 +10002535 #address-cells = <1>;
2536 #size-cells = <1>;
2537 ranges = <20000000 20000000 20000000
2538 60000000 60000000 20000000
2539 80000000 80000000 40000000
2540 c0000000 c0000000 20000000>;
2541
Stephen Neuendorfferab99eee2008-01-09 06:35:07 +11002542 opb_uart16550_0: serial@a0000000 {
Grant Likely7ae0fa492007-10-23 14:27:41 +10002543 reg = <a00000000 2000>;
2544 };
2545
Stephen Neuendorfferab99eee2008-01-09 06:35:07 +11002546 opb_intc_0: interrupt-controller@d1000fc0 {
Grant Likely7ae0fa492007-10-23 14:27:41 +10002547 reg = <d1000fc0 20>;
2548 };
2549 };
2550 };
2551
2552 That covers the general approach to binding xilinx IP cores into the
2553 device tree. The following are bindings for specific devices:
2554
2555 i) Xilinx ML300 Framebuffer
2556
2557 Simple framebuffer device from the ML300 reference design (also on the
2558 ML403 reference design as well as others).
2559
2560 Optional properties:
2561 - resolution = <xres yres> : pixel resolution of framebuffer. Some
2562 implementations use a different resolution.
2563 Default is <d#640 d#480>
2564 - virt-resolution = <xvirt yvirt> : Size of framebuffer in memory.
2565 Default is <d#1024 d#480>.
2566 - rotate-display (empty) : rotate display 180 degrees.
2567
2568 ii) Xilinx SystemACE
2569
2570 The Xilinx SystemACE device is used to program FPGAs from an FPGA
2571 bitstream stored on a CF card. It can also be used as a generic CF
2572 interface device.
2573
2574 Optional properties:
2575 - 8-bit (empty) : Set this property for SystemACE in 8 bit mode
2576
2577 iii) Xilinx EMAC and Xilinx TEMAC
2578
2579 Xilinx Ethernet devices. In addition to general xilinx properties
2580 listed above, nodes for these devices should include a phy-handle
2581 property, and may include other common network device properties
2582 like local-mac-address.
2583
2584 iv) Xilinx Uartlite
2585
2586 Xilinx uartlite devices are simple fixed speed serial ports.
2587
2588 Requred properties:
2589 - current-speed : Baud rate of uartlite
2590
Stephen Neuendorfferef66a9d2008-02-06 04:24:10 +11002591 v) Xilinx hwicap
2592
2593 Xilinx hwicap devices provide access to the configuration logic
2594 of the FPGA through the Internal Configuration Access Port
2595 (ICAP). The ICAP enables partial reconfiguration of the FPGA,
2596 readback of the configuration information, and some control over
2597 'warm boots' of the FPGA fabric.
2598
2599 Required properties:
2600 - xlnx,family : The family of the FPGA, necessary since the
2601 capabilities of the underlying ICAP hardware
2602 differ between different families. May be
2603 'virtex2p', 'virtex4', or 'virtex5'.
2604
John Linnb912b5e2008-04-03 10:22:19 +11002605 vi) Xilinx Uart 16550
2606
2607 Xilinx UART 16550 devices are very similar to the NS16550 but with
2608 different register spacing and an offset from the base address.
2609
2610 Requred properties:
2611 - clock-frequency : Frequency of the clock input
2612 - reg-offset : A value of 3 is required
2613 - reg-shift : A value of 2 is required
2614
2615
Timur Tabic7d24a22008-01-18 09:24:53 -06002616 p) Freescale Synchronous Serial Interface
2617
2618 The SSI is a serial device that communicates with audio codecs. It can
2619 be programmed in AC97, I2S, left-justified, or right-justified modes.
2620
2621 Required properties:
2622 - compatible : compatible list, containing "fsl,ssi"
2623 - cell-index : the SSI, <0> = SSI1, <1> = SSI2, and so on
2624 - reg : offset and length of the register set for the device
2625 - interrupts : <a b> where a is the interrupt number and b is a
2626 field that represents an encoding of the sense and
2627 level information for the interrupt. This should be
2628 encoded based on the information in section 2)
2629 depending on the type of interrupt controller you
2630 have.
2631 - interrupt-parent : the phandle for the interrupt controller that
2632 services interrupts for this device.
2633 - fsl,mode : the operating mode for the SSI interface
2634 "i2s-slave" - I2S mode, SSI is clock slave
2635 "i2s-master" - I2S mode, SSI is clock master
2636 "lj-slave" - left-justified mode, SSI is clock slave
2637 "lj-master" - l.j. mode, SSI is clock master
2638 "rj-slave" - right-justified mode, SSI is clock slave
2639 "rj-master" - r.j., SSI is clock master
2640 "ac97-slave" - AC97 mode, SSI is clock slave
2641 "ac97-master" - AC97 mode, SSI is clock master
2642
2643 Optional properties:
2644 - codec-handle : phandle to a 'codec' node that defines an audio
2645 codec connected to this SSI. This node is typically
2646 a child of an I2C or other control node.
2647
2648 Child 'codec' node required properties:
2649 - compatible : compatible list, contains the name of the codec
2650
2651 Child 'codec' node optional properties:
2652 - clock-frequency : The frequency of the input clock, which typically
2653 comes from an on-board dedicated oscillator.
2654
Zhang Wei457aa812007-10-30 17:23:48 +08002655 * Freescale 83xx DMA Controller
2656
2657 Freescale PowerPC 83xx have on chip general purpose DMA controllers.
2658
2659 Required properties:
2660
2661 - compatible : compatible list, contains 2 entries, first is
2662 "fsl,CHIP-dma", where CHIP is the processor
2663 (mpc8349, mpc8360, etc.) and the second is
2664 "fsl,elo-dma"
2665 - reg : <registers mapping for DMA general status reg>
2666 - ranges : Should be defined as specified in 1) to describe the
2667 DMA controller channels.
2668 - cell-index : controller index. 0 for controller @ 0x8100
2669 - interrupts : <interrupt mapping for DMA IRQ>
2670 - interrupt-parent : optional, if needed for interrupt mapping
2671
2672
2673 - DMA channel nodes:
2674 - compatible : compatible list, contains 2 entries, first is
2675 "fsl,CHIP-dma-channel", where CHIP is the processor
2676 (mpc8349, mpc8350, etc.) and the second is
2677 "fsl,elo-dma-channel"
2678 - reg : <registers mapping for channel>
2679 - cell-index : dma channel index starts at 0.
2680
2681 Optional properties:
2682 - interrupts : <interrupt mapping for DMA channel IRQ>
2683 (on 83xx this is expected to be identical to
2684 the interrupts property of the parent node)
2685 - interrupt-parent : optional, if needed for interrupt mapping
2686
2687 Example:
2688 dma@82a8 {
2689 #address-cells = <1>;
2690 #size-cells = <1>;
2691 compatible = "fsl,mpc8349-dma", "fsl,elo-dma";
2692 reg = <82a8 4>;
2693 ranges = <0 8100 1a4>;
2694 interrupt-parent = <&ipic>;
2695 interrupts = <47 8>;
2696 cell-index = <0>;
2697 dma-channel@0 {
2698 compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel";
2699 cell-index = <0>;
2700 reg = <0 80>;
2701 };
2702 dma-channel@80 {
2703 compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel";
2704 cell-index = <1>;
2705 reg = <80 80>;
2706 };
2707 dma-channel@100 {
2708 compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel";
2709 cell-index = <2>;
2710 reg = <100 80>;
2711 };
2712 dma-channel@180 {
2713 compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel";
2714 cell-index = <3>;
2715 reg = <180 80>;
2716 };
2717 };
2718
2719 * Freescale 85xx/86xx DMA Controller
2720
2721 Freescale PowerPC 85xx/86xx have on chip general purpose DMA controllers.
2722
2723 Required properties:
2724
2725 - compatible : compatible list, contains 2 entries, first is
2726 "fsl,CHIP-dma", where CHIP is the processor
2727 (mpc8540, mpc8540, etc.) and the second is
2728 "fsl,eloplus-dma"
2729 - reg : <registers mapping for DMA general status reg>
2730 - cell-index : controller index. 0 for controller @ 0x21000,
2731 1 for controller @ 0xc000
2732 - ranges : Should be defined as specified in 1) to describe the
2733 DMA controller channels.
2734
2735 - DMA channel nodes:
2736 - compatible : compatible list, contains 2 entries, first is
2737 "fsl,CHIP-dma-channel", where CHIP is the processor
2738 (mpc8540, mpc8560, etc.) and the second is
2739 "fsl,eloplus-dma-channel"
2740 - cell-index : dma channel index starts at 0.
2741 - reg : <registers mapping for channel>
2742 - interrupts : <interrupt mapping for DMA channel IRQ>
2743 - interrupt-parent : optional, if needed for interrupt mapping
2744
2745 Example:
2746 dma@21300 {
2747 #address-cells = <1>;
2748 #size-cells = <1>;
2749 compatible = "fsl,mpc8540-dma", "fsl,eloplus-dma";
2750 reg = <21300 4>;
2751 ranges = <0 21100 200>;
2752 cell-index = <0>;
2753 dma-channel@0 {
2754 compatible = "fsl,mpc8540-dma-channel", "fsl,eloplus-dma-channel";
2755 reg = <0 80>;
2756 cell-index = <0>;
2757 interrupt-parent = <&mpic>;
2758 interrupts = <14 2>;
2759 };
2760 dma-channel@80 {
2761 compatible = "fsl,mpc8540-dma-channel", "fsl,eloplus-dma-channel";
2762 reg = <80 80>;
2763 cell-index = <1>;
2764 interrupt-parent = <&mpic>;
2765 interrupts = <15 2>;
2766 };
2767 dma-channel@100 {
2768 compatible = "fsl,mpc8540-dma-channel", "fsl,eloplus-dma-channel";
2769 reg = <100 80>;
2770 cell-index = <2>;
2771 interrupt-parent = <&mpic>;
2772 interrupts = <16 2>;
2773 };
2774 dma-channel@180 {
2775 compatible = "fsl,mpc8540-dma-channel", "fsl,eloplus-dma-channel";
2776 reg = <180 80>;
2777 cell-index = <3>;
2778 interrupt-parent = <&mpic>;
2779 interrupts = <17 2>;
2780 };
2781 };
2782
Li Yangb61ad652007-10-19 19:38:46 +08002783 * Freescale 8xxx/3.0 Gb/s SATA nodes
2784
2785 SATA nodes are defined to describe on-chip Serial ATA controllers.
2786 Each SATA port should have its own node.
2787
2788 Required properties:
2789 - compatible : compatible list, contains 2 entries, first is
2790 "fsl,CHIP-sata", where CHIP is the processor
2791 (mpc8315, mpc8379, etc.) and the second is
2792 "fsl,pq-sata"
2793 - interrupts : <interrupt mapping for SATA IRQ>
2794 - cell-index : controller index.
2795 1 for controller @ 0x18000
2796 2 for controller @ 0x19000
2797 3 for controller @ 0x1a000
2798 4 for controller @ 0x1b000
2799
2800 Optional properties:
2801 - interrupt-parent : optional, if needed for interrupt mapping
2802 - reg : <registers mapping>
2803
2804 Example:
2805
2806 sata@18000 {
2807 compatible = "fsl,mpc8379-sata", "fsl,pq-sata";
2808 reg = <0x18000 0x1000>;
2809 cell-index = <1>;
2810 interrupts = <2c 8>;
2811 interrupt-parent = < &ipic >;
2812 };
Timur Tabic7d24a22008-01-18 09:24:53 -06002813
Valentine Barshak41abd682007-09-25 05:27:56 +10002814 q) USB EHCI controllers
2815
2816 Required properties:
2817 - compatible : should be "usb-ehci".
2818 - reg : should contain at least address and length of the standard EHCI
2819 register set for the device. Optional platform-dependent registers
2820 (debug-port or other) can be also specified here, but only after
2821 definition of standard EHCI registers.
2822 - interrupts : one EHCI interrupt should be described here.
2823 If device registers are implemented in big endian mode, the device
2824 node should have "big-endian-regs" property.
2825 If controller implementation operates with big endian descriptors,
2826 "big-endian-desc" property should be specified.
2827 If both big endian registers and descriptors are used by the controller
2828 implementation, "big-endian" property can be specified instead of having
2829 both "big-endian-regs" and "big-endian-desc".
2830
2831 Example (Sequoia 440EPx):
2832 ehci@e0000300 {
2833 compatible = "ibm,usb-ehci-440epx", "usb-ehci";
2834 interrupt-parent = <&UIC0>;
2835 interrupts = <1a 4>;
2836 reg = <0 e0000300 90 0 e0000390 70>;
2837 big-endian;
2838 };
2839
York Sun9b53a9e2008-04-28 02:15:34 -07002840 r) Freescale Display Interface Unit
2841
2842 The Freescale DIU is a LCD controller, with proper hardware, it can also
2843 drive DVI monitors.
2844
2845 Required properties:
2846 - compatible : should be "fsl-diu".
2847 - reg : should contain at least address and length of the DIU register
2848 set.
2849 - Interrupts : one DIU interrupt should be describe here.
2850
2851 Example (MPC8610HPCD)
2852 display@2c000 {
2853 compatible = "fsl,diu";
2854 reg = <0x2c000 100>;
2855 interrupts = <72 2>;
2856 interrupt-parent = <&mpic>;
2857 };
2858
2859 s) Freescale on board FPGA
2860
2861 This is the memory-mapped registers for on board FPGA.
2862
2863 Required properities:
2864 - compatible : should be "fsl,fpga-pixis".
2865 - reg : should contain the address and the lenght of the FPPGA register
2866 set.
2867
2868 Example (MPC8610HPCD)
2869 board-control@e8000000 {
2870 compatible = "fsl,fpga-pixis";
2871 reg = <0xe8000000 32>;
2872 };
Valentine Barshak41abd682007-09-25 05:27:56 +10002873
Laurent Pincharta5edecc2008-05-26 11:53:21 +02002874 r) MDIO on GPIOs
2875
2876 Currently defined compatibles:
2877 - virtual,gpio-mdio
2878
2879 MDC and MDIO lines connected to GPIO controllers are listed in the
2880 gpios property as described in section VIII.1 in the following order:
2881
2882 MDC, MDIO.
2883
2884 Example:
2885
2886 mdio {
2887 compatible = "virtual,mdio-gpio";
2888 #address-cells = <1>;
2889 #size-cells = <0>;
2890 gpios = <&qe_pio_a 11
2891 &qe_pio_c 6>;
2892 };
2893
Dale Farnsworthf5412c42008-04-08 08:12:07 +10002894VII - Marvell Discovery mv64[345]6x System Controller chips
2895===========================================================
David Gibsonc125a182006-02-01 03:05:22 -08002896
Dale Farnsworthf5412c42008-04-08 08:12:07 +10002897The Marvell mv64[345]60 series of system controller chips contain
2898many of the peripherals needed to implement a complete computer
2899system. In this section, we define device tree nodes to describe
2900the system controller chip itself and each of the peripherals
2901which it contains. Compatible string values for each node are
2902prefixed with the string "marvell,", for Marvell Technology Group Ltd.
2903
29041) The /system-controller node
2905
2906 This node is used to represent the system-controller and must be
2907 present when the system uses a system contller chip. The top-level
2908 system-controller node contains information that is global to all
2909 devices within the system controller chip. The node name begins
2910 with "system-controller" followed by the unit address, which is
2911 the base address of the memory-mapped register set for the system
2912 controller chip.
2913
2914 Required properties:
2915
2916 - ranges : Describes the translation of system controller addresses
2917 for memory mapped registers.
2918 - clock-frequency: Contains the main clock frequency for the system
2919 controller chip.
2920 - reg : This property defines the address and size of the
2921 memory-mapped registers contained within the system controller
2922 chip. The address specified in the "reg" property should match
2923 the unit address of the system-controller node.
2924 - #address-cells : Address representation for system controller
2925 devices. This field represents the number of cells needed to
2926 represent the address of the memory-mapped registers of devices
2927 within the system controller chip.
2928 - #size-cells : Size representation for for the memory-mapped
2929 registers within the system controller chip.
2930 - #interrupt-cells : Defines the width of cells used to represent
2931 interrupts.
2932
2933 Optional properties:
2934
2935 - model : The specific model of the system controller chip. Such
2936 as, "mv64360", "mv64460", or "mv64560".
2937 - compatible : A string identifying the compatibility identifiers
2938 of the system controller chip.
2939
2940 The system-controller node contains child nodes for each system
2941 controller device that the platform uses. Nodes should not be created
2942 for devices which exist on the system controller chip but are not used
2943
2944 Example Marvell Discovery mv64360 system-controller node:
2945
2946 system-controller@f1000000 { /* Marvell Discovery mv64360 */
2947 #address-cells = <1>;
2948 #size-cells = <1>;
2949 model = "mv64360"; /* Default */
2950 compatible = "marvell,mv64360";
2951 clock-frequency = <133333333>;
2952 reg = <0xf1000000 0x10000>;
2953 virtual-reg = <0xf1000000>;
2954 ranges = <0x88000000 0x88000000 0x1000000 /* PCI 0 I/O Space */
2955 0x80000000 0x80000000 0x8000000 /* PCI 0 MEM Space */
2956 0xa0000000 0xa0000000 0x4000000 /* User FLASH */
2957 0x00000000 0xf1000000 0x0010000 /* Bridge's regs */
2958 0xf2000000 0xf2000000 0x0040000>;/* Integrated SRAM */
2959
2960 [ child node definitions... ]
2961 }
2962
29632) Child nodes of /system-controller
2964
2965 a) Marvell Discovery MDIO bus
2966
2967 The MDIO is a bus to which the PHY devices are connected. For each
2968 device that exists on this bus, a child node should be created. See
2969 the definition of the PHY node below for an example of how to define
2970 a PHY.
2971
2972 Required properties:
2973 - #address-cells : Should be <1>
2974 - #size-cells : Should be <0>
2975 - device_type : Should be "mdio"
2976 - compatible : Should be "marvell,mv64360-mdio"
2977
2978 Example:
2979
2980 mdio {
2981 #address-cells = <1>;
2982 #size-cells = <0>;
2983 device_type = "mdio";
2984 compatible = "marvell,mv64360-mdio";
2985
2986 ethernet-phy@0 {
2987 ......
2988 };
2989 };
2990
2991
2992 b) Marvell Discovery ethernet controller
2993
2994 The Discover ethernet controller is described with two levels
2995 of nodes. The first level describes an ethernet silicon block
2996 and the second level describes up to 3 ethernet nodes within
2997 that block. The reason for the multiple levels is that the
2998 registers for the node are interleaved within a single set
2999 of registers. The "ethernet-block" level describes the
3000 shared register set, and the "ethernet" nodes describe ethernet
3001 port-specific properties.
3002
3003 Ethernet block node
3004
3005 Required properties:
3006 - #address-cells : <1>
3007 - #size-cells : <0>
3008 - compatible : "marvell,mv64360-eth-block"
3009 - reg : Offset and length of the register set for this block
3010
3011 Example Discovery Ethernet block node:
3012 ethernet-block@2000 {
3013 #address-cells = <1>;
3014 #size-cells = <0>;
3015 compatible = "marvell,mv64360-eth-block";
3016 reg = <0x2000 0x2000>;
3017 ethernet@0 {
3018 .......
3019 };
3020 };
3021
3022 Ethernet port node
3023
3024 Required properties:
3025 - device_type : Should be "network".
3026 - compatible : Should be "marvell,mv64360-eth".
3027 - reg : Should be <0>, <1>, or <2>, according to which registers
3028 within the silicon block the device uses.
3029 - interrupts : <a> where a is the interrupt number for the port.
3030 - interrupt-parent : the phandle for the interrupt controller
3031 that services interrupts for this device.
3032 - phy : the phandle for the PHY connected to this ethernet
3033 controller.
3034 - local-mac-address : 6 bytes, MAC address
3035
3036 Example Discovery Ethernet port node:
3037 ethernet@0 {
3038 device_type = "network";
3039 compatible = "marvell,mv64360-eth";
3040 reg = <0>;
3041 interrupts = <32>;
3042 interrupt-parent = <&PIC>;
3043 phy = <&PHY0>;
3044 local-mac-address = [ 00 00 00 00 00 00 ];
3045 };
3046
3047
3048
3049 c) Marvell Discovery PHY nodes
3050
3051 Required properties:
3052 - device_type : Should be "ethernet-phy"
3053 - interrupts : <a> where a is the interrupt number for this phy.
3054 - interrupt-parent : the phandle for the interrupt controller that
3055 services interrupts for this device.
3056 - reg : The ID number for the phy, usually a small integer
3057
3058 Example Discovery PHY node:
3059 ethernet-phy@1 {
3060 device_type = "ethernet-phy";
3061 compatible = "broadcom,bcm5421";
3062 interrupts = <76>; /* GPP 12 */
3063 interrupt-parent = <&PIC>;
3064 reg = <1>;
3065 };
3066
3067
3068 d) Marvell Discovery SDMA nodes
3069
3070 Represent DMA hardware associated with the MPSC (multiprotocol
3071 serial controllers).
3072
3073 Required properties:
3074 - compatible : "marvell,mv64360-sdma"
3075 - reg : Offset and length of the register set for this device
3076 - interrupts : <a> where a is the interrupt number for the DMA
3077 device.
3078 - interrupt-parent : the phandle for the interrupt controller
3079 that services interrupts for this device.
3080
3081 Example Discovery SDMA node:
3082 sdma@4000 {
3083 compatible = "marvell,mv64360-sdma";
3084 reg = <0x4000 0xc18>;
3085 virtual-reg = <0xf1004000>;
3086 interrupts = <36>;
3087 interrupt-parent = <&PIC>;
3088 };
3089
3090
3091 e) Marvell Discovery BRG nodes
3092
3093 Represent baud rate generator hardware associated with the MPSC
3094 (multiprotocol serial controllers).
3095
3096 Required properties:
3097 - compatible : "marvell,mv64360-brg"
3098 - reg : Offset and length of the register set for this device
3099 - clock-src : A value from 0 to 15 which selects the clock
3100 source for the baud rate generator. This value corresponds
3101 to the CLKS value in the BRGx configuration register. See
3102 the mv64x60 User's Manual.
3103 - clock-frequence : The frequency (in Hz) of the baud rate
3104 generator's input clock.
3105 - current-speed : The current speed setting (presumably by
3106 firmware) of the baud rate generator.
3107
3108 Example Discovery BRG node:
3109 brg@b200 {
3110 compatible = "marvell,mv64360-brg";
3111 reg = <0xb200 0x8>;
3112 clock-src = <8>;
3113 clock-frequency = <133333333>;
3114 current-speed = <9600>;
3115 };
3116
3117
3118 f) Marvell Discovery CUNIT nodes
3119
3120 Represent the Serial Communications Unit device hardware.
3121
3122 Required properties:
3123 - reg : Offset and length of the register set for this device
3124
3125 Example Discovery CUNIT node:
3126 cunit@f200 {
3127 reg = <0xf200 0x200>;
3128 };
3129
3130
3131 g) Marvell Discovery MPSCROUTING nodes
3132
3133 Represent the Discovery's MPSC routing hardware
3134
3135 Required properties:
3136 - reg : Offset and length of the register set for this device
3137
3138 Example Discovery CUNIT node:
3139 mpscrouting@b500 {
3140 reg = <0xb400 0xc>;
3141 };
3142
3143
3144 h) Marvell Discovery MPSCINTR nodes
3145
3146 Represent the Discovery's MPSC DMA interrupt hardware registers
3147 (SDMA cause and mask registers).
3148
3149 Required properties:
3150 - reg : Offset and length of the register set for this device
3151
3152 Example Discovery MPSCINTR node:
3153 mpsintr@b800 {
3154 reg = <0xb800 0x100>;
3155 };
3156
3157
3158 i) Marvell Discovery MPSC nodes
3159
3160 Represent the Discovery's MPSC (Multiprotocol Serial Controller)
3161 serial port.
3162
3163 Required properties:
3164 - device_type : "serial"
3165 - compatible : "marvell,mv64360-mpsc"
3166 - reg : Offset and length of the register set for this device
3167 - sdma : the phandle for the SDMA node used by this port
3168 - brg : the phandle for the BRG node used by this port
3169 - cunit : the phandle for the CUNIT node used by this port
3170 - mpscrouting : the phandle for the MPSCROUTING node used by this port
3171 - mpscintr : the phandle for the MPSCINTR node used by this port
3172 - cell-index : the hardware index of this cell in the MPSC core
3173 - max_idle : value needed for MPSC CHR3 (Maximum Frame Length)
3174 register
3175 - interrupts : <a> where a is the interrupt number for the MPSC.
3176 - interrupt-parent : the phandle for the interrupt controller
3177 that services interrupts for this device.
3178
3179 Example Discovery MPSCINTR node:
3180 mpsc@8000 {
3181 device_type = "serial";
3182 compatible = "marvell,mv64360-mpsc";
3183 reg = <0x8000 0x38>;
3184 virtual-reg = <0xf1008000>;
3185 sdma = <&SDMA0>;
3186 brg = <&BRG0>;
3187 cunit = <&CUNIT>;
3188 mpscrouting = <&MPSCROUTING>;
3189 mpscintr = <&MPSCINTR>;
3190 cell-index = <0>;
3191 max_idle = <40>;
3192 interrupts = <40>;
3193 interrupt-parent = <&PIC>;
3194 };
3195
3196
3197 j) Marvell Discovery Watch Dog Timer nodes
3198
3199 Represent the Discovery's watchdog timer hardware
3200
3201 Required properties:
3202 - compatible : "marvell,mv64360-wdt"
3203 - reg : Offset and length of the register set for this device
3204
3205 Example Discovery Watch Dog Timer node:
3206 wdt@b410 {
3207 compatible = "marvell,mv64360-wdt";
3208 reg = <0xb410 0x8>;
3209 };
3210
3211
3212 k) Marvell Discovery I2C nodes
3213
3214 Represent the Discovery's I2C hardware
3215
3216 Required properties:
3217 - device_type : "i2c"
3218 - compatible : "marvell,mv64360-i2c"
3219 - reg : Offset and length of the register set for this device
3220 - interrupts : <a> where a is the interrupt number for the I2C.
3221 - interrupt-parent : the phandle for the interrupt controller
3222 that services interrupts for this device.
3223
3224 Example Discovery I2C node:
3225 compatible = "marvell,mv64360-i2c";
3226 reg = <0xc000 0x20>;
3227 virtual-reg = <0xf100c000>;
3228 interrupts = <37>;
3229 interrupt-parent = <&PIC>;
3230 };
3231
3232
3233 l) Marvell Discovery PIC (Programmable Interrupt Controller) nodes
3234
3235 Represent the Discovery's PIC hardware
3236
3237 Required properties:
3238 - #interrupt-cells : <1>
3239 - #address-cells : <0>
3240 - compatible : "marvell,mv64360-pic"
3241 - reg : Offset and length of the register set for this device
3242 - interrupt-controller
3243
3244 Example Discovery PIC node:
3245 pic {
3246 #interrupt-cells = <1>;
3247 #address-cells = <0>;
3248 compatible = "marvell,mv64360-pic";
3249 reg = <0x0 0x88>;
3250 interrupt-controller;
3251 };
3252
3253
3254 m) Marvell Discovery MPP (Multipurpose Pins) multiplexing nodes
3255
3256 Represent the Discovery's MPP hardware
3257
3258 Required properties:
3259 - compatible : "marvell,mv64360-mpp"
3260 - reg : Offset and length of the register set for this device
3261
3262 Example Discovery MPP node:
3263 mpp@f000 {
3264 compatible = "marvell,mv64360-mpp";
3265 reg = <0xf000 0x10>;
3266 };
3267
3268
3269 n) Marvell Discovery GPP (General Purpose Pins) nodes
3270
3271 Represent the Discovery's GPP hardware
3272
3273 Required properties:
3274 - compatible : "marvell,mv64360-gpp"
3275 - reg : Offset and length of the register set for this device
3276
3277 Example Discovery GPP node:
3278 gpp@f000 {
3279 compatible = "marvell,mv64360-gpp";
3280 reg = <0xf100 0x20>;
3281 };
3282
3283
3284 o) Marvell Discovery PCI host bridge node
3285
3286 Represents the Discovery's PCI host bridge device. The properties
3287 for this node conform to Rev 2.1 of the PCI Bus Binding to IEEE
3288 1275-1994. A typical value for the compatible property is
3289 "marvell,mv64360-pci".
3290
3291 Example Discovery PCI host bridge node
3292 pci@80000000 {
3293 #address-cells = <3>;
3294 #size-cells = <2>;
3295 #interrupt-cells = <1>;
3296 device_type = "pci";
3297 compatible = "marvell,mv64360-pci";
3298 reg = <0xcf8 0x8>;
3299 ranges = <0x01000000 0x0 0x0
3300 0x88000000 0x0 0x01000000
3301 0x02000000 0x0 0x80000000
3302 0x80000000 0x0 0x08000000>;
3303 bus-range = <0 255>;
3304 clock-frequency = <66000000>;
3305 interrupt-parent = <&PIC>;
3306 interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
3307 interrupt-map = <
3308 /* IDSEL 0x0a */
3309 0x5000 0 0 1 &PIC 80
3310 0x5000 0 0 2 &PIC 81
3311 0x5000 0 0 3 &PIC 91
3312 0x5000 0 0 4 &PIC 93
3313
3314 /* IDSEL 0x0b */
3315 0x5800 0 0 1 &PIC 91
3316 0x5800 0 0 2 &PIC 93
3317 0x5800 0 0 3 &PIC 80
3318 0x5800 0 0 4 &PIC 81
3319
3320 /* IDSEL 0x0c */
3321 0x6000 0 0 1 &PIC 91
3322 0x6000 0 0 2 &PIC 93
3323 0x6000 0 0 3 &PIC 80
3324 0x6000 0 0 4 &PIC 81
3325
3326 /* IDSEL 0x0d */
3327 0x6800 0 0 1 &PIC 93
3328 0x6800 0 0 2 &PIC 80
3329 0x6800 0 0 3 &PIC 81
3330 0x6800 0 0 4 &PIC 91
3331 >;
3332 };
3333
3334
3335 p) Marvell Discovery CPU Error nodes
3336
3337 Represent the Discovery's CPU error handler device.
3338
3339 Required properties:
3340 - compatible : "marvell,mv64360-cpu-error"
3341 - reg : Offset and length of the register set for this device
3342 - interrupts : the interrupt number for this device
3343 - interrupt-parent : the phandle for the interrupt controller
3344 that services interrupts for this device.
3345
3346 Example Discovery CPU Error node:
3347 cpu-error@0070 {
3348 compatible = "marvell,mv64360-cpu-error";
3349 reg = <0x70 0x10 0x128 0x28>;
3350 interrupts = <3>;
3351 interrupt-parent = <&PIC>;
3352 };
3353
3354
3355 q) Marvell Discovery SRAM Controller nodes
3356
3357 Represent the Discovery's SRAM controller device.
3358
3359 Required properties:
3360 - compatible : "marvell,mv64360-sram-ctrl"
3361 - reg : Offset and length of the register set for this device
3362 - interrupts : the interrupt number for this device
3363 - interrupt-parent : the phandle for the interrupt controller
3364 that services interrupts for this device.
3365
3366 Example Discovery SRAM Controller node:
3367 sram-ctrl@0380 {
3368 compatible = "marvell,mv64360-sram-ctrl";
3369 reg = <0x380 0x80>;
3370 interrupts = <13>;
3371 interrupt-parent = <&PIC>;
3372 };
3373
3374
3375 r) Marvell Discovery PCI Error Handler nodes
3376
3377 Represent the Discovery's PCI error handler device.
3378
3379 Required properties:
3380 - compatible : "marvell,mv64360-pci-error"
3381 - reg : Offset and length of the register set for this device
3382 - interrupts : the interrupt number for this device
3383 - interrupt-parent : the phandle for the interrupt controller
3384 that services interrupts for this device.
3385
3386 Example Discovery PCI Error Handler node:
3387 pci-error@1d40 {
3388 compatible = "marvell,mv64360-pci-error";
3389 reg = <0x1d40 0x40 0xc28 0x4>;
3390 interrupts = <12>;
3391 interrupt-parent = <&PIC>;
3392 };
3393
3394
3395 s) Marvell Discovery Memory Controller nodes
3396
3397 Represent the Discovery's memory controller device.
3398
3399 Required properties:
3400 - compatible : "marvell,mv64360-mem-ctrl"
3401 - reg : Offset and length of the register set for this device
3402 - interrupts : the interrupt number for this device
3403 - interrupt-parent : the phandle for the interrupt controller
3404 that services interrupts for this device.
3405
3406 Example Discovery Memory Controller node:
3407 mem-ctrl@1400 {
3408 compatible = "marvell,mv64360-mem-ctrl";
3409 reg = <0x1400 0x60>;
3410 interrupts = <17>;
3411 interrupt-parent = <&PIC>;
3412 };
3413
3414
3415VIII - Specifying interrupt information for devices
Stuart Yoder27565902007-03-02 13:42:33 -06003416===================================================
3417
3418The device tree represents the busses and devices of a hardware
3419system in a form similar to the physical bus topology of the
3420hardware.
3421
3422In addition, a logical 'interrupt tree' exists which represents the
3423hierarchy and routing of interrupts in the hardware.
3424
3425The interrupt tree model is fully described in the
3426document "Open Firmware Recommended Practice: Interrupt
3427Mapping Version 0.9". The document is available at:
3428<http://playground.sun.com/1275/practice>.
3429
34301) interrupts property
3431----------------------
3432
3433Devices that generate interrupts to a single interrupt controller
3434should use the conventional OF representation described in the
3435OF interrupt mapping documentation.
3436
3437Each device which generates interrupts must have an 'interrupt'
3438property. The interrupt property value is an arbitrary number of
3439of 'interrupt specifier' values which describe the interrupt or
3440interrupts for the device.
3441
3442The encoding of an interrupt specifier is determined by the
3443interrupt domain in which the device is located in the
3444interrupt tree. The root of an interrupt domain specifies in
3445its #interrupt-cells property the number of 32-bit cells
3446required to encode an interrupt specifier. See the OF interrupt
3447mapping documentation for a detailed description of domains.
3448
3449For example, the binding for the OpenPIC interrupt controller
3450specifies an #interrupt-cells value of 2 to encode the interrupt
3451number and level/sense information. All interrupt children in an
3452OpenPIC interrupt domain use 2 cells per interrupt in their interrupts
3453property.
3454
3455The PCI bus binding specifies a #interrupt-cell value of 1 to encode
3456which interrupt pin (INTA,INTB,INTC,INTD) is used.
3457
34582) interrupt-parent property
3459----------------------------
3460
3461The interrupt-parent property is specified to define an explicit
3462link between a device node and its interrupt parent in
3463the interrupt tree. The value of interrupt-parent is the
3464phandle of the parent node.
3465
3466If the interrupt-parent property is not defined for a node, it's
3467interrupt parent is assumed to be an ancestor in the node's
3468_device tree_ hierarchy.
3469
34703) OpenPIC Interrupt Controllers
3471--------------------------------
3472
3473OpenPIC interrupt controllers require 2 cells to encode
3474interrupt information. The first cell defines the interrupt
3475number. The second cell defines the sense and level
3476information.
3477
3478Sense and level information should be encoded as follows:
3479
3480 0 = low to high edge sensitive type enabled
3481 1 = active low level sensitive type enabled
3482 2 = active high level sensitive type enabled
3483 3 = high to low edge sensitive type enabled
3484
34854) ISA Interrupt Controllers
3486----------------------------
3487
3488ISA PIC interrupt controllers require 2 cells to encode
3489interrupt information. The first cell defines the interrupt
3490number. The second cell defines the sense and level
3491information.
3492
3493ISA PIC interrupt controllers should adhere to the ISA PIC
3494encodings listed below:
3495
3496 0 = active low level sensitive type enabled
3497 1 = active high level sensitive type enabled
3498 2 = high to low edge sensitive type enabled
3499 3 = low to high edge sensitive type enabled
3500
Anton Vorontsovb7ce3412008-04-11 23:06:36 +10003501VIII - Specifying GPIO information for devices
3502==============================================
3503
35041) gpios property
3505-----------------
3506
3507Nodes that makes use of GPIOs should define them using `gpios' property,
3508format of which is: <&gpio-controller1-phandle gpio1-specifier
3509 &gpio-controller2-phandle gpio2-specifier
3510 0 /* holes are permitted, means no GPIO 3 */
3511 &gpio-controller4-phandle gpio4-specifier
3512 ...>;
3513
3514Note that gpio-specifier length is controller dependent.
3515
3516gpio-specifier may encode: bank, pin position inside the bank,
3517whether pin is open-drain and whether pin is logically inverted.
3518
3519Example of the node using GPIOs:
3520
3521 node {
3522 gpios = <&qe_pio_e 18 0>;
3523 };
3524
3525In this example gpio-specifier is "18 0" and encodes GPIO pin number,
3526and empty GPIO flags as accepted by the "qe_pio_e" gpio-controller.
3527
35282) gpio-controller nodes
3529------------------------
3530
3531Every GPIO controller node must have #gpio-cells property defined,
3532this information will be used to translate gpio-specifiers.
3533
3534Example of two SOC GPIO banks defined as gpio-controller nodes:
3535
3536 qe_pio_a: gpio-controller@1400 {
3537 #gpio-cells = <2>;
3538 compatible = "fsl,qe-pario-bank-a", "fsl,qe-pario-bank";
3539 reg = <0x1400 0x18>;
3540 gpio-controller;
3541 };
3542
3543 qe_pio_e: gpio-controller@1460 {
3544 #gpio-cells = <2>;
3545 compatible = "fsl,qe-pario-bank-e", "fsl,qe-pario-bank";
3546 reg = <0x1460 0x18>;
3547 gpio-controller;
3548 };
David Gibsonc125a182006-02-01 03:05:22 -08003549
3550Appendix A - Sample SOC node for MPC8540
3551========================================
3552
3553Note that the #address-cells and #size-cells for the SoC node
3554in this example have been explicitly listed; these are likely
3555not necessary as they are usually the same as the root node.
3556
3557 soc8540@e0000000 {
3558 #address-cells = <1>;
3559 #size-cells = <1>;
3560 #interrupt-cells = <2>;
3561 device_type = "soc";
3562 ranges = <00000000 e0000000 00100000>
3563 reg = <e0000000 00003000>;
Becky Bruce7d4b95a2006-02-06 14:26:31 -06003564 bus-frequency = <0>;
David Gibsonc125a182006-02-01 03:05:22 -08003565
3566 mdio@24520 {
3567 reg = <24520 20>;
3568 device_type = "mdio";
3569 compatible = "gianfar";
3570
3571 ethernet-phy@0 {
3572 linux,phandle = <2452000>
3573 interrupt-parent = <40000>;
3574 interrupts = <35 1>;
3575 reg = <0>;
3576 device_type = "ethernet-phy";
3577 };
3578
3579 ethernet-phy@1 {
3580 linux,phandle = <2452001>
3581 interrupt-parent = <40000>;
3582 interrupts = <35 1>;
3583 reg = <1>;
3584 device_type = "ethernet-phy";
3585 };
3586
3587 ethernet-phy@3 {
3588 linux,phandle = <2452002>
3589 interrupt-parent = <40000>;
3590 interrupts = <35 1>;
3591 reg = <3>;
3592 device_type = "ethernet-phy";
3593 };
3594
3595 };
3596
3597 ethernet@24000 {
3598 #size-cells = <0>;
3599 device_type = "network";
3600 model = "TSEC";
3601 compatible = "gianfar";
3602 reg = <24000 1000>;
Jon Loeligerf5831652006-08-17 08:42:35 -05003603 mac-address = [ 00 E0 0C 00 73 00 ];
David Gibsonc125a182006-02-01 03:05:22 -08003604 interrupts = <d 3 e 3 12 3>;
3605 interrupt-parent = <40000>;
3606 phy-handle = <2452000>;
3607 };
3608
3609 ethernet@25000 {
3610 #address-cells = <1>;
3611 #size-cells = <0>;
3612 device_type = "network";
3613 model = "TSEC";
3614 compatible = "gianfar";
3615 reg = <25000 1000>;
Jon Loeligerf5831652006-08-17 08:42:35 -05003616 mac-address = [ 00 E0 0C 00 73 01 ];
David Gibsonc125a182006-02-01 03:05:22 -08003617 interrupts = <13 3 14 3 18 3>;
3618 interrupt-parent = <40000>;
3619 phy-handle = <2452001>;
3620 };
3621
3622 ethernet@26000 {
3623 #address-cells = <1>;
3624 #size-cells = <0>;
3625 device_type = "network";
3626 model = "FEC";
3627 compatible = "gianfar";
3628 reg = <26000 1000>;
Jon Loeligerf5831652006-08-17 08:42:35 -05003629 mac-address = [ 00 E0 0C 00 73 02 ];
David Gibsonc125a182006-02-01 03:05:22 -08003630 interrupts = <19 3>;
3631 interrupt-parent = <40000>;
3632 phy-handle = <2452002>;
3633 };
3634
3635 serial@4500 {
3636 device_type = "serial";
3637 compatible = "ns16550";
3638 reg = <4500 100>;
3639 clock-frequency = <0>;
3640 interrupts = <1a 3>;
3641 interrupt-parent = <40000>;
3642 };
3643
3644 pic@40000 {
3645 linux,phandle = <40000>;
3646 clock-frequency = <0>;
3647 interrupt-controller;
3648 #address-cells = <0>;
3649 reg = <40000 40000>;
3650 built-in;
3651 compatible = "chrp,open-pic";
3652 device_type = "open-pic";
3653 big-endian;
3654 };
3655
3656 i2c@3000 {
3657 interrupt-parent = <40000>;
3658 interrupts = <1b 3>;
3659 reg = <3000 18>;
3660 device_type = "i2c";
3661 compatible = "fsl-i2c";
3662 dfsrr;
3663 };
3664
3665 };