| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 1 |            Booting the Linux/ppc kernel without Open Firmware | 
 | 2 |            -------------------------------------------------- | 
 | 3 |  | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 4 | (c) 2005 Benjamin Herrenschmidt <benh at kernel.crashing.org>, | 
 | 5 |     IBM Corp. | 
 | 6 | (c) 2005 Becky Bruce <becky.bruce at freescale.com>, | 
 | 7 |     Freescale Semiconductor, FSL SOC and 32-bit additions | 
| Vitaly Wool | 28f9ec3 | 2006-11-20 16:32:39 +0300 | [diff] [blame] | 8 | (c) 2006 MontaVista Software, Inc. | 
 | 9 |     Flash chip node definition | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 10 |  | 
| Stuart Yoder | 5e1e9ba | 2007-06-06 04:29:14 +1000 | [diff] [blame] | 11 | Table of Contents | 
 | 12 | ================= | 
 | 13 |  | 
 | 14 |   I - Introduction | 
 | 15 |     1) Entry point for arch/powerpc | 
 | 16 |     2) Board support | 
 | 17 |  | 
 | 18 |   II - The DT block format | 
 | 19 |     1) Header | 
 | 20 |     2) Device tree generalities | 
 | 21 |     3) Device tree "structure" block | 
 | 22 |     4) Device tree "strings" block | 
 | 23 |  | 
 | 24 |   III - Required content of the device tree | 
 | 25 |     1) Note about cells and address representation | 
 | 26 |     2) Note about "compatible" properties | 
 | 27 |     3) Note about "name" properties | 
 | 28 |     4) Note about node and property names and character set | 
 | 29 |     5) Required nodes and properties | 
 | 30 |       a) The root node | 
 | 31 |       b) The /cpus node | 
 | 32 |       c) The /cpus/* nodes | 
 | 33 |       d) the /memory node(s) | 
 | 34 |       e) The /chosen node | 
 | 35 |       f) the /soc<SOCname> node | 
 | 36 |  | 
 | 37 |   IV - "dtc", the device tree compiler | 
 | 38 |  | 
 | 39 |   V - Recommendations for a bootloader | 
 | 40 |  | 
 | 41 |   VI - System-on-a-chip devices and nodes | 
 | 42 |     1) Defining child nodes of an SOC | 
 | 43 |     2) Representing devices without a current OF specification | 
| Trent Piepho | ec5d765 | 2008-11-10 13:09:21 -0800 | [diff] [blame] | 44 |       a) PHY nodes | 
 | 45 |       b) Interrupt controllers | 
| Stefan Roese | efcc2da | 2009-04-16 15:11:54 -0600 | [diff] [blame] | 46 |       c) 4xx/Axon EMAC ethernet nodes | 
 | 47 |       d) Xilinx IP cores | 
 | 48 |       e) USB EHCI controllers | 
 | 49 |       f) MDIO on GPIOs | 
 | 50 |       g) SPI busses | 
| Stuart Yoder | 5e1e9ba | 2007-06-06 04:29:14 +1000 | [diff] [blame] | 51 |  | 
| Anton Vorontsov | b9e0ba8 | 2010-08-11 20:56:03 +0400 | [diff] [blame] | 52 |   VII - Specifying interrupt information for devices | 
| Stuart Yoder | 5e1e9ba | 2007-06-06 04:29:14 +1000 | [diff] [blame] | 53 |     1) interrupts property | 
 | 54 |     2) interrupt-parent property | 
 | 55 |     3) OpenPIC Interrupt Controllers | 
 | 56 |     4) ISA Interrupt Controllers | 
 | 57 |  | 
| Anton Vorontsov | b9e0ba8 | 2010-08-11 20:56:03 +0400 | [diff] [blame] | 58 |   VIII - Specifying device power management information (sleep property) | 
| Scott Wood | 2dff417 | 2008-07-11 17:31:15 -0500 | [diff] [blame] | 59 |  | 
| Stuart Yoder | 5e1e9ba | 2007-06-06 04:29:14 +1000 | [diff] [blame] | 60 |   Appendix A - Sample SOC node for MPC8540 | 
 | 61 |  | 
 | 62 |  | 
 | 63 | Revision Information | 
 | 64 | ==================== | 
 | 65 |  | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 66 |    May 18, 2005: Rev 0.1 - Initial draft, no chapter III yet. | 
 | 67 |  | 
 | 68 |    May 19, 2005: Rev 0.2 - Add chapter III and bits & pieces here or | 
 | 69 |                            clarifies the fact that a lot of things are | 
 | 70 |                            optional, the kernel only requires a very | 
 | 71 |                            small device tree, though it is encouraged | 
 | 72 |                            to provide an as complete one as possible. | 
 | 73 |  | 
 | 74 |    May 24, 2005: Rev 0.3 - Precise that DT block has to be in RAM | 
 | 75 | 			 - Misc fixes | 
 | 76 | 			 - Define version 3 and new format version 16 | 
 | 77 | 			   for the DT block (version 16 needs kernel | 
 | 78 | 			   patches, will be fwd separately). | 
 | 79 | 			   String block now has a size, and full path | 
 | 80 | 			   is replaced by unit name for more | 
 | 81 | 			   compactness. | 
 | 82 | 			   linux,phandle is made optional, only nodes | 
 | 83 | 			   that are referenced by other nodes need it. | 
 | 84 | 			   "name" property is now automatically | 
 | 85 | 			   deduced from the unit name | 
 | 86 |  | 
 | 87 |    June 1, 2005: Rev 0.4 - Correct confusion between OF_DT_END and | 
 | 88 |                            OF_DT_END_NODE in structure definition. | 
 | 89 |                          - Change version 16 format to always align | 
 | 90 |                            property data to 4 bytes. Since tokens are | 
 | 91 |                            already aligned, that means no specific | 
| Matt LaPlante | 5d3f083 | 2006-11-30 05:21:10 +0100 | [diff] [blame] | 92 |                            required alignment between property size | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 93 |                            and property data. The old style variable | 
 | 94 |                            alignment would make it impossible to do | 
 | 95 |                            "simple" insertion of properties using | 
| Domen Puncer | 5dd6016 | 2007-03-02 21:44:45 +1100 | [diff] [blame] | 96 |                            memmove (thanks Milton for | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 97 |                            noticing). Updated kernel patch as well | 
| Matt LaPlante | 5d3f083 | 2006-11-30 05:21:10 +0100 | [diff] [blame] | 98 | 			 - Correct a few more alignment constraints | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 99 | 			 - Add a chapter about the device-tree | 
 | 100 |                            compiler and the textural representation of | 
 | 101 |                            the tree that can be "compiled" by dtc. | 
 | 102 |  | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 103 |    November 21, 2005: Rev 0.5 | 
 | 104 | 			 - Additions/generalizations for 32-bit | 
 | 105 | 			 - Changed to reflect the new arch/powerpc | 
 | 106 | 			   structure | 
 | 107 | 			 - Added chapter VI | 
 | 108 |  | 
 | 109 |  | 
 | 110 |  ToDo: | 
 | 111 | 	- Add some definitions of interrupt tree (simple/complex) | 
| Domen Puncer | 5dd6016 | 2007-03-02 21:44:45 +1100 | [diff] [blame] | 112 | 	- Add some definitions for PCI host bridges | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 113 | 	- Add some common address format examples | 
 | 114 | 	- Add definitions for standard properties and "compatible" | 
 | 115 | 	  names for cells that are not already defined by the existing | 
 | 116 | 	  OF spec. | 
 | 117 | 	- Compare FSL SOC use of PCI to standard and make sure no new | 
 | 118 | 	  node definition required. | 
 | 119 | 	- Add more information about node definitions for SOC devices | 
 | 120 |   	  that currently have no standard, like the FSL CPM. | 
 | 121 |  | 
 | 122 |  | 
 | 123 | I - Introduction | 
 | 124 | ================ | 
 | 125 |  | 
 | 126 | During the recent development of the Linux/ppc64 kernel, and more | 
 | 127 | specifically, the addition of new platform types outside of the old | 
 | 128 | IBM pSeries/iSeries pair, it was decided to enforce some strict rules | 
 | 129 | regarding the kernel entry and bootloader <-> kernel interfaces, in | 
 | 130 | order to avoid the degeneration that had become the ppc32 kernel entry | 
 | 131 | point and the way a new platform should be added to the kernel. The | 
 | 132 | legacy iSeries platform breaks those rules as it predates this scheme, | 
 | 133 | but no new board support will be accepted in the main tree that | 
 | 134 | doesn't follows them properly.  In addition, since the advent of the | 
 | 135 | arch/powerpc merged architecture for ppc32 and ppc64, new 32-bit | 
 | 136 | platforms and 32-bit platforms which move into arch/powerpc will be | 
 | 137 | required to use these rules as well. | 
 | 138 |  | 
 | 139 | The main requirement that will be defined in more detail below is | 
 | 140 | the presence of a device-tree whose format is defined after Open | 
 | 141 | Firmware specification. However, in order to make life easier | 
 | 142 | to embedded board vendors, the kernel doesn't require the device-tree | 
 | 143 | to represent every device in the system and only requires some nodes | 
 | 144 | and properties to be present. This will be described in detail in | 
 | 145 | section III, but, for example, the kernel does not require you to | 
 | 146 | create a node for every PCI device in the system. It is a requirement | 
 | 147 | to have a node for PCI host bridges in order to provide interrupt | 
 | 148 | routing informations and memory/IO ranges, among others. It is also | 
 | 149 | recommended to define nodes for on chip devices and other busses that | 
 | 150 | don't specifically fit in an existing OF specification. This creates a | 
 | 151 | great flexibility in the way the kernel can then probe those and match | 
 | 152 | drivers to device, without having to hard code all sorts of tables. It | 
 | 153 | also makes it more flexible for board vendors to do minor hardware | 
 | 154 | upgrades without significantly impacting the kernel code or cluttering | 
 | 155 | it with special cases. | 
 | 156 |  | 
 | 157 |  | 
 | 158 | 1) Entry point for arch/powerpc | 
 | 159 | ------------------------------- | 
 | 160 |  | 
 | 161 |    There is one and one single entry point to the kernel, at the start | 
 | 162 |    of the kernel image. That entry point supports two calling | 
 | 163 |    conventions: | 
 | 164 |  | 
 | 165 |         a) Boot from Open Firmware. If your firmware is compatible | 
 | 166 |         with Open Firmware (IEEE 1275) or provides an OF compatible | 
 | 167 |         client interface API (support for "interpret" callback of | 
 | 168 |         forth words isn't required), you can enter the kernel with: | 
 | 169 |  | 
 | 170 |               r5 : OF callback pointer as defined by IEEE 1275 | 
| Domen Puncer | 5dd6016 | 2007-03-02 21:44:45 +1100 | [diff] [blame] | 171 |               bindings to powerpc. Only the 32-bit client interface | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 172 |               is currently supported | 
 | 173 |  | 
 | 174 |               r3, r4 : address & length of an initrd if any or 0 | 
 | 175 |  | 
 | 176 |               The MMU is either on or off; the kernel will run the | 
 | 177 |               trampoline located in arch/powerpc/kernel/prom_init.c to | 
 | 178 |               extract the device-tree and other information from open | 
 | 179 |               firmware and build a flattened device-tree as described | 
 | 180 |               in b). prom_init() will then re-enter the kernel using | 
 | 181 |               the second method. This trampoline code runs in the | 
 | 182 |               context of the firmware, which is supposed to handle all | 
 | 183 |               exceptions during that time. | 
 | 184 |  | 
 | 185 |         b) Direct entry with a flattened device-tree block. This entry | 
 | 186 |         point is called by a) after the OF trampoline and can also be | 
 | 187 |         called directly by a bootloader that does not support the Open | 
 | 188 |         Firmware client interface. It is also used by "kexec" to | 
 | 189 |         implement "hot" booting of a new kernel from a previous | 
 | 190 |         running one. This method is what I will describe in more | 
 | 191 |         details in this document, as method a) is simply standard Open | 
 | 192 |         Firmware, and thus should be implemented according to the | 
 | 193 |         various standard documents defining it and its binding to the | 
 | 194 |         PowerPC platform. The entry point definition then becomes: | 
 | 195 |  | 
 | 196 |                 r3 : physical pointer to the device-tree block | 
 | 197 |                 (defined in chapter II) in RAM | 
 | 198 |  | 
 | 199 |                 r4 : physical pointer to the kernel itself. This is | 
 | 200 |                 used by the assembly code to properly disable the MMU | 
 | 201 |                 in case you are entering the kernel with MMU enabled | 
 | 202 |                 and a non-1:1 mapping. | 
 | 203 |  | 
| Matt LaPlante | 2fe0ae7 | 2006-10-03 22:50:39 +0200 | [diff] [blame] | 204 |                 r5 : NULL (as to differentiate with method a) | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 205 |  | 
 | 206 |         Note about SMP entry: Either your firmware puts your other | 
 | 207 |         CPUs in some sleep loop or spin loop in ROM where you can get | 
 | 208 |         them out via a soft reset or some other means, in which case | 
 | 209 |         you don't need to care, or you'll have to enter the kernel | 
 | 210 |         with all CPUs. The way to do that with method b) will be | 
 | 211 |         described in a later revision of this document. | 
 | 212 |  | 
 | 213 |  | 
 | 214 | 2) Board support | 
 | 215 | ---------------- | 
 | 216 |  | 
 | 217 | 64-bit kernels: | 
 | 218 |  | 
 | 219 |    Board supports (platforms) are not exclusive config options. An | 
 | 220 |    arbitrary set of board supports can be built in a single kernel | 
 | 221 |    image. The kernel will "know" what set of functions to use for a | 
 | 222 |    given platform based on the content of the device-tree. Thus, you | 
 | 223 |    should: | 
 | 224 |  | 
 | 225 |         a) add your platform support as a _boolean_ option in | 
 | 226 |         arch/powerpc/Kconfig, following the example of PPC_PSERIES, | 
 | 227 |         PPC_PMAC and PPC_MAPLE. The later is probably a good | 
 | 228 |         example of a board support to start from. | 
 | 229 |  | 
 | 230 |         b) create your main platform file as | 
 | 231 |         "arch/powerpc/platforms/myplatform/myboard_setup.c" and add it | 
 | 232 |         to the Makefile under the condition of your CONFIG_ | 
 | 233 |         option. This file will define a structure of type "ppc_md" | 
 | 234 |         containing the various callbacks that the generic code will | 
 | 235 |         use to get to your platform specific code | 
 | 236 |  | 
 | 237 |         c) Add a reference to your "ppc_md" structure in the | 
 | 238 |         "machines" table in arch/powerpc/kernel/setup_64.c if you are | 
 | 239 |         a 64-bit platform. | 
 | 240 |  | 
 | 241 |         d) request and get assigned a platform number (see PLATFORM_* | 
| Stephen Rothwell | b8b572e | 2008-08-01 15:20:30 +1000 | [diff] [blame] | 242 |         constants in arch/powerpc/include/asm/processor.h | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 243 |  | 
 | 244 | 32-bit embedded kernels: | 
 | 245 |  | 
 | 246 |   Currently, board support is essentially an exclusive config option. | 
 | 247 |   The kernel is configured for a single platform.  Part of the reason | 
 | 248 |   for this is to keep kernels on embedded systems small and efficient; | 
 | 249 |   part of this is due to the fact the code is already that way. In the | 
 | 250 |   future, a kernel may support multiple platforms, but only if the | 
| Domen Puncer | 5dd6016 | 2007-03-02 21:44:45 +1100 | [diff] [blame] | 251 |   platforms feature the same core architecture.  A single kernel build | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 252 |   cannot support both configurations with Book E and configurations | 
 | 253 |   with classic Powerpc architectures. | 
 | 254 |  | 
 | 255 |   32-bit embedded platforms that are moved into arch/powerpc using a | 
 | 256 |   flattened device tree should adopt the merged tree practice of | 
 | 257 |   setting ppc_md up dynamically, even though the kernel is currently | 
 | 258 |   built with support for only a single platform at a time.  This allows | 
 | 259 |   unification of the setup code, and will make it easier to go to a | 
 | 260 |   multiple-platform-support model in the future. | 
 | 261 |  | 
 | 262 | NOTE: I believe the above will be true once Ben's done with the merge | 
 | 263 | of the boot sequences.... someone speak up if this is wrong! | 
 | 264 |  | 
 | 265 |   To add a 32-bit embedded platform support, follow the instructions | 
 | 266 |   for 64-bit platforms above, with the exception that the Kconfig | 
 | 267 |   option should be set up such that the kernel builds exclusively for | 
 | 268 |   the platform selected.  The processor type for the platform should | 
 | 269 |   enable another config option to select the specific board | 
 | 270 |   supported. | 
 | 271 |  | 
| Domen Puncer | 5dd6016 | 2007-03-02 21:44:45 +1100 | [diff] [blame] | 272 | NOTE: If Ben doesn't merge the setup files, may need to change this to | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 273 | point to setup_32.c | 
 | 274 |  | 
 | 275 |  | 
 | 276 |    I will describe later the boot process and various callbacks that | 
 | 277 |    your platform should implement. | 
 | 278 |  | 
 | 279 |  | 
 | 280 | II - The DT block format | 
 | 281 | ======================== | 
 | 282 |  | 
 | 283 |  | 
 | 284 | This chapter defines the actual format of the flattened device-tree | 
 | 285 | passed to the kernel. The actual content of it and kernel requirements | 
 | 286 | are described later. You can find example of code manipulating that | 
 | 287 | format in various places, including arch/powerpc/kernel/prom_init.c | 
 | 288 | which will generate a flattened device-tree from the Open Firmware | 
 | 289 | representation, or the fs2dt utility which is part of the kexec tools | 
 | 290 | which will generate one from a filesystem representation. It is | 
 | 291 | expected that a bootloader like uboot provides a bit more support, | 
 | 292 | that will be discussed later as well. | 
 | 293 |  | 
 | 294 | Note: The block has to be in main memory. It has to be accessible in | 
 | 295 | both real mode and virtual mode with no mapping other than main | 
 | 296 | memory. If you are writing a simple flash bootloader, it should copy | 
 | 297 | the block to RAM before passing it to the kernel. | 
 | 298 |  | 
 | 299 |  | 
 | 300 | 1) Header | 
 | 301 | --------- | 
 | 302 |  | 
 | 303 |    The kernel is entered with r3 pointing to an area of memory that is | 
| Stephen Rothwell | b8b572e | 2008-08-01 15:20:30 +1000 | [diff] [blame] | 304 |    roughly described in arch/powerpc/include/asm/prom.h by the structure | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 305 |    boot_param_header: | 
 | 306 |  | 
 | 307 | struct boot_param_header { | 
 | 308 |         u32     magic;                  /* magic word OF_DT_HEADER */ | 
 | 309 |         u32     totalsize;              /* total size of DT block */ | 
 | 310 |         u32     off_dt_struct;          /* offset to structure */ | 
 | 311 |         u32     off_dt_strings;         /* offset to strings */ | 
 | 312 |         u32     off_mem_rsvmap;         /* offset to memory reserve map | 
| Domen Puncer | 5dd6016 | 2007-03-02 21:44:45 +1100 | [diff] [blame] | 313 |                                            */ | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 314 |         u32     version;                /* format version */ | 
 | 315 |         u32     last_comp_version;      /* last compatible version */ | 
 | 316 |  | 
 | 317 |         /* version 2 fields below */ | 
 | 318 |         u32     boot_cpuid_phys;        /* Which physical CPU id we're | 
 | 319 |                                            booting on */ | 
 | 320 |         /* version 3 fields below */ | 
 | 321 |         u32     size_dt_strings;        /* size of the strings block */ | 
