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