Marek Szyprowski | 4b861c6 | 2013-02-14 13:45:28 +0100 | [diff] [blame] | 1 | * Memory binding |
| 2 | |
| 3 | The /memory node provides basic information about the address and size |
| 4 | of the physical memory. This node is usually filled or updated by the |
| 5 | bootloader, depending on the actual memory configuration of the given |
| 6 | hardware. |
| 7 | |
| 8 | The memory layout is described by the folllowing node: |
| 9 | |
| 10 | memory { |
| 11 | reg = <(baseaddr1) (size1) |
| 12 | (baseaddr2) (size2) |
| 13 | ... |
| 14 | (baseaddrN) (sizeN)>; |
| 15 | }; |
| 16 | |
| 17 | baseaddrX: the base address of the defined memory bank |
| 18 | sizeX: the size of the defined memory bank |
| 19 | |
| 20 | More than one memory bank can be defined. |
| 21 | |
| 22 | |
| 23 | * Memory regions |
| 24 | |
| 25 | In /memory node one can create additional nodes describing particular |
| 26 | memory regions, usually for the special usage by various device drivers. |
| 27 | A good example are contiguous memory allocations or memory sharing with |
| 28 | other operating system on the same hardware board. Those special memory |
| 29 | regions might depend on the board configuration and devices used on the |
| 30 | target system. |
| 31 | |
| 32 | Parameters for each memory region can be encoded into the device tree |
| 33 | wit the following convention: |
| 34 | |
| 35 | (name): region@(base-address) { |
| 36 | reg = <(baseaddr) (size)>; |
| 37 | (linux,contiguous-region); |
| 38 | (linux,default-contiguous-region); |
Laura Abbott | 52c4dce | 2013-02-26 10:38:34 -0800 | [diff] [blame] | 39 | label = (unique_name); |
Marek Szyprowski | 4b861c6 | 2013-02-14 13:45:28 +0100 | [diff] [blame] | 40 | }; |
| 41 | |
| 42 | name: an name given to the defined region. |
| 43 | base-address: the base address of the defined region. |
| 44 | size: the size of the memory region. |
| 45 | linux,contiguous-region: property indicating that the defined memory |
| 46 | region is used for contiguous memory allocations, |
| 47 | Linux specific (optional) |
| 48 | linux,default-contiguous-region: property indicating that the region |
| 49 | is the default region for all contiguous memory |
| 50 | allocations, Linux specific (optional) |
Laura Abbott | 52c4dce | 2013-02-26 10:38:34 -0800 | [diff] [blame] | 51 | label: an internal name used for automatically associating the |
| 52 | cma region with a given device. The label is optional; |
| 53 | if the label is not given the client is responsible for |
| 54 | calling the appropriate functions to associate the region |
| 55 | with a device. |
Marek Szyprowski | 4b861c6 | 2013-02-14 13:45:28 +0100 | [diff] [blame] | 56 | |
| 57 | * Device nodes |
| 58 | |
| 59 | Once the regions in the /memory node are defined, they can be assigned |
| 60 | to device some device nodes for their special use. The following |
| 61 | properties are defined: |
| 62 | |
| 63 | linux,contiguous-region = <&phandle>; |
| 64 | This property indicates that the device driver should use the |
| 65 | memory region pointed by the given phandle. |
| 66 | |
| 67 | |
| 68 | * Example: |
| 69 | |
| 70 | This example defines a memory consisting of 4 memory banks. 2 contiguous |
| 71 | regions are defined for Linux kernel, one default of all device drivers |
| 72 | (named contig_mem, placed at 0x72000000, 64MiB) and one dedicated to the |
| 73 | framebuffer device (named display_mem, placed at 0x78000000, 16MiB). The |
| 74 | display_mem region is then assigned to fb@12300000 device for contiguous |
| 75 | memory allocation with Linux kernel drivers. |
| 76 | |
| 77 | The reason for creating a separate region for framebuffer device is to |
| 78 | match the framebuffer address of from configuration done by bootloader, |
| 79 | so once Linux kernel drivers starts, no glitches on the displayed boot |
| 80 | logo appears. |
| 81 | |
| 82 | / { |
| 83 | /* ... */ |
| 84 | memory { |
| 85 | reg = <0x40000000 0x10000000 |
| 86 | 0x50000000 0x10000000 |
| 87 | 0x60000000 0x10000000 |
| 88 | 0x70000000 0x10000000>; |
| 89 | |
| 90 | contig_mem: region@72000000 { |
| 91 | linux,contiguous-region; |
| 92 | linux,default-contiguous-region; |
| 93 | reg = <0x72000000 0x4000000>; |
| 94 | }; |
| 95 | |
| 96 | display_mem: region@78000000 { |
| 97 | linux,contiguous-region; |
| 98 | reg = <0x78000000 0x1000000>; |
| 99 | }; |
| 100 | }; |
| 101 | |
| 102 | fb@12300000 { |
| 103 | linux,contiguous-region = <&display_mem>; |
| 104 | status = "okay"; |
| 105 | }; |
| 106 | }; |