| David Gibson | 0e0293c | 2007-03-14 11:50:40 +1100 | [diff] [blame] | 322 |  | 
 | 323 |         /* version 17 fields below */ | 
 | 324 |         u32	size_dt_struct;		/* size of the DT structure block */ | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 325 | }; | 
 | 326 |  | 
 | 327 |    Along with the constants: | 
 | 328 |  | 
 | 329 | /* Definitions used by the flattened device tree */ | 
 | 330 | #define OF_DT_HEADER            0xd00dfeed      /* 4: version, | 
 | 331 | 						   4: total size */ | 
 | 332 | #define OF_DT_BEGIN_NODE        0x1             /* Start node: full name | 
| Domen Puncer | 5dd6016 | 2007-03-02 21:44:45 +1100 | [diff] [blame] | 333 | 						   */ | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 334 | #define OF_DT_END_NODE          0x2             /* End node */ | 
 | 335 | #define OF_DT_PROP              0x3             /* Property: name off, | 
 | 336 |                                                    size, content */ | 
 | 337 | #define OF_DT_END               0x9 | 
 | 338 |  | 
 | 339 |    All values in this header are in big endian format, the various | 
 | 340 |    fields in this header are defined more precisely below. All | 
 | 341 |    "offset" values are in bytes from the start of the header; that is | 
 | 342 |    from the value of r3. | 
 | 343 |  | 
 | 344 |    - magic | 
 | 345 |  | 
 | 346 |      This is a magic value that "marks" the beginning of the | 
 | 347 |      device-tree block header. It contains the value 0xd00dfeed and is | 
 | 348 |      defined by the constant OF_DT_HEADER | 
 | 349 |  | 
 | 350 |    - totalsize | 
 | 351 |  | 
 | 352 |      This is the total size of the DT block including the header. The | 
 | 353 |      "DT" block should enclose all data structures defined in this | 
 | 354 |      chapter (who are pointed to by offsets in this header). That is, | 
 | 355 |      the device-tree structure, strings, and the memory reserve map. | 
 | 356 |  | 
 | 357 |    - off_dt_struct | 
 | 358 |  | 
 | 359 |      This is an offset from the beginning of the header to the start | 
 | 360 |      of the "structure" part the device tree. (see 2) device tree) | 
 | 361 |  | 
 | 362 |    - off_dt_strings | 
 | 363 |  | 
 | 364 |      This is an offset from the beginning of the header to the start | 
 | 365 |      of the "strings" part of the device-tree | 
 | 366 |  | 
 | 367 |    - off_mem_rsvmap | 
 | 368 |  | 
 | 369 |      This is an offset from the beginning of the header to the start | 
| Domen Puncer | 5dd6016 | 2007-03-02 21:44:45 +1100 | [diff] [blame] | 370 |      of the reserved memory map. This map is a list of pairs of 64- | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 371 |      bit integers. Each pair is a physical address and a size. The | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 372 |      list is terminated by an entry of size 0. This map provides the | 
 | 373 |      kernel with a list of physical memory areas that are "reserved" | 
 | 374 |      and thus not to be used for memory allocations, especially during | 
 | 375 |      early initialization. The kernel needs to allocate memory during | 
 | 376 |      boot for things like un-flattening the device-tree, allocating an | 
 | 377 |      MMU hash table, etc... Those allocations must be done in such a | 
 | 378 |      way to avoid overriding critical things like, on Open Firmware | 
 | 379 |      capable machines, the RTAS instance, or on some pSeries, the TCE | 
 | 380 |      tables used for the iommu. Typically, the reserve map should | 
 | 381 |      contain _at least_ this DT block itself (header,total_size). If | 
 | 382 |      you are passing an initrd to the kernel, you should reserve it as | 
 | 383 |      well. You do not need to reserve the kernel image itself. The map | 
