booting-without-of.txt 98 KB

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