1720ad00eSThierry Reding# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2720ad00eSThierry Reding%YAML 1.2
3720ad00eSThierry Reding---
4720ad00eSThierry Reding$id: http://devicetree.org/schemas/memory-controllers/nvidia,tegra186-mc.yaml#
5720ad00eSThierry Reding$schema: http://devicetree.org/meta-schemas/core.yaml#
6720ad00eSThierry Reding
7720ad00eSThierry Redingtitle: NVIDIA Tegra186 (and later) SoC Memory Controller
8720ad00eSThierry Reding
9720ad00eSThierry Redingmaintainers:
10720ad00eSThierry Reding  - Jon Hunter <jonathanh@nvidia.com>
11720ad00eSThierry Reding  - Thierry Reding <thierry.reding@gmail.com>
12720ad00eSThierry Reding
13720ad00eSThierry Redingdescription: |
14720ad00eSThierry Reding  The NVIDIA Tegra186 SoC features a 128 bit memory controller that is split
15720ad00eSThierry Reding  into four 32 bit channels to support LPDDR4 with x16 subpartitions. The MC
16720ad00eSThierry Reding  handles memory requests for 40-bit virtual addresses from internal clients
17720ad00eSThierry Reding  and arbitrates among them to allocate memory bandwidth.
18720ad00eSThierry Reding
19720ad00eSThierry Reding  Up to 15 GiB of physical memory can be supported. Security features such as
20720ad00eSThierry Reding  encryption of traffic to and from DRAM via general security apertures are
21720ad00eSThierry Reding  available for video and other secure applications, as well as DRAM ECC for
22720ad00eSThierry Reding  automotive safety applications (single bit error correction and double bit
23720ad00eSThierry Reding  error detection).
24720ad00eSThierry Reding
25720ad00eSThierry Redingproperties:
26720ad00eSThierry Reding  $nodename:
27720ad00eSThierry Reding    pattern: "^memory-controller@[0-9a-f]+$"
28720ad00eSThierry Reding
29720ad00eSThierry Reding  compatible:
30720ad00eSThierry Reding    items:
31720ad00eSThierry Reding      - enum:
32720ad00eSThierry Reding          - nvidia,tegra186-mc
33720ad00eSThierry Reding          - nvidia,tegra194-mc
34c3859c14SThierry Reding          - nvidia,tegra234-mc
35720ad00eSThierry Reding
36720ad00eSThierry Reding  reg:
37*e2ab93e5SAshish Mhetre    minItems: 6
38*e2ab93e5SAshish Mhetre    maxItems: 18
39*e2ab93e5SAshish Mhetre
40*e2ab93e5SAshish Mhetre  reg-names:
41*e2ab93e5SAshish Mhetre    minItems: 6
42*e2ab93e5SAshish Mhetre    maxItems: 18
43720ad00eSThierry Reding
44720ad00eSThierry Reding  interrupts:
458c970e7eSThierry Reding    items:
468c970e7eSThierry Reding      - description: MC general interrupt
47720ad00eSThierry Reding
48720ad00eSThierry Reding  "#address-cells":
49720ad00eSThierry Reding    const: 2
50720ad00eSThierry Reding
51720ad00eSThierry Reding  "#size-cells":
52720ad00eSThierry Reding    const: 2
53720ad00eSThierry Reding
54720ad00eSThierry Reding  ranges: true
55720ad00eSThierry Reding
56720ad00eSThierry Reding  dma-ranges: true
57720ad00eSThierry Reding
588c970e7eSThierry Reding  "#interconnect-cells":
598c970e7eSThierry Reding    const: 1
608c970e7eSThierry Reding
61720ad00eSThierry RedingpatternProperties:
62720ad00eSThierry Reding  "^external-memory-controller@[0-9a-f]+$":
63720ad00eSThierry Reding    description:
64720ad00eSThierry Reding      The bulk of the work involved in controlling the external memory
65720ad00eSThierry Reding      controller on NVIDIA Tegra186 and later is performed on the BPMP. This
66720ad00eSThierry Reding      coprocessor exposes the EMC clock that is used to set the frequency at
67720ad00eSThierry Reding      which the external memory is clocked and a remote procedure call that
68720ad00eSThierry Reding      can be used to obtain the set of available frequencies.
69720ad00eSThierry Reding    type: object
70720ad00eSThierry Reding    properties:
71720ad00eSThierry Reding      compatible:
72720ad00eSThierry Reding        items:
73720ad00eSThierry Reding          - enum:
74720ad00eSThierry Reding              - nvidia,tegra186-emc
75720ad00eSThierry Reding              - nvidia,tegra194-emc
76c3859c14SThierry Reding              - nvidia,tegra234-emc
77720ad00eSThierry Reding
78720ad00eSThierry Reding      reg:
798c970e7eSThierry Reding        minItems: 1
808c970e7eSThierry Reding        maxItems: 2
81720ad00eSThierry Reding
82720ad00eSThierry Reding      interrupts:
838c970e7eSThierry Reding        items:
848c970e7eSThierry Reding          - description: EMC general interrupt
85720ad00eSThierry Reding
86720ad00eSThierry Reding      clocks:
87720ad00eSThierry Reding        items:
88720ad00eSThierry Reding          - description: external memory clock
89720ad00eSThierry Reding
90720ad00eSThierry Reding      clock-names:
91720ad00eSThierry Reding        items:
92720ad00eSThierry Reding          - const: emc
93720ad00eSThierry Reding
948c970e7eSThierry Reding      "#interconnect-cells":
958c970e7eSThierry Reding        const: 0
968c970e7eSThierry Reding
97720ad00eSThierry Reding      nvidia,bpmp:
98720ad00eSThierry Reding        $ref: /schemas/types.yaml#/definitions/phandle
99720ad00eSThierry Reding        description:
100720ad00eSThierry Reding          phandle of the node representing the BPMP
101720ad00eSThierry Reding
1028c970e7eSThierry Reding    allOf:
1038c970e7eSThierry Reding      - if:
1048c970e7eSThierry Reding          properties:
1058c970e7eSThierry Reding            compatible:
1068c970e7eSThierry Reding              const: nvidia,tegra186-emc
1078c970e7eSThierry Reding        then:
1088c970e7eSThierry Reding          properties:
1098c970e7eSThierry Reding            reg:
1108c970e7eSThierry Reding              maxItems: 1
1118c970e7eSThierry Reding
1128c970e7eSThierry Reding      - if:
1138c970e7eSThierry Reding          properties:
1148c970e7eSThierry Reding            compatible:
1158c970e7eSThierry Reding              const: nvidia,tegra194-emc
1168c970e7eSThierry Reding        then:
1178c970e7eSThierry Reding          properties:
1188c970e7eSThierry Reding            reg:
1198c970e7eSThierry Reding              minItems: 2
1208c970e7eSThierry Reding
121c3859c14SThierry Reding      - if:
122c3859c14SThierry Reding          properties:
123c3859c14SThierry Reding            compatible:
124c3859c14SThierry Reding              const: nvidia,tegra234-emc
125c3859c14SThierry Reding        then:
126c3859c14SThierry Reding          properties:
127c3859c14SThierry Reding            reg:
128c3859c14SThierry Reding              minItems: 2
129c3859c14SThierry Reding
1308c970e7eSThierry Reding    additionalProperties: false
1318c970e7eSThierry Reding
1328c970e7eSThierry Reding    required:
1338c970e7eSThierry Reding      - compatible
1348c970e7eSThierry Reding      - reg
1358c970e7eSThierry Reding      - interrupts
1368c970e7eSThierry Reding      - clocks
1378c970e7eSThierry Reding      - clock-names
1388c970e7eSThierry Reding      - "#interconnect-cells"
1398c970e7eSThierry Reding      - nvidia,bpmp
1408c970e7eSThierry Reding
1418c970e7eSThierry RedingallOf:
1428c970e7eSThierry Reding  - if:
1438c970e7eSThierry Reding      properties:
1448c970e7eSThierry Reding        compatible:
1458c970e7eSThierry Reding          const: nvidia,tegra186-mc
1468c970e7eSThierry Reding    then:
1478c970e7eSThierry Reding      properties:
1488c970e7eSThierry Reding        reg:
149*e2ab93e5SAshish Mhetre          maxItems: 6
150*e2ab93e5SAshish Mhetre          description: 5 memory controller channels and 1 for stream-id registers
151*e2ab93e5SAshish Mhetre
152*e2ab93e5SAshish Mhetre        reg-names:
153*e2ab93e5SAshish Mhetre          items:
154*e2ab93e5SAshish Mhetre            - const: sid
155*e2ab93e5SAshish Mhetre            - const: broadcast
156*e2ab93e5SAshish Mhetre            - const: ch0
157*e2ab93e5SAshish Mhetre            - const: ch1
158*e2ab93e5SAshish Mhetre            - const: ch2
159*e2ab93e5SAshish Mhetre            - const: ch3
1608c970e7eSThierry Reding
1618c970e7eSThierry Reding  - if:
1628c970e7eSThierry Reding      properties:
1638c970e7eSThierry Reding        compatible:
1648c970e7eSThierry Reding          const: nvidia,tegra194-mc
1658c970e7eSThierry Reding    then:
1668c970e7eSThierry Reding      properties:
1678c970e7eSThierry Reding        reg:
168*e2ab93e5SAshish Mhetre          minItems: 18
169*e2ab93e5SAshish Mhetre          description: 17 memory controller channels and 1 for stream-id registers
170*e2ab93e5SAshish Mhetre
171*e2ab93e5SAshish Mhetre        reg-names:
172*e2ab93e5SAshish Mhetre          items:
173*e2ab93e5SAshish Mhetre            - const: sid
174*e2ab93e5SAshish Mhetre            - const: broadcast
175*e2ab93e5SAshish Mhetre            - const: ch0
176*e2ab93e5SAshish Mhetre            - const: ch1
177*e2ab93e5SAshish Mhetre            - const: ch2
178*e2ab93e5SAshish Mhetre            - const: ch3
179*e2ab93e5SAshish Mhetre            - const: ch4
180*e2ab93e5SAshish Mhetre            - const: ch5
181*e2ab93e5SAshish Mhetre            - const: ch6
182*e2ab93e5SAshish Mhetre            - const: ch7
183*e2ab93e5SAshish Mhetre            - const: ch8
184*e2ab93e5SAshish Mhetre            - const: ch9
185*e2ab93e5SAshish Mhetre            - const: ch10
186*e2ab93e5SAshish Mhetre            - const: ch11
187*e2ab93e5SAshish Mhetre            - const: ch12
188*e2ab93e5SAshish Mhetre            - const: ch13
189*e2ab93e5SAshish Mhetre            - const: ch14
190*e2ab93e5SAshish Mhetre            - const: ch15
1918c970e7eSThierry Reding
192c3859c14SThierry Reding  - if:
193c3859c14SThierry Reding      properties:
194c3859c14SThierry Reding        compatible:
195c3859c14SThierry Reding          const: nvidia,tegra234-mc
196c3859c14SThierry Reding    then:
197c3859c14SThierry Reding      properties:
198c3859c14SThierry Reding        reg:
199*e2ab93e5SAshish Mhetre          minItems: 18
200*e2ab93e5SAshish Mhetre          description: 17 memory controller channels and 1 for stream-id registers
201*e2ab93e5SAshish Mhetre
202*e2ab93e5SAshish Mhetre        reg-names:
203*e2ab93e5SAshish Mhetre          items:
204*e2ab93e5SAshish Mhetre            - const: sid
205*e2ab93e5SAshish Mhetre            - const: broadcast
206*e2ab93e5SAshish Mhetre            - const: ch0
207*e2ab93e5SAshish Mhetre            - const: ch1
208*e2ab93e5SAshish Mhetre            - const: ch2
209*e2ab93e5SAshish Mhetre            - const: ch3
210*e2ab93e5SAshish Mhetre            - const: ch4
211*e2ab93e5SAshish Mhetre            - const: ch5
212*e2ab93e5SAshish Mhetre            - const: ch6
213*e2ab93e5SAshish Mhetre            - const: ch7
214*e2ab93e5SAshish Mhetre            - const: ch8
215*e2ab93e5SAshish Mhetre            - const: ch9
216*e2ab93e5SAshish Mhetre            - const: ch10
217*e2ab93e5SAshish Mhetre            - const: ch11
218*e2ab93e5SAshish Mhetre            - const: ch12
219*e2ab93e5SAshish Mhetre            - const: ch13
220*e2ab93e5SAshish Mhetre            - const: ch14
221*e2ab93e5SAshish Mhetre            - const: ch15
222c3859c14SThierry Reding
2238c970e7eSThierry RedingadditionalProperties: false
2248c970e7eSThierry Reding
225720ad00eSThierry Redingrequired:
226720ad00eSThierry Reding  - compatible
227720ad00eSThierry Reding  - reg
228*e2ab93e5SAshish Mhetre  - reg-names
229720ad00eSThierry Reding  - interrupts
230720ad00eSThierry Reding  - "#address-cells"
231720ad00eSThierry Reding  - "#size-cells"
232720ad00eSThierry Reding
233720ad00eSThierry Redingexamples:
234720ad00eSThierry Reding  - |
235720ad00eSThierry Reding    #include <dt-bindings/clock/tegra186-clock.h>
236720ad00eSThierry Reding    #include <dt-bindings/interrupt-controller/arm-gic.h>
237720ad00eSThierry Reding
238f88d59fcSRob Herring    bus {
239f88d59fcSRob Herring        #address-cells = <2>;
240f88d59fcSRob Herring        #size-cells = <2>;
241f88d59fcSRob Herring
242720ad00eSThierry Reding        memory-controller@2c00000 {
243720ad00eSThierry Reding            compatible = "nvidia,tegra186-mc";
244*e2ab93e5SAshish Mhetre            reg = <0x0 0x02c00000 0x0 0x10000>,    /* MC-SID */
245*e2ab93e5SAshish Mhetre                  <0x0 0x02c10000 0x0 0x10000>,    /* Broadcast channel */
246*e2ab93e5SAshish Mhetre                  <0x0 0x02c20000 0x0 0x10000>,    /* MC0 */
247*e2ab93e5SAshish Mhetre                  <0x0 0x02c30000 0x0 0x10000>,    /* MC1 */
248*e2ab93e5SAshish Mhetre                  <0x0 0x02c40000 0x0 0x10000>,    /* MC2 */
249*e2ab93e5SAshish Mhetre                  <0x0 0x02c50000 0x0 0x10000>;    /* MC3 */
250*e2ab93e5SAshish Mhetre            reg-names = "sid", "broadcast", "ch0", "ch1", "ch2", "ch3";
251720ad00eSThierry Reding            interrupts = <GIC_SPI 223 IRQ_TYPE_LEVEL_HIGH>;
252720ad00eSThierry Reding
253720ad00eSThierry Reding            #address-cells = <2>;
254720ad00eSThierry Reding            #size-cells = <2>;
255720ad00eSThierry Reding
256f88d59fcSRob Herring            ranges = <0x0 0x02c00000 0x0 0x02c00000 0x0 0xb0000>;
257720ad00eSThierry Reding
258720ad00eSThierry Reding            /*
259720ad00eSThierry Reding             * Memory clients have access to all 40 bits that the memory
260720ad00eSThierry Reding             * controller can address.
261720ad00eSThierry Reding             */
262720ad00eSThierry Reding            dma-ranges = <0x0 0x0 0x0 0x0 0x100 0x0>;
263720ad00eSThierry Reding
264720ad00eSThierry Reding            external-memory-controller@2c60000 {
265720ad00eSThierry Reding                compatible = "nvidia,tegra186-emc";
266720ad00eSThierry Reding                reg = <0x0 0x02c60000 0x0 0x50000>;
267720ad00eSThierry Reding                interrupts = <GIC_SPI 224 IRQ_TYPE_LEVEL_HIGH>;
268720ad00eSThierry Reding                clocks = <&bpmp TEGRA186_CLK_EMC>;
269720ad00eSThierry Reding                clock-names = "emc";
270720ad00eSThierry Reding
2718c970e7eSThierry Reding                #interconnect-cells = <0>;
2728c970e7eSThierry Reding
273720ad00eSThierry Reding                nvidia,bpmp = <&bpmp>;
274720ad00eSThierry Reding            };
275720ad00eSThierry Reding        };
276f88d59fcSRob Herring    };
277