booting-without-of.txt 102 KB

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