| Domen Puncer | 5dd6016 | 2007-03-02 21:44:45 +1100 | [diff] [blame] | 384 |      should be 64-bit aligned. | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 385 |  | 
 | 386 |    - version | 
 | 387 |  | 
 | 388 |      This is the version of this structure. Version 1 stops | 
 | 389 |      here. Version 2 adds an additional field boot_cpuid_phys. | 
 | 390 |      Version 3 adds the size of the strings block, allowing the kernel | 
 | 391 |      to reallocate it easily at boot and free up the unused flattened | 
 | 392 |      structure after expansion. Version 16 introduces a new more | 
 | 393 |      "compact" format for the tree itself that is however not backward | 
| David Gibson | 0e0293c | 2007-03-14 11:50:40 +1100 | [diff] [blame] | 394 |      compatible. Version 17 adds an additional field, size_dt_struct, | 
 | 395 |      allowing it to be reallocated or moved more easily (this is | 
 | 396 |      particularly useful for bootloaders which need to make | 
 | 397 |      adjustments to a device tree based on probed information). You | 
 | 398 |      should always generate a structure of the highest version defined | 
 | 399 |      at the time of your implementation. Currently that is version 17, | 
 | 400 |      unless you explicitly aim at being backward compatible. | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 401 |  | 
 | 402 |    - last_comp_version | 
 | 403 |  | 
 | 404 |      Last compatible version. This indicates down to what version of | 
 | 405 |      the DT block you are backward compatible. For example, version 2 | 
 | 406 |      is backward compatible with version 1 (that is, a kernel build | 
 | 407 |      for version 1 will be able to boot with a version 2 format). You | 
 | 408 |      should put a 1 in this field if you generate a device tree of | 
| David Gibson | 0e0293c | 2007-03-14 11:50:40 +1100 | [diff] [blame] | 409 |      version 1 to 3, or 16 if you generate a tree of version 16 or 17 | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 410 |      using the new unit name format. | 
 | 411 |  | 
 | 412 |    - boot_cpuid_phys | 
 | 413 |  | 
 | 414 |      This field only exist on version 2 headers. It indicate which | 
 | 415 |      physical CPU ID is calling the kernel entry point. This is used, | 
 | 416 |      among others, by kexec. If you are on an SMP system, this value | 
 | 417 |      should match the content of the "reg" property of the CPU node in | 
 | 418 |      the device-tree corresponding to the CPU calling the kernel entry | 
 | 419 |      point (see further chapters for more informations on the required | 
 | 420 |      device-tree contents) | 
 | 421 |  | 
| David Gibson | 0e0293c | 2007-03-14 11:50:40 +1100 | [diff] [blame] | 422 |    - size_dt_strings | 
 | 423 |  | 
 | 424 |      This field only exists on version 3 and later headers.  It | 
 | 425 |      gives the size of the "strings" section of the device tree (which | 
 | 426 |      starts at the offset given by off_dt_strings). | 
 | 427 |  | 
 | 428 |    - size_dt_struct | 
 | 429 |  | 
 | 430 |      This field only exists on version 17 and later headers.  It gives | 
 | 431 |      the size of the "structure" section of the device tree (which | 
 | 432 |      starts at the offset given by off_dt_struct). | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 433 |  | 
 | 434 |    So the typical layout of a DT block (though the various parts don't | 
 | 435 |    need to be in that order) looks like this (addresses go from top to | 
 | 436 |    bottom): | 
 | 437 |  | 
 | 438 |  | 
 | 439 |              ------------------------------ | 
 | 440 |        r3 -> |  struct boot_param_header  | | 
 | 441 |              ------------------------------ | 
 | 442 |              |      (alignment gap) (*)   | | 
 | 443 |              ------------------------------ | 
 | 444 |              |      memory reserve map    | | 
 | 445 |              ------------------------------ | 
 | 446 |              |      (alignment gap)       | | 
 | 447 |              ------------------------------ | 
 | 448 |              |                            | | 
 | 449 |              |    device-tree structure   | | 
 | 450 |              |                            | | 
 | 451 |              ------------------------------ | 
 | 452 |              |      (alignment gap)       | | 
 | 453 |              ------------------------------ | 
 | 454 |              |                            | | 
 | 455 |              |     device-tree strings    | | 
 | 456 |              |                            | | 
 | 457 |       -----> ------------------------------ | 
 | 458 |       | | 
 | 459 |       | | 
 | 460 |       --- (r3 + totalsize) | 
 | 461 |  | 
 | 462 |   (*) The alignment gaps are not necessarily present; their presence | 
 | 463 |       and size are dependent on the various alignment requirements of | 
 | 464 |       the individual data blocks. | 
 | 465 |  | 
 | 466 |  | 
 | 467 | 2) Device tree generalities | 
 | 468 | --------------------------- | 
 | 469 |  | 
 | 470 | This device-tree itself is separated in two different blocks, a | 
 | 471 | structure block and a strings block. Both need to be aligned to a 4 | 
 | 472 | byte boundary. | 
 | 473 |  | 
 | 474 | First, let's quickly describe the device-tree concept before detailing | 
 | 475 | the storage format. This chapter does _not_ describe the detail of the | 
 | 476 | required types of nodes & properties for the kernel, this is done | 
 | 477 | later in chapter III. | 
 | 478 |  | 
 | 479 | The device-tree layout is strongly inherited from the definition of | 
 | 480 | the Open Firmware IEEE 1275 device-tree. It's basically a tree of | 
 | 481 | nodes, each node having two or more named properties. A property can | 
 | 482 | have a value or not. | 
 | 483 |  | 
 | 484 | It is a tree, so each node has one and only one parent except for the | 
 | 485 | root node who has no parent. | 
 | 486 |  | 
 | 487 | A node has 2 names. The actual node name is generally contained in a | 
 | 488 | property of type "name" in the node property list whose value is a | 
 | 489 | zero terminated string and is mandatory for version 1 to 3 of the | 
| David Gibson | 0e0293c | 2007-03-14 11:50:40 +1100 | [diff] [blame] | 490 | format definition (as it is in Open Firmware). Version 16 makes it | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 491 | optional as it can generate it from the unit name defined below. | 
 | 492 |  | 
| Matt LaPlante | 2fe0ae7 | 2006-10-03 22:50:39 +0200 | [diff] [blame] | 493 | There is also a "unit name" that is used to differentiate nodes with | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 494 | the same name at the same level, it is usually made of the node | 
| Matt LaPlante | 2fe0ae7 | 2006-10-03 22:50:39 +0200 | [diff] [blame] | 495 | names, the "@" sign, and a "unit address", which definition is | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 496 | specific to the bus type the node sits on. | 
 | 497 |  | 
 | 498 | The unit name doesn't exist as a property per-se but is included in | 
 | 499 | the device-tree structure. It is typically used to represent "path" in | 
 | 500 | the device-tree. More details about the actual format of these will be | 
 | 501 | below. | 
 | 502 |  | 
 | 503 | The kernel powerpc generic code does not make any formal use of the | 
 | 504 | unit address (though some board support code may do) so the only real | 
 | 505 | requirement here for the unit address is to ensure uniqueness of | 
 | 506 | the node unit name at a given level of the tree. Nodes with no notion | 
 | 507 | of address and no possible sibling of the same name (like /memory or | 
 | 508 | /cpus) may omit the unit address in the context of this specification, | 
 | 509 | or use the "@0" default unit address. The unit name is used to define | 
 | 510 | a node "full path", which is the concatenation of all parent node | 
 | 511 | unit names separated with "/". | 
 | 512 |  | 
 | 513 | The root node doesn't have a defined name, and isn't required to have | 
 | 514 | a name property either if you are using version 3 or earlier of the | 
 | 515 | format. It also has no unit address (no @ symbol followed by a unit | 
 | 516 | address). The root node unit name is thus an empty string. The full | 
 | 517 | path to the root node is "/". | 
 | 518 |  | 
 | 519 | Every node which actually represents an actual device (that is, a node | 
 | 520 | which isn't only a virtual "container" for more nodes, like "/cpus" | 
 | 521 | is) is also required to have a "device_type" property indicating the | 
 | 522 | type of node . | 
 | 523 |  | 
 | 524 | Finally, every node that can be referenced from a property in another | 
 | 525 | node is required to have a "linux,phandle" property. Real open | 
 | 526 | firmware implementations provide a unique "phandle" value for every | 
 | 527 | node that the "prom_init()" trampoline code turns into | 
 | 528 | "linux,phandle" properties. However, this is made optional if the | 
 | 529 | flattened device tree is used directly. An example of a node | 
 | 530 | referencing another node via "phandle" is when laying out the | 
 | 531 | interrupt tree which will be described in a further version of this | 
 | 532 | document. | 
 | 533 |  | 
| Domen Puncer | 5dd6016 | 2007-03-02 21:44:45 +1100 | [diff] [blame] | 534 | This "linux, phandle" property is a 32-bit value that uniquely | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 535 | identifies a node. You are free to use whatever values or system of | 
 | 536 | values, internal pointers, or whatever to generate these, the only | 
 | 537 | requirement is that every node for which you provide that property has | 
 | 538 | a unique value for it. | 
 | 539 |  | 
 | 540 | Here is an example of a simple device-tree. In this example, an "o" | 
 | 541 | designates a node followed by the node unit name. Properties are | 
 | 542 | presented with their name followed by their content. "content" | 
 | 543 | represents an ASCII string (zero terminated) value, while <content> | 
| Domen Puncer | 5dd6016 | 2007-03-02 21:44:45 +1100 | [diff] [blame] | 544 | represents a 32-bit hexadecimal value. The various nodes in this | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 545 | example will be discussed in a later chapter. At this point, it is | 
 | 546 | only meant to give you a idea of what a device-tree looks like. I have | 
 | 547 | purposefully kept the "name" and "linux,phandle" properties which | 
 | 548 | aren't necessary in order to give you a better idea of what the tree | 
 | 549 | looks like in practice. | 
 | 550 |  | 
 | 551 |   / o device-tree | 
 | 552 |       |- name = "device-tree" | 
 | 553 |       |- model = "MyBoardName" | 
 | 554 |       |- compatible = "MyBoardFamilyName" | 
 | 555 |       |- #address-cells = <2> | 
 | 556 |       |- #size-cells = <2> | 
 | 557 |       |- linux,phandle = <0> | 
 | 558 |       | | 
 | 559 |       o cpus | 
 | 560 |       | | - name = "cpus" | 
 | 561 |       | | - linux,phandle = <1> | 
 | 562 |       | | - #address-cells = <1> | 
 | 563 |       | | - #size-cells = <0> | 
 | 564 |       | | | 
 | 565 |       | o PowerPC,970@0 | 
 | 566 |       |   |- name = "PowerPC,970" | 
 | 567 |       |   |- device_type = "cpu" | 
 | 568 |       |   |- reg = <0> | 
 | 569 |       |   |- clock-frequency = <5f5e1000> | 
