← Documents Documentation/devicetree/bindings/sram/sram.yaml GitHub 원문 ↗

Linux 6.18.37 · Devicetree Bindings / SRAM

Generic on-chip SRAM

Generic SRAM controller와 reserved region의 pool·export·실행 보호 규칙을 설명합니다.

Source pathDocumentation/devicetree/bindings/sram/sram.yaml
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약과 해설

sram.yaml:1-306

Generic SRAM controller와 reserved region의 pool·export·실행 보호 규칙을 설명합니다. 접을 수 있는 영어 원문 전체와 줄 좌표를 보존하고, 한국어 전문 번역에서는 compatible·property·symbol·source path·수치·예제 코드를 원형대로 유지합니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 # SPDX-License-Identifier: GPL-2.0
2 %YAML 1.2
3 ---
4 $id: http://devicetree.org/schemas/sram/sram.yaml#
5 $schema: http://devicetree.org/meta-schemas/core.yaml#
6
7 title: Generic on-chip SRAM
8
9 maintainers:
10 - Rob Herring <robh@kernel.org>
11
12 description: |+
13 Simple IO memory regions to be managed by the genalloc API.
14
15 Each child of the sram node specifies a region of reserved memory. Each
16 child node should use a 'reg' property to specify a specific range of
17 reserved memory.
18
19 Following the generic-names recommended practice, node names should
20 reflect the purpose of the node. Unit address (@<address>) should be
21 appended to the name.
22
23 properties:
24 $nodename:
25 pattern: "^sram(@.*)?"
26
27 compatible:
28 contains:
29 enum:
30 - mmio-sram
31 - amlogic,meson-gxbb-sram
32 - arm,juno-sram-ns
33 - atmel,sama5d2-securam
34 - nvidia,tegra186-sysram
35 - nvidia,tegra194-sysram
36 - nvidia,tegra234-sysram
37 - qcom,rpm-msg-ram
38 - rockchip,rk3288-pmu-sram
39
40 reg:
41 maxItems: 1
42
43 clocks:
44 maxItems: 1
45 description:
46 A list of phandle and clock specifier pair that controls the single
47 SRAM clock.
48
49 "#address-cells":
50 const: 1
51
52 "#size-cells":
53 const: 1
54
55 ranges:
56 maxItems: 1
57 description:
58 Should translate from local addresses within the sram to bus addresses.
59
60 no-memory-wc:
61 description:
62 The flag indicating, that SRAM memory region has not to be remapped
63 as write combining. WC is used by default.
64 type: boolean
65
66 patternProperties:
67 "^([a-z0-9]*-)?sram(-section)?@[a-f0-9]+$":
68 type: object
69 description:
70 Each child of the sram node specifies a region of reserved memory.
71 properties:
72 compatible:
73 description:
74 Should contain a vendor specific string in the form
75 <vendor>,[<device>-]<usage>
76 contains:
77 enum:
78 - allwinner,sun4i-a10-sram-a3-a4
79 - allwinner,sun4i-a10-sram-c1
80 - allwinner,sun4i-a10-sram-d
81 - allwinner,sun9i-a80-smp-sram
82 - allwinner,sun50i-a64-sram-c
83 - amlogic,meson8-ao-arc-sram
84 - amlogic,meson8b-ao-arc-sram
85 - amlogic,meson8-smp-sram
86 - amlogic,meson8b-smp-sram
87 - amlogic,meson-gxbb-scp-shmem
88 - amlogic,meson-axg-scp-shmem
89 - arm,juno-scp-shmem
90 - arm,scmi-shmem
91 - arm,scp-shmem
92 - renesas,smp-sram
93 - rockchip,rk3066-smp-sram
94 - samsung,exynos4210-sysram
95 - samsung,exynos4210-sysram-ns
96 - socionext,milbeaut-smp-sram
97 - stericsson,u8500-esram
98
99 reg:
100 description:
101 IO mem address range, relative to the SRAM range.
102 maxItems: 1
103
104 reg-io-width:
105 description:
106 The size (in bytes) of the IO accesses that should be performed on the
107 SRAM.
108 enum: [1, 2, 4, 8]
109
110 pool:
111 description:
112 Indicates that the particular reserved SRAM area is addressable
113 and in use by another device or devices.
114 type: boolean
115
116 export:
117 description:
118 Indicates that the reserved SRAM area may be accessed outside
119 of the kernel, e.g. by bootloader or userspace.
120 type: boolean
121
122 protect-exec:
123 description: |
124 Same as 'pool' above but with the additional constraint that code
125 will be run from the region and that the memory is maintained as
126 read-only, executable during code execution. NOTE: This region must
127 be page aligned on start and end in order to properly allow
128 manipulation of the page attributes.
129 type: boolean
130
131 label:
132 description:
133 The name for the reserved partition, if omitted, the label is taken
134 from the node name excluding the unit address.
135
136 required:
137 - reg
138
139 additionalProperties: false
140
141 required:
142 - compatible
143 - reg
144
145 if:
146 not:
147 properties:
148 compatible:
149 contains:
150 enum:
151 - qcom,rpm-msg-ram
152 - rockchip,rk3288-pmu-sram
153 then:
154 required:
155 - "#address-cells"
156 - "#size-cells"
157 - ranges
158
159 additionalProperties: false
160
161 examples:
162 - |
163 sram@5c000000 {
164 compatible = "mmio-sram";
165 reg = <0x5c000000 0x40000>; /* 256 KiB SRAM at address 0x5c000000 */
166
167 #address-cells = <1>;
168 #size-cells = <1>;
169 ranges = <0 0x5c000000 0x40000>;
170
171 smp-sram@100 {
172 reg = <0x100 0x50>;
173 };
174
175 device-sram@1000 {
176 reg = <0x1000 0x1000>;
177 pool;
178 };
179
180 exported-sram@20000 {
181 reg = <0x20000 0x20000>;
182 export;
183 };
184 };
185
186 - |
187 // Samsung SMP-capable Exynos SoCs use part of the SYSRAM for the bringup
188 // of the secondary cores. Once the core gets powered up it executes the
189 // code that is residing at some specific location of the SYSRAM.
190 //
191 // Therefore reserved section sub-nodes have to be added to the mmio-sram
192 // declaration. These nodes are of two types depending upon secure or
193 // non-secure execution environment.
194 sram@2020000 {
195 compatible = "mmio-sram";
196 reg = <0x02020000 0x54000>;
197 #address-cells = <1>;
198 #size-cells = <1>;
199 ranges = <0 0x02020000 0x54000>;
200
201 smp-sram@0 {
202 compatible = "samsung,exynos4210-sysram";
203 reg = <0x0 0x1000>;
204 };
205
206 smp-sram@53000 {
207 compatible = "samsung,exynos4210-sysram-ns";
208 reg = <0x53000 0x1000>;
209 };
210 };
211
212 - |
213 // Amlogic's SMP-capable SoCs use part of the sram for the bringup of the cores.
214 // Once the core gets powered up it executes the code that is residing at a
215 // specific location.
216 //
217 // Therefore a reserved section sub-node has to be added to the mmio-sram
218 // declaration.
219 sram@d9000000 {
220 compatible = "mmio-sram";
221 reg = <0xd9000000 0x20000>;
222 #address-cells = <1>;
223 #size-cells = <1>;
224 ranges = <0 0xd9000000 0x20000>;
225
226 smp-sram@1ff80 {
227 compatible = "amlogic,meson8b-smp-sram";
228 reg = <0x1ff80 0x8>;
229 };
230 };
231
232 - |
233 sram@e63c0000 {
234 compatible = "mmio-sram";
235 reg = <0xe63c0000 0x1000>;
236 #address-cells = <1>;
237 #size-cells = <1>;
238 ranges = <0 0xe63c0000 0x1000>;
239
240 smp-sram@0 {
241 compatible = "renesas,smp-sram";
242 reg = <0 0x10>;
243 };
244 };
245
246 - |
247 sram@10080000 {
248 compatible = "mmio-sram";
249 reg = <0x10080000 0x10000>;
250 #address-cells = <1>;
251 #size-cells = <1>;
252 ranges;
253
254 smp-sram@10080000 {
255 compatible = "rockchip,rk3066-smp-sram";
256 reg = <0x10080000 0x50>;
257 };
258 };
259
260 - |
261 // Rockchip's rk3288 SoC uses the sram of pmu to store the function of
262 // resume from maskrom(the 1st level loader). This is a common use of
263 // the "pmu-sram" because it keeps power even in low power states
264 // in the system.
265 sram@ff720000 {
266 compatible = "rockchip,rk3288-pmu-sram", "mmio-sram";
267 reg = <0xff720000 0x1000>;
268 };
269
270 - |
271 // Allwinner's A80 SoC uses part of the secure sram for hotplugging of the
272 // primary core (cpu0). Once the core gets powered up it checks if a magic
273 // value is set at a specific location. If it is then the BROM will jump
274 // to the software entry address, instead of executing a standard boot.
275 //
276 // Also there are no "secure-only" properties. The implementation should
277 // check if this SRAM is usable first.
278 sram@20000 {
279 // 256 KiB secure SRAM at 0x20000
280 compatible = "mmio-sram";
281 reg = <0x00020000 0x40000>;
282 #address-cells = <1>;
283 #size-cells = <1>;
284 ranges = <0 0x00020000 0x40000>;
285
286 smp-sram@1000 {
287 // This is checked by BROM to determine if
288 // cpu0 should jump to SMP entry vector
289 compatible = "allwinner,sun9i-a80-smp-sram";
290 reg = <0x1000 0x8>;
291 };
292 };
293
294 - |
295 sram@0 {
296 compatible = "mmio-sram";
297 reg = <0x0 0x10000>;
298 #address-cells = <1>;
299 #size-cells = <1>;
300 ranges = <0 0x0 0x10000>;
301
302 smp-sram@f100 {
303 compatible = "socionext,milbeaut-smp-sram";
304 reg = <0xf100 0x20>;
305 };
306 };
307

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

