booting-without-of.txt 103 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775
  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. b) Gianfar-compatible ethernet nodes
  38. c) PHY 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. j) CFI or JEDEC memory-mapped NOR flash
  46. k) Global Utilities Block
  47. l) Freescale Communications Processor Module
  48. m) Chipselect/Local Bus
  49. n) 4xx/Axon EMAC ethernet nodes
  50. o) Xilinx IP cores
  51. VII - Specifying interrupt information for devices
  52. 1) interrupts property
  53. 2) interrupt-parent property
  54. 3) OpenPIC Interrupt Controllers
  55. 4) ISA Interrupt Controllers
  56. Appendix A - Sample SOC node for MPC8540
  57. Revision Information
  58. ====================
  59. May 18, 2005: Rev 0.1 - Initial draft, no chapter III yet.
  60. May 19, 2005: Rev 0.2 - Add chapter III and bits & pieces here or
  61. clarifies the fact that a lot of things are
  62. optional, the kernel only requires a very
  63. small device tree, though it is encouraged
  64. to provide an as complete one as possible.
  65. May 24, 2005: Rev 0.3 - Precise that DT block has to be in RAM
  66. - Misc fixes
  67. - Define version 3 and new format version 16
  68. for the DT block (version 16 needs kernel
  69. patches, will be fwd separately).
  70. String block now has a size, and full path
  71. is replaced by unit name for more
  72. compactness.
  73. linux,phandle is made optional, only nodes
  74. that are referenced by other nodes need it.
  75. "name" property is now automatically
  76. deduced from the unit name
  77. June 1, 2005: Rev 0.4 - Correct confusion between OF_DT_END and
  78. OF_DT_END_NODE in structure definition.
  79. - Change version 16 format to always align
  80. property data to 4 bytes. Since tokens are
  81. already aligned, that means no specific
  82. required alignment between property size
  83. and property data. The old style variable
  84. alignment would make it impossible to do
  85. "simple" insertion of properties using
  86. memmove (thanks Milton for
  87. noticing). Updated kernel patch as well
  88. - Correct a few more alignment constraints
  89. - Add a chapter about the device-tree
  90. compiler and the textural representation of
  91. the tree that can be "compiled" by dtc.
  92. November 21, 2005: Rev 0.5
  93. - Additions/generalizations for 32-bit
  94. - Changed to reflect the new arch/powerpc
  95. structure
  96. - Added chapter VI
  97. ToDo:
  98. - Add some definitions of interrupt tree (simple/complex)
  99. - Add some definitions for PCI host bridges
  100. - Add some common address format examples
  101. - Add definitions for standard properties and "compatible"
  102. names for cells that are not already defined by the existing
  103. OF spec.
  104. - Compare FSL SOC use of PCI to standard and make sure no new
  105. node definition required.
  106. - Add more information about node definitions for SOC devices
  107. that currently have no standard, like the FSL CPM.
  108. I - Introduction
  109. ================
  110. During the recent development of the Linux/ppc64 kernel, and more
  111. specifically, the addition of new platform types outside of the old
  112. IBM pSeries/iSeries pair, it was decided to enforce some strict rules
  113. regarding the kernel entry and bootloader <-> kernel interfaces, in
  114. order to avoid the degeneration that had become the ppc32 kernel entry
  115. point and the way a new platform should be added to the kernel. The
  116. legacy iSeries platform breaks those rules as it predates this scheme,
  117. but no new board support will be accepted in the main tree that
  118. doesn't follows them properly. In addition, since the advent of the
  119. arch/powerpc merged architecture for ppc32 and ppc64, new 32-bit
  120. platforms and 32-bit platforms which move into arch/powerpc will be
  121. required to use these rules as well.
  122. The main requirement that will be defined in more detail below is
  123. the presence of a device-tree whose format is defined after Open
  124. Firmware specification. However, in order to make life easier
  125. to embedded board vendors, the kernel doesn't require the device-tree
  126. to represent every device in the system and only requires some nodes
  127. and properties to be present. This will be described in detail in
  128. section III, but, for example, the kernel does not require you to
  129. create a node for every PCI device in the system. It is a requirement
  130. to have a node for PCI host bridges in order to provide interrupt
  131. routing informations and memory/IO ranges, among others. It is also
  132. recommended to define nodes for on chip devices and other busses that
  133. don't specifically fit in an existing OF specification. This creates a
  134. great flexibility in the way the kernel can then probe those and match
  135. drivers to device, without having to hard code all sorts of tables. It
  136. also makes it more flexible for board vendors to do minor hardware
  137. upgrades without significantly impacting the kernel code or cluttering
  138. it with special cases.
  139. 1) Entry point for arch/powerpc
  140. -------------------------------
  141. There is one and one single entry point to the kernel, at the start
  142. of the kernel image. That entry point supports two calling
  143. conventions:
  144. a) Boot from Open Firmware. If your firmware is compatible
  145. with Open Firmware (IEEE 1275) or provides an OF compatible
  146. client interface API (support for "interpret" callback of
  147. forth words isn't required), you can enter the kernel with:
  148. r5 : OF callback pointer as defined by IEEE 1275
  149. bindings to powerpc. Only the 32-bit client interface
  150. is currently supported
  151. r3, r4 : address & length of an initrd if any or 0
  152. The MMU is either on or off; the kernel will run the
  153. trampoline located in arch/powerpc/kernel/prom_init.c to
  154. extract the device-tree and other information from open
  155. firmware and build a flattened device-tree as described
  156. in b). prom_init() will then re-enter the kernel using
  157. the second method. This trampoline code runs in the
  158. context of the firmware, which is supposed to handle all
  159. exceptions during that time.
  160. b) Direct entry with a flattened device-tree block. This entry
  161. point is called by a) after the OF trampoline and can also be
  162. called directly by a bootloader that does not support the Open
  163. Firmware client interface. It is also used by "kexec" to
  164. implement "hot" booting of a new kernel from a previous
  165. running one. This method is what I will describe in more
  166. details in this document, as method a) is simply standard Open
  167. Firmware, and thus should be implemented according to the
  168. various standard documents defining it and its binding to the
  169. PowerPC platform. The entry point definition then becomes:
  170. r3 : physical pointer to the device-tree block
  171. (defined in chapter II) in RAM
  172. r4 : physical pointer to the kernel itself. This is
  173. used by the assembly code to properly disable the MMU
  174. in case you are entering the kernel with MMU enabled
  175. and a non-1:1 mapping.
  176. r5 : NULL (as to differentiate with method a)
  177. Note about SMP entry: Either your firmware puts your other
  178. CPUs in some sleep loop or spin loop in ROM where you can get
  179. them out via a soft reset or some other means, in which case
  180. you don't need to care, or you'll have to enter the kernel
  181. with all CPUs. The way to do that with method b) will be
  182. described in a later revision of this document.
  183. 2) Board support
  184. ----------------
  185. 64-bit kernels:
  186. Board supports (platforms) are not exclusive config options. An
  187. arbitrary set of board supports can be built in a single kernel
  188. image. The kernel will "know" what set of functions to use for a
  189. given platform based on the content of the device-tree. Thus, you
  190. should:
  191. a) add your platform support as a _boolean_ option in
  192. arch/powerpc/Kconfig, following the example of PPC_PSERIES,
  193. PPC_PMAC and PPC_MAPLE. The later is probably a good
  194. example of a board support to start from.
  195. b) create your main platform file as
  196. "arch/powerpc/platforms/myplatform/myboard_setup.c" and add it
  197. to the Makefile under the condition of your CONFIG_
  198. option. This file will define a structure of type "ppc_md"
  199. containing the various callbacks that the generic code will
  200. use to get to your platform specific code
  201. c) Add a reference to your "ppc_md" structure in the
  202. "machines" table in arch/powerpc/kernel/setup_64.c if you are
  203. a 64-bit platform.
  204. d) request and get assigned a platform number (see PLATFORM_*
  205. constants in include/asm-powerpc/processor.h
  206. 32-bit embedded kernels:
  207. Currently, board support is essentially an exclusive config option.
  208. The kernel is configured for a single platform. Part of the reason
  209. for this is to keep kernels on embedded systems small and efficient;
  210. part of this is due to the fact the code is already that way. In the
  211. future, a kernel may support multiple platforms, but only if the
  212. platforms feature the same core architecture. A single kernel build
  213. cannot support both configurations with Book E and configurations
  214. with classic Powerpc architectures.
  215. 32-bit embedded platforms that are moved into arch/powerpc using a
  216. flattened device tree should adopt the merged tree practice of
  217. setting ppc_md up dynamically, even though the kernel is currently
  218. built with support for only a single platform at a time. This allows
  219. unification of the setup code, and will make it easier to go to a
  220. multiple-platform-support model in the future.
  221. NOTE: I believe the above will be true once Ben's done with the merge
  222. of the boot sequences.... someone speak up if this is wrong!
  223. To add a 32-bit embedded platform support, follow the instructions
  224. for 64-bit platforms above, with the exception that the Kconfig
  225. option should be set up such that the kernel builds exclusively for
  226. the platform selected. The processor type for the platform should
  227. enable another config option to select the specific board
  228. supported.
  229. NOTE: If Ben doesn't merge the setup files, may need to change this to
  230. point to setup_32.c
  231. I will describe later the boot process and various callbacks that
  232. your platform should implement.
  233. II - The DT block format
  234. ========================
  235. This chapter defines the actual format of the flattened device-tree
  236. passed to the kernel. The actual content of it and kernel requirements
  237. are described later. You can find example of code manipulating that
  238. format in various places, including arch/powerpc/kernel/prom_init.c
  239. which will generate a flattened device-tree from the Open Firmware
  240. representation, or the fs2dt utility which is part of the kexec tools
  241. which will generate one from a filesystem representation. It is
  242. expected that a bootloader like uboot provides a bit more support,
  243. that will be discussed later as well.
  244. Note: The block has to be in main memory. It has to be accessible in
  245. both real mode and virtual mode with no mapping other than main
  246. memory. If you are writing a simple flash bootloader, it should copy
  247. the block to RAM before passing it to the kernel.
  248. 1) Header
  249. ---------
  250. The kernel is entered with r3 pointing to an area of memory that is
  251. roughly described in include/asm-powerpc/prom.h by the structure
  252. boot_param_header:
  253. struct boot_param_header {
  254. u32 magic; /* magic word OF_DT_HEADER */
  255. u32 totalsize; /* total size of DT block */
  256. u32 off_dt_struct; /* offset to structure */
  257. u32 off_dt_strings; /* offset to strings */
  258. u32 off_mem_rsvmap; /* offset to memory reserve map
  259. */
  260. u32 version; /* format version */
  261. u32 last_comp_version; /* last compatible version */
  262. /* version 2 fields below */
  263. u32 boot_cpuid_phys; /* Which physical CPU id we're
  264. booting on */
  265. /* version 3 fields below */
  266. u32 size_dt_strings; /* size of the strings block */
  267. /* version 17 fields below */
  268. u32 size_dt_struct; /* size of the DT structure block */
  269. };
  270. Along with the constants:
  271. /* Definitions used by the flattened device tree */
  272. #define OF_DT_HEADER 0xd00dfeed /* 4: version,
  273. 4: total size */
  274. #define OF_DT_BEGIN_NODE 0x1 /* Start node: full name
  275. */
  276. #define OF_DT_END_NODE 0x2 /* End node */
  277. #define OF_DT_PROP 0x3 /* Property: name off,
  278. size, content */
  279. #define OF_DT_END 0x9
  280. All values in this header are in big endian format, the various
  281. fields in this header are defined more precisely below. All
  282. "offset" values are in bytes from the start of the header; that is
  283. from the value of r3.
  284. - magic
  285. This is a magic value that "marks" the beginning of the
  286. device-tree block header. It contains the value 0xd00dfeed and is
  287. defined by the constant OF_DT_HEADER
  288. - totalsize
  289. This is the total size of the DT block including the header. The
  290. "DT" block should enclose all data structures defined in this
  291. chapter (who are pointed to by offsets in this header). That is,
  292. the device-tree structure, strings, and the memory reserve map.
  293. - off_dt_struct
  294. This is an offset from the beginning of the header to the start
  295. of the "structure" part the device tree. (see 2) device tree)
  296. - off_dt_strings
  297. This is an offset from the beginning of the header to the start
  298. of the "strings" part of the device-tree
  299. - off_mem_rsvmap
  300. This is an offset from the beginning of the header to the start
  301. of the reserved memory map. This map is a list of pairs of 64-
  302. bit integers. Each pair is a physical address and a size. The
  303. list is terminated by an entry of size 0. This map provides the
  304. kernel with a list of physical memory areas that are "reserved"
  305. and thus not to be used for memory allocations, especially during
  306. early initialization. The kernel needs to allocate memory during
  307. boot for things like un-flattening the device-tree, allocating an
  308. MMU hash table, etc... Those allocations must be done in such a
  309. way to avoid overriding critical things like, on Open Firmware
  310. capable machines, the RTAS instance, or on some pSeries, the TCE
  311. tables used for the iommu. Typically, the reserve map should
  312. contain _at least_ this DT block itself (header,total_size). If
  313. you are passing an initrd to the kernel, you should reserve it as
  314. well. You do not need to reserve the kernel image itself. The map
  315. should be 64-bit aligned.
  316. - version
  317. This is the version of this structure. Version 1 stops
  318. here. Version 2 adds an additional field boot_cpuid_phys.
  319. Version 3 adds the size of the strings block, allowing the kernel
  320. to reallocate it easily at boot and free up the unused flattened
  321. structure after expansion. Version 16 introduces a new more
  322. "compact" format for the tree itself that is however not backward
  323. compatible. Version 17 adds an additional field, size_dt_struct,
  324. allowing it to be reallocated or moved more easily (this is
  325. particularly useful for bootloaders which need to make
  326. adjustments to a device tree based on probed information). You
  327. should always generate a structure of the highest version defined
  328. at the time of your implementation. Currently that is version 17,
  329. unless you explicitly aim at being backward compatible.
  330. - last_comp_version
  331. Last compatible version. This indicates down to what version of
  332. the DT block you are backward compatible. For example, version 2
  333. is backward compatible with version 1 (that is, a kernel build
  334. for version 1 will be able to boot with a version 2 format). You
  335. should put a 1 in this field if you generate a device tree of
  336. version 1 to 3, or 16 if you generate a tree of version 16 or 17
  337. using the new unit name format.
  338. - boot_cpuid_phys
  339. This field only exist on version 2 headers. It indicate which
  340. physical CPU ID is calling the kernel entry point. This is used,
  341. among others, by kexec. If you are on an SMP system, this value
  342. should match the content of the "reg" property of the CPU node in
  343. the device-tree corresponding to the CPU calling the kernel entry
  344. point (see further chapters for more informations on the required
  345. device-tree contents)
  346. - size_dt_strings
  347. This field only exists on version 3 and later headers. It
  348. gives the size of the "strings" section of the device tree (which
  349. starts at the offset given by off_dt_strings).
  350. - size_dt_struct
  351. This field only exists on version 17 and later headers. It gives
  352. the size of the "structure" section of the device tree (which
  353. starts at the offset given by off_dt_struct).
  354. So the typical layout of a DT block (though the various parts don't
  355. need to be in that order) looks like this (addresses go from top to
  356. bottom):
  357. ------------------------------
  358. r3 -> | struct boot_param_header |
  359. ------------------------------
  360. | (alignment gap) (*) |
  361. ------------------------------
  362. | memory reserve map |
  363. ------------------------------
  364. | (alignment gap) |
  365. ------------------------------
  366. | |
  367. | device-tree structure |
  368. | |
  369. ------------------------------
  370. | (alignment gap) |
  371. ------------------------------
  372. | |
  373. | device-tree strings |
  374. | |
  375. -----> ------------------------------
  376. |
  377. |
  378. --- (r3 + totalsize)
  379. (*) The alignment gaps are not necessarily present; their presence
  380. and size are dependent on the various alignment requirements of
  381. the individual data blocks.
  382. 2) Device tree generalities
  383. ---------------------------
  384. This device-tree itself is separated in two different blocks, a
  385. structure block and a strings block. Both need to be aligned to a 4
  386. byte boundary.
  387. First, let's quickly describe the device-tree concept before detailing
  388. the storage format. This chapter does _not_ describe the detail of the
  389. required types of nodes & properties for the kernel, this is done
  390. later in chapter III.
  391. The device-tree layout is strongly inherited from the definition of
  392. the Open Firmware IEEE 1275 device-tree. It's basically a tree of
  393. nodes, each node having two or more named properties. A property can
  394. have a value or not.
  395. It is a tree, so each node has one and only one parent except for the
  396. root node who has no parent.
  397. A node has 2 names. The actual node name is generally contained in a
  398. property of type "name" in the node property list whose value is a
  399. zero terminated string and is mandatory for version 1 to 3 of the
  400. format definition (as it is in Open Firmware). Version 16 makes it
  401. optional as it can generate it from the unit name defined below.
  402. There is also a "unit name" that is used to differentiate nodes with
  403. the same name at the same level, it is usually made of the node
  404. names, the "@" sign, and a "unit address", which definition is
  405. specific to the bus type the node sits on.
  406. The unit name doesn't exist as a property per-se but is included in
  407. the device-tree structure. It is typically used to represent "path" in
  408. the device-tree. More details about the actual format of these will be
  409. below.
  410. The kernel powerpc generic code does not make any formal use of the
  411. unit address (though some board support code may do) so the only real
  412. requirement here for the unit address is to ensure uniqueness of
  413. the node unit name at a given level of the tree. Nodes with no notion
  414. of address and no possible sibling of the same name (like /memory or
  415. /cpus) may omit the unit address in the context of this specification,
  416. or use the "@0" default unit address. The unit name is used to define
  417. a node "full path", which is the concatenation of all parent node
  418. unit names separated with "/".
  419. The root node doesn't have a defined name, and isn't required to have
  420. a name property either if you are using version 3 or earlier of the
  421. format. It also has no unit address (no @ symbol followed by a unit
  422. address). The root node unit name is thus an empty string. The full
  423. path to the root node is "/".
  424. Every node which actually represents an actual device (that is, a node
  425. which isn't only a virtual "container" for more nodes, like "/cpus"
  426. is) is also required to have a "device_type" property indicating the
  427. type of node .
  428. Finally, every node that can be referenced from a property in another
  429. node is required to have a "linux,phandle" property. Real open
  430. firmware implementations provide a unique "phandle" value for every
  431. node that the "prom_init()" trampoline code turns into
  432. "linux,phandle" properties. However, this is made optional if the
  433. flattened device tree is used directly. An example of a node
  434. referencing another node via "phandle" is when laying out the
  435. interrupt tree which will be described in a further version of this
  436. document.
  437. This "linux, phandle" property is a 32-bit value that uniquely
  438. identifies a node. You are free to use whatever values or system of
  439. values, internal pointers, or whatever to generate these, the only
  440. requirement is that every node for which you provide that property has
  441. a unique value for it.
  442. Here is an example of a simple device-tree. In this example, an "o"
  443. designates a node followed by the node unit name. Properties are
  444. presented with their name followed by their content. "content"
  445. represents an ASCII string (zero terminated) value, while <content>
  446. represents a 32-bit hexadecimal value. The various nodes in this
  447. example will be discussed in a later chapter. At this point, it is
  448. only meant to give you a idea of what a device-tree looks like. I have
  449. purposefully kept the "name" and "linux,phandle" properties which
  450. aren't necessary in order to give you a better idea of what the tree
  451. looks like in practice.
  452. / o device-tree
  453. |- name = "device-tree"
  454. |- model = "MyBoardName"
  455. |- compatible = "MyBoardFamilyName"
  456. |- #address-cells = <2>
  457. |- #size-cells = <2>
  458. |- linux,phandle = <0>
  459. |
  460. o cpus
  461. | | - name = "cpus"
  462. | | - linux,phandle = <1>
  463. | | - #address-cells = <1>
  464. | | - #size-cells = <0>
  465. | |
  466. | o PowerPC,970@0
  467. | |- name = "PowerPC,970"
  468. | |- device_type = "cpu"
  469. | |- reg = <0>
  470. | |- clock-frequency = <5f5e1000>
  471. | |- 64-bit
  472. | |- linux,phandle = <2>
  473. |
  474. o memory@0
  475. | |- name = "memory"
  476. | |- device_type = "memory"
  477. | |- reg = <00000000 00000000 00000000 20000000>
  478. | |- linux,phandle = <3>
  479. |
  480. o chosen
  481. |- name = "chosen"
  482. |- bootargs = "root=/dev/sda2"
  483. |- linux,phandle = <4>
  484. This tree is almost a minimal tree. It pretty much contains the
  485. minimal set of required nodes and properties to boot a linux kernel;
  486. that is, some basic model informations at the root, the CPUs, and the
  487. physical memory layout. It also includes misc information passed
  488. through /chosen, like in this example, the platform type (mandatory)
  489. and the kernel command line arguments (optional).
  490. The /cpus/PowerPC,970@0/64-bit property is an example of a
  491. property without a value. All other properties have a value. The
  492. significance of the #address-cells and #size-cells properties will be
  493. explained in chapter IV which defines precisely the required nodes and
  494. properties and their content.
  495. 3) Device tree "structure" block
  496. The structure of the device tree is a linearized tree structure. The
  497. "OF_DT_BEGIN_NODE" token starts a new node, and the "OF_DT_END_NODE"
  498. ends that node definition. Child nodes are simply defined before
  499. "OF_DT_END_NODE" (that is nodes within the node). A 'token' is a 32
  500. bit value. The tree has to be "finished" with a OF_DT_END token
  501. Here's the basic structure of a single node:
  502. * token OF_DT_BEGIN_NODE (that is 0x00000001)
  503. * for version 1 to 3, this is the node full path as a zero
  504. terminated string, starting with "/". For version 16 and later,
  505. this is the node unit name only (or an empty string for the
  506. root node)
  507. * [align gap to next 4 bytes boundary]
  508. * for each property:
  509. * token OF_DT_PROP (that is 0x00000003)
  510. * 32-bit value of property value size in bytes (or 0 if no
  511. value)
  512. * 32-bit value of offset in string block of property name
  513. * property value data if any
  514. * [align gap to next 4 bytes boundary]
  515. * [child nodes if any]
  516. * token OF_DT_END_NODE (that is 0x00000002)
  517. So the node content can be summarized as a start token, a full path,
  518. a list of properties, a list of child nodes, and an end token. Every
  519. child node is a full node structure itself as defined above.
  520. NOTE: The above definition requires that all property definitions for
  521. a particular node MUST precede any subnode definitions for that node.
  522. Although the structure would not be ambiguous if properties and
  523. subnodes were intermingled, the kernel parser requires that the
  524. properties come first (up until at least 2.6.22). Any tools
  525. manipulating a flattened tree must take care to preserve this
  526. constraint.
  527. 4) Device tree "strings" block
  528. In order to save space, property names, which are generally redundant,
  529. are stored separately in the "strings" block. This block is simply the
  530. whole bunch of zero terminated strings for all property names
  531. concatenated together. The device-tree property definitions in the
  532. structure block will contain offset values from the beginning of the
  533. strings block.
  534. III - Required content of the device tree
  535. =========================================
  536. WARNING: All "linux,*" properties defined in this document apply only
  537. to a flattened device-tree. If your platform uses a real
  538. implementation of Open Firmware or an implementation compatible with
  539. the Open Firmware client interface, those properties will be created
  540. by the trampoline code in the kernel's prom_init() file. For example,
  541. that's where you'll have to add code to detect your board model and
  542. set the platform number. However, when using the flattened device-tree
  543. entry point, there is no prom_init() pass, and thus you have to
  544. provide those properties yourself.
  545. 1) Note about cells and address representation
  546. ----------------------------------------------
  547. The general rule is documented in the various Open Firmware
  548. documentations. If you choose to describe a bus with the device-tree
  549. and there exist an OF bus binding, then you should follow the
  550. specification. However, the kernel does not require every single
  551. device or bus to be described by the device tree.
  552. In general, the format of an address for a device is defined by the
  553. parent bus type, based on the #address-cells and #size-cells
  554. properties. Note that the parent's parent definitions of #address-cells
  555. and #size-cells are not inhereted so every node with children must specify
  556. them. The kernel requires the root node to have those properties defining
  557. addresses format for devices directly mapped on the processor bus.
  558. Those 2 properties define 'cells' for representing an address and a
  559. size. A "cell" is a 32-bit number. For example, if both contain 2
  560. like the example tree given above, then an address and a size are both
  561. composed of 2 cells, and each is a 64-bit number (cells are
  562. concatenated and expected to be in big endian format). Another example
  563. is the way Apple firmware defines them, with 2 cells for an address
  564. and one cell for a size. Most 32-bit implementations should define
  565. #address-cells and #size-cells to 1, which represents a 32-bit value.
  566. Some 32-bit processors allow for physical addresses greater than 32
  567. bits; these processors should define #address-cells as 2.
  568. "reg" properties are always a tuple of the type "address size" where
  569. the number of cells of address and size is specified by the bus
  570. #address-cells and #size-cells. When a bus supports various address
  571. spaces and other flags relative to a given address allocation (like
  572. prefetchable, etc...) those flags are usually added to the top level
  573. bits of the physical address. For example, a PCI physical address is
  574. made of 3 cells, the bottom two containing the actual address itself
  575. while the top cell contains address space indication, flags, and pci
  576. bus & device numbers.
  577. For busses that support dynamic allocation, it's the accepted practice
  578. to then not provide the address in "reg" (keep it 0) though while
  579. providing a flag indicating the address is dynamically allocated, and
  580. then, to provide a separate "assigned-addresses" property that
  581. contains the fully allocated addresses. See the PCI OF bindings for
  582. details.
  583. In general, a simple bus with no address space bits and no dynamic
  584. allocation is preferred if it reflects your hardware, as the existing
  585. kernel address parsing functions will work out of the box. If you
  586. define a bus type with a more complex address format, including things
  587. like address space bits, you'll have to add a bus translator to the
  588. prom_parse.c file of the recent kernels for your bus type.
  589. The "reg" property only defines addresses and sizes (if #size-cells is
  590. non-0) within a given bus. In order to translate addresses upward
  591. (that is into parent bus addresses, and possibly into CPU physical
  592. addresses), all busses must contain a "ranges" property. If the
  593. "ranges" property is missing at a given level, it's assumed that
  594. translation isn't possible, i.e., the registers are not visible on the
  595. parent bus. The format of the "ranges" property for a bus is a list
  596. of:
  597. bus address, parent bus address, size
  598. "bus address" is in the format of the bus this bus node is defining,
  599. that is, for a PCI bridge, it would be a PCI address. Thus, (bus
  600. address, size) defines a range of addresses for child devices. "parent
  601. bus address" is in the format of the parent bus of this bus. For
  602. example, for a PCI host controller, that would be a CPU address. For a
  603. PCI<->ISA bridge, that would be a PCI address. It defines the base
  604. address in the parent bus where the beginning of that range is mapped.
  605. For a new 64-bit powerpc board, I recommend either the 2/2 format or
  606. Apple's 2/1 format which is slightly more compact since sizes usually
  607. fit in a single 32-bit word. New 32-bit powerpc boards should use a
  608. 1/1 format, unless the processor supports physical addresses greater
  609. than 32-bits, in which case a 2/1 format is recommended.
  610. Alternatively, the "ranges" property may be empty, indicating that the
  611. registers are visible on the parent bus using an identity mapping
  612. translation. In other words, the parent bus address space is the same
  613. as the child bus address space.
  614. 2) Note about "compatible" properties
  615. -------------------------------------
  616. These properties are optional, but recommended in devices and the root
  617. node. The format of a "compatible" property is a list of concatenated
  618. zero terminated strings. They allow a device to express its
  619. compatibility with a family of similar devices, in some cases,
  620. allowing a single driver to match against several devices regardless
  621. of their actual names.
  622. 3) Note about "name" properties
  623. -------------------------------
  624. While earlier users of Open Firmware like OldWorld macintoshes tended
  625. to use the actual device name for the "name" property, it's nowadays
  626. considered a good practice to use a name that is closer to the device
  627. class (often equal to device_type). For example, nowadays, ethernet
  628. controllers are named "ethernet", an additional "model" property
  629. defining precisely the chip type/model, and "compatible" property
  630. defining the family in case a single driver can driver more than one
  631. of these chips. However, the kernel doesn't generally put any
  632. restriction on the "name" property; it is simply considered good
  633. practice to follow the standard and its evolutions as closely as
  634. possible.
  635. Note also that the new format version 16 makes the "name" property
  636. optional. If it's absent for a node, then the node's unit name is then
  637. used to reconstruct the name. That is, the part of the unit name
  638. before the "@" sign is used (or the entire unit name if no "@" sign
  639. is present).
  640. 4) Note about node and property names and character set
  641. -------------------------------------------------------
  642. While open firmware provides more flexible usage of 8859-1, this
  643. specification enforces more strict rules. Nodes and properties should
  644. be comprised only of ASCII characters 'a' to 'z', '0' to
  645. '9', ',', '.', '_', '+', '#', '?', and '-'. Node names additionally
  646. allow uppercase characters 'A' to 'Z' (property names should be
  647. lowercase. The fact that vendors like Apple don't respect this rule is
  648. irrelevant here). Additionally, node and property names should always
  649. begin with a character in the range 'a' to 'z' (or 'A' to 'Z' for node
  650. names).
  651. The maximum number of characters for both nodes and property names
  652. is 31. In the case of node names, this is only the leftmost part of
  653. a unit name (the pure "name" property), it doesn't include the unit
  654. address which can extend beyond that limit.
  655. 5) Required nodes and properties
  656. --------------------------------
  657. These are all that are currently required. However, it is strongly
  658. recommended that you expose PCI host bridges as documented in the
  659. PCI binding to open firmware, and your interrupt tree as documented
  660. in OF interrupt tree specification.
  661. a) The root node
  662. The root node requires some properties to be present:
  663. - model : this is your board name/model
  664. - #address-cells : address representation for "root" devices
  665. - #size-cells: the size representation for "root" devices
  666. - device_type : This property shouldn't be necessary. However, if
  667. you decide to create a device_type for your root node, make sure it
  668. is _not_ "chrp" unless your platform is a pSeries or PAPR compliant
  669. one for 64-bit, or a CHRP-type machine for 32-bit as this will
  670. matched by the kernel this way.
  671. Additionally, some recommended properties are:
  672. - compatible : the board "family" generally finds its way here,
  673. for example, if you have 2 board models with a similar layout,
  674. that typically get driven by the same platform code in the
  675. kernel, you would use a different "model" property but put a
  676. value in "compatible". The kernel doesn't directly use that
  677. value but it is generally useful.
  678. The root node is also generally where you add additional properties
  679. specific to your board like the serial number if any, that sort of
  680. thing. It is recommended that if you add any "custom" property whose
  681. name may clash with standard defined ones, you prefix them with your
  682. vendor name and a comma.
  683. b) The /cpus node
  684. This node is the parent of all individual CPU nodes. It doesn't
  685. have any specific requirements, though it's generally good practice
  686. to have at least:
  687. #address-cells = <00000001>
  688. #size-cells = <00000000>
  689. This defines that the "address" for a CPU is a single cell, and has
  690. no meaningful size. This is not necessary but the kernel will assume
  691. that format when reading the "reg" properties of a CPU node, see
  692. below
  693. c) The /cpus/* nodes
  694. So under /cpus, you are supposed to create a node for every CPU on
  695. the machine. There is no specific restriction on the name of the
  696. CPU, though It's common practice to call it PowerPC,<name>. For
  697. example, Apple uses PowerPC,G5 while IBM uses PowerPC,970FX.
  698. Required properties:
  699. - device_type : has to be "cpu"
  700. - reg : This is the physical CPU number, it's a single 32-bit cell
  701. and is also used as-is as the unit number for constructing the
  702. unit name in the full path. For example, with 2 CPUs, you would
  703. have the full path:
  704. /cpus/PowerPC,970FX@0
  705. /cpus/PowerPC,970FX@1
  706. (unit addresses do not require leading zeroes)
  707. - d-cache-block-size : one cell, L1 data cache block size in bytes (*)
  708. - i-cache-block-size : one cell, L1 instruction cache block size in
  709. bytes
  710. - d-cache-size : one cell, size of L1 data cache in bytes
  711. - i-cache-size : one cell, size of L1 instruction cache in bytes
  712. (*) The cache "block" size is the size on which the cache management
  713. instructions operate. Historically, this document used the cache
  714. "line" size here which is incorrect. The kernel will prefer the cache
  715. block size and will fallback to cache line size for backward
  716. compatibility.
  717. Recommended properties:
  718. - timebase-frequency : a cell indicating the frequency of the
  719. timebase in Hz. This is not directly used by the generic code,
  720. but you are welcome to copy/paste the pSeries code for setting
  721. the kernel timebase/decrementer calibration based on this
  722. value.
  723. - clock-frequency : a cell indicating the CPU core clock frequency
  724. in Hz. A new property will be defined for 64-bit values, but if
  725. your frequency is < 4Ghz, one cell is enough. Here as well as
  726. for the above, the common code doesn't use that property, but
  727. you are welcome to re-use the pSeries or Maple one. A future
  728. kernel version might provide a common function for this.
  729. - d-cache-line-size : one cell, L1 data cache line size in bytes
  730. if different from the block size
  731. - i-cache-line-size : one cell, L1 instruction cache line size in
  732. bytes if different from the block size
  733. You are welcome to add any property you find relevant to your board,
  734. like some information about the mechanism used to soft-reset the
  735. CPUs. For example, Apple puts the GPIO number for CPU soft reset
  736. lines in there as a "soft-reset" property since they start secondary
  737. CPUs by soft-resetting them.
  738. d) the /memory node(s)
  739. To define the physical memory layout of your board, you should
  740. create one or more memory node(s). You can either create a single
  741. node with all memory ranges in its reg property, or you can create
  742. several nodes, as you wish. The unit address (@ part) used for the
  743. full path is the address of the first range of memory defined by a
  744. given node. If you use a single memory node, this will typically be
  745. @0.
  746. Required properties:
  747. - device_type : has to be "memory"
  748. - reg : This property contains all the physical memory ranges of
  749. your board. It's a list of addresses/sizes concatenated
  750. together, with the number of cells of each defined by the
  751. #address-cells and #size-cells of the root node. For example,
  752. with both of these properties being 2 like in the example given
  753. earlier, a 970 based machine with 6Gb of RAM could typically
  754. have a "reg" property here that looks like:
  755. 00000000 00000000 00000000 80000000
  756. 00000001 00000000 00000001 00000000
  757. That is a range starting at 0 of 0x80000000 bytes and a range
  758. starting at 0x100000000 and of 0x100000000 bytes. You can see
  759. that there is no memory covering the IO hole between 2Gb and
  760. 4Gb. Some vendors prefer splitting those ranges into smaller
  761. segments, but the kernel doesn't care.
  762. e) The /chosen node
  763. This node is a bit "special". Normally, that's where open firmware
  764. puts some variable environment information, like the arguments, or
  765. the default input/output devices.
  766. This specification makes a few of these mandatory, but also defines
  767. some linux-specific properties that would be normally constructed by
  768. the prom_init() trampoline when booting with an OF client interface,
  769. but that you have to provide yourself when using the flattened format.
  770. Recommended properties:
  771. - bootargs : This zero-terminated string is passed as the kernel
  772. command line
  773. - linux,stdout-path : This is the full path to your standard
  774. console device if any. Typically, if you have serial devices on
  775. your board, you may want to put the full path to the one set as
  776. the default console in the firmware here, for the kernel to pick
  777. it up as its own default console. If you look at the function
  778. set_preferred_console() in arch/ppc64/kernel/setup.c, you'll see
  779. that the kernel tries to find out the default console and has
  780. knowledge of various types like 8250 serial ports. You may want
  781. to extend this function to add your own.
  782. Note that u-boot creates and fills in the chosen node for platforms
  783. that use it.
  784. (Note: a practice that is now obsolete was to include a property
  785. under /chosen called interrupt-controller which had a phandle value
  786. that pointed to the main interrupt controller)
  787. f) the /soc<SOCname> node
  788. This node is used to represent a system-on-a-chip (SOC) and must be
  789. present if the processor is a SOC. The top-level soc node contains
  790. information that is global to all devices on the SOC. The node name
  791. should contain a unit address for the SOC, which is the base address
  792. of the memory-mapped register set for the SOC. The name of an soc
  793. node should start with "soc", and the remainder of the name should
  794. represent the part number for the soc. For example, the MPC8540's
  795. soc node would be called "soc8540".
  796. Required properties:
  797. - device_type : Should be "soc"
  798. - ranges : Should be defined as specified in 1) to describe the
  799. translation of SOC addresses for memory mapped SOC registers.
  800. - bus-frequency: Contains the bus frequency for the SOC node.
  801. Typically, the value of this field is filled in by the boot
  802. loader.
  803. Recommended properties:
  804. - reg : This property defines the address and size of the
  805. memory-mapped registers that are used for the SOC node itself.
  806. It does not include the child device registers - these will be
  807. defined inside each child node. The address specified in the
  808. "reg" property should match the unit address of the SOC node.
  809. - #address-cells : Address representation for "soc" devices. The
  810. format of this field may vary depending on whether or not the
  811. device registers are memory mapped. For memory mapped
  812. registers, this field represents the number of cells needed to
  813. represent the address of the registers. For SOCs that do not
  814. use MMIO, a special address format should be defined that
  815. contains enough cells to represent the required information.
  816. See 1) above for more details on defining #address-cells.
  817. - #size-cells : Size representation for "soc" devices
  818. - #interrupt-cells : Defines the width of cells used to represent
  819. interrupts. Typically this value is <2>, which includes a
  820. 32-bit number that represents the interrupt number, and a
  821. 32-bit number that represents the interrupt sense and level.
  822. This field is only needed if the SOC contains an interrupt
  823. controller.
  824. The SOC node may contain child nodes for each SOC device that the
  825. platform uses. Nodes should not be created for devices which exist
  826. on the SOC but are not used by a particular platform. See chapter VI
  827. for more information on how to specify devices that are part of a SOC.
  828. Example SOC node for the MPC8540:
  829. soc8540@e0000000 {
  830. #address-cells = <1>;
  831. #size-cells = <1>;
  832. #interrupt-cells = <2>;
  833. device_type = "soc";
  834. ranges = <00000000 e0000000 00100000>
  835. reg = <e0000000 00003000>;
  836. bus-frequency = <0>;
  837. }
  838. IV - "dtc", the device tree compiler
  839. ====================================
  840. dtc source code can be found at
  841. <http://ozlabs.org/~dgibson/dtc/dtc.tar.gz>
  842. WARNING: This version is still in early development stage; the
  843. resulting device-tree "blobs" have not yet been validated with the
  844. kernel. The current generated bloc lacks a useful reserve map (it will
  845. be fixed to generate an empty one, it's up to the bootloader to fill
  846. it up) among others. The error handling needs work, bugs are lurking,
  847. etc...
  848. dtc basically takes a device-tree in a given format and outputs a
  849. device-tree in another format. The currently supported formats are:
  850. Input formats:
  851. -------------
  852. - "dtb": "blob" format, that is a flattened device-tree block
  853. with
  854. header all in a binary blob.
  855. - "dts": "source" format. This is a text file containing a
  856. "source" for a device-tree. The format is defined later in this
  857. chapter.
  858. - "fs" format. This is a representation equivalent to the
  859. output of /proc/device-tree, that is nodes are directories and
  860. properties are files
  861. Output formats:
  862. ---------------
  863. - "dtb": "blob" format
  864. - "dts": "source" format
  865. - "asm": assembly language file. This is a file that can be
  866. sourced by gas to generate a device-tree "blob". That file can
  867. then simply be added to your Makefile. Additionally, the
  868. assembly file exports some symbols that can be used.
  869. The syntax of the dtc tool is
  870. dtc [-I <input-format>] [-O <output-format>]
  871. [-o output-filename] [-V output_version] input_filename
  872. The "output_version" defines what version of the "blob" format will be
  873. generated. Supported versions are 1,2,3 and 16. The default is
  874. currently version 3 but that may change in the future to version 16.
  875. Additionally, dtc performs various sanity checks on the tree, like the
  876. uniqueness of linux, phandle properties, validity of strings, etc...
  877. The format of the .dts "source" file is "C" like, supports C and C++
  878. style comments.
  879. / {
  880. }
  881. The above is the "device-tree" definition. It's the only statement
  882. supported currently at the toplevel.
  883. / {
  884. property1 = "string_value"; /* define a property containing a 0
  885. * terminated string
  886. */
  887. property2 = <1234abcd>; /* define a property containing a
  888. * numerical 32-bit value (hexadecimal)
  889. */
  890. property3 = <12345678 12345678 deadbeef>;
  891. /* define a property containing 3
  892. * numerical 32-bit values (cells) in
  893. * hexadecimal
  894. */
  895. property4 = [0a 0b 0c 0d de ea ad be ef];
  896. /* define a property whose content is
  897. * an arbitrary array of bytes
  898. */
  899. childnode@addresss { /* define a child node named "childnode"
  900. * whose unit name is "childnode at
  901. * address"
  902. */
  903. childprop = "hello\n"; /* define a property "childprop" of
  904. * childnode (in this case, a string)
  905. */
  906. };
  907. };
  908. Nodes can contain other nodes etc... thus defining the hierarchical
  909. structure of the tree.
  910. Strings support common escape sequences from C: "\n", "\t", "\r",
  911. "\(octal value)", "\x(hex value)".
  912. It is also suggested that you pipe your source file through cpp (gcc
  913. preprocessor) so you can use #include's, #define for constants, etc...
  914. Finally, various options are planned but not yet implemented, like
  915. automatic generation of phandles, labels (exported to the asm file so
  916. you can point to a property content and change it easily from whatever
  917. you link the device-tree with), label or path instead of numeric value
  918. in some cells to "point" to a node (replaced by a phandle at compile
  919. time), export of reserve map address to the asm file, ability to
  920. specify reserve map content at compile time, etc...
  921. We may provide a .h include file with common definitions of that
  922. proves useful for some properties (like building PCI properties or
  923. interrupt maps) though it may be better to add a notion of struct
  924. definitions to the compiler...
  925. V - Recommendations for a bootloader
  926. ====================================
  927. Here are some various ideas/recommendations that have been proposed
  928. while all this has been defined and implemented.
  929. - The bootloader may want to be able to use the device-tree itself
  930. and may want to manipulate it (to add/edit some properties,
  931. like physical memory size or kernel arguments). At this point, 2
  932. choices can be made. Either the bootloader works directly on the
  933. flattened format, or the bootloader has its own internal tree
  934. representation with pointers (similar to the kernel one) and
  935. re-flattens the tree when booting the kernel. The former is a bit
  936. more difficult to edit/modify, the later requires probably a bit
  937. more code to handle the tree structure. Note that the structure
  938. format has been designed so it's relatively easy to "insert"
  939. properties or nodes or delete them by just memmoving things
  940. around. It contains no internal offsets or pointers for this
  941. purpose.
  942. - An example of code for iterating nodes & retrieving properties
  943. directly from the flattened tree format can be found in the kernel
  944. file arch/ppc64/kernel/prom.c, look at scan_flat_dt() function,
  945. its usage in early_init_devtree(), and the corresponding various
  946. early_init_dt_scan_*() callbacks. That code can be re-used in a
  947. GPL bootloader, and as the author of that code, I would be happy
  948. to discuss possible free licensing to any vendor who wishes to
  949. integrate all or part of this code into a non-GPL bootloader.
  950. VI - System-on-a-chip devices and nodes
  951. =======================================
  952. Many companies are now starting to develop system-on-a-chip
  953. processors, where the processor core (CPU) and many peripheral devices
  954. exist on a single piece of silicon. For these SOCs, an SOC node
  955. should be used that defines child nodes for the devices that make
  956. up the SOC. While platforms are not required to use this model in
  957. order to boot the kernel, it is highly encouraged that all SOC
  958. implementations define as complete a flat-device-tree as possible to
  959. describe the devices on the SOC. This will allow for the
  960. genericization of much of the kernel code.
  961. 1) Defining child nodes of an SOC
  962. ---------------------------------
  963. Each device that is part of an SOC may have its own node entry inside
  964. the SOC node. For each device that is included in the SOC, the unit
  965. address property represents the address offset for this device's
  966. memory-mapped registers in the parent's address space. The parent's
  967. address space is defined by the "ranges" property in the top-level soc
  968. node. The "reg" property for each node that exists directly under the
  969. SOC node should contain the address mapping from the child address space
  970. to the parent SOC address space and the size of the device's
  971. memory-mapped register file.
  972. For many devices that may exist inside an SOC, there are predefined
  973. specifications for the format of the device tree node. All SOC child
  974. nodes should follow these specifications, except where noted in this
  975. document.
  976. See appendix A for an example partial SOC node definition for the
  977. MPC8540.
  978. 2) Representing devices without a current OF specification
  979. ----------------------------------------------------------
  980. Currently, there are many devices on SOCs that do not have a standard
  981. representation pre-defined as part of the open firmware
  982. specifications, mainly because the boards that contain these SOCs are
  983. not currently booted using open firmware. This section contains
  984. descriptions for the SOC devices for which new nodes have been
  985. defined; this list will expand as more and more SOC-containing
  986. platforms are moved over to use the flattened-device-tree model.
  987. a) MDIO IO device
  988. The MDIO is a bus to which the PHY devices are connected. For each
  989. device that exists on this bus, a child node should be created. See
  990. the definition of the PHY node below for an example of how to define
  991. a PHY.
  992. Required properties:
  993. - reg : Offset and length of the register set for the device
  994. - compatible : Should define the compatible device type for the
  995. mdio. Currently, this is most likely to be "fsl,gianfar-mdio"
  996. Example:
  997. mdio@24520 {
  998. reg = <24520 20>;
  999. compatible = "fsl,gianfar-mdio";
  1000. ethernet-phy@0 {
  1001. ......
  1002. };
  1003. };
  1004. b) Gianfar-compatible ethernet nodes
  1005. Required properties:
  1006. - device_type : Should be "network"
  1007. - model : Model of the device. Can be "TSEC", "eTSEC", or "FEC"
  1008. - compatible : Should be "gianfar"
  1009. - reg : Offset and length of the register set for the device
  1010. - mac-address : List of bytes representing the ethernet address of
  1011. this controller
  1012. - interrupts : <a b> where a is the interrupt number and b is a
  1013. field that represents an encoding of the sense and level
  1014. information for the interrupt. This should be encoded based on
  1015. the information in section 2) depending on the type of interrupt
  1016. controller you have.
  1017. - interrupt-parent : the phandle for the interrupt controller that
  1018. services interrupts for this device.
  1019. - phy-handle : The phandle for the PHY connected to this ethernet
  1020. controller.
  1021. - fixed-link : <a b c d e> where a is emulated phy id - choose any,
  1022. but unique to the all specified fixed-links, b is duplex - 0 half,
  1023. 1 full, c is link speed - d#10/d#100/d#1000, d is pause - 0 no
  1024. pause, 1 pause, e is asym_pause - 0 no asym_pause, 1 asym_pause.
  1025. Recommended properties:
  1026. - linux,network-index : This is the intended "index" of this
  1027. network device. This is used by the bootwrapper to interpret
  1028. MAC addresses passed by the firmware when no information other
  1029. than indices is available to associate an address with a device.
  1030. - phy-connection-type : a string naming the controller/PHY interface type,
  1031. i.e., "mii" (default), "rmii", "gmii", "rgmii", "rgmii-id", "sgmii",
  1032. "tbi", or "rtbi". This property is only really needed if the connection
  1033. is of type "rgmii-id", as all other connection types are detected by
  1034. hardware.
  1035. Example:
  1036. ethernet@24000 {
  1037. #size-cells = <0>;
  1038. device_type = "network";
  1039. model = "TSEC";
  1040. compatible = "gianfar";
  1041. reg = <24000 1000>;
  1042. mac-address = [ 00 E0 0C 00 73 00 ];
  1043. interrupts = <d 3 e 3 12 3>;
  1044. interrupt-parent = <40000>;
  1045. phy-handle = <2452000>
  1046. };
  1047. c) PHY nodes
  1048. Required properties:
  1049. - device_type : Should be "ethernet-phy"
  1050. - interrupts : <a b> where a is the interrupt number and b is a
  1051. field that represents an encoding of the sense and level
  1052. information for the interrupt. This should be encoded based on
  1053. the information in section 2) depending on the type of interrupt
  1054. controller you have.
  1055. - interrupt-parent : the phandle for the interrupt controller that
  1056. services interrupts for this device.
  1057. - reg : The ID number for the phy, usually a small integer
  1058. - linux,phandle : phandle for this node; likely referenced by an
  1059. ethernet controller node.
  1060. Example:
  1061. ethernet-phy@0 {
  1062. linux,phandle = <2452000>
  1063. interrupt-parent = <40000>;
  1064. interrupts = <35 1>;
  1065. reg = <0>;
  1066. device_type = "ethernet-phy";
  1067. };
  1068. d) Interrupt controllers
  1069. Some SOC devices contain interrupt controllers that are different
  1070. from the standard Open PIC specification. The SOC device nodes for
  1071. these types of controllers should be specified just like a standard
  1072. OpenPIC controller. Sense and level information should be encoded
  1073. as specified in section 2) of this chapter for each device that
  1074. specifies an interrupt.
  1075. Example :
  1076. pic@40000 {
  1077. linux,phandle = <40000>;
  1078. clock-frequency = <0>;
  1079. interrupt-controller;
  1080. #address-cells = <0>;
  1081. reg = <40000 40000>;
  1082. built-in;
  1083. compatible = "chrp,open-pic";
  1084. device_type = "open-pic";
  1085. big-endian;
  1086. };
  1087. e) I2C
  1088. Required properties :
  1089. - device_type : Should be "i2c"
  1090. - reg : Offset and length of the register set for the device
  1091. Recommended properties :
  1092. - compatible : Should be "fsl-i2c" for parts compatible with
  1093. Freescale I2C specifications.
  1094. - interrupts : <a b> where a is the interrupt number and b is a
  1095. field that represents an encoding of the sense and level
  1096. information for the interrupt. This should be encoded based on
  1097. the information in section 2) depending on the type of interrupt
  1098. controller you have.
  1099. - interrupt-parent : the phandle for the interrupt controller that
  1100. services interrupts for this device.
  1101. - dfsrr : boolean; if defined, indicates that this I2C device has
  1102. a digital filter sampling rate register
  1103. - fsl5200-clocking : boolean; if defined, indicated that this device
  1104. uses the FSL 5200 clocking mechanism.
  1105. Example :
  1106. i2c@3000 {
  1107. interrupt-parent = <40000>;
  1108. interrupts = <1b 3>;
  1109. reg = <3000 18>;
  1110. device_type = "i2c";
  1111. compatible = "fsl-i2c";
  1112. dfsrr;
  1113. };
  1114. f) Freescale SOC USB controllers
  1115. The device node for a USB controller that is part of a Freescale
  1116. SOC is as described in the document "Open Firmware Recommended
  1117. Practice : Universal Serial Bus" with the following modifications
  1118. and additions :
  1119. Required properties :
  1120. - compatible : Should be "fsl-usb2-mph" for multi port host USB
  1121. controllers, or "fsl-usb2-dr" for dual role USB controllers
  1122. - phy_type : For multi port host USB controllers, should be one of
  1123. "ulpi", or "serial". For dual role USB controllers, should be
  1124. one of "ulpi", "utmi", "utmi_wide", or "serial".
  1125. - reg : Offset and length of the register set for the device
  1126. - port0 : boolean; if defined, indicates port0 is connected for
  1127. fsl-usb2-mph compatible controllers. Either this property or
  1128. "port1" (or both) must be defined for "fsl-usb2-mph" compatible
  1129. controllers.
  1130. - port1 : boolean; if defined, indicates port1 is connected for
  1131. fsl-usb2-mph compatible controllers. Either this property or
  1132. "port0" (or both) must be defined for "fsl-usb2-mph" compatible
  1133. controllers.
  1134. - dr_mode : indicates the working mode for "fsl-usb2-dr" compatible
  1135. controllers. Can be "host", "peripheral", or "otg". Default to
  1136. "host" if not defined for backward compatibility.
  1137. Recommended properties :
  1138. - interrupts : <a b> where a is the interrupt number and b is a
  1139. field that represents an encoding of the sense and level
  1140. information for the interrupt. This should be encoded based on
  1141. the information in section 2) depending on the type of interrupt
  1142. controller you have.
  1143. - interrupt-parent : the phandle for the interrupt controller that
  1144. services interrupts for this device.
  1145. Example multi port host USB controller device node :
  1146. usb@22000 {
  1147. compatible = "fsl-usb2-mph";
  1148. reg = <22000 1000>;
  1149. #address-cells = <1>;
  1150. #size-cells = <0>;
  1151. interrupt-parent = <700>;
  1152. interrupts = <27 1>;
  1153. phy_type = "ulpi";
  1154. port0;
  1155. port1;
  1156. };
  1157. Example dual role USB controller device node :
  1158. usb@23000 {
  1159. compatible = "fsl-usb2-dr";
  1160. reg = <23000 1000>;
  1161. #address-cells = <1>;
  1162. #size-cells = <0>;
  1163. interrupt-parent = <700>;
  1164. interrupts = <26 1>;
  1165. dr_mode = "otg";
  1166. phy = "ulpi";
  1167. };
  1168. g) Freescale SOC SEC Security Engines
  1169. Required properties:
  1170. - device_type : Should be "crypto"
  1171. - model : Model of the device. Should be "SEC1" or "SEC2"
  1172. - compatible : Should be "talitos"
  1173. - reg : Offset and length of the register set for the device
  1174. - interrupts : <a b> where a is the interrupt number and b is a
  1175. field that represents an encoding of the sense and level
  1176. information for the interrupt. This should be encoded based on
  1177. the information in section 2) depending on the type of interrupt
  1178. controller you have.
  1179. - interrupt-parent : the phandle for the interrupt controller that
  1180. services interrupts for this device.
  1181. - num-channels : An integer representing the number of channels
  1182. available.
  1183. - channel-fifo-len : An integer representing the number of
  1184. descriptor pointers each channel fetch fifo can hold.
  1185. - exec-units-mask : The bitmask representing what execution units
  1186. (EUs) are available. It's a single 32-bit cell. EU information
  1187. should be encoded following the SEC's Descriptor Header Dword
  1188. EU_SEL0 field documentation, i.e. as follows:
  1189. bit 0 = reserved - should be 0
  1190. bit 1 = set if SEC has the ARC4 EU (AFEU)
  1191. bit 2 = set if SEC has the DES/3DES EU (DEU)
  1192. bit 3 = set if SEC has the message digest EU (MDEU)
  1193. bit 4 = set if SEC has the random number generator EU (RNG)
  1194. bit 5 = set if SEC has the public key EU (PKEU)
  1195. bit 6 = set if SEC has the AES EU (AESU)
  1196. bit 7 = set if SEC has the Kasumi EU (KEU)
  1197. bits 8 through 31 are reserved for future SEC EUs.
  1198. - descriptor-types-mask : The bitmask representing what descriptors
  1199. are available. It's a single 32-bit cell. Descriptor type
  1200. information should be encoded following the SEC's Descriptor
  1201. Header Dword DESC_TYPE field documentation, i.e. as follows:
  1202. bit 0 = set if SEC supports the aesu_ctr_nonsnoop desc. type
  1203. bit 1 = set if SEC supports the ipsec_esp descriptor type
  1204. bit 2 = set if SEC supports the common_nonsnoop desc. type
  1205. bit 3 = set if SEC supports the 802.11i AES ccmp desc. type
  1206. bit 4 = set if SEC supports the hmac_snoop_no_afeu desc. type
  1207. bit 5 = set if SEC supports the srtp descriptor type
  1208. bit 6 = set if SEC supports the non_hmac_snoop_no_afeu desc.type
  1209. bit 7 = set if SEC supports the pkeu_assemble descriptor type
  1210. bit 8 = set if SEC supports the aesu_key_expand_output desc.type
  1211. bit 9 = set if SEC supports the pkeu_ptmul descriptor type
  1212. bit 10 = set if SEC supports the common_nonsnoop_afeu desc. type
  1213. bit 11 = set if SEC supports the pkeu_ptadd_dbl descriptor type
  1214. ..and so on and so forth.
  1215. Example:
  1216. /* MPC8548E */
  1217. crypto@30000 {
  1218. device_type = "crypto";
  1219. model = "SEC2";
  1220. compatible = "talitos";
  1221. reg = <30000 10000>;
  1222. interrupts = <1d 3>;
  1223. interrupt-parent = <40000>;
  1224. num-channels = <4>;
  1225. channel-fifo-len = <18>;
  1226. exec-units-mask = <000000fe>;
  1227. descriptor-types-mask = <012b0ebf>;
  1228. };
  1229. h) Board Control and Status (BCSR)
  1230. Required properties:
  1231. - device_type : Should be "board-control"
  1232. - reg : Offset and length of the register set for the device
  1233. Example:
  1234. bcsr@f8000000 {
  1235. device_type = "board-control";
  1236. reg = <f8000000 8000>;
  1237. };
  1238. i) Freescale QUICC Engine module (QE)
  1239. This represents qe module that is installed on PowerQUICC II Pro.
  1240. NOTE: This is an interim binding; it should be updated to fit
  1241. in with the CPM binding later in this document.
  1242. Basically, it is a bus of devices, that could act more or less
  1243. as a complete entity (UCC, USB etc ). All of them should be siblings on
  1244. the "root" qe node, using the common properties from there.
  1245. The description below applies to the qe of MPC8360 and
  1246. more nodes and properties would be extended in the future.
  1247. i) Root QE device
  1248. Required properties:
  1249. - device_type : should be "qe";
  1250. - model : precise model of the QE, Can be "QE", "CPM", or "CPM2"
  1251. - reg : offset and length of the device registers.
  1252. - bus-frequency : the clock frequency for QUICC Engine.
  1253. Recommended properties
  1254. - brg-frequency : the internal clock source frequency for baud-rate
  1255. generators in Hz.
  1256. Example:
  1257. qe@e0100000 {
  1258. #address-cells = <1>;
  1259. #size-cells = <1>;
  1260. #interrupt-cells = <2>;
  1261. device_type = "qe";
  1262. model = "QE";
  1263. ranges = <0 e0100000 00100000>;
  1264. reg = <e0100000 480>;
  1265. brg-frequency = <0>;
  1266. bus-frequency = <179A7B00>;
  1267. }
  1268. ii) SPI (Serial Peripheral Interface)
  1269. Required properties:
  1270. - device_type : should be "spi".
  1271. - compatible : should be "fsl_spi".
  1272. - mode : the SPI operation mode, it can be "cpu" or "cpu-qe".
  1273. - reg : Offset and length of the register set for the device
  1274. - interrupts : <a b> where a is the interrupt number and b is a
  1275. field that represents an encoding of the sense and level
  1276. information for the interrupt. This should be encoded based on
  1277. the information in section 2) depending on the type of interrupt
  1278. controller you have.
  1279. - interrupt-parent : the phandle for the interrupt controller that
  1280. services interrupts for this device.
  1281. Example:
  1282. spi@4c0 {
  1283. device_type = "spi";
  1284. compatible = "fsl_spi";
  1285. reg = <4c0 40>;
  1286. interrupts = <82 0>;
  1287. interrupt-parent = <700>;
  1288. mode = "cpu";
  1289. };
  1290. iii) USB (Universal Serial Bus Controller)
  1291. Required properties:
  1292. - compatible : could be "qe_udc" or "fhci-hcd".
  1293. - mode : the could be "host" or "slave".
  1294. - reg : Offset and length of the register set for the device
  1295. - interrupts : <a b> where a is the interrupt number and b is a
  1296. field that represents an encoding of the sense and level
  1297. information for the interrupt. This should be encoded based on
  1298. the information in section 2) depending on the type of interrupt
  1299. controller you have.
  1300. - interrupt-parent : the phandle for the interrupt controller that
  1301. services interrupts for this device.
  1302. Example(slave):
  1303. usb@6c0 {
  1304. compatible = "qe_udc";
  1305. reg = <6c0 40>;
  1306. interrupts = <8b 0>;
  1307. interrupt-parent = <700>;
  1308. mode = "slave";
  1309. };
  1310. iv) UCC (Unified Communications Controllers)
  1311. Required properties:
  1312. - device_type : should be "network", "hldc", "uart", "transparent"
  1313. "bisync" or "atm".
  1314. - compatible : could be "ucc_geth" or "fsl_atm" and so on.
  1315. - model : should be "UCC".
  1316. - device-id : the ucc number(1-8), corresponding to UCCx in UM.
  1317. - reg : Offset and length of the register set for the device
  1318. - interrupts : <a b> where a is the interrupt number and b is a
  1319. field that represents an encoding of the sense and level
  1320. information for the interrupt. This should be encoded based on
  1321. the information in section 2) depending on the type of interrupt
  1322. controller you have.
  1323. - interrupt-parent : the phandle for the interrupt controller that
  1324. services interrupts for this device.
  1325. - pio-handle : The phandle for the Parallel I/O port configuration.
  1326. - rx-clock-name: the UCC receive clock source
  1327. "none": clock source is disabled
  1328. "brg1" through "brg16": clock source is BRG1-BRG16, respectively
  1329. "clk1" through "clk24": clock source is CLK1-CLK24, respectively
  1330. - tx-clock-name: the UCC transmit clock source
  1331. "none": clock source is disabled
  1332. "brg1" through "brg16": clock source is BRG1-BRG16, respectively
  1333. "clk1" through "clk24": clock source is CLK1-CLK24, respectively
  1334. The following two properties are deprecated. rx-clock has been replaced
  1335. with rx-clock-name, and tx-clock has been replaced with tx-clock-name.
  1336. Drivers that currently use the deprecated properties should continue to
  1337. do so, in order to support older device trees, but they should be updated
  1338. to check for the new properties first.
  1339. - rx-clock : represents the UCC receive clock source.
  1340. 0x00 : clock source is disabled;
  1341. 0x1~0x10 : clock source is BRG1~BRG16 respectively;
  1342. 0x11~0x28: clock source is QE_CLK1~QE_CLK24 respectively.
  1343. - tx-clock: represents the UCC transmit clock source;
  1344. 0x00 : clock source is disabled;
  1345. 0x1~0x10 : clock source is BRG1~BRG16 respectively;
  1346. 0x11~0x28: clock source is QE_CLK1~QE_CLK24 respectively.
  1347. Required properties for network device_type:
  1348. - mac-address : list of bytes representing the ethernet address.
  1349. - phy-handle : The phandle for the PHY connected to this controller.
  1350. Recommended properties:
  1351. - linux,network-index : This is the intended "index" of this
  1352. network device. This is used by the bootwrapper to interpret
  1353. MAC addresses passed by the firmware when no information other
  1354. than indices is available to associate an address with a device.
  1355. - phy-connection-type : a string naming the controller/PHY interface type,
  1356. i.e., "mii" (default), "rmii", "gmii", "rgmii", "rgmii-id" (Internal
  1357. Delay), "rgmii-txid" (delay on TX only), "rgmii-rxid" (delay on RX only),
  1358. "tbi", or "rtbi".
  1359. Example:
  1360. ucc@2000 {
  1361. device_type = "network";
  1362. compatible = "ucc_geth";
  1363. model = "UCC";
  1364. device-id = <1>;
  1365. reg = <2000 200>;
  1366. interrupts = <a0 0>;
  1367. interrupt-parent = <700>;
  1368. mac-address = [ 00 04 9f 00 23 23 ];
  1369. rx-clock = "none";
  1370. tx-clock = "clk9";
  1371. phy-handle = <212000>;
  1372. phy-connection-type = "gmii";
  1373. pio-handle = <140001>;
  1374. };
  1375. v) Parallel I/O Ports
  1376. This node configures Parallel I/O ports for CPUs with QE support.
  1377. The node should reside in the "soc" node of the tree. For each
  1378. device that using parallel I/O ports, a child node should be created.
  1379. See the definition of the Pin configuration nodes below for more
  1380. information.
  1381. Required properties:
  1382. - device_type : should be "par_io".
  1383. - reg : offset to the register set and its length.
  1384. - num-ports : number of Parallel I/O ports
  1385. Example:
  1386. par_io@1400 {
  1387. reg = <1400 100>;
  1388. #address-cells = <1>;
  1389. #size-cells = <0>;
  1390. device_type = "par_io";
  1391. num-ports = <7>;
  1392. ucc_pin@01 {
  1393. ......
  1394. };
  1395. vi) Pin configuration nodes
  1396. Required properties:
  1397. - linux,phandle : phandle of this node; likely referenced by a QE
  1398. device.
  1399. - pio-map : array of pin configurations. Each pin is defined by 6
  1400. integers. The six numbers are respectively: port, pin, dir,
  1401. open_drain, assignment, has_irq.
  1402. - port : port number of the pin; 0-6 represent port A-G in UM.
  1403. - pin : pin number in the port.
  1404. - dir : direction of the pin, should encode as follows:
  1405. 0 = The pin is disabled
  1406. 1 = The pin is an output
  1407. 2 = The pin is an input
  1408. 3 = The pin is I/O
  1409. - open_drain : indicates the pin is normal or wired-OR:
  1410. 0 = The pin is actively driven as an output
  1411. 1 = The pin is an open-drain driver. As an output, the pin is
  1412. driven active-low, otherwise it is three-stated.
  1413. - assignment : function number of the pin according to the Pin Assignment
  1414. tables in User Manual. Each pin can have up to 4 possible functions in
  1415. QE and two options for CPM.
  1416. - has_irq : indicates if the pin is used as source of external
  1417. interrupts.
  1418. Example:
  1419. ucc_pin@01 {
  1420. linux,phandle = <140001>;
  1421. pio-map = <
  1422. /* port pin dir open_drain assignment has_irq */
  1423. 0 3 1 0 1 0 /* TxD0 */
  1424. 0 4 1 0 1 0 /* TxD1 */
  1425. 0 5 1 0 1 0 /* TxD2 */
  1426. 0 6 1 0 1 0 /* TxD3 */
  1427. 1 6 1 0 3 0 /* TxD4 */
  1428. 1 7 1 0 1 0 /* TxD5 */
  1429. 1 9 1 0 2 0 /* TxD6 */
  1430. 1 a 1 0 2 0 /* TxD7 */
  1431. 0 9 2 0 1 0 /* RxD0 */
  1432. 0 a 2 0 1 0 /* RxD1 */
  1433. 0 b 2 0 1 0 /* RxD2 */
  1434. 0 c 2 0 1 0 /* RxD3 */
  1435. 0 d 2 0 1 0 /* RxD4 */
  1436. 1 1 2 0 2 0 /* RxD5 */
  1437. 1 0 2 0 2 0 /* RxD6 */
  1438. 1 4 2 0 2 0 /* RxD7 */
  1439. 0 7 1 0 1 0 /* TX_EN */
  1440. 0 8 1 0 1 0 /* TX_ER */
  1441. 0 f 2 0 1 0 /* RX_DV */
  1442. 0 10 2 0 1 0 /* RX_ER */
  1443. 0 0 2 0 1 0 /* RX_CLK */
  1444. 2 9 1 0 3 0 /* GTX_CLK - CLK10 */
  1445. 2 8 2 0 1 0>; /* GTX125 - CLK9 */
  1446. };
  1447. vii) Multi-User RAM (MURAM)
  1448. Required properties:
  1449. - device_type : should be "muram".
  1450. - mode : the could be "host" or "slave".
  1451. - ranges : Should be defined as specified in 1) to describe the
  1452. translation of MURAM addresses.
  1453. - data-only : sub-node which defines the address area under MURAM
  1454. bus that can be allocated as data/parameter
  1455. Example:
  1456. muram@10000 {
  1457. device_type = "muram";
  1458. ranges = <0 00010000 0000c000>;
  1459. data-only@0{
  1460. reg = <0 c000>;
  1461. };
  1462. };
  1463. viii) Uploaded QE firmware
  1464. If a new firwmare has been uploaded to the QE (usually by the
  1465. boot loader), then a 'firmware' child node should be added to the QE
  1466. node. This node provides information on the uploaded firmware that
  1467. device drivers may need.
  1468. Required properties:
  1469. - id: The string name of the firmware. This is taken from the 'id'
  1470. member of the qe_firmware structure of the uploaded firmware.
  1471. Device drivers can search this string to determine if the
  1472. firmware they want is already present.
  1473. - extended-modes: The Extended Modes bitfield, taken from the
  1474. firmware binary. It is a 64-bit number represented
  1475. as an array of two 32-bit numbers.
  1476. - virtual-traps: The virtual traps, taken from the firmware binary.
  1477. It is an array of 8 32-bit numbers.
  1478. Example:
  1479. firmware {
  1480. id = "Soft-UART";
  1481. extended-modes = <0 0>;
  1482. virtual-traps = <0 0 0 0 0 0 0 0>;
  1483. }
  1484. j) CFI or JEDEC memory-mapped NOR flash
  1485. Flash chips (Memory Technology Devices) are often used for solid state
  1486. file systems on embedded devices.
  1487. - compatible : should contain the specific model of flash chip(s)
  1488. used, if known, followed by either "cfi-flash" or "jedec-flash"
  1489. - reg : Address range of the flash chip
  1490. - bank-width : Width (in bytes) of the flash bank. Equal to the
  1491. device width times the number of interleaved chips.
  1492. - device-width : (optional) Width of a single flash chip. If
  1493. omitted, assumed to be equal to 'bank-width'.
  1494. - #address-cells, #size-cells : Must be present if the flash has
  1495. sub-nodes representing partitions (see below). In this case
  1496. both #address-cells and #size-cells must be equal to 1.
  1497. For JEDEC compatible devices, the following additional properties
  1498. are defined:
  1499. - vendor-id : Contains the flash chip's vendor id (1 byte).
  1500. - device-id : Contains the flash chip's device id (1 byte).
  1501. In addition to the information on the flash bank itself, the
  1502. device tree may optionally contain additional information
  1503. describing partitions of the flash address space. This can be
  1504. used on platforms which have strong conventions about which
  1505. portions of the flash are used for what purposes, but which don't
  1506. use an on-flash partition table such as RedBoot.
  1507. Each partition is represented as a sub-node of the flash device.
  1508. Each node's name represents the name of the corresponding
  1509. partition of the flash device.
  1510. Flash partitions
  1511. - reg : The partition's offset and size within the flash bank.
  1512. - label : (optional) The label / name for this flash partition.
  1513. If omitted, the label is taken from the node name (excluding
  1514. the unit address).
  1515. - read-only : (optional) This parameter, if present, is a hint to
  1516. Linux that this flash partition should only be mounted
  1517. read-only. This is usually used for flash partitions
  1518. containing early-boot firmware images or data which should not
  1519. be clobbered.
  1520. Example:
  1521. flash@ff000000 {
  1522. compatible = "amd,am29lv128ml", "cfi-flash";
  1523. reg = <ff000000 01000000>;
  1524. bank-width = <4>;
  1525. device-width = <1>;
  1526. #address-cells = <1>;
  1527. #size-cells = <1>;
  1528. fs@0 {
  1529. label = "fs";
  1530. reg = <0 f80000>;
  1531. };
  1532. firmware@f80000 {
  1533. label ="firmware";
  1534. reg = <f80000 80000>;
  1535. read-only;
  1536. };
  1537. };
  1538. k) Global Utilities Block
  1539. The global utilities block controls power management, I/O device
  1540. enabling, power-on-reset configuration monitoring, general-purpose
  1541. I/O signal configuration, alternate function selection for multiplexed
  1542. signals, and clock control.
  1543. Required properties:
  1544. - compatible : Should define the compatible device type for
  1545. global-utilities.
  1546. - reg : Offset and length of the register set for the device.
  1547. Recommended properties:
  1548. - fsl,has-rstcr : Indicates that the global utilities register set
  1549. contains a functioning "reset control register" (i.e. the board
  1550. is wired to reset upon setting the HRESET_REQ bit in this register).
  1551. Example:
  1552. global-utilities@e0000 { /* global utilities block */
  1553. compatible = "fsl,mpc8548-guts";
  1554. reg = <e0000 1000>;
  1555. fsl,has-rstcr;
  1556. };
  1557. l) Freescale Communications Processor Module
  1558. NOTE: This is an interim binding, and will likely change slightly,
  1559. as more devices are supported. The QE bindings especially are
  1560. incomplete.
  1561. i) Root CPM node
  1562. Properties:
  1563. - compatible : "fsl,cpm1", "fsl,cpm2", or "fsl,qe".
  1564. - reg : A 48-byte region beginning with CPCR.
  1565. Example:
  1566. cpm@119c0 {
  1567. #address-cells = <1>;
  1568. #size-cells = <1>;
  1569. #interrupt-cells = <2>;
  1570. compatible = "fsl,mpc8272-cpm", "fsl,cpm2";
  1571. reg = <119c0 30>;
  1572. }
  1573. ii) Properties common to mulitple CPM/QE devices
  1574. - fsl,cpm-command : This value is ORed with the opcode and command flag
  1575. to specify the device on which a CPM command operates.
  1576. - fsl,cpm-brg : Indicates which baud rate generator the device
  1577. is associated with. If absent, an unused BRG
  1578. should be dynamically allocated. If zero, the
  1579. device uses an external clock rather than a BRG.
  1580. - reg : Unless otherwise specified, the first resource represents the
  1581. scc/fcc/ucc registers, and the second represents the device's
  1582. parameter RAM region (if it has one).
  1583. iii) Serial
  1584. Currently defined compatibles:
  1585. - fsl,cpm1-smc-uart
  1586. - fsl,cpm2-smc-uart
  1587. - fsl,cpm1-scc-uart
  1588. - fsl,cpm2-scc-uart
  1589. - fsl,qe-uart
  1590. Example:
  1591. serial@11a00 {
  1592. device_type = "serial";
  1593. compatible = "fsl,mpc8272-scc-uart",
  1594. "fsl,cpm2-scc-uart";
  1595. reg = <11a00 20 8000 100>;
  1596. interrupts = <28 8>;
  1597. interrupt-parent = <&PIC>;
  1598. fsl,cpm-brg = <1>;
  1599. fsl,cpm-command = <00800000>;
  1600. };
  1601. iii) Network
  1602. Currently defined compatibles:
  1603. - fsl,cpm1-scc-enet
  1604. - fsl,cpm2-scc-enet
  1605. - fsl,cpm1-fec-enet
  1606. - fsl,cpm2-fcc-enet (third resource is GFEMR)
  1607. - fsl,qe-enet
  1608. Example:
  1609. ethernet@11300 {
  1610. device_type = "network";
  1611. compatible = "fsl,mpc8272-fcc-enet",
  1612. "fsl,cpm2-fcc-enet";
  1613. reg = <11300 20 8400 100 11390 1>;
  1614. local-mac-address = [ 00 00 00 00 00 00 ];
  1615. interrupts = <20 8>;
  1616. interrupt-parent = <&PIC>;
  1617. phy-handle = <&PHY0>;
  1618. linux,network-index = <0>;
  1619. fsl,cpm-command = <12000300>;
  1620. };
  1621. iv) MDIO
  1622. Currently defined compatibles:
  1623. fsl,pq1-fec-mdio (reg is same as first resource of FEC device)
  1624. fsl,cpm2-mdio-bitbang (reg is port C registers)
  1625. Properties for fsl,cpm2-mdio-bitbang:
  1626. fsl,mdio-pin : pin of port C controlling mdio data
  1627. fsl,mdc-pin : pin of port C controlling mdio clock
  1628. Example:
  1629. mdio@10d40 {
  1630. device_type = "mdio";
  1631. compatible = "fsl,mpc8272ads-mdio-bitbang",
  1632. "fsl,mpc8272-mdio-bitbang",
  1633. "fsl,cpm2-mdio-bitbang";
  1634. reg = <10d40 14>;
  1635. #address-cells = <1>;
  1636. #size-cells = <0>;
  1637. fsl,mdio-pin = <12>;
  1638. fsl,mdc-pin = <13>;
  1639. };
  1640. v) Baud Rate Generators
  1641. Currently defined compatibles:
  1642. fsl,cpm-brg
  1643. fsl,cpm1-brg
  1644. fsl,cpm2-brg
  1645. Properties:
  1646. - reg : There may be an arbitrary number of reg resources; BRG
  1647. numbers are assigned to these in order.
  1648. - clock-frequency : Specifies the base frequency driving
  1649. the BRG.
  1650. Example:
  1651. brg@119f0 {
  1652. compatible = "fsl,mpc8272-brg",
  1653. "fsl,cpm2-brg",
  1654. "fsl,cpm-brg";
  1655. reg = <119f0 10 115f0 10>;
  1656. clock-frequency = <d#25000000>;
  1657. };
  1658. vi) Interrupt Controllers
  1659. Currently defined compatibles:
  1660. - fsl,cpm1-pic
  1661. - only one interrupt cell
  1662. - fsl,pq1-pic
  1663. - fsl,cpm2-pic
  1664. - second interrupt cell is level/sense:
  1665. - 2 is falling edge
  1666. - 8 is active low
  1667. Example:
  1668. interrupt-controller@10c00 {
  1669. #interrupt-cells = <2>;
  1670. interrupt-controller;
  1671. reg = <10c00 80>;
  1672. compatible = "mpc8272-pic", "fsl,cpm2-pic";
  1673. };
  1674. vii) USB (Universal Serial Bus Controller)
  1675. Properties:
  1676. - compatible : "fsl,cpm1-usb", "fsl,cpm2-usb", "fsl,qe-usb"
  1677. Example:
  1678. usb@11bc0 {
  1679. #address-cells = <1>;
  1680. #size-cells = <0>;
  1681. compatible = "fsl,cpm2-usb";
  1682. reg = <11b60 18 8b00 100>;
  1683. interrupts = <b 8>;
  1684. interrupt-parent = <&PIC>;
  1685. fsl,cpm-command = <2e600000>;
  1686. };
  1687. viii) Multi-User RAM (MURAM)
  1688. The multi-user/dual-ported RAM is expressed as a bus under the CPM node.
  1689. Ranges must be set up subject to the following restrictions:
  1690. - Children's reg nodes must be offsets from the start of all muram, even
  1691. if the user-data area does not begin at zero.
  1692. - If multiple range entries are used, the difference between the parent
  1693. address and the child address must be the same in all, so that a single
  1694. mapping can cover them all while maintaining the ability to determine
  1695. CPM-side offsets with pointer subtraction. It is recommended that
  1696. multiple range entries not be used.
  1697. - A child address of zero must be translatable, even if no reg resources
  1698. contain it.
  1699. A child "data" node must exist, compatible with "fsl,cpm-muram-data", to
  1700. indicate the portion of muram that is usable by the OS for arbitrary
  1701. purposes. The data node may have an arbitrary number of reg resources,
  1702. all of which contribute to the allocatable muram pool.
  1703. Example, based on mpc8272:
  1704. muram@0 {
  1705. #address-cells = <1>;
  1706. #size-cells = <1>;
  1707. ranges = <0 0 10000>;
  1708. data@0 {
  1709. compatible = "fsl,cpm-muram-data";
  1710. reg = <0 2000 9800 800>;
  1711. };
  1712. };
  1713. m) Chipselect/Local Bus
  1714. Properties:
  1715. - name : Should be localbus
  1716. - #address-cells : Should be either two or three. The first cell is the
  1717. chipselect number, and the remaining cells are the
  1718. offset into the chipselect.
  1719. - #size-cells : Either one or two, depending on how large each chipselect
  1720. can be.
  1721. - ranges : Each range corresponds to a single chipselect, and cover
  1722. the entire access window as configured.
  1723. Example:
  1724. localbus@f0010100 {
  1725. compatible = "fsl,mpc8272-localbus",
  1726. "fsl,pq2-localbus";
  1727. #address-cells = <2>;
  1728. #size-cells = <1>;
  1729. reg = <f0010100 40>;
  1730. ranges = <0 0 fe000000 02000000
  1731. 1 0 f4500000 00008000>;
  1732. flash@0,0 {
  1733. compatible = "jedec-flash";
  1734. reg = <0 0 2000000>;
  1735. bank-width = <4>;
  1736. device-width = <1>;
  1737. };
  1738. board-control@1,0 {
  1739. reg = <1 0 20>;
  1740. compatible = "fsl,mpc8272ads-bcsr";
  1741. };
  1742. };
  1743. n) 4xx/Axon EMAC ethernet nodes
  1744. The EMAC ethernet controller in IBM and AMCC 4xx chips, and also
  1745. the Axon bridge. To operate this needs to interact with a ths
  1746. special McMAL DMA controller, and sometimes an RGMII or ZMII
  1747. interface. In addition to the nodes and properties described
  1748. below, the node for the OPB bus on which the EMAC sits must have a
  1749. correct clock-frequency property.
  1750. i) The EMAC node itself
  1751. Required properties:
  1752. - device_type : "network"
  1753. - compatible : compatible list, contains 2 entries, first is
  1754. "ibm,emac-CHIP" where CHIP is the host ASIC (440gx,
  1755. 405gp, Axon) and second is either "ibm,emac" or
  1756. "ibm,emac4". For Axon, thus, we have: "ibm,emac-axon",
  1757. "ibm,emac4"
  1758. - interrupts : <interrupt mapping for EMAC IRQ and WOL IRQ>
  1759. - interrupt-parent : optional, if needed for interrupt mapping
  1760. - reg : <registers mapping>
  1761. - local-mac-address : 6 bytes, MAC address
  1762. - mal-device : phandle of the associated McMAL node
  1763. - mal-tx-channel : 1 cell, index of the tx channel on McMAL associated
  1764. with this EMAC
  1765. - mal-rx-channel : 1 cell, index of the rx channel on McMAL associated
  1766. with this EMAC
  1767. - cell-index : 1 cell, hardware index of the EMAC cell on a given
  1768. ASIC (typically 0x0 and 0x1 for EMAC0 and EMAC1 on
  1769. each Axon chip)
  1770. - max-frame-size : 1 cell, maximum frame size supported in bytes
  1771. - rx-fifo-size : 1 cell, Rx fifo size in bytes for 10 and 100 Mb/sec
  1772. operations.
  1773. For Axon, 2048
  1774. - tx-fifo-size : 1 cell, Tx fifo size in bytes for 10 and 100 Mb/sec
  1775. operations.
  1776. For Axon, 2048.
  1777. - fifo-entry-size : 1 cell, size of a fifo entry (used to calculate
  1778. thresholds).
  1779. For Axon, 0x00000010
  1780. - mal-burst-size : 1 cell, MAL burst size (used to calculate thresholds)
  1781. in bytes.
  1782. For Axon, 0x00000100 (I think ...)
  1783. - phy-mode : string, mode of operations of the PHY interface.
  1784. Supported values are: "mii", "rmii", "smii", "rgmii",
  1785. "tbi", "gmii", rtbi", "sgmii".
  1786. For Axon on CAB, it is "rgmii"
  1787. - mdio-device : 1 cell, required iff using shared MDIO registers
  1788. (440EP). phandle of the EMAC to use to drive the
  1789. MDIO lines for the PHY used by this EMAC.
  1790. - zmii-device : 1 cell, required iff connected to a ZMII. phandle of
  1791. the ZMII device node
  1792. - zmii-channel : 1 cell, required iff connected to a ZMII. Which ZMII
  1793. channel or 0xffffffff if ZMII is only used for MDIO.
  1794. - rgmii-device : 1 cell, required iff connected to an RGMII. phandle
  1795. of the RGMII device node.
  1796. For Axon: phandle of plb5/plb4/opb/rgmii
  1797. - rgmii-channel : 1 cell, required iff connected to an RGMII. Which
  1798. RGMII channel is used by this EMAC.
  1799. Fox Axon: present, whatever value is appropriate for each
  1800. EMAC, that is the content of the current (bogus) "phy-port"
  1801. property.
  1802. Recommended properties:
  1803. - linux,network-index : This is the intended "index" of this
  1804. network device. This is used by the bootwrapper to interpret
  1805. MAC addresses passed by the firmware when no information other
  1806. than indices is available to associate an address with a device.
  1807. Optional properties:
  1808. - phy-address : 1 cell, optional, MDIO address of the PHY. If absent,
  1809. a search is performed.
  1810. - phy-map : 1 cell, optional, bitmap of addresses to probe the PHY
  1811. for, used if phy-address is absent. bit 0x00000001 is
  1812. MDIO address 0.
  1813. For Axon it can be absent, thouugh my current driver
  1814. doesn't handle phy-address yet so for now, keep
  1815. 0x00ffffff in it.
  1816. - rx-fifo-size-gige : 1 cell, Rx fifo size in bytes for 1000 Mb/sec
  1817. operations (if absent the value is the same as
  1818. rx-fifo-size). For Axon, either absent or 2048.
  1819. - tx-fifo-size-gige : 1 cell, Tx fifo size in bytes for 1000 Mb/sec
  1820. operations (if absent the value is the same as
  1821. tx-fifo-size). For Axon, either absent or 2048.
  1822. - tah-device : 1 cell, optional. If connected to a TAH engine for
  1823. offload, phandle of the TAH device node.
  1824. - tah-channel : 1 cell, optional. If appropriate, channel used on the
  1825. TAH engine.
  1826. Example:
  1827. EMAC0: ethernet@40000800 {
  1828. linux,network-index = <0>;
  1829. device_type = "network";
  1830. compatible = "ibm,emac-440gp", "ibm,emac";
  1831. interrupt-parent = <&UIC1>;
  1832. interrupts = <1c 4 1d 4>;
  1833. reg = <40000800 70>;
  1834. local-mac-address = [00 04 AC E3 1B 1E];
  1835. mal-device = <&MAL0>;
  1836. mal-tx-channel = <0 1>;
  1837. mal-rx-channel = <0>;
  1838. cell-index = <0>;
  1839. max-frame-size = <5dc>;
  1840. rx-fifo-size = <1000>;
  1841. tx-fifo-size = <800>;
  1842. phy-mode = "rmii";
  1843. phy-map = <00000001>;
  1844. zmii-device = <&ZMII0>;
  1845. zmii-channel = <0>;
  1846. };
  1847. ii) McMAL node
  1848. Required properties:
  1849. - device_type : "dma-controller"
  1850. - compatible : compatible list, containing 2 entries, first is
  1851. "ibm,mcmal-CHIP" where CHIP is the host ASIC (like
  1852. emac) and the second is either "ibm,mcmal" or
  1853. "ibm,mcmal2".
  1854. For Axon, "ibm,mcmal-axon","ibm,mcmal2"
  1855. - interrupts : <interrupt mapping for the MAL interrupts sources:
  1856. 5 sources: tx_eob, rx_eob, serr, txde, rxde>.
  1857. For Axon: This is _different_ from the current
  1858. firmware. We use the "delayed" interrupts for txeob
  1859. and rxeob. Thus we end up with mapping those 5 MPIC
  1860. interrupts, all level positive sensitive: 10, 11, 32,
  1861. 33, 34 (in decimal)
  1862. - dcr-reg : < DCR registers range >
  1863. - dcr-parent : if needed for dcr-reg
  1864. - num-tx-chans : 1 cell, number of Tx channels
  1865. - num-rx-chans : 1 cell, number of Rx channels
  1866. iii) ZMII node
  1867. Required properties:
  1868. - compatible : compatible list, containing 2 entries, first is
  1869. "ibm,zmii-CHIP" where CHIP is the host ASIC (like
  1870. EMAC) and the second is "ibm,zmii".
  1871. For Axon, there is no ZMII node.
  1872. - reg : <registers mapping>
  1873. iv) RGMII node
  1874. Required properties:
  1875. - compatible : compatible list, containing 2 entries, first is
  1876. "ibm,rgmii-CHIP" where CHIP is the host ASIC (like
  1877. EMAC) and the second is "ibm,rgmii".
  1878. For Axon, "ibm,rgmii-axon","ibm,rgmii"
  1879. - reg : <registers mapping>
  1880. - revision : as provided by the RGMII new version register if
  1881. available.
  1882. For Axon: 0x0000012a
  1883. o) Xilinx IP cores
  1884. The Xilinx EDK toolchain ships with a set of IP cores (devices) for use
  1885. in Xilinx Spartan and Virtex FPGAs. The devices cover the whole range
  1886. of standard device types (network, serial, etc.) and miscellanious
  1887. devices (gpio, LCD, spi, etc). Also, since these devices are
  1888. implemented within the fpga fabric every instance of the device can be
  1889. synthesised with different options that change the behaviour.
  1890. Each IP-core has a set of parameters which the FPGA designer can use to
  1891. control how the core is synthesized. Historically, the EDK tool would
  1892. extract the device parameters relevant to device drivers and copy them
  1893. into an 'xparameters.h' in the form of #define symbols. This tells the
  1894. device drivers how the IP cores are configured, but it requres the kernel
  1895. to be recompiled every time the FPGA bitstream is resynthesized.
  1896. The new approach is to export the parameters into the device tree and
  1897. generate a new device tree each time the FPGA bitstream changes. The
  1898. parameters which used to be exported as #defines will now become
  1899. properties of the device node. In general, device nodes for IP-cores
  1900. will take the following form:
  1901. (name): (generic-name)@(base-address) {
  1902. compatible = "xlnx,(ip-core-name)-(HW_VER)"
  1903. [, (list of compatible devices), ...];
  1904. reg = <(baseaddr) (size)>;
  1905. interrupt-parent = <&interrupt-controller-phandle>;
  1906. interrupts = < ... >;
  1907. xlnx,(parameter1) = "(string-value)";
  1908. xlnx,(parameter2) = <(int-value)>;
  1909. };
  1910. (generic-name): an open firmware-style name that describes the
  1911. generic class of device. Preferably, this is one word, such
  1912. as 'serial' or 'ethernet'.
  1913. (ip-core-name): the name of the ip block (given after the BEGIN
  1914. directive in system.mhs). Should be in lowercase
  1915. and all underscores '_' converted to dashes '-'.
  1916. (name): is derived from the "PARAMETER INSTANCE" value.
  1917. (parameter#): C_* parameters from system.mhs. The C_ prefix is
  1918. dropped from the parameter name, the name is converted
  1919. to lowercase and all underscore '_' characters are
  1920. converted to dashes '-'.
  1921. (baseaddr): the baseaddr parameter value (often named C_BASEADDR).
  1922. (HW_VER): from the HW_VER parameter.
  1923. (size): the address range size (often C_HIGHADDR - C_BASEADDR + 1).
  1924. Typically, the compatible list will include the exact IP core version
  1925. followed by an older IP core version which implements the same
  1926. interface or any other device with the same interface.
  1927. 'reg', 'interrupt-parent' and 'interrupts' are all optional properties.
  1928. For example, the following block from system.mhs:
  1929. BEGIN opb_uartlite
  1930. PARAMETER INSTANCE = opb_uartlite_0
  1931. PARAMETER HW_VER = 1.00.b
  1932. PARAMETER C_BAUDRATE = 115200
  1933. PARAMETER C_DATA_BITS = 8
  1934. PARAMETER C_ODD_PARITY = 0
  1935. PARAMETER C_USE_PARITY = 0
  1936. PARAMETER C_CLK_FREQ = 50000000
  1937. PARAMETER C_BASEADDR = 0xEC100000
  1938. PARAMETER C_HIGHADDR = 0xEC10FFFF
  1939. BUS_INTERFACE SOPB = opb_7
  1940. PORT OPB_Clk = CLK_50MHz
  1941. PORT Interrupt = opb_uartlite_0_Interrupt
  1942. PORT RX = opb_uartlite_0_RX
  1943. PORT TX = opb_uartlite_0_TX
  1944. PORT OPB_Rst = sys_bus_reset_0
  1945. END
  1946. becomes the following device tree node:
  1947. opb_uartlite_0: serial@ec100000 {
  1948. device_type = "serial";
  1949. compatible = "xlnx,opb-uartlite-1.00.b";
  1950. reg = <ec100000 10000>;
  1951. interrupt-parent = <&opb_intc_0>;
  1952. interrupts = <1 0>; // got this from the opb_intc parameters
  1953. current-speed = <d#115200>; // standard serial device prop
  1954. clock-frequency = <d#50000000>; // standard serial device prop
  1955. xlnx,data-bits = <8>;
  1956. xlnx,odd-parity = <0>;
  1957. xlnx,use-parity = <0>;
  1958. };
  1959. Some IP cores actually implement 2 or more logical devices. In
  1960. this case, the device should still describe the whole IP core with
  1961. a single node and add a child node for each logical device. The
  1962. ranges property can be used to translate from parent IP-core to the
  1963. registers of each device. In addition, the parent node should be
  1964. compatible with the bus type 'xlnx,compound', and should contain
  1965. #address-cells and #size-cells, as with any other bus. (Note: this
  1966. makes the assumption that both logical devices have the same bus
  1967. binding. If this is not true, then separate nodes should be used
  1968. for each logical device). The 'cell-index' property can be used to
  1969. enumerate logical devices within an IP core. For example, the
  1970. following is the system.mhs entry for the dual ps2 controller found
  1971. on the ml403 reference design.
  1972. BEGIN opb_ps2_dual_ref
  1973. PARAMETER INSTANCE = opb_ps2_dual_ref_0
  1974. PARAMETER HW_VER = 1.00.a
  1975. PARAMETER C_BASEADDR = 0xA9000000
  1976. PARAMETER C_HIGHADDR = 0xA9001FFF
  1977. BUS_INTERFACE SOPB = opb_v20_0
  1978. PORT Sys_Intr1 = ps2_1_intr
  1979. PORT Sys_Intr2 = ps2_2_intr
  1980. PORT Clkin1 = ps2_clk_rx_1
  1981. PORT Clkin2 = ps2_clk_rx_2
  1982. PORT Clkpd1 = ps2_clk_tx_1
  1983. PORT Clkpd2 = ps2_clk_tx_2
  1984. PORT Rx1 = ps2_d_rx_1
  1985. PORT Rx2 = ps2_d_rx_2
  1986. PORT Txpd1 = ps2_d_tx_1
  1987. PORT Txpd2 = ps2_d_tx_2
  1988. END
  1989. It would result in the following device tree nodes:
  1990. opb_ps2_dual_ref_0: opb-ps2-dual-ref@a9000000 {
  1991. #address-cells = <1>;
  1992. #size-cells = <1>;
  1993. compatible = "xlnx,compound";
  1994. ranges = <0 a9000000 2000>;
  1995. // If this device had extra parameters, then they would
  1996. // go here.
  1997. ps2@0 {
  1998. compatible = "xlnx,opb-ps2-dual-ref-1.00.a";
  1999. reg = <0 40>;
  2000. interrupt-parent = <&opb_intc_0>;
  2001. interrupts = <3 0>;
  2002. cell-index = <0>;
  2003. };
  2004. ps2@1000 {
  2005. compatible = "xlnx,opb-ps2-dual-ref-1.00.a";
  2006. reg = <1000 40>;
  2007. interrupt-parent = <&opb_intc_0>;
  2008. interrupts = <3 0>;
  2009. cell-index = <0>;
  2010. };
  2011. };
  2012. Also, the system.mhs file defines bus attachments from the processor
  2013. to the devices. The device tree structure should reflect the bus
  2014. attachments. Again an example; this system.mhs fragment:
  2015. BEGIN ppc405_virtex4
  2016. PARAMETER INSTANCE = ppc405_0
  2017. PARAMETER HW_VER = 1.01.a
  2018. BUS_INTERFACE DPLB = plb_v34_0
  2019. BUS_INTERFACE IPLB = plb_v34_0
  2020. END
  2021. BEGIN opb_intc
  2022. PARAMETER INSTANCE = opb_intc_0
  2023. PARAMETER HW_VER = 1.00.c
  2024. PARAMETER C_BASEADDR = 0xD1000FC0
  2025. PARAMETER C_HIGHADDR = 0xD1000FDF
  2026. BUS_INTERFACE SOPB = opb_v20_0
  2027. END
  2028. BEGIN opb_uart16550
  2029. PARAMETER INSTANCE = opb_uart16550_0
  2030. PARAMETER HW_VER = 1.00.d
  2031. PARAMETER C_BASEADDR = 0xa0000000
  2032. PARAMETER C_HIGHADDR = 0xa0001FFF
  2033. BUS_INTERFACE SOPB = opb_v20_0
  2034. END
  2035. BEGIN plb_v34
  2036. PARAMETER INSTANCE = plb_v34_0
  2037. PARAMETER HW_VER = 1.02.a
  2038. END
  2039. BEGIN plb_bram_if_cntlr
  2040. PARAMETER INSTANCE = plb_bram_if_cntlr_0
  2041. PARAMETER HW_VER = 1.00.b
  2042. PARAMETER C_BASEADDR = 0xFFFF0000
  2043. PARAMETER C_HIGHADDR = 0xFFFFFFFF
  2044. BUS_INTERFACE SPLB = plb_v34_0
  2045. END
  2046. BEGIN plb2opb_bridge
  2047. PARAMETER INSTANCE = plb2opb_bridge_0
  2048. PARAMETER HW_VER = 1.01.a
  2049. PARAMETER C_RNG0_BASEADDR = 0x20000000
  2050. PARAMETER C_RNG0_HIGHADDR = 0x3FFFFFFF
  2051. PARAMETER C_RNG1_BASEADDR = 0x60000000
  2052. PARAMETER C_RNG1_HIGHADDR = 0x7FFFFFFF
  2053. PARAMETER C_RNG2_BASEADDR = 0x80000000
  2054. PARAMETER C_RNG2_HIGHADDR = 0xBFFFFFFF
  2055. PARAMETER C_RNG3_BASEADDR = 0xC0000000
  2056. PARAMETER C_RNG3_HIGHADDR = 0xDFFFFFFF
  2057. BUS_INTERFACE SPLB = plb_v34_0
  2058. BUS_INTERFACE MOPB = opb_v20_0
  2059. END
  2060. Gives this device tree (some properties removed for clarity):
  2061. plb@0 {
  2062. #address-cells = <1>;
  2063. #size-cells = <1>;
  2064. compatible = "xlnx,plb-v34-1.02.a";
  2065. device_type = "ibm,plb";
  2066. ranges; // 1:1 translation
  2067. plb_bram_if_cntrl_0: bram@ffff0000 {
  2068. reg = <ffff0000 10000>;
  2069. }
  2070. opb@20000000 {
  2071. #address-cells = <1>;
  2072. #size-cells = <1>;
  2073. ranges = <20000000 20000000 20000000
  2074. 60000000 60000000 20000000
  2075. 80000000 80000000 40000000
  2076. c0000000 c0000000 20000000>;
  2077. opb_uart16550_0: serial@a0000000 {
  2078. reg = <a00000000 2000>;
  2079. };
  2080. opb_intc_0: interrupt-controller@d1000fc0 {
  2081. reg = <d1000fc0 20>;
  2082. };
  2083. };
  2084. };
  2085. That covers the general approach to binding xilinx IP cores into the
  2086. device tree. The following are bindings for specific devices:
  2087. i) Xilinx ML300 Framebuffer
  2088. Simple framebuffer device from the ML300 reference design (also on the
  2089. ML403 reference design as well as others).
  2090. Optional properties:
  2091. - resolution = <xres yres> : pixel resolution of framebuffer. Some
  2092. implementations use a different resolution.
  2093. Default is <d#640 d#480>
  2094. - virt-resolution = <xvirt yvirt> : Size of framebuffer in memory.
  2095. Default is <d#1024 d#480>.
  2096. - rotate-display (empty) : rotate display 180 degrees.
  2097. ii) Xilinx SystemACE
  2098. The Xilinx SystemACE device is used to program FPGAs from an FPGA
  2099. bitstream stored on a CF card. It can also be used as a generic CF
  2100. interface device.
  2101. Optional properties:
  2102. - 8-bit (empty) : Set this property for SystemACE in 8 bit mode
  2103. iii) Xilinx EMAC and Xilinx TEMAC
  2104. Xilinx Ethernet devices. In addition to general xilinx properties
  2105. listed above, nodes for these devices should include a phy-handle
  2106. property, and may include other common network device properties
  2107. like local-mac-address.
  2108. iv) Xilinx Uartlite
  2109. Xilinx uartlite devices are simple fixed speed serial ports.
  2110. Requred properties:
  2111. - current-speed : Baud rate of uartlite
  2112. More devices will be defined as this spec matures.
  2113. VII - Specifying interrupt information for devices
  2114. ===================================================
  2115. The device tree represents the busses and devices of a hardware
  2116. system in a form similar to the physical bus topology of the
  2117. hardware.
  2118. In addition, a logical 'interrupt tree' exists which represents the
  2119. hierarchy and routing of interrupts in the hardware.
  2120. The interrupt tree model is fully described in the
  2121. document "Open Firmware Recommended Practice: Interrupt
  2122. Mapping Version 0.9". The document is available at:
  2123. <http://playground.sun.com/1275/practice>.
  2124. 1) interrupts property
  2125. ----------------------
  2126. Devices that generate interrupts to a single interrupt controller
  2127. should use the conventional OF representation described in the
  2128. OF interrupt mapping documentation.
  2129. Each device which generates interrupts must have an 'interrupt'
  2130. property. The interrupt property value is an arbitrary number of
  2131. of 'interrupt specifier' values which describe the interrupt or
  2132. interrupts for the device.
  2133. The encoding of an interrupt specifier is determined by the
  2134. interrupt domain in which the device is located in the
  2135. interrupt tree. The root of an interrupt domain specifies in
  2136. its #interrupt-cells property the number of 32-bit cells
  2137. required to encode an interrupt specifier. See the OF interrupt
  2138. mapping documentation for a detailed description of domains.
  2139. For example, the binding for the OpenPIC interrupt controller
  2140. specifies an #interrupt-cells value of 2 to encode the interrupt
  2141. number and level/sense information. All interrupt children in an
  2142. OpenPIC interrupt domain use 2 cells per interrupt in their interrupts
  2143. property.
  2144. The PCI bus binding specifies a #interrupt-cell value of 1 to encode
  2145. which interrupt pin (INTA,INTB,INTC,INTD) is used.
  2146. 2) interrupt-parent property
  2147. ----------------------------
  2148. The interrupt-parent property is specified to define an explicit
  2149. link between a device node and its interrupt parent in
  2150. the interrupt tree. The value of interrupt-parent is the
  2151. phandle of the parent node.
  2152. If the interrupt-parent property is not defined for a node, it's
  2153. interrupt parent is assumed to be an ancestor in the node's
  2154. _device tree_ hierarchy.
  2155. 3) OpenPIC Interrupt Controllers
  2156. --------------------------------
  2157. OpenPIC interrupt controllers require 2 cells to encode
  2158. interrupt information. The first cell defines the interrupt
  2159. number. The second cell defines the sense and level
  2160. information.
  2161. Sense and level information should be encoded as follows:
  2162. 0 = low to high edge sensitive type enabled
  2163. 1 = active low level sensitive type enabled
  2164. 2 = active high level sensitive type enabled
  2165. 3 = high to low edge sensitive type enabled
  2166. 4) ISA Interrupt Controllers
  2167. ----------------------------
  2168. ISA PIC interrupt controllers require 2 cells to encode
  2169. interrupt information. The first cell defines the interrupt
  2170. number. The second cell defines the sense and level
  2171. information.
  2172. ISA PIC interrupt controllers should adhere to the ISA PIC
  2173. encodings listed below:
  2174. 0 = active low level sensitive type enabled
  2175. 1 = active high level sensitive type enabled
  2176. 2 = high to low edge sensitive type enabled
  2177. 3 = low to high edge sensitive type enabled
  2178. Appendix A - Sample SOC node for MPC8540
  2179. ========================================
  2180. Note that the #address-cells and #size-cells for the SoC node
  2181. in this example have been explicitly listed; these are likely
  2182. not necessary as they are usually the same as the root node.
  2183. soc8540@e0000000 {
  2184. #address-cells = <1>;
  2185. #size-cells = <1>;
  2186. #interrupt-cells = <2>;
  2187. device_type = "soc";
  2188. ranges = <00000000 e0000000 00100000>
  2189. reg = <e0000000 00003000>;
  2190. bus-frequency = <0>;
  2191. mdio@24520 {
  2192. reg = <24520 20>;
  2193. device_type = "mdio";
  2194. compatible = "gianfar";
  2195. ethernet-phy@0 {
  2196. linux,phandle = <2452000>
  2197. interrupt-parent = <40000>;
  2198. interrupts = <35 1>;
  2199. reg = <0>;
  2200. device_type = "ethernet-phy";
  2201. };
  2202. ethernet-phy@1 {
  2203. linux,phandle = <2452001>
  2204. interrupt-parent = <40000>;
  2205. interrupts = <35 1>;
  2206. reg = <1>;
  2207. device_type = "ethernet-phy";
  2208. };
  2209. ethernet-phy@3 {
  2210. linux,phandle = <2452002>
  2211. interrupt-parent = <40000>;
  2212. interrupts = <35 1>;
  2213. reg = <3>;
  2214. device_type = "ethernet-phy";
  2215. };
  2216. };
  2217. ethernet@24000 {
  2218. #size-cells = <0>;
  2219. device_type = "network";
  2220. model = "TSEC";
  2221. compatible = "gianfar";
  2222. reg = <24000 1000>;
  2223. mac-address = [ 00 E0 0C 00 73 00 ];
  2224. interrupts = <d 3 e 3 12 3>;
  2225. interrupt-parent = <40000>;
  2226. phy-handle = <2452000>;
  2227. };
  2228. ethernet@25000 {
  2229. #address-cells = <1>;
  2230. #size-cells = <0>;
  2231. device_type = "network";
  2232. model = "TSEC";
  2233. compatible = "gianfar";
  2234. reg = <25000 1000>;
  2235. mac-address = [ 00 E0 0C 00 73 01 ];
  2236. interrupts = <13 3 14 3 18 3>;
  2237. interrupt-parent = <40000>;
  2238. phy-handle = <2452001>;
  2239. };
  2240. ethernet@26000 {
  2241. #address-cells = <1>;
  2242. #size-cells = <0>;
  2243. device_type = "network";
  2244. model = "FEC";
  2245. compatible = "gianfar";
  2246. reg = <26000 1000>;
  2247. mac-address = [ 00 E0 0C 00 73 02 ];
  2248. interrupts = <19 3>;
  2249. interrupt-parent = <40000>;
  2250. phy-handle = <2452002>;
  2251. };
  2252. serial@4500 {
  2253. device_type = "serial";
  2254. compatible = "ns16550";
  2255. reg = <4500 100>;
  2256. clock-frequency = <0>;
  2257. interrupts = <1a 3>;
  2258. interrupt-parent = <40000>;
  2259. };
  2260. pic@40000 {
  2261. linux,phandle = <40000>;
  2262. clock-frequency = <0>;
  2263. interrupt-controller;
  2264. #address-cells = <0>;
  2265. reg = <40000 40000>;
  2266. built-in;
  2267. compatible = "chrp,open-pic";
  2268. device_type = "open-pic";
  2269. big-endian;
  2270. };
  2271. i2c@3000 {
  2272. interrupt-parent = <40000>;
  2273. interrupts = <1b 3>;
  2274. reg = <3000 18>;
  2275. device_type = "i2c";
  2276. compatible = "fsl-i2c";
  2277. dfsrr;
  2278. };
  2279. };