booting-without-of.txt 101 KB

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