1# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2# Copyright (C) 2020 Texas Instruments Incorporated
3# Author: Peter Ujfalusi <peter.ujfalusi@ti.com>
4%YAML 1.2
5---
6$id: http://devicetree.org/schemas/dma/ti/k3-bcdma.yaml#
7$schema: http://devicetree.org/meta-schemas/core.yaml#
8
9title: Texas Instruments K3 DMSS BCDMA
10
11maintainers:
12  - Peter Ujfalusi <peter.ujfalusi@gmail.com>
13
14description: |
15  The Block Copy DMA (BCDMA) is intended to perform similar functions as the TR
16  mode channels of K3 UDMA-P.
17  BCDMA includes block copy channels and Split channels.
18
19  Block copy channels mainly used for memory to memory transfers, but with
20  optional triggers a block copy channel can service peripherals by accessing
21  directly to memory mapped registers or area.
22
23  Split channels can be used to service PSI-L based peripherals.
24  The peripherals can be PSI-L native or legacy, non PSI-L native peripherals
25  with PDMAs. PDMA is tasked to act as a bridge between the PSI-L fabric and the
26  legacy peripheral.
27
28  PDMAs can be configured via BCDMA split channel's peer registers to match with
29  the configuration of the legacy peripheral.
30
31properties:
32  compatible:
33    enum:
34      - ti,am62a-dmss-bcdma-csirx
35      - ti,am64-dmss-bcdma
36      - ti,j721s2-dmss-bcdma-csi
37
38  reg:
39    minItems: 3
40    maxItems: 5
41
42  reg-names:
43    minItems: 3
44    maxItems: 5
45
46  "#dma-cells":
47    const: 3
48    description: |
49      cell 1: type of the BCDMA channel to be used to service the peripheral:
50        0 - split channel
51        1 - block copy channel using global trigger 1
52        2 - block copy channel using global trigger 2
53        3 - block copy channel using local trigger
54
55      cell 2: parameter for the channel:
56        if cell 1 is 0 (split channel):
57          PSI-L thread ID of the remote (to BCDMA) end.
58          Valid ranges for thread ID depends on the data movement direction:
59          for source thread IDs (rx): 0 - 0x7fff
60          for destination thread IDs (tx): 0x8000 - 0xffff
61
62          Please refer to the device documentation for the PSI-L thread map and
63          also the PSI-L peripheral chapter for the correct thread ID.
64        if cell 1 is 1 or 2 (block copy channel using global trigger):
65          Unused, ignored
66
67          The trigger must be configured for the channel externally to BCDMA,
68          channels using global triggers should not be requested directly, but
69          via DMA event router.
70        if cell 1 is 3 (block copy channel using local trigger):
71          bchan number of the locally triggered channel
72
73      cell 3: ASEL value for the channel
74
75  msi-parent: true
76
77  power-domains:
78    description:
79      Power domain if available
80    maxItems: 1
81
82  ti,asel:
83    $ref: /schemas/types.yaml#/definitions/uint32
84    description: ASEL value for non slave channels
85
86  ti,sci-rm-range-bchan:
87    $ref: /schemas/types.yaml#/definitions/uint32-array
88    description: |
89      Array of BCDMA block-copy channel resource subtypes for resource
90      allocation for this host
91    minItems: 1
92    # Should be enough
93    maxItems: 255
94    items:
95      maximum: 0x3f
96
97  ti,sci-rm-range-tchan:
98    $ref: /schemas/types.yaml#/definitions/uint32-array
99    description: |
100      Array of BCDMA split tx channel resource subtypes for resource allocation
101      for this host
102    minItems: 1
103    # Should be enough
104    maxItems: 255
105    items:
106      maximum: 0x3f
107
108  ti,sci-rm-range-rchan:
109    $ref: /schemas/types.yaml#/definitions/uint32-array
110    description: |
111      Array of BCDMA split rx channel resource subtypes for resource allocation
112      for this host
113    minItems: 1
114    # Should be enough
115    maxItems: 255
116    items:
117      maximum: 0x3f
118
119required:
120  - compatible
121  - "#dma-cells"
122  - reg
123  - reg-names
124  - msi-parent
125  - ti,sci
126  - ti,sci-dev-id
127  - ti,sci-rm-range-rchan
128
129allOf:
130  - $ref: /schemas/dma/dma-controller.yaml#
131  - $ref: /schemas/arm/keystone/ti,k3-sci-common.yaml#
132
133  - if:
134      properties:
135        compatible:
136          contains:
137            const: ti,am62a-dmss-bcdma-csirx
138    then:
139      properties:
140        ti,sci-rm-range-bchan: false
141        ti,sci-rm-range-tchan: false
142
143        reg:
144          maxItems: 3
145
146        reg-names:
147          items:
148            - const: gcfg
149            - const: rchanrt
150            - const: ringrt
151
152      required:
153        - power-domains
154
155  - if:
156      properties:
157        compatible:
158          contains:
159            const: ti,am64-dmss-bcdma
160    then:
161      properties:
162        reg:
163          minItems: 5
164
165        reg-names:
166          items:
167            - const: gcfg
168            - const: bchanrt
169            - const: rchanrt
170            - const: tchanrt
171            - const: ringrt
172
173      required:
174        - ti,sci-rm-range-bchan
175        - ti,sci-rm-range-tchan
176
177  - if:
178      properties:
179        compatible:
180          contains:
181            const: ti,j721s2-dmss-bcdma-csi
182    then:
183      properties:
184        ti,sci-rm-range-bchan: false
185
186        reg:
187          maxItems: 4
188
189        reg-names:
190          items:
191            - const: gcfg
192            - const: rchanrt
193            - const: tchanrt
194            - const: ringrt
195
196      required:
197        - ti,sci-rm-range-tchan
198
199unevaluatedProperties: false
200
201examples:
202  - |+
203    cbass_main {
204        #address-cells = <2>;
205        #size-cells = <2>;
206
207        main_dmss {
208            compatible = "simple-mfd";
209            #address-cells = <2>;
210            #size-cells = <2>;
211            dma-ranges;
212            ranges;
213
214            ti,sci-dev-id = <25>;
215
216            main_bcdma: dma-controller@485c0100 {
217                compatible = "ti,am64-dmss-bcdma";
218
219                reg = <0x0 0x485c0100 0x0 0x100>,
220                      <0x0 0x4c000000 0x0 0x20000>,
221                      <0x0 0x4a820000 0x0 0x20000>,
222                      <0x0 0x4aa40000 0x0 0x20000>,
223                      <0x0 0x4bc00000 0x0 0x100000>;
224                reg-names = "gcfg", "bchanrt", "rchanrt", "tchanrt", "ringrt";
225                msi-parent = <&inta_main_dmss>;
226                #dma-cells = <3>;
227
228                ti,sci = <&dmsc>;
229                ti,sci-dev-id = <26>;
230
231                ti,sci-rm-range-bchan = <0x20>; /* BLOCK_COPY_CHAN */
232                ti,sci-rm-range-rchan = <0x21>; /* SPLIT_TR_RX_CHAN */
233                ti,sci-rm-range-tchan = <0x22>; /* SPLIT_TR_TX_CHAN */
234            };
235        };
236    };
237