Generic on-chip SRAM

1-22

이 GPL-2.0 YAML schema는 genalloc API가 관리하는 simple IO memory region인 generic on-chip SRAM을 정의합니다. Maintainer는 Rob Herring입니다.

SRAM node의 각 child는 reserved memory region 하나를 나타내며 `reg`로 구체적인 범위를 지정해야 합니다. Generic-name 권장 관례에 따라 node name은 용도를 반영하고 unit address `@<address>`를 덧붙여야 합니다.

SRAM controller 속성

23-65

Node name은 `^sram(@.*)?` pattern을 따릅니다. `compatible`은 `mmio-sram`, `amlogic,meson-gxbb-sram`, `arm,juno-sram-ns`, `atmel,sama5d2-securam`, `nvidia,tegra186-sysram`, `nvidia,tegra194-sysram`, `nvidia,tegra234-sysram`, `qcom,rpm-msg-ram`, `rockchip,rk3288-pmu-sram` 중 하나를 포함합니다.

`reg`와 SRAM을 제어하는 단일 `clocks`는 각각 최대 한 항목입니다. `#address-cells`와 `#size-cells`는 모두 1이며 `ranges`는 local SRAM address를 bus address로 변환하는 최대 한 항목입니다.

Boolean `no-memory-wc`는 SRAM region을 write-combining으로 remap하지 말아야 함을 나타냅니다. 기본값은 write combining입니다.

