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