xref: /freebsd/sys/contrib/device-tree/Bindings/media/renesas,drif.yaml (revision 2eb4d8dc723da3cf7d735a3226ae49da4c8c5dbc)
1*2eb4d8dcSEmmanuel Vadot# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2*2eb4d8dcSEmmanuel Vadot%YAML 1.2
3*2eb4d8dcSEmmanuel Vadot---
4*2eb4d8dcSEmmanuel Vadot$id: http://devicetree.org/schemas/media/renesas,drif.yaml#
5*2eb4d8dcSEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
6*2eb4d8dcSEmmanuel Vadot
7*2eb4d8dcSEmmanuel Vadottitle: Renesas R-Car Gen3 Digital Radio Interface Controller (DRIF)
8*2eb4d8dcSEmmanuel Vadot
9*2eb4d8dcSEmmanuel Vadotmaintainers:
10*2eb4d8dcSEmmanuel Vadot  - Ramesh Shanmugasundaram <rashanmu@gmail.com>
11*2eb4d8dcSEmmanuel Vadot  - Fabrizio Castro <fabrizio.castro.jz@renesas.com>
12*2eb4d8dcSEmmanuel Vadot
13*2eb4d8dcSEmmanuel Vadotdescription: |
14*2eb4d8dcSEmmanuel Vadot  R-Car Gen3 DRIF is a SPI like receive only slave device. A general
15*2eb4d8dcSEmmanuel Vadot  representation of DRIF interfacing with a master device is shown below.
16*2eb4d8dcSEmmanuel Vadot
17*2eb4d8dcSEmmanuel Vadot  +---------------------+                +---------------------+
18*2eb4d8dcSEmmanuel Vadot  |                     |-----SCK------->|CLK                  |
19*2eb4d8dcSEmmanuel Vadot  |       Master        |-----SS-------->|SYNC  DRIFn (slave)  |
20*2eb4d8dcSEmmanuel Vadot  |                     |-----SD0------->|D0                   |
21*2eb4d8dcSEmmanuel Vadot  |                     |-----SD1------->|D1                   |
22*2eb4d8dcSEmmanuel Vadot  +---------------------+                +---------------------+
23*2eb4d8dcSEmmanuel Vadot
24*2eb4d8dcSEmmanuel Vadot  As per datasheet, each DRIF channel (drifn) is made up of two internal
25*2eb4d8dcSEmmanuel Vadot  channels (drifn0 & drifn1). These two internal channels share the common
26*2eb4d8dcSEmmanuel Vadot  CLK & SYNC. Each internal channel has its own dedicated resources like
27*2eb4d8dcSEmmanuel Vadot  irq, dma channels, address space & clock. This internal split is not
28*2eb4d8dcSEmmanuel Vadot  visible to the external master device.
29*2eb4d8dcSEmmanuel Vadot
30*2eb4d8dcSEmmanuel Vadot  The device tree model represents each internal channel as a separate node.
31*2eb4d8dcSEmmanuel Vadot  The internal channels sharing the CLK & SYNC are tied together by their
32*2eb4d8dcSEmmanuel Vadot  phandles using a property called "renesas,bonding". For the rest of
33*2eb4d8dcSEmmanuel Vadot  the documentation, unless explicitly stated, the word channel implies an
34*2eb4d8dcSEmmanuel Vadot  internal channel.
35*2eb4d8dcSEmmanuel Vadot
36*2eb4d8dcSEmmanuel Vadot  When both internal channels are enabled they need to be managed together
37*2eb4d8dcSEmmanuel Vadot  as one (i.e.) they cannot operate alone as independent devices. Out of the
38*2eb4d8dcSEmmanuel Vadot  two, one of them needs to act as a primary device that accepts common
39*2eb4d8dcSEmmanuel Vadot  properties of both the internal channels. This channel is identified by a
40*2eb4d8dcSEmmanuel Vadot  property called "renesas,primary-bond".
41*2eb4d8dcSEmmanuel Vadot
42*2eb4d8dcSEmmanuel Vadot  To summarize,
43*2eb4d8dcSEmmanuel Vadot     * When both the internal channels that are bonded together are enabled,
44*2eb4d8dcSEmmanuel Vadot       the zeroth channel is selected as primary-bond. This channels accepts
45*2eb4d8dcSEmmanuel Vadot       properties common to all the members of the bond.
46*2eb4d8dcSEmmanuel Vadot     * When only one of the bonded channels need to be enabled, the property
47*2eb4d8dcSEmmanuel Vadot       "renesas,bonding" or "renesas,primary-bond" will have no effect. That
48*2eb4d8dcSEmmanuel Vadot       enabled channel can act alone as any other independent device.
49*2eb4d8dcSEmmanuel Vadot
50*2eb4d8dcSEmmanuel Vadotproperties:
51*2eb4d8dcSEmmanuel Vadot  compatible:
52*2eb4d8dcSEmmanuel Vadot    items:
53*2eb4d8dcSEmmanuel Vadot      - enum:
54*2eb4d8dcSEmmanuel Vadot          - renesas,r8a7795-drif        # R-Car H3
55*2eb4d8dcSEmmanuel Vadot          - renesas,r8a7796-drif        # R-Car M3-W
56*2eb4d8dcSEmmanuel Vadot          - renesas,r8a77965-drif       # R-Car M3-N
57*2eb4d8dcSEmmanuel Vadot          - renesas,r8a77990-drif       # R-Car E3
58*2eb4d8dcSEmmanuel Vadot      - const: renesas,rcar-gen3-drif   # Generic R-Car Gen3 compatible device
59*2eb4d8dcSEmmanuel Vadot
60*2eb4d8dcSEmmanuel Vadot  reg:
61*2eb4d8dcSEmmanuel Vadot    maxItems: 1
62*2eb4d8dcSEmmanuel Vadot
63*2eb4d8dcSEmmanuel Vadot  interrupts:
64*2eb4d8dcSEmmanuel Vadot    maxItems: 1
65*2eb4d8dcSEmmanuel Vadot
66*2eb4d8dcSEmmanuel Vadot  clocks:
67*2eb4d8dcSEmmanuel Vadot    maxItems: 1
68*2eb4d8dcSEmmanuel Vadot
69*2eb4d8dcSEmmanuel Vadot  clock-names:
70*2eb4d8dcSEmmanuel Vadot    const: fck
71*2eb4d8dcSEmmanuel Vadot
72*2eb4d8dcSEmmanuel Vadot  resets:
73*2eb4d8dcSEmmanuel Vadot    maxItems: 1
74*2eb4d8dcSEmmanuel Vadot
75*2eb4d8dcSEmmanuel Vadot  dmas:
76*2eb4d8dcSEmmanuel Vadot    minItems: 1
77*2eb4d8dcSEmmanuel Vadot    maxItems: 2
78*2eb4d8dcSEmmanuel Vadot
79*2eb4d8dcSEmmanuel Vadot  dma-names:
80*2eb4d8dcSEmmanuel Vadot    minItems: 1
81*2eb4d8dcSEmmanuel Vadot    maxItems: 2
82*2eb4d8dcSEmmanuel Vadot    items:
83*2eb4d8dcSEmmanuel Vadot      - const: rx
84*2eb4d8dcSEmmanuel Vadot      - const: rx
85*2eb4d8dcSEmmanuel Vadot
86*2eb4d8dcSEmmanuel Vadot  renesas,bonding:
87*2eb4d8dcSEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/phandle
88*2eb4d8dcSEmmanuel Vadot    description:
89*2eb4d8dcSEmmanuel Vadot      The phandle to the other internal channel of DRIF
90*2eb4d8dcSEmmanuel Vadot
91*2eb4d8dcSEmmanuel Vadot  power-domains:
92*2eb4d8dcSEmmanuel Vadot    maxItems: 1
93*2eb4d8dcSEmmanuel Vadot
94*2eb4d8dcSEmmanuel Vadot  renesas,primary-bond:
95*2eb4d8dcSEmmanuel Vadot    type: boolean
96*2eb4d8dcSEmmanuel Vadot    description:
97*2eb4d8dcSEmmanuel Vadot      Indicates that the channel acts as primary among the bonded channels.
98*2eb4d8dcSEmmanuel Vadot
99*2eb4d8dcSEmmanuel Vadot  port:
100*2eb4d8dcSEmmanuel Vadot    $ref: /schemas/graph.yaml#/properties/port
101*2eb4d8dcSEmmanuel Vadot    unevaluatedProperties: false
102*2eb4d8dcSEmmanuel Vadot    description:
103*2eb4d8dcSEmmanuel Vadot      Child port node corresponding to the data input. The port node must
104*2eb4d8dcSEmmanuel Vadot      contain at least one endpoint.
105*2eb4d8dcSEmmanuel Vadot
106*2eb4d8dcSEmmanuel Vadot    properties:
107*2eb4d8dcSEmmanuel Vadot      endpoint:
108*2eb4d8dcSEmmanuel Vadot        $ref: /schemas/graph.yaml#/$defs/endpoint-base
109*2eb4d8dcSEmmanuel Vadot        unevaluatedProperties: false
110*2eb4d8dcSEmmanuel Vadot
111*2eb4d8dcSEmmanuel Vadot        properties:
112*2eb4d8dcSEmmanuel Vadot          sync-active:
113*2eb4d8dcSEmmanuel Vadot            $ref: /schemas/types.yaml#/definitions/uint32
114*2eb4d8dcSEmmanuel Vadot            enum: [0, 1]
115*2eb4d8dcSEmmanuel Vadot            description:
116*2eb4d8dcSEmmanuel Vadot              Indicates sync signal polarity, 0/1 for low/high respectively.
117*2eb4d8dcSEmmanuel Vadot              This property maps to SYNCAC bit in the hardware manual. The
118*2eb4d8dcSEmmanuel Vadot              default is 1 (active high).
119*2eb4d8dcSEmmanuel Vadot
120*2eb4d8dcSEmmanuel Vadotrequired:
121*2eb4d8dcSEmmanuel Vadot  - compatible
122*2eb4d8dcSEmmanuel Vadot  - reg
123*2eb4d8dcSEmmanuel Vadot  - interrupts
124*2eb4d8dcSEmmanuel Vadot  - clocks
125*2eb4d8dcSEmmanuel Vadot  - clock-names
126*2eb4d8dcSEmmanuel Vadot  - resets
127*2eb4d8dcSEmmanuel Vadot  - dmas
128*2eb4d8dcSEmmanuel Vadot  - dma-names
129*2eb4d8dcSEmmanuel Vadot  - renesas,bonding
130*2eb4d8dcSEmmanuel Vadot  - power-domains
131*2eb4d8dcSEmmanuel Vadot
132*2eb4d8dcSEmmanuel VadotallOf:
133*2eb4d8dcSEmmanuel Vadot  - if:
134*2eb4d8dcSEmmanuel Vadot      required:
135*2eb4d8dcSEmmanuel Vadot        - renesas,primary-bond
136*2eb4d8dcSEmmanuel Vadot    then:
137*2eb4d8dcSEmmanuel Vadot      required:
138*2eb4d8dcSEmmanuel Vadot        - pinctrl-0
139*2eb4d8dcSEmmanuel Vadot        - pinctrl-names
140*2eb4d8dcSEmmanuel Vadot        - port
141*2eb4d8dcSEmmanuel Vadot
142*2eb4d8dcSEmmanuel Vadot  - if:
143*2eb4d8dcSEmmanuel Vadot      required:
144*2eb4d8dcSEmmanuel Vadot        - port
145*2eb4d8dcSEmmanuel Vadot    then:
146*2eb4d8dcSEmmanuel Vadot      required:
147*2eb4d8dcSEmmanuel Vadot        - pinctrl-0
148*2eb4d8dcSEmmanuel Vadot        - pinctrl-names
149*2eb4d8dcSEmmanuel Vadot    else:
150*2eb4d8dcSEmmanuel Vadot      properties:
151*2eb4d8dcSEmmanuel Vadot        pinctrl-0: false
152*2eb4d8dcSEmmanuel Vadot        pinctrl-names: false
153*2eb4d8dcSEmmanuel Vadot
154*2eb4d8dcSEmmanuel VadotadditionalProperties: false
155*2eb4d8dcSEmmanuel Vadot
156*2eb4d8dcSEmmanuel Vadotexamples:
157*2eb4d8dcSEmmanuel Vadot  # Example with both internal channels enabled.
158*2eb4d8dcSEmmanuel Vadot  #
159*2eb4d8dcSEmmanuel Vadot  # When interfacing with a third party tuner device with two data pins as shown
160*2eb4d8dcSEmmanuel Vadot  # below.
161*2eb4d8dcSEmmanuel Vadot  #
162*2eb4d8dcSEmmanuel Vadot  # +---------------------+                +---------------------+
163*2eb4d8dcSEmmanuel Vadot  # |                     |-----SCK------->|CLK                  |
164*2eb4d8dcSEmmanuel Vadot  # |       Master        |-----SS-------->|SYNC  DRIFn (slave)  |
165*2eb4d8dcSEmmanuel Vadot  # |                     |-----SD0------->|D0                   |
166*2eb4d8dcSEmmanuel Vadot  # |                     |-----SD1------->|D1                   |
167*2eb4d8dcSEmmanuel Vadot  # +---------------------+                +---------------------+
168*2eb4d8dcSEmmanuel Vadot  - |
169*2eb4d8dcSEmmanuel Vadot    #include <dt-bindings/clock/r8a7795-cpg-mssr.h>
170*2eb4d8dcSEmmanuel Vadot    #include <dt-bindings/interrupt-controller/arm-gic.h>
171*2eb4d8dcSEmmanuel Vadot    #include <dt-bindings/power/r8a7795-sysc.h>
172*2eb4d8dcSEmmanuel Vadot
173*2eb4d8dcSEmmanuel Vadot    soc {
174*2eb4d8dcSEmmanuel Vadot            #address-cells = <2>;
175*2eb4d8dcSEmmanuel Vadot            #size-cells = <2>;
176*2eb4d8dcSEmmanuel Vadot
177*2eb4d8dcSEmmanuel Vadot            drif00: rif@e6f40000 {
178*2eb4d8dcSEmmanuel Vadot                    compatible = "renesas,r8a7795-drif",
179*2eb4d8dcSEmmanuel Vadot                                 "renesas,rcar-gen3-drif";
180*2eb4d8dcSEmmanuel Vadot                    reg = <0 0xe6f40000 0 0x64>;
181*2eb4d8dcSEmmanuel Vadot                    interrupts = <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>;
182*2eb4d8dcSEmmanuel Vadot                    clocks = <&cpg CPG_MOD 515>;
183*2eb4d8dcSEmmanuel Vadot                    clock-names = "fck";
184*2eb4d8dcSEmmanuel Vadot                    dmas = <&dmac1 0x20>, <&dmac2 0x20>;
185*2eb4d8dcSEmmanuel Vadot                    dma-names = "rx", "rx";
186*2eb4d8dcSEmmanuel Vadot                    power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
187*2eb4d8dcSEmmanuel Vadot                    renesas,bonding = <&drif01>;
188*2eb4d8dcSEmmanuel Vadot                    resets = <&cpg 515>;
189*2eb4d8dcSEmmanuel Vadot                    renesas,primary-bond;
190*2eb4d8dcSEmmanuel Vadot                    pinctrl-0 = <&drif0_pins>;
191*2eb4d8dcSEmmanuel Vadot                    pinctrl-names = "default";
192*2eb4d8dcSEmmanuel Vadot                    port {
193*2eb4d8dcSEmmanuel Vadot                            drif0_ep: endpoint {
194*2eb4d8dcSEmmanuel Vadot                                 remote-endpoint = <&tuner_ep>;
195*2eb4d8dcSEmmanuel Vadot                            };
196*2eb4d8dcSEmmanuel Vadot                    };
197*2eb4d8dcSEmmanuel Vadot            };
198*2eb4d8dcSEmmanuel Vadot
199*2eb4d8dcSEmmanuel Vadot            drif01: rif@e6f50000 {
200*2eb4d8dcSEmmanuel Vadot                    compatible = "renesas,r8a7795-drif",
201*2eb4d8dcSEmmanuel Vadot                                 "renesas,rcar-gen3-drif";
202*2eb4d8dcSEmmanuel Vadot                    reg = <0 0xe6f50000 0 0x64>;
203*2eb4d8dcSEmmanuel Vadot                    interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>;
204*2eb4d8dcSEmmanuel Vadot                    clocks = <&cpg CPG_MOD 514>;
205*2eb4d8dcSEmmanuel Vadot                    clock-names = "fck";
206*2eb4d8dcSEmmanuel Vadot                    dmas = <&dmac1 0x22>, <&dmac2 0x22>;
207*2eb4d8dcSEmmanuel Vadot                    dma-names = "rx", "rx";
208*2eb4d8dcSEmmanuel Vadot                    power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
209*2eb4d8dcSEmmanuel Vadot                    renesas,bonding = <&drif00>;
210*2eb4d8dcSEmmanuel Vadot                    resets = <&cpg 514>;
211*2eb4d8dcSEmmanuel Vadot            };
212*2eb4d8dcSEmmanuel Vadot    };
213*2eb4d8dcSEmmanuel Vadot
214*2eb4d8dcSEmmanuel Vadot  # Example with internal channel 1 alone enabled.
215*2eb4d8dcSEmmanuel Vadot  #
216*2eb4d8dcSEmmanuel Vadot  # When interfacing with a third party tuner device with one data pin as shown
217*2eb4d8dcSEmmanuel Vadot  # below.
218*2eb4d8dcSEmmanuel Vadot  #
219*2eb4d8dcSEmmanuel Vadot  # +---------------------+                +---------------------+
220*2eb4d8dcSEmmanuel Vadot  # |                     |-----SCK------->|CLK                  |
221*2eb4d8dcSEmmanuel Vadot  # |       Master        |-----SS-------->|SYNC  DRIFn (slave)  |
222*2eb4d8dcSEmmanuel Vadot  # |                     |                |D0 (unused)          |
223*2eb4d8dcSEmmanuel Vadot  # |                     |-----SD-------->|D1                   |
224*2eb4d8dcSEmmanuel Vadot  # +---------------------+                +---------------------+
225*2eb4d8dcSEmmanuel Vadot  - |
226*2eb4d8dcSEmmanuel Vadot    #include <dt-bindings/clock/r8a7795-cpg-mssr.h>
227*2eb4d8dcSEmmanuel Vadot    #include <dt-bindings/interrupt-controller/arm-gic.h>
228*2eb4d8dcSEmmanuel Vadot    #include <dt-bindings/power/r8a7795-sysc.h>
229*2eb4d8dcSEmmanuel Vadot
230*2eb4d8dcSEmmanuel Vadot    soc {
231*2eb4d8dcSEmmanuel Vadot            #address-cells = <2>;
232*2eb4d8dcSEmmanuel Vadot            #size-cells = <2>;
233*2eb4d8dcSEmmanuel Vadot
234*2eb4d8dcSEmmanuel Vadot            drif10: rif@e6f60000 {
235*2eb4d8dcSEmmanuel Vadot                    compatible = "renesas,r8a7795-drif",
236*2eb4d8dcSEmmanuel Vadot                                 "renesas,rcar-gen3-drif";
237*2eb4d8dcSEmmanuel Vadot                    reg = <0 0xe6f60000 0 0x64>;
238*2eb4d8dcSEmmanuel Vadot                    interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
239*2eb4d8dcSEmmanuel Vadot                    clocks = <&cpg CPG_MOD 513>;
240*2eb4d8dcSEmmanuel Vadot                    clock-names = "fck";
241*2eb4d8dcSEmmanuel Vadot                    dmas = <&dmac1 0x24>, <&dmac2 0x24>;
242*2eb4d8dcSEmmanuel Vadot                    dma-names = "rx", "rx";
243*2eb4d8dcSEmmanuel Vadot                    power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
244*2eb4d8dcSEmmanuel Vadot                    resets = <&cpg 513>;
245*2eb4d8dcSEmmanuel Vadot                    renesas,bonding = <&drif11>;
246*2eb4d8dcSEmmanuel Vadot                    status = "disabled";
247*2eb4d8dcSEmmanuel Vadot            };
248*2eb4d8dcSEmmanuel Vadot
249*2eb4d8dcSEmmanuel Vadot            drif11: rif@e6f70000 {
250*2eb4d8dcSEmmanuel Vadot                    compatible = "renesas,r8a7795-drif",
251*2eb4d8dcSEmmanuel Vadot                                 "renesas,rcar-gen3-drif";
252*2eb4d8dcSEmmanuel Vadot                    reg = <0 0xe6f70000 0 0x64>;
253*2eb4d8dcSEmmanuel Vadot                    interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
254*2eb4d8dcSEmmanuel Vadot                    clocks = <&cpg CPG_MOD 512>;
255*2eb4d8dcSEmmanuel Vadot                    clock-names = "fck";
256*2eb4d8dcSEmmanuel Vadot                    dmas = <&dmac1 0x26>, <&dmac2 0x26>;
257*2eb4d8dcSEmmanuel Vadot                    dma-names = "rx", "rx";
258*2eb4d8dcSEmmanuel Vadot                    power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
259*2eb4d8dcSEmmanuel Vadot                    resets = <&cpg 512>;
260*2eb4d8dcSEmmanuel Vadot                    renesas,bonding = <&drif10>;
261*2eb4d8dcSEmmanuel Vadot                    pinctrl-0 = <&drif1_pins>;
262*2eb4d8dcSEmmanuel Vadot                    pinctrl-names = "default";
263*2eb4d8dcSEmmanuel Vadot                    port {
264*2eb4d8dcSEmmanuel Vadot                            drif1_ep: endpoint {
265*2eb4d8dcSEmmanuel Vadot                                 remote-endpoint = <&tuner_ep1>;
266*2eb4d8dcSEmmanuel Vadot                                 sync-active = <0>;
267*2eb4d8dcSEmmanuel Vadot                            };
268*2eb4d8dcSEmmanuel Vadot                    };
269*2eb4d8dcSEmmanuel Vadot            };
270*2eb4d8dcSEmmanuel Vadot    };
271*2eb4d8dcSEmmanuel Vadot...
272