| Timur Tabi | 32aed2a | 2007-02-14 15:29:07 -0600 | [diff] [blame] | 570 |       |   |- 64-bit | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 571 |       |   |- linux,phandle = <2> | 
 | 572 |       | | 
 | 573 |       o memory@0 | 
 | 574 |       | |- name = "memory" | 
 | 575 |       | |- device_type = "memory" | 
 | 576 |       | |- reg = <00000000 00000000 00000000 20000000> | 
 | 577 |       | |- linux,phandle = <3> | 
 | 578 |       | | 
 | 579 |       o chosen | 
 | 580 |         |- name = "chosen" | 
 | 581 |         |- bootargs = "root=/dev/sda2" | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 582 |         |- linux,phandle = <4> | 
 | 583 |  | 
 | 584 | This tree is almost a minimal tree. It pretty much contains the | 
 | 585 | minimal set of required nodes and properties to boot a linux kernel; | 
 | 586 | that is, some basic model informations at the root, the CPUs, and the | 
 | 587 | physical memory layout.  It also includes misc information passed | 
 | 588 | through /chosen, like in this example, the platform type (mandatory) | 
 | 589 | and the kernel command line arguments (optional). | 
 | 590 |  | 
| Timur Tabi | 32aed2a | 2007-02-14 15:29:07 -0600 | [diff] [blame] | 591 | The /cpus/PowerPC,970@0/64-bit property is an example of a | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 592 | property without a value. All other properties have a value. The | 
 | 593 | significance of the #address-cells and #size-cells properties will be | 
 | 594 | explained in chapter IV which defines precisely the required nodes and | 
 | 595 | properties and their content. | 
 | 596 |  | 
 | 597 |  | 
 | 598 | 3) Device tree "structure" block | 
 | 599 |  | 
 | 600 | The structure of the device tree is a linearized tree structure. The | 
 | 601 | "OF_DT_BEGIN_NODE" token starts a new node, and the "OF_DT_END_NODE" | 
 | 602 | ends that node definition. Child nodes are simply defined before | 
 | 603 | "OF_DT_END_NODE" (that is nodes within the node). A 'token' is a 32 | 
 | 604 | bit value. The tree has to be "finished" with a OF_DT_END token | 
 | 605 |  | 
 | 606 | Here's the basic structure of a single node: | 
 | 607 |  | 
 | 608 |      * token OF_DT_BEGIN_NODE (that is 0x00000001) | 
 | 609 |      * for version 1 to 3, this is the node full path as a zero | 
 | 610 |        terminated string, starting with "/". For version 16 and later, | 
 | 611 |        this is the node unit name only (or an empty string for the | 
 | 612 |        root node) | 
 | 613 |      * [align gap to next 4 bytes boundary] | 
 | 614 |      * for each property: | 
 | 615 |         * token OF_DT_PROP (that is 0x00000003) | 
| Domen Puncer | 5dd6016 | 2007-03-02 21:44:45 +1100 | [diff] [blame] | 616 |         * 32-bit value of property value size in bytes (or 0 if no | 
 | 617 |           value) | 
 | 618 |         * 32-bit value of offset in string block of property name | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 619 |         * property value data if any | 
 | 620 |         * [align gap to next 4 bytes boundary] | 
 | 621 |      * [child nodes if any] | 
 | 622 |      * token OF_DT_END_NODE (that is 0x00000002) | 
 | 623 |  | 
| Domen Puncer | 5dd6016 | 2007-03-02 21:44:45 +1100 | [diff] [blame] | 624 | So the node content can be summarized as a start token, a full path, | 
| Matt LaPlante | 53cb472 | 2006-10-03 22:55:17 +0200 | [diff] [blame] | 625 | a list of properties, a list of child nodes, and an end token. Every | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 626 | child node is a full node structure itself as defined above. | 
 | 627 |  | 
| David Gibson | eff2ebd | 2007-06-28 15:56:26 +1000 | [diff] [blame] | 628 | NOTE: The above definition requires that all property definitions for | 
 | 629 | a particular node MUST precede any subnode definitions for that node. | 
 | 630 | Although the structure would not be ambiguous if properties and | 
 | 631 | subnodes were intermingled, the kernel parser requires that the | 
 | 632 | properties come first (up until at least 2.6.22).  Any tools | 
 | 633 | manipulating a flattened tree must take care to preserve this | 
 | 634 | constraint. | 
 | 635 |  | 
| Matt LaPlante | 53cb472 | 2006-10-03 22:55:17 +0200 | [diff] [blame] | 636 | 4) Device tree "strings" block | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 637 |  | 
 | 638 | In order to save space, property names, which are generally redundant, | 
 | 639 | are stored separately in the "strings" block. This block is simply the | 
 | 640 | whole bunch of zero terminated strings for all property names | 
 | 641 | concatenated together. The device-tree property definitions in the | 
 | 642 | structure block will contain offset values from the beginning of the | 
 | 643 | strings block. | 
 | 644 |  | 
 | 645 |  | 
 | 646 | III - Required content of the device tree | 
 | 647 | ========================================= | 
 | 648 |  | 
 | 649 | WARNING: All "linux,*" properties defined in this document apply only | 
 | 650 | to a flattened device-tree. If your platform uses a real | 
 | 651 | implementation of Open Firmware or an implementation compatible with | 
 | 652 | the Open Firmware client interface, those properties will be created | 
 | 653 | by the trampoline code in the kernel's prom_init() file. For example, | 
 | 654 | that's where you'll have to add code to detect your board model and | 
| Matt LaPlante | a2ffd27 | 2006-10-03 22:49:15 +0200 | [diff] [blame] | 655 | set the platform number. However, when using the flattened device-tree | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 656 | entry point, there is no prom_init() pass, and thus you have to | 
 | 657 | provide those properties yourself. | 
 | 658 |  | 
 | 659 |  | 
 | 660 | 1) Note about cells and address representation | 
 | 661 | ---------------------------------------------- | 
 | 662 |  | 
 | 663 | The general rule is documented in the various Open Firmware | 
| Domen Puncer | 5dd6016 | 2007-03-02 21:44:45 +1100 | [diff] [blame] | 664 | documentations. If you choose to describe a bus with the device-tree | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 665 | and there exist an OF bus binding, then you should follow the | 
 | 666 | specification. However, the kernel does not require every single | 
 | 667 | device or bus to be described by the device tree. | 
 | 668 |  | 
 | 669 | In general, the format of an address for a device is defined by the | 
 | 670 | parent bus type, based on the #address-cells and #size-cells | 
| Mark A. Greer | 5b14e5f | 2008-01-04 02:40:47 +1100 | [diff] [blame] | 671 | properties.  Note that the parent's parent definitions of #address-cells | 
| Matt LaPlante | d919588 | 2008-07-25 19:45:33 -0700 | [diff] [blame] | 672 | and #size-cells are not inherited so every node with children must specify | 
| Mark A. Greer | 5b14e5f | 2008-01-04 02:40:47 +1100 | [diff] [blame] | 673 | them.  The kernel requires the root node to have those properties defining | 
 | 674 | addresses format for devices directly mapped on the processor bus. | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 675 |  | 
 | 676 | Those 2 properties define 'cells' for representing an address and a | 
| Domen Puncer | 5dd6016 | 2007-03-02 21:44:45 +1100 | [diff] [blame] | 677 | size. A "cell" is a 32-bit number. For example, if both contain 2 | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 678 | like the example tree given above, then an address and a size are both | 
| Domen Puncer | 5dd6016 | 2007-03-02 21:44:45 +1100 | [diff] [blame] | 679 | composed of 2 cells, and each is a 64-bit number (cells are | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 680 | concatenated and expected to be in big endian format). Another example | 
 | 681 | is the way Apple firmware defines them, with 2 cells for an address | 
 | 682 | and one cell for a size.  Most 32-bit implementations should define | 
 | 683 | #address-cells and #size-cells to 1, which represents a 32-bit value. | 
 | 684 | Some 32-bit processors allow for physical addresses greater than 32 | 
 | 685 | bits; these processors should define #address-cells as 2. | 
 | 686 |  | 
 | 687 | "reg" properties are always a tuple of the type "address size" where | 
 | 688 | the number of cells of address and size is specified by the bus | 
 | 689 | #address-cells and #size-cells. When a bus supports various address | 
 | 690 | spaces and other flags relative to a given address allocation (like | 
 | 691 | prefetchable, etc...) those flags are usually added to the top level | 
 | 692 | bits of the physical address. For example, a PCI physical address is | 
 | 693 | made of 3 cells, the bottom two containing the actual address itself | 
 | 694 | while the top cell contains address space indication, flags, and pci | 
 | 695 | bus & device numbers. | 
 | 696 |  | 
 | 697 | For busses that support dynamic allocation, it's the accepted practice | 
 | 698 | to then not provide the address in "reg" (keep it 0) though while | 
 | 699 | providing a flag indicating the address is dynamically allocated, and | 
 | 700 | then, to provide a separate "assigned-addresses" property that | 
 | 701 | contains the fully allocated addresses. See the PCI OF bindings for | 
 | 702 | details. | 
 | 703 |  | 
 | 704 | In general, a simple bus with no address space bits and no dynamic | 
 | 705 | allocation is preferred if it reflects your hardware, as the existing | 
 | 706 | kernel address parsing functions will work out of the box. If you | 
 | 707 | define a bus type with a more complex address format, including things | 
 | 708 | like address space bits, you'll have to add a bus translator to the | 
 | 709 | prom_parse.c file of the recent kernels for your bus type. | 
 | 710 |  | 
| Stephen Neuendorffer | e1fd186 | 2007-12-04 12:08:57 +1100 | [diff] [blame] | 711 | The "reg" property only defines addresses and sizes (if #size-cells is | 
 | 712 | non-0) within a given bus. In order to translate addresses upward | 
| Domen Puncer | 5dd6016 | 2007-03-02 21:44:45 +1100 | [diff] [blame] | 713 | (that is into parent bus addresses, and possibly into CPU physical | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 714 | addresses), all busses must contain a "ranges" property. If the | 
 | 715 | "ranges" property is missing at a given level, it's assumed that | 
| Stephen Neuendorffer | e1fd186 | 2007-12-04 12:08:57 +1100 | [diff] [blame] | 716 | translation isn't possible, i.e., the registers are not visible on the | 
 | 717 | parent bus.  The format of the "ranges" property for a bus is a list | 
 | 718 | of: | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 719 |  | 
 | 720 | 	bus address, parent bus address, size | 
 | 721 |  | 
 | 722 | "bus address" is in the format of the bus this bus node is defining, | 
 | 723 | that is, for a PCI bridge, it would be a PCI address. Thus, (bus | 
 | 724 | address, size) defines a range of addresses for child devices. "parent | 
 | 725 | bus address" is in the format of the parent bus of this bus. For | 
 | 726 | example, for a PCI host controller, that would be a CPU address. For a | 
 | 727 | PCI<->ISA bridge, that would be a PCI address. It defines the base | 
 | 728 | address in the parent bus where the beginning of that range is mapped. | 
 | 729 |  | 
| Domen Puncer | 5dd6016 | 2007-03-02 21:44:45 +1100 | [diff] [blame] | 730 | For a new 64-bit powerpc board, I recommend either the 2/2 format or | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 731 | Apple's 2/1 format which is slightly more compact since sizes usually | 
| Domen Puncer | 5dd6016 | 2007-03-02 21:44:45 +1100 | [diff] [blame] | 732 | fit in a single 32-bit word.   New 32-bit powerpc boards should use a | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 733 | 1/1 format, unless the processor supports physical addresses greater | 
 | 734 | than 32-bits, in which case a 2/1 format is recommended. | 
 | 735 |  | 