Reserved SRAM child와 compatible

66-103

`^([a-z0-9]*-)?sram(-section)?@[a-f0-9]+$`에 맞는 각 child object는 reserved memory region 하나를 나타냅니다. Vendor-specific compatible은 `<vendor>,[<device>-]<usage>` 형식이어야 합니다.

지원 목록은 `allwinner,sun4i-a10-sram-a3-a4`, `allwinner,sun4i-a10-sram-c1`, `allwinner,sun4i-a10-sram-d`, `allwinner,sun9i-a80-smp-sram`, `allwinner,sun50i-a64-sram-c`, `amlogic,meson8-ao-arc-sram`, `amlogic,meson8b-ao-arc-sram`, `amlogic,meson8-smp-sram`, `amlogic,meson8b-smp-sram`, `amlogic,meson-gxbb-scp-shmem`, `amlogic,meson-axg-scp-shmem`입니다.

또한 `arm,juno-scp-shmem`, `arm,scmi-shmem`, `arm,scp-shmem`, `renesas,smp-sram`, `rockchip,rk3066-smp-sram`, `samsung,exynos4210-sysram`, `samsung,exynos4210-sysram-ns`, `socionext,milbeaut-smp-sram`, `stericsson,u8500-esram`을 지원합니다. `reg`는 SRAM 전체 범위에 상대적인 IO memory address range이며 최대 한 항목입니다.

