booting-without-of.txt 76 KB

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