blob: e98ee0588f3c9ecffe829139ed95bfd042ed545a [file] [log] [blame]
Marek Szyprowski4b861c62013-02-14 13:45:28 +01001* Memory binding
2
3The /memory node provides basic information about the address and size
4of the physical memory. This node is usually filled or updated by the
5bootloader, depending on the actual memory configuration of the given
6hardware.
7
8The memory layout is described by the folllowing node:
9
10memory {
11 reg = <(baseaddr1) (size1)
12 (baseaddr2) (size2)
13 ...
14 (baseaddrN) (sizeN)>;
15};
16
17baseaddrX: the base address of the defined memory bank
18sizeX: the size of the defined memory bank
19
20More than one memory bank can be defined.
21
22
23* Memory regions
24
25In /memory node one can create additional nodes describing particular
26memory regions, usually for the special usage by various device drivers.
27A good example are contiguous memory allocations or memory sharing with
28other operating system on the same hardware board. Those special memory
29regions might depend on the board configuration and devices used on the
30target system.
31
32Parameters for each memory region can be encoded into the device tree
33wit the following convention:
34
35(name): region@(base-address) {
36 reg = <(baseaddr) (size)>;
37 (linux,contiguous-region);
38 (linux,default-contiguous-region);
Laura Abbott52c4dce2013-02-26 10:38:34 -080039 label = (unique_name);
Marek Szyprowski4b861c62013-02-14 13:45:28 +010040};
41
42name: an name given to the defined region.
43base-address: the base address of the defined region.
44size: the size of the memory region.
45linux,contiguous-region: property indicating that the defined memory
46 region is used for contiguous memory allocations,
47 Linux specific (optional)
48linux,default-contiguous-region: property indicating that the region
49 is the default region for all contiguous memory
50 allocations, Linux specific (optional)
Laura Abbott52c4dce2013-02-26 10:38:34 -080051label: 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 Szyprowski4b861c62013-02-14 13:45:28 +010056
57* Device nodes
58
59Once the regions in the /memory node are defined, they can be assigned
60to device some device nodes for their special use. The following
61properties are defined:
62
63linux,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
70This example defines a memory consisting of 4 memory banks. 2 contiguous
71regions are defined for Linux kernel, one default of all device drivers
72(named contig_mem, placed at 0x72000000, 64MiB) and one dedicated to the
73framebuffer device (named display_mem, placed at 0x78000000, 16MiB). The
74display_mem region is then assigned to fb@12300000 device for contiguous
75memory allocation with Linux kernel drivers.
76
77The reason for creating a separate region for framebuffer device is to
78match the framebuffer address of from configuration done by bootloader,
79so once Linux kernel drivers starts, no glitches on the displayed boot
80logo 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};