접근 폭과 pool·export·실행 보호

104-140

`reg-io-width`는 SRAM에 수행할 IO access 크기(byte)이며 1, 2, 4, 8 중 하나입니다. Boolean `pool`은 해당 reserved SRAM area를 다른 device 하나 이상이 address할 수 있고 사용 중임을 나타냅니다.

Boolean `export`는 bootloader나 userspace처럼 kernel 외부에서도 reserved SRAM area에 접근할 수 있음을 나타냅니다. `protect-exec`는 `pool`과 같지만 그 region에서 code를 실행하고 실행 중 memory를 read-only executable로 유지합니다. Page attribute 조작을 위해 시작과 끝이 page-aligned여야 합니다.

`label`은 reserved partition 이름입니다. 생략하면 unit address를 제외한 node name에서 label을 가져옵니다. 각 child에는 `reg`가 필수이고 추가 속성은 허용하지 않습니다.

필수 속성과 예외 조건

141-160

SRAM node에는 `compatible`, `reg`가 필수입니다. Compatible이 `qcom,rpm-msg-ram` 또는 `rockchip,rk3288-pmu-sram`을 포함하지 않는 경우 `#address-cells`, `#size-cells`, `ranges`도 필수입니다. 정의하지 않은 추가 속성은 금지합니다.

Generic SRAM 사용 예제

161-306

예제들은 256 KiB generic SRAM의 SMP·device pool·export partition, Samsung Exynos의 secure/non-secure SMP SYSRAM, Amlogic core bring-up SRAM, Renesas와 Rockchip RK3066 SMP SRAM을 보여 줍니다.

이어지는 예제는 low-power 상태에서도 유지되는 RK3288 PMU SRAM, BROM magic value로 CPU0 hotplug entry를 선택하는 Allwinner A80 secure SRAM, Socionext Milbeaut SMP SRAM을 구성합니다. Secure-only 속성은 별도로 없으므로 A80 구현은 SRAM 사용 가능 여부를 먼저 확인해야 합니다.

- |
  sram@5c000000 {
      compatible = "mmio-sram";
      reg = <0x5c000000 0x40000>; /* 256 KiB SRAM at address 0x5c000000 */

      #address-cells = <1>;
      #size-cells = <1>;
      ranges = <0 0x5c000000 0x40000>;

      smp-sram@100 {
          reg = <0x100 0x50>;
      };

      device-sram@1000 {
          reg = <0x1000 0x1000>;
          pool;
      };

      exported-sram@20000 {
          reg = <0x20000 0x20000>;
          export;
      };
  };