| Stephen Neuendorffer | e1fd186 | 2007-12-04 12:08:57 +1100 | [diff] [blame] | 736 | Alternatively, the "ranges" property may be empty, indicating that the | 
 | 737 | registers are visible on the parent bus using an identity mapping | 
 | 738 | translation.  In other words, the parent bus address space is the same | 
 | 739 | as the child bus address space. | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 740 |  | 
 | 741 | 2) Note about "compatible" properties | 
 | 742 | ------------------------------------- | 
 | 743 |  | 
 | 744 | These properties are optional, but recommended in devices and the root | 
 | 745 | node. The format of a "compatible" property is a list of concatenated | 
 | 746 | zero terminated strings. They allow a device to express its | 
 | 747 | compatibility with a family of similar devices, in some cases, | 
 | 748 | allowing a single driver to match against several devices regardless | 
 | 749 | of their actual names. | 
 | 750 |  | 
 | 751 | 3) Note about "name" properties | 
 | 752 | ------------------------------- | 
 | 753 |  | 
 | 754 | While earlier users of Open Firmware like OldWorld macintoshes tended | 
 | 755 | to use the actual device name for the "name" property, it's nowadays | 
 | 756 | considered a good practice to use a name that is closer to the device | 
 | 757 | class (often equal to device_type). For example, nowadays, ethernet | 
 | 758 | controllers are named "ethernet", an additional "model" property | 
 | 759 | defining precisely the chip type/model, and "compatible" property | 
 | 760 | defining the family in case a single driver can driver more than one | 
 | 761 | of these chips. However, the kernel doesn't generally put any | 
 | 762 | restriction on the "name" property; it is simply considered good | 
 | 763 | practice to follow the standard and its evolutions as closely as | 
 | 764 | possible. | 
 | 765 |  | 
 | 766 | Note also that the new format version 16 makes the "name" property | 
 | 767 | optional. If it's absent for a node, then the node's unit name is then | 
 | 768 | used to reconstruct the name. That is, the part of the unit name | 
 | 769 | before the "@" sign is used (or the entire unit name if no "@" sign | 
 | 770 | is present). | 
 | 771 |  | 
 | 772 | 4) Note about node and property names and character set | 
 | 773 | ------------------------------------------------------- | 
 | 774 |  | 
| Matt LaPlante | a2ffd27 | 2006-10-03 22:49:15 +0200 | [diff] [blame] | 775 | While open firmware provides more flexible usage of 8859-1, this | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 776 | specification enforces more strict rules. Nodes and properties should | 
 | 777 | be comprised only of ASCII characters 'a' to 'z', '0' to | 
 | 778 | '9', ',', '.', '_', '+', '#', '?', and '-'. Node names additionally | 
 | 779 | allow uppercase characters 'A' to 'Z' (property names should be | 
 | 780 | lowercase. The fact that vendors like Apple don't respect this rule is | 
 | 781 | irrelevant here). Additionally, node and property names should always | 
 | 782 | begin with a character in the range 'a' to 'z' (or 'A' to 'Z' for node | 
 | 783 | names). | 
 | 784 |  | 
 | 785 | The maximum number of characters for both nodes and property names | 
 | 786 | is 31. In the case of node names, this is only the leftmost part of | 
 | 787 | a unit name (the pure "name" property), it doesn't include the unit | 
 | 788 | address which can extend beyond that limit. | 
 | 789 |  | 
 | 790 |  | 
 | 791 | 5) Required nodes and properties | 
 | 792 | -------------------------------- | 
 | 793 |   These are all that are currently required. However, it is strongly | 
 | 794 |   recommended that you expose PCI host bridges as documented in the | 
 | 795 |   PCI binding to open firmware, and your interrupt tree as documented | 
 | 796 |   in OF interrupt tree specification. | 
 | 797 |  | 
 | 798 |   a) The root node | 
 | 799 |  | 
 | 800 |   The root node requires some properties to be present: | 
 | 801 |  | 
 | 802 |     - model : this is your board name/model | 
 | 803 |     - #address-cells : address representation for "root" devices | 
 | 804 |     - #size-cells: the size representation for "root" devices | 
| Benjamin Herrenschmidt | e822250 | 2006-03-28 23:15:54 +1100 | [diff] [blame] | 805 |     - device_type : This property shouldn't be necessary. However, if | 
 | 806 |       you decide to create a device_type for your root node, make sure it | 
 | 807 |       is _not_ "chrp" unless your platform is a pSeries or PAPR compliant | 
 | 808 |       one for 64-bit, or a CHRP-type machine for 32-bit as this will | 
 | 809 |       matched by the kernel this way. | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 810 |  | 
 | 811 |   Additionally, some recommended properties are: | 
 | 812 |  | 
 | 813 |     - compatible : the board "family" generally finds its way here, | 
 | 814 |       for example, if you have 2 board models with a similar layout, | 
 | 815 |       that typically get driven by the same platform code in the | 
 | 816 |       kernel, you would use a different "model" property but put a | 
 | 817 |       value in "compatible". The kernel doesn't directly use that | 
| Stuart Yoder | 143a42d | 2007-02-16 11:30:29 -0600 | [diff] [blame] | 818 |       value but it is generally useful. | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 819 |  | 
 | 820 |   The root node is also generally where you add additional properties | 
 | 821 |   specific to your board like the serial number if any, that sort of | 
