booting-without-of.txt 100 KB

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