- |
  // Samsung SMP-capable Exynos SoCs use part of the SYSRAM for the bringup
  // of the secondary cores. Once the core gets powered up it executes the
  // code that is residing at some specific location of the SYSRAM.
  //
  // Therefore reserved section sub-nodes have to be added to the mmio-sram
  // declaration. These nodes are of two types depending upon secure or
  // non-secure execution environment.
  sram@2020000 {
      compatible = "mmio-sram";
      reg = <0x02020000 0x54000>;
      #address-cells = <1>;
      #size-cells = <1>;
      ranges = <0 0x02020000 0x54000>;

      smp-sram@0 {
          compatible = "samsung,exynos4210-sysram";
          reg = <0x0 0x1000>;
      };

      smp-sram@53000 {
          compatible = "samsung,exynos4210-sysram-ns";
          reg = <0x53000 0x1000>;
      };
  };

- |
  // Amlogic's SMP-capable SoCs use part of the sram for the bringup of the cores.
  // Once the core gets powered up it executes the code that is residing at a
  // specific location.
  //
  // Therefore a reserved section sub-node has to be added to the mmio-sram
  // declaration.
  sram@d9000000 {
      compatible = "mmio-sram";
      reg = <0xd9000000 0x20000>;
      #address-cells = <1>;
      #size-cells = <1>;
      ranges = <0 0xd9000000 0x20000>;

      smp-sram@1ff80 {
          compatible = "amlogic,meson8b-smp-sram";
          reg = <0x1ff80 0x8>;
      };
  };

- |
  sram@e63c0000 {
      compatible = "mmio-sram";
      reg = <0xe63c0000 0x1000>;
      #address-cells = <1>;
      #size-cells = <1>;
      ranges = <0 0xe63c0000 0x1000>;

      smp-sram@0 {
          compatible = "renesas,smp-sram";
          reg = <0 0x10>;
      };
  };

- |
  sram@10080000 {
      compatible = "mmio-sram";
      reg = <0x10080000 0x10000>;
      #address-cells = <1>;
      #size-cells = <1>;
      ranges;

      smp-sram@10080000 {
          compatible = "rockchip,rk3066-smp-sram";
          reg = <0x10080000 0x50>;
      };
  };

- |
  // Rockchip's rk3288 SoC uses the sram of pmu to store the function of
  // resume from maskrom(the 1st level loader). This is a common use of
  // the "pmu-sram" because it keeps power even in low power states
  // in the system.
  sram@ff720000 {
    compatible = "rockchip,rk3288-pmu-sram", "mmio-sram";
    reg = <0xff720000 0x1000>;
  };

- |
  // Allwinner's A80 SoC uses part of the secure sram for hotplugging of the
  // primary core (cpu0). Once the core gets powered up it checks if a magic
  // value is set at a specific location. If it is then the BROM will jump
  // to the software entry address, instead of executing a standard boot.
  //
  // Also there are no "secure-only" properties. The implementation should
  // check if this SRAM is usable first.
  sram@20000 {
      // 256 KiB secure SRAM at 0x20000
      compatible = "mmio-sram";
      reg = <0x00020000 0x40000>;
      #address-cells = <1>;
      #size-cells = <1>;
      ranges = <0 0x00020000 0x40000>;

      smp-sram@1000 {
          // This is checked by BROM to determine if
          // cpu0 should jump to SMP entry vector
          compatible = "allwinner,sun9i-a80-smp-sram";
          reg = <0x1000 0x8>;
      };
  };

- |
  sram@0 {
      compatible = "mmio-sram";
      reg = <0x0 0x10000>;
      #address-cells = <1>;
      #size-cells = <1>;
      ranges = <0 0x0 0x10000>;

      smp-sram@f100 {
          compatible = "socionext,milbeaut-smp-sram";
          reg = <0xf100 0x20>;
      };
  };