booting-without-of.txt 97 KB

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