| Matt LaPlante | 6c28f2c | 2006-10-03 22:46:31 +0200 | [diff] [blame] | 822 |   thing. It is recommended that if you add any "custom" property whose | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 823 |   name may clash with standard defined ones, you prefix them with your | 
 | 824 |   vendor name and a comma. | 
 | 825 |  | 
 | 826 |   b) The /cpus node | 
 | 827 |  | 
 | 828 |   This node is the parent of all individual CPU nodes. It doesn't | 
 | 829 |   have any specific requirements, though it's generally good practice | 
 | 830 |   to have at least: | 
 | 831 |  | 
 | 832 |                #address-cells = <00000001> | 
 | 833 |                #size-cells    = <00000000> | 
 | 834 |  | 
 | 835 |   This defines that the "address" for a CPU is a single cell, and has | 
 | 836 |   no meaningful size. This is not necessary but the kernel will assume | 
 | 837 |   that format when reading the "reg" properties of a CPU node, see | 
 | 838 |   below | 
 | 839 |  | 
 | 840 |   c) The /cpus/* nodes | 
 | 841 |  | 
 | 842 |   So under /cpus, you are supposed to create a node for every CPU on | 
 | 843 |   the machine. There is no specific restriction on the name of the | 
 | 844 |   CPU, though It's common practice to call it PowerPC,<name>. For | 
 | 845 |   example, Apple uses PowerPC,G5 while IBM uses PowerPC,970FX. | 
 | 846 |  | 
 | 847 |   Required properties: | 
 | 848 |  | 
 | 849 |     - device_type : has to be "cpu" | 
| Domen Puncer | 5dd6016 | 2007-03-02 21:44:45 +1100 | [diff] [blame] | 850 |     - reg : This is the physical CPU number, it's a single 32-bit cell | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 851 |       and is also used as-is as the unit number for constructing the | 
 | 852 |       unit name in the full path. For example, with 2 CPUs, you would | 
 | 853 |       have the full path: | 
 | 854 |         /cpus/PowerPC,970FX@0 | 
 | 855 |         /cpus/PowerPC,970FX@1 | 
 | 856 |       (unit addresses do not require leading zeroes) | 
| Benjamin Herrenschmidt | 20474ab | 2007-10-28 08:49:28 +1100 | [diff] [blame] | 857 |     - d-cache-block-size : one cell, L1 data cache block size in bytes (*) | 
 | 858 |     - i-cache-block-size : one cell, L1 instruction cache block size in | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 859 |       bytes | 
 | 860 |     - d-cache-size : one cell, size of L1 data cache in bytes | 
 | 861 |     - i-cache-size : one cell, size of L1 instruction cache in bytes | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 862 |  | 
| Benjamin Herrenschmidt | 20474ab | 2007-10-28 08:49:28 +1100 | [diff] [blame] | 863 | (*) The cache "block" size is the size on which the cache management | 
 | 864 | instructions operate. Historically, this document used the cache | 
 | 865 | "line" size here which is incorrect. The kernel will prefer the cache | 
 | 866 | block size and will fallback to cache line size for backward | 
 | 867 | compatibility. | 
 | 868 |  | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 869 |   Recommended properties: | 
 | 870 |  | 
 | 871 |     - timebase-frequency : a cell indicating the frequency of the | 
 | 872 |       timebase in Hz. This is not directly used by the generic code, | 
 | 873 |       but you are welcome to copy/paste the pSeries code for setting | 
 | 874 |       the kernel timebase/decrementer calibration based on this | 
 | 875 |       value. | 
 | 876 |     - clock-frequency : a cell indicating the CPU core clock frequency | 
| Domen Puncer | 5dd6016 | 2007-03-02 21:44:45 +1100 | [diff] [blame] | 877 |       in Hz. A new property will be defined for 64-bit values, but if | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 878 |       your frequency is < 4Ghz, one cell is enough. Here as well as | 
 | 879 |       for the above, the common code doesn't use that property, but | 
 | 880 |       you are welcome to re-use the pSeries or Maple one. A future | 
 | 881 |       kernel version might provide a common function for this. | 
| Benjamin Herrenschmidt | 20474ab | 2007-10-28 08:49:28 +1100 | [diff] [blame] | 882 |     - d-cache-line-size : one cell, L1 data cache line size in bytes | 
 | 883 |       if different from the block size | 
 | 884 |     - i-cache-line-size : one cell, L1 instruction cache line size in | 
 | 885 |       bytes if different from the block size | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 886 |  | 
 | 887 |   You are welcome to add any property you find relevant to your board, | 
 | 888 |   like some information about the mechanism used to soft-reset the | 
 | 889 |   CPUs. For example, Apple puts the GPIO number for CPU soft reset | 
 | 890 |   lines in there as a "soft-reset" property since they start secondary | 
 | 891 |   CPUs by soft-resetting them. | 
 | 892 |  | 
 | 893 |  | 
 | 894 |   d) the /memory node(s) | 
 | 895 |  | 
 | 896 |   To define the physical memory layout of your board, you should | 
 | 897 |   create one or more memory node(s). You can either create a single | 
 | 898 |   node with all memory ranges in its reg property, or you can create | 
 | 899 |   several nodes, as you wish. The unit address (@ part) used for the | 
 | 900 |   full path is the address of the first range of memory defined by a | 
 | 901 |   given node. If you use a single memory node, this will typically be | 
 | 902 |   @0. | 
 | 903 |  | 
 | 904 |   Required properties: | 
 | 905 |  | 
 | 906 |     - device_type : has to be "memory" | 
 | 907 |     - reg : This property contains all the physical memory ranges of | 
 | 908 |       your board. It's a list of addresses/sizes concatenated | 
 | 909 |       together, with the number of cells of each defined by the | 
 | 910 |       #address-cells and #size-cells of the root node. For example, | 
| Matt LaPlante | 6c28f2c | 2006-10-03 22:46:31 +0200 | [diff] [blame] | 911 |       with both of these properties being 2 like in the example given | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 912 |       earlier, a 970 based machine with 6Gb of RAM could typically | 
 | 913 |       have a "reg" property here that looks like: | 
 | 914 |  | 
 | 915 |       00000000 00000000 00000000 80000000 | 
 | 916 |       00000001 00000000 00000001 00000000 | 
 | 917 |  | 
 | 918 |       That is a range starting at 0 of 0x80000000 bytes and a range | 
 | 919 |       starting at 0x100000000 and of 0x100000000 bytes. You can see | 
 | 920 |       that there is no memory covering the IO hole between 2Gb and | 
 | 921 |       4Gb. Some vendors prefer splitting those ranges into smaller | 
 | 922 |       segments, but the kernel doesn't care. | 
 | 923 |  | 
 | 924 |   e) The /chosen node | 
 | 925 |  | 
 | 926 |   This node is a bit "special". Normally, that's where open firmware | 
 | 927 |   puts some variable environment information, like the arguments, or | 
| Stuart Yoder | d1bff9e | 2007-02-19 11:25:05 -0600 | [diff] [blame] | 928 |   the default input/output devices. | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 929 |  | 
 | 930 |   This specification makes a few of these mandatory, but also defines | 
 | 931 |   some linux-specific properties that would be normally constructed by | 
 | 932 |   the prom_init() trampoline when booting with an OF client interface, | 
 | 933 |   but that you have to provide yourself when using the flattened format. | 
 | 934 |  | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 935 |   Recommended properties: | 
 | 936 |  | 
 | 937 |     - bootargs : This zero-terminated string is passed as the kernel | 
 | 938 |       command line | 
 | 939 |     - linux,stdout-path : This is the full path to your standard | 
 | 940 |       console device if any. Typically, if you have serial devices on | 
 | 941 |       your board, you may want to put the full path to the one set as | 
 | 942 |       the default console in the firmware here, for the kernel to pick | 
| Matt LaPlante | 5d3f083 | 2006-11-30 05:21:10 +0100 | [diff] [blame] | 943 |       it up as its own default console. If you look at the function | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 944 |       set_preferred_console() in arch/ppc64/kernel/setup.c, you'll see | 
 | 945 |       that the kernel tries to find out the default console and has | 
 | 946 |       knowledge of various types like 8250 serial ports. You may want | 
 | 947 |       to extend this function to add your own. | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 948 |  | 
 | 949 |   Note that u-boot creates and fills in the chosen node for platforms | 
 | 950 |   that use it. | 
 | 951 |  | 
| Stuart Yoder | d1bff9e | 2007-02-19 11:25:05 -0600 | [diff] [blame] | 952 |   (Note: a practice that is now obsolete was to include a property | 
 | 953 |   under /chosen called interrupt-controller which had a phandle value | 
 | 954 |   that pointed to the main interrupt controller) | 
 | 955 |  | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 956 |   f) the /soc<SOCname> node | 
 | 957 |  | 
 | 958 |   This node is used to represent a system-on-a-chip (SOC) and must be | 
 | 959 |   present if the processor is a SOC. The top-level soc node contains | 
 | 960 |   information that is global to all devices on the SOC. The node name | 
 | 961 |   should contain a unit address for the SOC, which is the base address | 
 | 962 |   of the memory-mapped register set for the SOC. The name of an soc | 
 | 963 |   node should start with "soc", and the remainder of the name should | 
 | 964 |   represent the part number for the soc.  For example, the MPC8540's | 
 | 965 |   soc node would be called "soc8540". | 
 | 966 |  | 
 | 967 |   Required properties: | 
 | 968 |  | 
 | 969 |     - device_type : Should be "soc" | 
 | 970 |     - ranges : Should be defined as specified in 1) to describe the | 
 | 971 |       translation of SOC addresses for memory mapped SOC registers. | 
| Becky Bruce | 7d4b95a | 2006-02-06 14:26:31 -0600 | [diff] [blame] | 972 |     - bus-frequency: Contains the bus frequency for the SOC node. | 
 | 973 |       Typically, the value of this field is filled in by the boot | 
| Stefan Roese | efcc2da | 2009-04-16 15:11:54 -0600 | [diff] [blame] | 974 |       loader. | 
| Becky Bruce | 7d4b95a | 2006-02-06 14:26:31 -0600 | [diff] [blame] | 975 |  | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 976 |  | 
 | 977 |   Recommended properties: | 
 | 978 |  | 
 | 979 |     - reg : This property defines the address and size of the | 
 | 980 |       memory-mapped registers that are used for the SOC node itself. | 
 | 981 |       It does not include the child device registers - these will be | 
 | 982 |       defined inside each child node.  The address specified in the | 
 | 983 |       "reg" property should match the unit address of the SOC node. | 
 | 984 |     - #address-cells : Address representation for "soc" devices.  The | 
 | 985 |       format of this field may vary depending on whether or not the | 
 | 986 |       device registers are memory mapped.  For memory mapped | 
 | 987 |       registers, this field represents the number of cells needed to | 
 | 988 |       represent the address of the registers.  For SOCs that do not | 
 | 989 |       use MMIO, a special address format should be defined that | 
 | 990 |       contains enough cells to represent the required information. | 
 | 991 |       See 1) above for more details on defining #address-cells. | 
 | 992 |     - #size-cells : Size representation for "soc" devices | 
 | 993 |     - #interrupt-cells : Defines the width of cells used to represent | 
 | 994 |        interrupts.  Typically this value is <2>, which includes a | 
 | 995 |        32-bit number that represents the interrupt number, and a | 
 | 996 |        32-bit number that represents the interrupt sense and level. | 
 | 997 |        This field is only needed if the SOC contains an interrupt | 
 | 998 |        controller. | 
 | 999 |  | 
 | 1000 |   The SOC node may contain child nodes for each SOC device that the | 
 | 1001 |   platform uses.  Nodes should not be created for devices which exist | 
 | 1002 |   on the SOC but are not used by a particular platform. See chapter VI | 
| Domen Puncer | 5dd6016 | 2007-03-02 21:44:45 +1100 | [diff] [blame] | 1003 |   for more information on how to specify devices that are part of a SOC. | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 1004 |  | 
 | 1005 |   Example SOC node for the MPC8540: | 
 | 1006 |  | 
 | 1007 | 	soc8540@e0000000 { | 
 | 1008 | 		#address-cells = <1>; | 
 | 1009 | 		#size-cells = <1>; | 
 | 1010 | 		#interrupt-cells = <2>; | 
 | 1011 | 		device_type = "soc"; | 
 | 1012 | 		ranges = <00000000 e0000000 00100000> | 
 | 1013 | 		reg = <e0000000 00003000>; | 
| Becky Bruce | 7d4b95a | 2006-02-06 14:26:31 -0600 | [diff] [blame] | 1014 | 		bus-frequency = <0>; | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 1015 | 	} | 
 | 1016 |  | 
 | 1017 |  | 
 | 1018 |  | 
 | 1019 | IV - "dtc", the device tree compiler | 
 | 1020 | ==================================== | 
 | 1021 |  | 
 | 1022 |  | 
 | 1023 | dtc source code can be found at | 
| Justin P. Mattock | 0ea6e61 | 2010-07-23 20:51:24 -0700 | [diff] [blame] | 1024 | <http://git.jdl.com/gitweb/?p=dtc.git> | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 1025 |  | 
 | 1026 | WARNING: This version is still in early development stage; the | 
 | 1027 | resulting device-tree "blobs" have not yet been validated with the | 
 | 1028 | kernel. The current generated bloc lacks a useful reserve map (it will | 
 | 1029 | be fixed to generate an empty one, it's up to the bootloader to fill | 
 | 1030 | it up) among others. The error handling needs work, bugs are lurking, | 
 | 1031 | etc... | 
 | 1032 |  | 
 | 1033 | dtc basically takes a device-tree in a given format and outputs a | 
 | 1034 | device-tree in another format. The currently supported formats are: | 
 | 1035 |  | 
 | 1036 |   Input formats: | 
 | 1037 |   ------------- | 
 | 1038 |  | 
 | 1039 |      - "dtb": "blob" format, that is a flattened device-tree block | 
 | 1040 |        with | 
 | 1041 |         header all in a binary blob. | 
 | 1042 |      - "dts": "source" format. This is a text file containing a | 
 | 1043 |        "source" for a device-tree. The format is defined later in this | 
 | 1044 |         chapter. | 
 | 1045 |      - "fs" format. This is a representation equivalent to the | 
 | 1046 |         output of /proc/device-tree, that is nodes are directories and | 
 | 1047 | 	properties are files | 
 | 1048 |  | 
 | 1049 |  Output formats: | 
 | 1050 |  --------------- | 
 | 1051 |  | 
 | 1052 |      - "dtb": "blob" format | 
 | 1053 |      - "dts": "source" format | 
 | 1054 |      - "asm": assembly language file. This is a file that can be | 
 | 1055 |        sourced by gas to generate a device-tree "blob". That file can | 
 | 1056 |        then simply be added to your Makefile. Additionally, the | 
| Matt LaPlante | 6c28f2c | 2006-10-03 22:46:31 +0200 | [diff] [blame] | 1057 |        assembly file exports some symbols that can be used. | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 1058 |  | 
 | 1059 |  | 
 | 1060 | The syntax of the dtc tool is | 
 | 1061 |  | 
 | 1062 |     dtc [-I <input-format>] [-O <output-format>] | 
 | 1063 |         [-o output-filename] [-V output_version] input_filename | 
 | 1064 |  | 
 | 1065 |  | 
| Domen Puncer | 5dd6016 | 2007-03-02 21:44:45 +1100 | [diff] [blame] | 1066 | The "output_version" defines what version of the "blob" format will be | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 1067 | generated. Supported versions are 1,2,3 and 16. The default is | 
 | 1068 | currently version 3 but that may change in the future to version 16. | 
 | 1069 |  | 
 | 1070 | Additionally, dtc performs various sanity checks on the tree, like the | 
| Matt LaPlante | 6c28f2c | 2006-10-03 22:46:31 +0200 | [diff] [blame] | 1071 | uniqueness of linux, phandle properties, validity of strings, etc... | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 1072 |  | 
 | 1073 | The format of the .dts "source" file is "C" like, supports C and C++ | 
| Matt LaPlante | 6c28f2c | 2006-10-03 22:46:31 +0200 | [diff] [blame] | 1074 | style comments. | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 1075 |  | 
 | 1076 | / { | 
 | 1077 | } | 
 | 1078 |  | 
 | 1079 | The above is the "device-tree" definition. It's the only statement | 
 | 1080 | supported currently at the toplevel. | 
 | 1081 |  | 
 | 1082 | / { | 
 | 1083 |   property1 = "string_value";	/* define a property containing a 0 | 
 | 1084 |                                  * terminated string | 
 | 1085 | 				 */ | 
 | 1086 |  | 
 | 1087 |   property2 = <1234abcd>;	/* define a property containing a | 
| Domen Puncer | 5dd6016 | 2007-03-02 21:44:45 +1100 | [diff] [blame] | 1088 |                                  * numerical 32-bit value (hexadecimal) | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 1089 | 				 */ | 
 | 1090 |  | 
 | 1091 |   property3 = <12345678 12345678 deadbeef>; | 
 | 1092 |                                 /* define a property containing 3 | 
| Domen Puncer | 5dd6016 | 2007-03-02 21:44:45 +1100 | [diff] [blame] | 1093 |                                  * numerical 32-bit values (cells) in | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 1094 |                                  * hexadecimal | 
 | 1095 | 				 */ | 
 | 1096 |   property4 = [0a 0b 0c 0d de ea ad be ef]; | 
 | 1097 |                                 /* define a property whose content is | 
 | 1098 |                                  * an arbitrary array of bytes | 
 | 1099 |                                  */ | 
 | 1100 |  | 
 | 1101 |   childnode@addresss {	/* define a child node named "childnode" | 
 | 1102 |                                  * whose unit name is "childnode at | 
 | 1103 | 				 * address" | 
 | 1104 |                                  */ | 
 | 1105 |  | 
 | 1106 |     childprop = "hello\n";      /* define a property "childprop" of | 
 | 1107 |                                  * childnode (in this case, a string) | 
 | 1108 |                                  */ | 
 | 1109 |   }; | 
 | 1110 | }; | 
 | 1111 |  | 
 | 1112 | Nodes can contain other nodes etc... thus defining the hierarchical | 
 | 1113 | structure of the tree. | 
 | 1114 |  | 
 | 1115 | Strings support common escape sequences from C: "\n", "\t", "\r", | 
 | 1116 | "\(octal value)", "\x(hex value)". | 
 | 1117 |  | 
 | 1118 | It is also suggested that you pipe your source file through cpp (gcc | 
 | 1119 | preprocessor) so you can use #include's, #define for constants, etc... | 
 | 1120 |  | 
 | 1121 | Finally, various options are planned but not yet implemented, like | 
 | 1122 | automatic generation of phandles, labels (exported to the asm file so | 
 | 1123 | you can point to a property content and change it easily from whatever | 
 | 1124 | you link the device-tree with), label or path instead of numeric value | 
 | 1125 | in some cells to "point" to a node (replaced by a phandle at compile | 
 | 1126 | time), export of reserve map address to the asm file, ability to | 
 | 1127 | specify reserve map content at compile time, etc... | 
 | 1128 |  | 
 | 1129 | We may provide a .h include file with common definitions of that | 
 | 1130 | proves useful for some properties (like building PCI properties or | 
 | 1131 | interrupt maps) though it may be better to add a notion of struct | 
 | 1132 | definitions to the compiler... | 
 | 1133 |  | 
 | 1134 |  | 
 | 1135 | V - Recommendations for a bootloader | 
 | 1136 | ==================================== | 
 | 1137 |  | 
 | 1138 |  | 
 | 1139 | Here are some various ideas/recommendations that have been proposed | 
 | 1140 | while all this has been defined and implemented. | 
 | 1141 |  | 
 | 1142 |   - The bootloader may want to be able to use the device-tree itself | 
 | 1143 |     and may want to manipulate it (to add/edit some properties, | 
 | 1144 |     like physical memory size or kernel arguments). At this point, 2 | 
 | 1145 |     choices can be made. Either the bootloader works directly on the | 
 | 1146 |     flattened format, or the bootloader has its own internal tree | 
 | 1147 |     representation with pointers (similar to the kernel one) and | 
 | 1148 |     re-flattens the tree when booting the kernel. The former is a bit | 
 | 1149 |     more difficult to edit/modify, the later requires probably a bit | 
 | 1150 |     more code to handle the tree structure. Note that the structure | 
 | 1151 |     format has been designed so it's relatively easy to "insert" | 
 | 1152 |     properties or nodes or delete them by just memmoving things | 
 | 1153 |     around. It contains no internal offsets or pointers for this | 
 | 1154 |     purpose. | 
 | 1155 |  | 
