xref: /OK3568_Linux_fs/kernel/Documentation/devicetree/bindings/media/renesas,drif.txt (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunRenesas R-Car Gen3 Digital Radio Interface controller (DRIF)
2*4882a593Smuzhiyun------------------------------------------------------------
3*4882a593Smuzhiyun
4*4882a593SmuzhiyunR-Car Gen3 DRIF is a SPI like receive only slave device. A general
5*4882a593Smuzhiyunrepresentation of DRIF interfacing with a master device is shown below.
6*4882a593Smuzhiyun
7*4882a593Smuzhiyun+---------------------+                +---------------------+
8*4882a593Smuzhiyun|                     |-----SCK------->|CLK                  |
9*4882a593Smuzhiyun|       Master        |-----SS-------->|SYNC  DRIFn (slave)  |
10*4882a593Smuzhiyun|                     |-----SD0------->|D0                   |
11*4882a593Smuzhiyun|                     |-----SD1------->|D1                   |
12*4882a593Smuzhiyun+---------------------+                +---------------------+
13*4882a593Smuzhiyun
14*4882a593SmuzhiyunAs per datasheet, each DRIF channel (drifn) is made up of two internal
15*4882a593Smuzhiyunchannels (drifn0 & drifn1). These two internal channels share the common
16*4882a593SmuzhiyunCLK & SYNC. Each internal channel has its own dedicated resources like
17*4882a593Smuzhiyunirq, dma channels, address space & clock. This internal split is not
18*4882a593Smuzhiyunvisible to the external master device.
19*4882a593Smuzhiyun
20*4882a593SmuzhiyunThe device tree model represents each internal channel as a separate node.
21*4882a593SmuzhiyunThe internal channels sharing the CLK & SYNC are tied together by their
22*4882a593Smuzhiyunphandles using a property called "renesas,bonding". For the rest of
23*4882a593Smuzhiyunthe documentation, unless explicitly stated, the word channel implies an
24*4882a593Smuzhiyuninternal channel.
25*4882a593Smuzhiyun
26*4882a593SmuzhiyunWhen both internal channels are enabled they need to be managed together
27*4882a593Smuzhiyunas one (i.e.) they cannot operate alone as independent devices. Out of the
28*4882a593Smuzhiyuntwo, one of them needs to act as a primary device that accepts common
29*4882a593Smuzhiyunproperties of both the internal channels. This channel is identified by a
30*4882a593Smuzhiyunproperty called "renesas,primary-bond".
31*4882a593Smuzhiyun
32*4882a593SmuzhiyunTo summarize,
33*4882a593Smuzhiyun   - When both the internal channels that are bonded together are enabled,
34*4882a593Smuzhiyun     the zeroth channel is selected as primary-bond. This channels accepts
35*4882a593Smuzhiyun     properties common to all the members of the bond.
36*4882a593Smuzhiyun   - When only one of the bonded channels need to be enabled, the property
37*4882a593Smuzhiyun     "renesas,bonding" or "renesas,primary-bond" will have no effect. That
38*4882a593Smuzhiyun     enabled channel can act alone as any other independent device.
39*4882a593Smuzhiyun
40*4882a593SmuzhiyunRequired properties of an internal channel:
41*4882a593Smuzhiyun-------------------------------------------
42*4882a593Smuzhiyun- compatible:	"renesas,r8a7795-drif" if DRIF controller is a part of R8A7795 SoC.
43*4882a593Smuzhiyun		"renesas,r8a7796-drif" if DRIF controller is a part of R8A7796 SoC.
44*4882a593Smuzhiyun		"renesas,rcar-gen3-drif" for a generic R-Car Gen3 compatible device.
45*4882a593Smuzhiyun
46*4882a593Smuzhiyun		When compatible with the generic version, nodes must list the
47*4882a593Smuzhiyun		SoC-specific version corresponding to the platform first
48*4882a593Smuzhiyun		followed by the generic version.
49*4882a593Smuzhiyun
50*4882a593Smuzhiyun- reg: offset and length of that channel.
51*4882a593Smuzhiyun- interrupts: associated with that channel.
52*4882a593Smuzhiyun- clocks: phandle and clock specifier of that channel.
53*4882a593Smuzhiyun- clock-names: clock input name string: "fck".
54*4882a593Smuzhiyun- dmas: phandles to the DMA channels.
55*4882a593Smuzhiyun- dma-names: names of the DMA channel: "rx".
56*4882a593Smuzhiyun- renesas,bonding: phandle to the other channel.
57*4882a593Smuzhiyun
58*4882a593SmuzhiyunOptional properties of an internal channel:
59*4882a593Smuzhiyun-------------------------------------------
60*4882a593Smuzhiyun- power-domains: phandle to the respective power domain.
61*4882a593Smuzhiyun
62*4882a593SmuzhiyunRequired properties of an internal channel when:
63*4882a593Smuzhiyun	- It is the only enabled channel of the bond (or)
64*4882a593Smuzhiyun	- If it acts as primary among enabled bonds
65*4882a593Smuzhiyun--------------------------------------------------------
66*4882a593Smuzhiyun- pinctrl-0: pin control group to be used for this channel.
67*4882a593Smuzhiyun- pinctrl-names: must be "default".
68*4882a593Smuzhiyun- renesas,primary-bond: empty property indicating the channel acts as primary
69*4882a593Smuzhiyun			among the bonded channels.
70*4882a593Smuzhiyun- port: child port node corresponding to the data input, in accordance with
71*4882a593Smuzhiyun	the video interface bindings defined in
72*4882a593Smuzhiyun	Documentation/devicetree/bindings/media/video-interfaces.txt. The port
73*4882a593Smuzhiyun	node must contain at least one endpoint.
74*4882a593Smuzhiyun
75*4882a593SmuzhiyunOptional endpoint property:
76*4882a593Smuzhiyun---------------------------
77*4882a593Smuzhiyun- sync-active: Indicates sync signal polarity, 0/1 for low/high respectively.
78*4882a593Smuzhiyun	       This property maps to SYNCAC bit in the hardware manual. The
79*4882a593Smuzhiyun	       default is 1 (active high).
80*4882a593Smuzhiyun
81*4882a593SmuzhiyunExample:
82*4882a593Smuzhiyun--------
83*4882a593Smuzhiyun
84*4882a593Smuzhiyun(1) Both internal channels enabled:
85*4882a593Smuzhiyun-----------------------------------
86*4882a593Smuzhiyun
87*4882a593SmuzhiyunWhen interfacing with a third party tuner device with two data pins as shown
88*4882a593Smuzhiyunbelow.
89*4882a593Smuzhiyun
90*4882a593Smuzhiyun+---------------------+                +---------------------+
91*4882a593Smuzhiyun|                     |-----SCK------->|CLK                  |
92*4882a593Smuzhiyun|       Master        |-----SS-------->|SYNC  DRIFn (slave)  |
93*4882a593Smuzhiyun|                     |-----SD0------->|D0                   |
94*4882a593Smuzhiyun|                     |-----SD1------->|D1                   |
95*4882a593Smuzhiyun+---------------------+                +---------------------+
96*4882a593Smuzhiyun
97*4882a593Smuzhiyun	drif00: rif@e6f40000 {
98*4882a593Smuzhiyun		compatible = "renesas,r8a7795-drif",
99*4882a593Smuzhiyun			     "renesas,rcar-gen3-drif";
100*4882a593Smuzhiyun		reg = <0 0xe6f40000 0 0x64>;
101*4882a593Smuzhiyun		interrupts = <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>;
102*4882a593Smuzhiyun		clocks = <&cpg CPG_MOD 515>;
103*4882a593Smuzhiyun		clock-names = "fck";
104*4882a593Smuzhiyun		dmas = <&dmac1 0x20>, <&dmac2 0x20>;
105*4882a593Smuzhiyun		dma-names = "rx", "rx";
106*4882a593Smuzhiyun		power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
107*4882a593Smuzhiyun		renesas,bonding = <&drif01>;
108*4882a593Smuzhiyun		renesas,primary-bond;
109*4882a593Smuzhiyun		pinctrl-0 = <&drif0_pins>;
110*4882a593Smuzhiyun		pinctrl-names = "default";
111*4882a593Smuzhiyun		port {
112*4882a593Smuzhiyun			drif0_ep: endpoint {
113*4882a593Smuzhiyun			     remote-endpoint = <&tuner_ep>;
114*4882a593Smuzhiyun			};
115*4882a593Smuzhiyun		};
116*4882a593Smuzhiyun	};
117*4882a593Smuzhiyun
118*4882a593Smuzhiyun	drif01: rif@e6f50000 {
119*4882a593Smuzhiyun		compatible = "renesas,r8a7795-drif",
120*4882a593Smuzhiyun			     "renesas,rcar-gen3-drif";
121*4882a593Smuzhiyun		reg = <0 0xe6f50000 0 0x64>;
122*4882a593Smuzhiyun		interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>;
123*4882a593Smuzhiyun		clocks = <&cpg CPG_MOD 514>;
124*4882a593Smuzhiyun		clock-names = "fck";
125*4882a593Smuzhiyun		dmas = <&dmac1 0x22>, <&dmac2 0x22>;
126*4882a593Smuzhiyun		dma-names = "rx", "rx";
127*4882a593Smuzhiyun		power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
128*4882a593Smuzhiyun		renesas,bonding = <&drif00>;
129*4882a593Smuzhiyun	};
130*4882a593Smuzhiyun
131*4882a593Smuzhiyun
132*4882a593Smuzhiyun(2) Internal channel 1 alone is enabled:
133*4882a593Smuzhiyun----------------------------------------
134*4882a593Smuzhiyun
135*4882a593SmuzhiyunWhen interfacing with a third party tuner device with one data pin as shown
136*4882a593Smuzhiyunbelow.
137*4882a593Smuzhiyun
138*4882a593Smuzhiyun+---------------------+                +---------------------+
139*4882a593Smuzhiyun|                     |-----SCK------->|CLK                  |
140*4882a593Smuzhiyun|       Master        |-----SS-------->|SYNC  DRIFn (slave)  |
141*4882a593Smuzhiyun|                     |                |D0 (unused)          |
142*4882a593Smuzhiyun|                     |-----SD-------->|D1                   |
143*4882a593Smuzhiyun+---------------------+                +---------------------+
144*4882a593Smuzhiyun
145*4882a593Smuzhiyun	drif00: rif@e6f40000 {
146*4882a593Smuzhiyun		compatible = "renesas,r8a7795-drif",
147*4882a593Smuzhiyun			     "renesas,rcar-gen3-drif";
148*4882a593Smuzhiyun		reg = <0 0xe6f40000 0 0x64>;
149*4882a593Smuzhiyun		interrupts = <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>;
150*4882a593Smuzhiyun		clocks = <&cpg CPG_MOD 515>;
151*4882a593Smuzhiyun		clock-names = "fck";
152*4882a593Smuzhiyun		dmas = <&dmac1 0x20>, <&dmac2 0x20>;
153*4882a593Smuzhiyun		dma-names = "rx", "rx";
154*4882a593Smuzhiyun		power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
155*4882a593Smuzhiyun		renesas,bonding = <&drif01>;
156*4882a593Smuzhiyun	};
157*4882a593Smuzhiyun
158*4882a593Smuzhiyun	drif01: rif@e6f50000 {
159*4882a593Smuzhiyun		compatible = "renesas,r8a7795-drif",
160*4882a593Smuzhiyun			     "renesas,rcar-gen3-drif";
161*4882a593Smuzhiyun		reg = <0 0xe6f50000 0 0x64>;
162*4882a593Smuzhiyun		interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>;
163*4882a593Smuzhiyun		clocks = <&cpg CPG_MOD 514>;
164*4882a593Smuzhiyun		clock-names = "fck";
165*4882a593Smuzhiyun		dmas = <&dmac1 0x22>, <&dmac2 0x22>;
166*4882a593Smuzhiyun		dma-names = "rx", "rx";
167*4882a593Smuzhiyun		power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
168*4882a593Smuzhiyun		renesas,bonding = <&drif00>;
169*4882a593Smuzhiyun		pinctrl-0 = <&drif0_pins>;
170*4882a593Smuzhiyun		pinctrl-names = "default";
171*4882a593Smuzhiyun		port {
172*4882a593Smuzhiyun			drif0_ep: endpoint {
173*4882a593Smuzhiyun			     remote-endpoint = <&tuner_ep>;
174*4882a593Smuzhiyun			     sync-active = <0>;
175*4882a593Smuzhiyun			};
176*4882a593Smuzhiyun		};
177*4882a593Smuzhiyun	};
178