Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

docs: dt: convert booting-without-of.txt to ReST format

- Add a SPDX header;
- Adjust document title;
- Adjust document and section titles;
- Some whitespace fixes and new line breaks;
- Mark literal blocks as such;
- Add table markups;
- Add it to devicetree/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/8dce14af13f66cb8393c21b58f0693e667a7045f.1592918949.git.mchehab+huawei@kernel.org
Signed-off-by: Jonathan Corbet <corbet@lwn.net>

authored by

Mauro Carvalho Chehab and committed by
Jonathan Corbet
691462f2 565dbe72

+166 -133
+1 -1
Documentation/arm/booting.rst
··· 128 128 129 129 The boot loader must load a device tree image (dtb) into system ram 130 130 at a 64bit aligned address and initialize it with the boot data. The 131 - dtb format is documented in Documentation/devicetree/booting-without-of.txt. 131 + dtb format is documented in Documentation/devicetree/booting-without-of.rst. 132 132 The kernel will look for the dtb magic value of 0xd00dfeed at the dtb 133 133 physical address to determine if a dtb has been passed instead of a 134 134 tagged list.
+163 -131
Documentation/devicetree/booting-without-of.txt Documentation/devicetree/booting-without-of.rst
··· 1 - Booting the Linux/ppc kernel without Open Firmware 2 - -------------------------------------------------- 1 + .. SPDX-License-Identifier: GPL-2.0 3 2 4 - (c) 2005 Benjamin Herrenschmidt <benh at kernel.crashing.org>, 5 - IBM Corp. 6 - (c) 2005 Becky Bruce <becky.bruce at freescale.com>, 7 - Freescale Semiconductor, FSL SOC and 32-bit additions 8 - (c) 2006 MontaVista Software, Inc. 9 - Flash chip node definition 3 + ================================================== 4 + Booting the Linux/ppc kernel without Open Firmware 5 + ================================================== 10 6 11 - Table of Contents 12 - ================= 7 + Copyright (c) 2005 Benjamin Herrenschmidt <benh at kernel.crashing.org>, 8 + IBM Corp. 9 + 10 + Copyright (c) 2005 Becky Bruce <becky.bruce at freescale.com>, 11 + Freescale Semiconductor, FSL SOC and 32-bit additions 12 + 13 + Copyright (c) 2006 MontaVista Software, Inc. 14 + Flash chip node definition 15 + 16 + .. Table of Contents 13 17 14 18 I - Introduction 15 19 1) Entry point for arch/arm ··· 65 61 Revision Information 66 62 ==================== 67 63 68 - May 18, 2005: Rev 0.1 - Initial draft, no chapter III yet. 64 + May 18, 2005: Rev 0.1 65 + - Initial draft, no chapter III yet. 69 66 70 - May 19, 2005: Rev 0.2 - Add chapter III and bits & pieces here or 67 + May 19, 2005: Rev 0.2 68 + - Add chapter III and bits & pieces here or 71 69 clarifies the fact that a lot of things are 72 70 optional, the kernel only requires a very 73 71 small device tree, though it is encouraged 74 72 to provide an as complete one as possible. 75 73 76 - May 24, 2005: Rev 0.3 - Precise that DT block has to be in RAM 74 + May 24, 2005: Rev 0.3 75 + - Precise that DT block has to be in RAM 77 76 - Misc fixes 78 77 - Define version 3 and new format version 16 79 78 for the DT block (version 16 needs kernel ··· 89 82 "name" property is now automatically 90 83 deduced from the unit name 91 84 92 - June 1, 2005: Rev 0.4 - Correct confusion between OF_DT_END and 85 + June 1, 2005: Rev 0.4 86 + - Correct confusion between OF_DT_END and 93 87 OF_DT_END_NODE in structure definition. 94 88 - Change version 16 format to always align 95 89 property data to 4 bytes. Since tokens are ··· 123 115 - Compare FSL SOC use of PCI to standard and make sure no new 124 116 node definition required. 125 117 - Add more information about node definitions for SOC devices 126 - that currently have no standard, like the FSL CPM. 118 + that currently have no standard, like the FSL CPM. 127 119 128 120 129 121 I - Introduction ··· 268 260 269 261 b) create your main platform file as 270 262 "arch/powerpc/platforms/myplatform/myboard_setup.c" and add it 271 - to the Makefile under the condition of your CONFIG_ 263 + to the Makefile under the condition of your ``CONFIG_`` 272 264 option. This file will define a structure of type "ppc_md" 273 265 containing the various callbacks that the generic code will 274 266 use to get to your platform specific code ··· 279 271 with classic Powerpc architectures. 280 272 281 273 3) Entry point for arch/x86 282 - ------------------------------- 274 + --------------------------- 283 275 284 276 There is one single 32bit entry point to the kernel at code32_start, 285 277 the decompressor (the real mode entry point goes to the same 32bit ··· 288 280 Documentation/x86/boot.rst 289 281 The physical pointer to the device-tree block (defined in chapter II) 290 282 is passed via setup_data which requires at least boot protocol 2.09. 291 - The type filed is defined as 283 + The type filed is defined as:: 292 284 293 - #define SETUP_DTB 2 285 + #define SETUP_DTB 2 294 286 295 287 This device-tree is used as an extension to the "boot page". As such it 296 288 does not parse / consider data which is already covered by the boot ··· 362 354 363 355 The kernel is passed the physical address pointing to an area of memory 364 356 that is roughly described in include/linux/of_fdt.h by the structure 365 - boot_param_header: 357 + boot_param_header::: 366 358 367 - struct boot_param_header { 359 + struct boot_param_header { 368 360 u32 magic; /* magic word OF_DT_HEADER */ 369 361 u32 totalsize; /* total size of DT block */ 370 362 u32 off_dt_struct; /* offset to structure */ ··· 382 374 383 375 /* version 17 fields below */ 384 376 u32 size_dt_struct; /* size of the DT structure block */ 385 - }; 377 + }; 386 378 387 - Along with the constants: 379 + Along with the constants:: 388 380 389 - /* Definitions used by the flattened device tree */ 390 - #define OF_DT_HEADER 0xd00dfeed /* 4: version, 391 - 4: total size */ 392 - #define OF_DT_BEGIN_NODE 0x1 /* Start node: full name 393 - */ 394 - #define OF_DT_END_NODE 0x2 /* End node */ 395 - #define OF_DT_PROP 0x3 /* Property: name off, 396 - size, content */ 397 - #define OF_DT_END 0x9 381 + /* Definitions used by the flattened device tree */ 382 + #define OF_DT_HEADER 0xd00dfeed /* 4: version, 383 + 4: total size */ 384 + #define OF_DT_BEGIN_NODE 0x1 /* Start node: full name 385 + */ 386 + #define OF_DT_END_NODE 0x2 /* End node */ 387 + #define OF_DT_PROP 0x3 /* Property: name off, 388 + size, content */ 389 + #define OF_DT_END 0x9 398 390 399 391 All values in this header are in big endian format, the various 400 392 fields in this header are defined more precisely below. All ··· 438 430 way to avoid overriding critical things like, on Open Firmware 439 431 capable machines, the RTAS instance, or on some pSeries, the TCE 440 432 tables used for the iommu. Typically, the reserve map should 441 - contain _at least_ this DT block itself (header,total_size). If 433 + contain **at least** this DT block itself (header,total_size). If 442 434 you are passing an initrd to the kernel, you should reserve it as 443 435 well. You do not need to reserve the kernel image itself. The map 444 436 should be 64-bit aligned. ··· 493 485 494 486 So the typical layout of a DT block (though the various parts don't 495 487 need to be in that order) looks like this (addresses go from top to 496 - bottom): 488 + bottom):: 497 489 498 490 499 491 ------------------------------ ··· 519 511 | 520 512 --- (base + totalsize) 521 513 522 - (*) The alignment gaps are not necessarily present; their presence 523 - and size are dependent on the various alignment requirements of 524 - the individual data blocks. 514 + (*) The alignment gaps are not necessarily present; their presence 515 + and size are dependent on the various alignment requirements of 516 + the individual data blocks. 525 517 526 518 527 519 2) Device tree generalities ··· 608 600 you a idea of what a device-tree looks like. I have purposefully kept 609 601 the "name" and "linux,phandle" properties which aren't necessary in 610 602 order to give you a better idea of what the tree looks like in 611 - practice. 603 + practice:: 612 604 613 605 / o device-tree 614 606 |- name = "device-tree" ··· 658 650 659 651 660 652 3) Device tree "structure" block 653 + -------------------------------- 661 654 662 655 The structure of the device tree is a linearized tree structure. The 663 656 "OF_DT_BEGIN_NODE" token starts a new node, and the "OF_DT_END_NODE" ··· 675 666 root node) 676 667 * [align gap to next 4 bytes boundary] 677 668 * for each property: 669 + 678 670 * token OF_DT_PROP (that is 0x00000003) 679 671 * 32-bit value of property value size in bytes (or 0 if no 680 672 value) 681 673 * 32-bit value of offset in string block of property name 682 674 * property value data if any 683 675 * [align gap to next 4 bytes boundary] 676 + 684 677 * [child nodes if any] 685 678 * token OF_DT_END_NODE (that is 0x00000002) 686 679 ··· 699 688 constraint. 700 689 701 690 4) Device tree "strings" block 691 + ------------------------------ 702 692 703 693 In order to save space, property names, which are generally redundant, 704 694 are stored separately in the "strings" block. This block is simply the ··· 712 700 III - Required content of the device tree 713 701 ========================================= 714 702 715 - WARNING: All "linux,*" properties defined in this document apply only 716 - to a flattened device-tree. If your platform uses a real 717 - implementation of Open Firmware or an implementation compatible with 718 - the Open Firmware client interface, those properties will be created 719 - by the trampoline code in the kernel's prom_init() file. For example, 720 - that's where you'll have to add code to detect your board model and 721 - set the platform number. However, when using the flattened device-tree 722 - entry point, there is no prom_init() pass, and thus you have to 723 - provide those properties yourself. 703 + .. Warning:: 704 + 705 + All ``linux,*`` properties defined in this document apply only 706 + to a flattened device-tree. If your platform uses a real 707 + implementation of Open Firmware or an implementation compatible with 708 + the Open Firmware client interface, those properties will be created 709 + by the trampoline code in the kernel's prom_init() file. For example, 710 + that's where you'll have to add code to detect your board model and 711 + set the platform number. However, when using the flattened device-tree 712 + entry point, there is no prom_init() pass, and thus you have to 713 + provide those properties yourself. 724 714 725 715 726 716 1) Note about cells and address representation ··· 783 769 "ranges" property is missing at a given level, it's assumed that 784 770 translation isn't possible, i.e., the registers are not visible on the 785 771 parent bus. The format of the "ranges" property for a bus is a list 786 - of: 772 + of:: 787 773 788 774 bus address, parent bus address, size 789 775 ··· 891 877 892 878 This node is the parent of all individual CPU nodes. It doesn't 893 879 have any specific requirements, though it's generally good practice 894 - to have at least: 880 + to have at least:: 895 881 896 882 #address-cells = <00000001> 897 883 #size-cells = <00000000> ··· 901 887 that format when reading the "reg" properties of a CPU node, see 902 888 below 903 889 904 - c) The /cpus/* nodes 890 + c) The ``/cpus/*`` nodes 905 891 906 892 So under /cpus, you are supposed to create a node for every CPU on 907 893 the machine. There is no specific restriction on the name of the ··· 917 903 - reg : This is the physical CPU number, it's a single 32-bit cell 918 904 and is also used as-is as the unit number for constructing the 919 905 unit name in the full path. For example, with 2 CPUs, you would 920 - have the full path: 906 + have the full path:: 907 + 921 908 /cpus/PowerPC,970FX@0 922 909 /cpus/PowerPC,970FX@1 910 + 923 911 (unit addresses do not require leading zeroes) 924 - - d-cache-block-size : one cell, L1 data cache block size in bytes (*) 912 + - d-cache-block-size : one cell, L1 data cache block size in bytes [#]_ 925 913 - i-cache-block-size : one cell, L1 instruction cache block size in 926 914 bytes 927 915 - d-cache-size : one cell, size of L1 data cache in bytes 928 916 - i-cache-size : one cell, size of L1 instruction cache in bytes 929 917 930 - (*) The cache "block" size is the size on which the cache management 931 - instructions operate. Historically, this document used the cache 932 - "line" size here which is incorrect. The kernel will prefer the cache 933 - block size and will fallback to cache line size for backward 934 - compatibility. 918 + .. [#] The cache "block" size is the size on which the cache management 919 + instructions operate. Historically, this document used the cache 920 + "line" size here which is incorrect. The kernel will prefer the cache 921 + block size and will fallback to cache line size for backward 922 + compatibility. 935 923 936 924 Recommended properties: 937 925 ··· 979 963 #address-cells and #size-cells of the root node. For example, 980 964 with both of these properties being 2 like in the example given 981 965 earlier, a 970 based machine with 6Gb of RAM could typically 982 - have a "reg" property here that looks like: 966 + have a "reg" property here that looks like:: 983 967 984 - 00000000 00000000 00000000 80000000 985 - 00000001 00000000 00000001 00000000 968 + 00000000 00000000 00000000 80000000 969 + 00000001 00000000 00000001 00000000 986 970 987 971 That is a range starting at 0 of 0x80000000 bytes and a range 988 972 starting at 0x100000000 and of 0x100000000 bytes. You can see ··· 1063 1047 See 1) above for more details on defining #address-cells. 1064 1048 - #size-cells : Size representation for "soc" devices 1065 1049 - #interrupt-cells : Defines the width of cells used to represent 1066 - interrupts. Typically this value is <2>, which includes a 1067 - 32-bit number that represents the interrupt number, and a 1068 - 32-bit number that represents the interrupt sense and level. 1069 - This field is only needed if the SOC contains an interrupt 1070 - controller. 1050 + interrupts. Typically this value is <2>, which includes a 1051 + 32-bit number that represents the interrupt number, and a 1052 + 32-bit number that represents the interrupt sense and level. 1053 + This field is only needed if the SOC contains an interrupt 1054 + controller. 1071 1055 1072 1056 The SOC node may contain child nodes for each SOC device that the 1073 1057 platform uses. Nodes should not be created for devices which exist 1074 1058 on the SOC but are not used by a particular platform. See chapter VI 1075 1059 for more information on how to specify devices that are part of a SOC. 1076 1060 1077 - Example SOC node for the MPC8540: 1061 + Example SOC node for the MPC8540:: 1078 1062 1079 1063 soc8540@e0000000 { 1080 1064 #address-cells = <1>; ··· 1095 1079 dtc source code can be found at 1096 1080 <http://git.jdl.com/gitweb/?p=dtc.git> 1097 1081 1098 - WARNING: This version is still in early development stage; the 1099 - resulting device-tree "blobs" have not yet been validated with the 1100 - kernel. The current generated block lacks a useful reserve map (it will 1101 - be fixed to generate an empty one, it's up to the bootloader to fill 1102 - it up) among others. The error handling needs work, bugs are lurking, 1103 - etc... 1082 + .. Warning:: 1083 + 1084 + This version is still in early development stage; the 1085 + resulting device-tree "blobs" have not yet been validated with the 1086 + kernel. The current generated block lacks a useful reserve map (it will 1087 + be fixed to generate an empty one, it's up to the bootloader to fill 1088 + it up) among others. The error handling needs work, bugs are lurking, 1089 + etc... 1104 1090 1105 1091 dtc basically takes a device-tree in a given format and outputs a 1106 1092 device-tree in another format. The currently supported formats are: 1107 1093 1108 - Input formats: 1109 - ------------- 1094 + Input formats 1095 + ------------- 1110 1096 1111 1097 - "dtb": "blob" format, that is a flattened device-tree block 1112 1098 with 1113 - header all in a binary blob. 1099 + header all in a binary blob. 1114 1100 - "dts": "source" format. This is a text file containing a 1115 1101 "source" for a device-tree. The format is defined later in this 1116 - chapter. 1102 + chapter. 1117 1103 - "fs" format. This is a representation equivalent to the 1118 - output of /proc/device-tree, that is nodes are directories and 1119 - properties are files 1104 + output of /proc/device-tree, that is nodes are directories and 1105 + properties are files 1120 1106 1121 - Output formats: 1122 - --------------- 1107 + Output formats 1108 + -------------- 1123 1109 1124 1110 - "dtb": "blob" format 1125 1111 - "dts": "source" format ··· 1131 1113 assembly file exports some symbols that can be used. 1132 1114 1133 1115 1134 - The syntax of the dtc tool is 1116 + The syntax of the dtc tool is:: 1135 1117 1136 1118 dtc [-I <input-format>] [-O <output-format>] 1137 1119 [-o output-filename] [-V output_version] input_filename ··· 1145 1127 uniqueness of linux, phandle properties, validity of strings, etc... 1146 1128 1147 1129 The format of the .dts "source" file is "C" like, supports C and C++ 1148 - style comments. 1130 + style comments:: 1149 1131 1150 - / { 1151 - } 1132 + / { 1133 + } 1152 1134 1153 1135 The above is the "device-tree" definition. It's the only statement 1154 1136 supported currently at the toplevel. 1155 1137 1156 - / { 1157 - property1 = "string_value"; /* define a property containing a 0 1158 - * terminated string 1159 - */ 1138 + :: 1160 1139 1161 - property2 = <0x1234abcd>; /* define a property containing a 1162 - * numerical 32-bit value (hexadecimal) 1163 - */ 1140 + / { 1141 + property1 = "string_value"; /* define a property containing a 0 1142 + * terminated string 1143 + */ 1164 1144 1165 - property3 = <0x12345678 0x12345678 0xdeadbeef>; 1166 - /* define a property containing 3 1167 - * numerical 32-bit values (cells) in 1168 - * hexadecimal 1169 - */ 1170 - property4 = [0x0a 0x0b 0x0c 0x0d 0xde 0xea 0xad 0xbe 0xef]; 1171 - /* define a property whose content is 1172 - * an arbitrary array of bytes 1173 - */ 1145 + property2 = <0x1234abcd>; /* define a property containing a 1146 + * numerical 32-bit value (hexadecimal) 1147 + */ 1174 1148 1175 - childnode@address { /* define a child node named "childnode" 1176 - * whose unit name is "childnode at 1177 - * address" 1178 - */ 1149 + property3 = <0x12345678 0x12345678 0xdeadbeef>; 1150 + /* define a property containing 3 1151 + * numerical 32-bit values (cells) in 1152 + * hexadecimal 1153 + */ 1154 + property4 = [0x0a 0x0b 0x0c 0x0d 0xde 0xea 0xad 0xbe 0xef]; 1155 + /* define a property whose content is 1156 + * an arbitrary array of bytes 1157 + */ 1179 1158 1180 - childprop = "hello\n"; /* define a property "childprop" of 1181 - * childnode (in this case, a string) 1182 - */ 1183 - }; 1184 - }; 1159 + childnode@address { /* define a child node named "childnode" 1160 + * whose unit name is "childnode at 1161 + * address" 1162 + */ 1163 + 1164 + childprop = "hello\n"; /* define a property "childprop" of 1165 + * childnode (in this case, a string) 1166 + */ 1167 + }; 1168 + }; 1185 1169 1186 1170 Nodes can contain other nodes etc... thus defining the hierarchical 1187 1171 structure of the tree. ··· 1342 1322 1343 1323 If the interrupt-parent property is not defined for a node, its 1344 1324 interrupt parent is assumed to be an ancestor in the node's 1345 - _device tree_ hierarchy. 1325 + *device tree* hierarchy. 1346 1326 1347 1327 3) OpenPIC Interrupt Controllers 1348 1328 -------------------------------- ··· 1354 1334 1355 1335 Sense and level information should be encoded as follows: 1356 1336 1357 - 0 = low to high edge sensitive type enabled 1358 - 1 = active low level sensitive type enabled 1359 - 2 = active high level sensitive type enabled 1360 - 3 = high to low edge sensitive type enabled 1337 + == ======================================== 1338 + 0 low to high edge sensitive type enabled 1339 + 1 active low level sensitive type enabled 1340 + 2 active high level sensitive type enabled 1341 + 3 high to low edge sensitive type enabled 1342 + == ======================================== 1361 1343 1362 1344 4) ISA Interrupt Controllers 1363 1345 ---------------------------- ··· 1372 1350 ISA PIC interrupt controllers should adhere to the ISA PIC 1373 1351 encodings listed below: 1374 1352 1375 - 0 = active low level sensitive type enabled 1376 - 1 = active high level sensitive type enabled 1377 - 2 = high to low edge sensitive type enabled 1378 - 3 = low to high edge sensitive type enabled 1353 + == ======================================== 1354 + 0 active low level sensitive type enabled 1355 + 1 active high level sensitive type enabled 1356 + 2 high to low edge sensitive type enabled 1357 + 3 low to high edge sensitive type enabled 1358 + == ======================================== 1379 1359 1380 1360 VIII - Specifying Device Power Management Information (sleep property) 1381 - =================================================================== 1361 + ====================================================================== 1382 1362 1383 1363 Devices on SOCs often have mechanisms for placing devices into low-power 1384 1364 states that are decoupled from the devices' own register blocks. Sometimes, ··· 1411 1387 sleep-map should wait until its necessity is demonstrated). 1412 1388 1413 1389 IX - Specifying dma bus information 1390 + =================================== 1414 1391 1415 1392 Some devices may have DMA memory range shifted relatively to the beginning of 1416 1393 RAM, or even placed outside of kernel RAM. For example, the Keystone 2 SoC ··· 1429 1404 for identifying devices supported coherent DMA operations in DT. 1430 1405 1431 1406 * DMA Bus master 1407 + 1432 1408 Optional property: 1409 + 1433 1410 - dma-ranges: <prop-encoded-array> encoded as arbitrary number of triplets of 1434 - (child-bus-address, parent-bus-address, length). Each triplet specified 1435 - describes a contiguous DMA address range. 1436 - The dma-ranges property is used to describe the direct memory access (DMA) 1437 - structure of a memory-mapped bus whose device tree parent can be accessed 1438 - from DMA operations originating from the bus. It provides a means of 1439 - defining a mapping or translation between the physical address space of 1440 - the bus and the physical address space of the parent of the bus. 1441 - (for more information see the Devicetree Specification) 1411 + (child-bus-address, parent-bus-address, length). Each triplet specified 1412 + describes a contiguous DMA address range. 1413 + The dma-ranges property is used to describe the direct memory access (DMA) 1414 + structure of a memory-mapped bus whose device tree parent can be accessed 1415 + from DMA operations originating from the bus. It provides a means of 1416 + defining a mapping or translation between the physical address space of 1417 + the bus and the physical address space of the parent of the bus. 1418 + (for more information see the Devicetree Specification) 1442 1419 1443 1420 * DMA Bus child 1421 + 1444 1422 Optional property: 1423 + 1445 1424 - dma-ranges: <empty> value. if present - It means that DMA addresses 1446 - translation has to be enabled for this device. 1425 + translation has to be enabled for this device. 1447 1426 - dma-coherent: Present if dma operations are coherent 1448 1427 1449 - Example: 1450 - soc { 1428 + Example:: 1429 + 1430 + soc { 1451 1431 compatible = "ti,keystone","simple-bus"; 1452 1432 ranges = <0x0 0x0 0x0 0xc0000000>; 1453 1433 dma-ranges = <0x80000000 0x8 0x00000000 0x80000000>; ··· 1465 1435 [...] 1466 1436 dma-coherent; 1467 1437 }; 1468 - }; 1438 + }; 1469 1439 1470 1440 Appendix A - Sample SOC node for MPC8540 1471 1441 ======================================== 1442 + 1443 + :: 1472 1444 1473 1445 soc@e0000000 { 1474 1446 #address-cells = <1>;
+1
Documentation/devicetree/index.rst
··· 15 15 overlay-notes 16 16 17 17 bindings/index 18 + booting-without-of
+1 -1
Documentation/translations/zh_CN/arm/Booting
··· 124 124 125 125 bootloader 必须以 64bit 地址对齐的形式加载一个设备树映像(dtb)到系统 126 126 RAM 中,并用启动数据初始化它。dtb 格式在文档 127 - Documentation/devicetree/booting-without-of.txt 中。内核将会在 127 + Documentation/devicetree/booting-without-of.rst 中。内核将会在 128 128 dtb 物理地址处查找 dtb 魔数值(0xd00dfeed),以确定 dtb 是否已经代替 129 129 标签列表被传递进来。 130 130