| Matt LaPlante | d6bc8ac | 2006-10-03 22:54:15 +0200 | [diff] [blame] | 1156 |   - An example of code for iterating nodes & retrieving properties | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 1157 |     directly from the flattened tree format can be found in the kernel | 
 | 1158 |     file arch/ppc64/kernel/prom.c, look at scan_flat_dt() function, | 
| Matt LaPlante | d6bc8ac | 2006-10-03 22:54:15 +0200 | [diff] [blame] | 1159 |     its usage in early_init_devtree(), and the corresponding various | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 1160 |     early_init_dt_scan_*() callbacks. That code can be re-used in a | 
 | 1161 |     GPL bootloader, and as the author of that code, I would be happy | 
| Domen Puncer | 5dd6016 | 2007-03-02 21:44:45 +1100 | [diff] [blame] | 1162 |     to discuss possible free licensing to any vendor who wishes to | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 1163 |     integrate all or part of this code into a non-GPL bootloader. | 
 | 1164 |  | 
 | 1165 |  | 
 | 1166 |  | 
 | 1167 | VI - System-on-a-chip devices and nodes | 
 | 1168 | ======================================= | 
 | 1169 |  | 
 | 1170 | Many companies are now starting to develop system-on-a-chip | 
| Domen Puncer | 5dd6016 | 2007-03-02 21:44:45 +1100 | [diff] [blame] | 1171 | processors, where the processor core (CPU) and many peripheral devices | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 1172 | exist on a single piece of silicon.  For these SOCs, an SOC node | 
 | 1173 | should be used that defines child nodes for the devices that make | 
 | 1174 | up the SOC. While platforms are not required to use this model in | 
 | 1175 | order to boot the kernel, it is highly encouraged that all SOC | 
 | 1176 | implementations define as complete a flat-device-tree as possible to | 
 | 1177 | describe the devices on the SOC.  This will allow for the | 
 | 1178 | genericization of much of the kernel code. | 
 | 1179 |  | 
 | 1180 |  | 
 | 1181 | 1) Defining child nodes of an SOC | 
 | 1182 | --------------------------------- | 
 | 1183 |  | 
 | 1184 | Each device that is part of an SOC may have its own node entry inside | 
 | 1185 | the SOC node.  For each device that is included in the SOC, the unit | 
 | 1186 | address property represents the address offset for this device's | 
 | 1187 | memory-mapped registers in the parent's address space.  The parent's | 
 | 1188 | address space is defined by the "ranges" property in the top-level soc | 
 | 1189 | node. The "reg" property for each node that exists directly under the | 
 | 1190 | SOC node should contain the address mapping from the child address space | 
 | 1191 | to the parent SOC address space and the size of the device's | 
 | 1192 | memory-mapped register file. | 
 | 1193 |  | 
 | 1194 | For many devices that may exist inside an SOC, there are predefined | 
 | 1195 | specifications for the format of the device tree node.  All SOC child | 
 | 1196 | nodes should follow these specifications, except where noted in this | 
 | 1197 | document. | 
 | 1198 |  | 
 | 1199 | See appendix A for an example partial SOC node definition for the | 
 | 1200 | MPC8540. | 
 | 1201 |  | 
 | 1202 |  | 
| Stuart Yoder | 2756590 | 2007-03-02 13:42:33 -0600 | [diff] [blame] | 1203 | 2) Representing devices without a current OF specification | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 1204 | ---------------------------------------------------------- | 
 | 1205 |  | 
 | 1206 | Currently, there are many devices on SOCs that do not have a standard | 
 | 1207 | representation pre-defined as part of the open firmware | 
 | 1208 | specifications, mainly because the boards that contain these SOCs are | 
 | 1209 | not currently booted using open firmware.   This section contains | 
 | 1210 | descriptions for the SOC devices for which new nodes have been | 
 | 1211 | defined; this list will expand as more and more SOC-containing | 
 | 1212 | platforms are moved over to use the flattened-device-tree model. | 
 | 1213 |  | 
| Kumar Gala | b053dc5 | 2009-06-19 08:31:05 -0500 | [diff] [blame] | 1214 | VII - Specifying interrupt information for devices | 
| Stuart Yoder | 2756590 | 2007-03-02 13:42:33 -0600 | [diff] [blame] | 1215 | =================================================== | 
 | 1216 |  | 
 | 1217 | The device tree represents the busses and devices of a hardware | 
 | 1218 | system in a form similar to the physical bus topology of the | 
 | 1219 | hardware. | 
 | 1220 |  | 
 | 1221 | In addition, a logical 'interrupt tree' exists which represents the | 
 | 1222 | hierarchy and routing of interrupts in the hardware. | 
 | 1223 |  | 
 | 1224 | The interrupt tree model is fully described in the | 
 | 1225 | document "Open Firmware Recommended Practice: Interrupt | 
 | 1226 | Mapping Version 0.9".  The document is available at: | 
 | 1227 | <http://playground.sun.com/1275/practice>. | 
 | 1228 |  | 
 | 1229 | 1) interrupts property | 
 | 1230 | ---------------------- | 
 | 1231 |  | 
 | 1232 | Devices that generate interrupts to a single interrupt controller | 
 | 1233 | should use the conventional OF representation described in the | 
 | 1234 | OF interrupt mapping documentation. | 
 | 1235 |  | 
 | 1236 | Each device which generates interrupts must have an 'interrupt' | 
 | 1237 | property.  The interrupt property value is an arbitrary number of | 
 | 1238 | of 'interrupt specifier' values which describe the interrupt or | 
 | 1239 | interrupts for the device. | 
 | 1240 |  | 
 | 1241 | The encoding of an interrupt specifier is determined by the | 
 | 1242 | interrupt domain in which the device is located in the | 
 | 1243 | interrupt tree.  The root of an interrupt domain specifies in | 
 | 1244 | its #interrupt-cells property the number of 32-bit cells | 
 | 1245 | required to encode an interrupt specifier.  See the OF interrupt | 
 | 1246 | mapping documentation for a detailed description of domains. | 
 | 1247 |  | 
 | 1248 | For example, the binding for the OpenPIC interrupt controller | 
 | 1249 | specifies  an #interrupt-cells value of 2 to encode the interrupt | 
 | 1250 | number and level/sense information. All interrupt children in an | 
 | 1251 | OpenPIC interrupt domain use 2 cells per interrupt in their interrupts | 
 | 1252 | property. | 
 | 1253 |  | 
 | 1254 | The PCI bus binding specifies a #interrupt-cell value of 1 to encode | 
 | 1255 | which interrupt pin (INTA,INTB,INTC,INTD) is used. | 
 | 1256 |  | 
 | 1257 | 2) interrupt-parent property | 
 | 1258 | ---------------------------- | 
 | 1259 |  | 
 | 1260 | The interrupt-parent property is specified to define an explicit | 
 | 1261 | link between a device node and its interrupt parent in | 
 | 1262 | the interrupt tree.  The value of interrupt-parent is the | 
 | 1263 | phandle of the parent node. | 
 | 1264 |  | 
| Francis Galiegue | a33f322 | 2010-04-23 00:08:02 +0200 | [diff] [blame] | 1265 | If the interrupt-parent property is not defined for a node, its | 
| Stuart Yoder | 2756590 | 2007-03-02 13:42:33 -0600 | [diff] [blame] | 1266 | interrupt parent is assumed to be an ancestor in the node's | 
 | 1267 | _device tree_ hierarchy. | 
 | 1268 |  | 
 | 1269 | 3) OpenPIC Interrupt Controllers | 
 | 1270 | -------------------------------- | 
 | 1271 |  | 
 | 1272 | OpenPIC interrupt controllers require 2 cells to encode | 
 | 1273 | interrupt information.  The first cell defines the interrupt | 
 | 1274 | number.  The second cell defines the sense and level | 
 | 1275 | information. | 
 | 1276 |  | 
 | 1277 | Sense and level information should be encoded as follows: | 
 | 1278 |  | 
 | 1279 | 	0 = low to high edge sensitive type enabled | 
 | 1280 | 	1 = active low level sensitive type enabled | 
 | 1281 | 	2 = active high level sensitive type enabled | 
 | 1282 | 	3 = high to low edge sensitive type enabled | 
 | 1283 |  | 
 | 1284 | 4) ISA Interrupt Controllers | 
 | 1285 | ---------------------------- | 
 | 1286 |  | 
 | 1287 | ISA PIC interrupt controllers require 2 cells to encode | 
 | 1288 | interrupt information.  The first cell defines the interrupt | 
 | 1289 | number.  The second cell defines the sense and level | 
 | 1290 | information. | 
 | 1291 |  | 
 | 1292 | ISA PIC interrupt controllers should adhere to the ISA PIC | 
 | 1293 | encodings listed below: | 
 | 1294 |  | 
 | 1295 | 	0 =  active low level sensitive type enabled | 
 | 1296 | 	1 =  active high level sensitive type enabled | 
 | 1297 | 	2 =  high to low edge sensitive type enabled | 
 | 1298 | 	3 =  low to high edge sensitive type enabled | 
 | 1299 |  | 
| Kumar Gala | b053dc5 | 2009-06-19 08:31:05 -0500 | [diff] [blame] | 1300 | VIII - Specifying Device Power Management Information (sleep property) | 
| Scott Wood | 2dff417 | 2008-07-11 17:31:15 -0500 | [diff] [blame] | 1301 | =================================================================== | 
 | 1302 |  | 
 | 1303 | Devices on SOCs often have mechanisms for placing devices into low-power | 
 | 1304 | states that are decoupled from the devices' own register blocks.  Sometimes, | 
 | 1305 | this information is more complicated than a cell-index property can | 
 | 1306 | reasonably describe.  Thus, each device controlled in such a manner | 
 | 1307 | may contain a "sleep" property which describes these connections. | 
 | 1308 |  | 
 | 1309 | The sleep property consists of one or more sleep resources, each of | 
 | 1310 | which consists of a phandle to a sleep controller, followed by a | 
 | 1311 | controller-specific sleep specifier of zero or more cells. | 
 | 1312 |  | 
 | 1313 | The semantics of what type of low power modes are possible are defined | 
 | 1314 | by the sleep controller.  Some examples of the types of low power modes | 
 | 1315 | that may be supported are: | 
 | 1316 |  | 
 | 1317 |  - Dynamic: The device may be disabled or enabled at any time. | 
 | 1318 |  - System Suspend: The device may request to be disabled or remain | 
 | 1319 |    awake during system suspend, but will not be disabled until then. | 
 | 1320 |  - Permanent: The device is disabled permanently (until the next hard | 
 | 1321 |    reset). | 
 | 1322 |  | 
 | 1323 | Some devices may share a clock domain with each other, such that they should | 
 | 1324 | only be suspended when none of the devices are in use.  Where reasonable, | 
 | 1325 | such nodes should be placed on a virtual bus, where the bus has the sleep | 
 | 1326 | property.  If the clock domain is shared among devices that cannot be | 
 | 1327 | reasonably grouped in this manner, then create a virtual sleep controller | 
 | 1328 | (similar to an interrupt nexus, except that defining a standardized | 
 | 1329 | sleep-map should wait until its necessity is demonstrated). | 
 | 1330 |  | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 1331 | Appendix A - Sample SOC node for MPC8540 | 
 | 1332 | ======================================== | 
 | 1333 |  | 
| Scott Wood | 7e72063 | 2008-06-25 12:07:39 -0500 | [diff] [blame] | 1334 | 	soc@e0000000 { | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 1335 | 		#address-cells = <1>; | 
 | 1336 | 		#size-cells = <1>; | 
| Scott Wood | 7e72063 | 2008-06-25 12:07:39 -0500 | [diff] [blame] | 1337 | 		compatible = "fsl,mpc8540-ccsr", "simple-bus"; | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 1338 | 		device_type = "soc"; | 
| Scott Wood | 7e72063 | 2008-06-25 12:07:39 -0500 | [diff] [blame] | 1339 | 		ranges = <0x00000000 0xe0000000 0x00100000> | 
| Becky Bruce | 7d4b95a | 2006-02-06 14:26:31 -0600 | [diff] [blame] | 1340 | 		bus-frequency = <0>; | 
| Scott Wood | 7e72063 | 2008-06-25 12:07:39 -0500 | [diff] [blame] | 1341 | 		interrupt-parent = <&pic>; | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 1342 |  | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 1343 | 		ethernet@24000 { | 
| Scott Wood | 2dff417 | 2008-07-11 17:31:15 -0500 | [diff] [blame] | 1344 | 			#address-cells = <1>; | 
 | 1345 | 			#size-cells = <1>; | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 1346 | 			device_type = "network"; | 
 | 1347 | 			model = "TSEC"; | 
| Scott Wood | 2dff417 | 2008-07-11 17:31:15 -0500 | [diff] [blame] | 1348 | 			compatible = "gianfar", "simple-bus"; | 
| Scott Wood | 7e72063 | 2008-06-25 12:07:39 -0500 | [diff] [blame] | 1349 | 			reg = <0x24000 0x1000>; | 
 | 1350 | 			local-mac-address = [ 00 E0 0C 00 73 00 ]; | 
 | 1351 | 			interrupts = <29 2 30 2 34 2>; | 
 | 1352 | 			phy-handle = <&phy0>; | 
| Scott Wood | 2dff417 | 2008-07-11 17:31:15 -0500 | [diff] [blame] | 1353 | 			sleep = <&pmc 00000080>; | 
 | 1354 | 			ranges; | 
 | 1355 |  | 
 | 1356 | 			mdio@24520 { | 
| Scott Wood | 7e72063 | 2008-06-25 12:07:39 -0500 | [diff] [blame] | 1357 | 				reg = <0x24520 0x20>; | 
| Scott Wood | 2dff417 | 2008-07-11 17:31:15 -0500 | [diff] [blame] | 1358 | 				compatible = "fsl,gianfar-mdio"; | 
 | 1359 |  | 
| Scott Wood | 7e72063 | 2008-06-25 12:07:39 -0500 | [diff] [blame] | 1360 | 				phy0: ethernet-phy@0 { | 
 | 1361 | 					interrupts = <5 1>; | 
| Scott Wood | 2dff417 | 2008-07-11 17:31:15 -0500 | [diff] [blame] | 1362 | 					reg = <0>; | 
 | 1363 | 					device_type = "ethernet-phy"; | 
 | 1364 | 				}; | 
 | 1365 |  | 
| Scott Wood | 7e72063 | 2008-06-25 12:07:39 -0500 | [diff] [blame] | 1366 | 				phy1: ethernet-phy@1 { | 
 | 1367 | 					interrupts = <5 1>; | 
| Scott Wood | 2dff417 | 2008-07-11 17:31:15 -0500 | [diff] [blame] | 1368 | 					reg = <1>; | 
 | 1369 | 					device_type = "ethernet-phy"; | 
 | 1370 | 				}; | 
 | 1371 |  | 
| Scott Wood | 7e72063 | 2008-06-25 12:07:39 -0500 | [diff] [blame] | 1372 | 				phy3: ethernet-phy@3 { | 
 | 1373 | 					interrupts = <7 1>; | 
| Scott Wood | 2dff417 | 2008-07-11 17:31:15 -0500 | [diff] [blame] | 1374 | 					reg = <3>; | 
 | 1375 | 					device_type = "ethernet-phy"; | 
 | 1376 | 				}; | 
 | 1377 | 			}; | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 1378 | 		}; | 
 | 1379 |  | 
 | 1380 | 		ethernet@25000 { | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 1381 | 			device_type = "network"; | 
 | 1382 | 			model = "TSEC"; | 
 | 1383 | 			compatible = "gianfar"; | 
| Scott Wood | 7e72063 | 2008-06-25 12:07:39 -0500 | [diff] [blame] | 1384 | 			reg = <0x25000 0x1000>; | 
 | 1385 | 			local-mac-address = [ 00 E0 0C 00 73 01 ]; | 
 | 1386 | 			interrupts = <13 2 14 2 18 2>; | 
 | 1387 | 			phy-handle = <&phy1>; | 
| Scott Wood | 2dff417 | 2008-07-11 17:31:15 -0500 | [diff] [blame] | 1388 | 			sleep = <&pmc 00000040>; | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 1389 | 		}; | 
 | 1390 |  | 
 | 1391 | 		ethernet@26000 { | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 1392 | 			device_type = "network"; | 
 | 1393 | 			model = "FEC"; | 
 | 1394 | 			compatible = "gianfar"; | 
| Scott Wood | 7e72063 | 2008-06-25 12:07:39 -0500 | [diff] [blame] | 1395 | 			reg = <0x26000 0x1000>; | 
 | 1396 | 			local-mac-address = [ 00 E0 0C 00 73 02 ]; | 
 | 1397 | 			interrupts = <41 2>; | 
 | 1398 | 			phy-handle = <&phy3>; | 
| Scott Wood | 2dff417 | 2008-07-11 17:31:15 -0500 | [diff] [blame] | 1399 | 			sleep = <&pmc 00000020>; | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 1400 | 		}; | 
 | 1401 |  | 
 | 1402 | 		serial@4500 { | 
| Scott Wood | 2dff417 | 2008-07-11 17:31:15 -0500 | [diff] [blame] | 1403 | 			#address-cells = <1>; | 
 | 1404 | 			#size-cells = <1>; | 
 | 1405 | 			compatible = "fsl,mpc8540-duart", "simple-bus"; | 
 | 1406 | 			sleep = <&pmc 00000002>; | 
 | 1407 | 			ranges; | 
 | 1408 |  | 
 | 1409 | 			serial@4500 { | 
 | 1410 | 				device_type = "serial"; | 
 | 1411 | 				compatible = "ns16550"; | 
| Scott Wood | 7e72063 | 2008-06-25 12:07:39 -0500 | [diff] [blame] | 1412 | 				reg = <0x4500 0x100>; | 
| Scott Wood | 2dff417 | 2008-07-11 17:31:15 -0500 | [diff] [blame] | 1413 | 				clock-frequency = <0>; | 
| Scott Wood | 7e72063 | 2008-06-25 12:07:39 -0500 | [diff] [blame] | 1414 | 				interrupts = <42 2>; | 
| Scott Wood | 2dff417 | 2008-07-11 17:31:15 -0500 | [diff] [blame] | 1415 | 			}; | 
 | 1416 |  | 
 | 1417 | 			serial@4600 { | 
 | 1418 | 				device_type = "serial"; | 
 | 1419 | 				compatible = "ns16550"; | 
| Scott Wood | 7e72063 | 2008-06-25 12:07:39 -0500 | [diff] [blame] | 1420 | 				reg = <0x4600 0x100>; | 
| Scott Wood | 2dff417 | 2008-07-11 17:31:15 -0500 | [diff] [blame] | 1421 | 				clock-frequency = <0>; | 
| Scott Wood | 7e72063 | 2008-06-25 12:07:39 -0500 | [diff] [blame] | 1422 | 				interrupts = <42 2>; | 
| Scott Wood | 2dff417 | 2008-07-11 17:31:15 -0500 | [diff] [blame] | 1423 | 			}; | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 1424 | 		}; | 
 | 1425 |  | 
| Scott Wood | 7e72063 | 2008-06-25 12:07:39 -0500 | [diff] [blame] | 1426 | 		pic: pic@40000 { | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 1427 | 			interrupt-controller; | 
 | 1428 | 			#address-cells = <0>; | 
| Scott Wood | 7e72063 | 2008-06-25 12:07:39 -0500 | [diff] [blame] | 1429 | 			#interrupt-cells = <2>; | 
 | 1430 | 			reg = <0x40000 0x40000>; | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 1431 | 			compatible = "chrp,open-pic"; | 
 | 1432 | 			device_type = "open-pic"; | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 1433 | 		}; | 
 | 1434 |  | 
 | 1435 | 		i2c@3000 { | 
| Scott Wood | 7e72063 | 2008-06-25 12:07:39 -0500 | [diff] [blame] | 1436 | 			interrupts = <43 2>; | 
 | 1437 | 			reg = <0x3000 0x100>; | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 1438 | 			compatible  = "fsl-i2c"; | 
 | 1439 | 			dfsrr; | 
| Scott Wood | 2dff417 | 2008-07-11 17:31:15 -0500 | [diff] [blame] | 1440 | 			sleep = <&pmc 00000004>; | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 1441 | 		}; | 
 | 1442 |  | 
| Scott Wood | 2dff417 | 2008-07-11 17:31:15 -0500 | [diff] [blame] | 1443 | 		pmc: power@e0070 { | 
 | 1444 | 			compatible = "fsl,mpc8540-pmc", "fsl,mpc8548-pmc"; | 
| Scott Wood | 7e72063 | 2008-06-25 12:07:39 -0500 | [diff] [blame] | 1445 | 			reg = <0xe0070 0x20>; | 
| Scott Wood | 2dff417 | 2008-07-11 17:31:15 -0500 | [diff] [blame] | 1446 | 		}; | 
| David Gibson | c125a18 | 2006-02-01 03:05:22 -0800 | [diff] [blame] | 1447 | 	}; |