12eb4d8dcSEmmanuel Vadot# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause 22eb4d8dcSEmmanuel Vadot%YAML 1.2 32eb4d8dcSEmmanuel Vadot--- 42eb4d8dcSEmmanuel Vadot$id: http://devicetree.org/schemas/media/renesas,drif.yaml# 52eb4d8dcSEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml# 62eb4d8dcSEmmanuel Vadot 72eb4d8dcSEmmanuel Vadottitle: Renesas R-Car Gen3 Digital Radio Interface Controller (DRIF) 82eb4d8dcSEmmanuel Vadot 92eb4d8dcSEmmanuel Vadotmaintainers: 102eb4d8dcSEmmanuel Vadot - Ramesh Shanmugasundaram <rashanmu@gmail.com> 112eb4d8dcSEmmanuel Vadot - Fabrizio Castro <fabrizio.castro.jz@renesas.com> 122eb4d8dcSEmmanuel Vadot 132eb4d8dcSEmmanuel Vadotdescription: | 142eb4d8dcSEmmanuel Vadot R-Car Gen3 DRIF is a SPI like receive only slave device. A general 152eb4d8dcSEmmanuel Vadot representation of DRIF interfacing with a master device is shown below. 162eb4d8dcSEmmanuel Vadot 172eb4d8dcSEmmanuel Vadot +---------------------+ +---------------------+ 182eb4d8dcSEmmanuel Vadot | |-----SCK------->|CLK | 192eb4d8dcSEmmanuel Vadot | Master |-----SS-------->|SYNC DRIFn (slave) | 202eb4d8dcSEmmanuel Vadot | |-----SD0------->|D0 | 212eb4d8dcSEmmanuel Vadot | |-----SD1------->|D1 | 222eb4d8dcSEmmanuel Vadot +---------------------+ +---------------------+ 232eb4d8dcSEmmanuel Vadot 242eb4d8dcSEmmanuel Vadot As per datasheet, each DRIF channel (drifn) is made up of two internal 252eb4d8dcSEmmanuel Vadot channels (drifn0 & drifn1). These two internal channels share the common 262eb4d8dcSEmmanuel Vadot CLK & SYNC. Each internal channel has its own dedicated resources like 272eb4d8dcSEmmanuel Vadot irq, dma channels, address space & clock. This internal split is not 282eb4d8dcSEmmanuel Vadot visible to the external master device. 292eb4d8dcSEmmanuel Vadot 302eb4d8dcSEmmanuel Vadot The device tree model represents each internal channel as a separate node. 312eb4d8dcSEmmanuel Vadot The internal channels sharing the CLK & SYNC are tied together by their 322eb4d8dcSEmmanuel Vadot phandles using a property called "renesas,bonding". For the rest of 332eb4d8dcSEmmanuel Vadot the documentation, unless explicitly stated, the word channel implies an 342eb4d8dcSEmmanuel Vadot internal channel. 352eb4d8dcSEmmanuel Vadot 362eb4d8dcSEmmanuel Vadot When both internal channels are enabled they need to be managed together 372eb4d8dcSEmmanuel Vadot as one (i.e.) they cannot operate alone as independent devices. Out of the 382eb4d8dcSEmmanuel Vadot two, one of them needs to act as a primary device that accepts common 392eb4d8dcSEmmanuel Vadot properties of both the internal channels. This channel is identified by a 402eb4d8dcSEmmanuel Vadot property called "renesas,primary-bond". 412eb4d8dcSEmmanuel Vadot 422eb4d8dcSEmmanuel Vadot To summarize, 432eb4d8dcSEmmanuel Vadot * When both the internal channels that are bonded together are enabled, 442eb4d8dcSEmmanuel Vadot the zeroth channel is selected as primary-bond. This channels accepts 452eb4d8dcSEmmanuel Vadot properties common to all the members of the bond. 462eb4d8dcSEmmanuel Vadot * When only one of the bonded channels need to be enabled, the property 472eb4d8dcSEmmanuel Vadot "renesas,bonding" or "renesas,primary-bond" will have no effect. That 482eb4d8dcSEmmanuel Vadot enabled channel can act alone as any other independent device. 492eb4d8dcSEmmanuel Vadot 502eb4d8dcSEmmanuel Vadotproperties: 512eb4d8dcSEmmanuel Vadot compatible: 522eb4d8dcSEmmanuel Vadot items: 532eb4d8dcSEmmanuel Vadot - enum: 542eb4d8dcSEmmanuel Vadot - renesas,r8a7795-drif # R-Car H3 552eb4d8dcSEmmanuel Vadot - renesas,r8a7796-drif # R-Car M3-W 562eb4d8dcSEmmanuel Vadot - renesas,r8a77965-drif # R-Car M3-N 572eb4d8dcSEmmanuel Vadot - renesas,r8a77990-drif # R-Car E3 582eb4d8dcSEmmanuel Vadot - const: renesas,rcar-gen3-drif # Generic R-Car Gen3 compatible device 592eb4d8dcSEmmanuel Vadot 602eb4d8dcSEmmanuel Vadot reg: 612eb4d8dcSEmmanuel Vadot maxItems: 1 622eb4d8dcSEmmanuel Vadot 632eb4d8dcSEmmanuel Vadot interrupts: 642eb4d8dcSEmmanuel Vadot maxItems: 1 652eb4d8dcSEmmanuel Vadot 662eb4d8dcSEmmanuel Vadot clocks: 672eb4d8dcSEmmanuel Vadot maxItems: 1 682eb4d8dcSEmmanuel Vadot 692eb4d8dcSEmmanuel Vadot clock-names: 702eb4d8dcSEmmanuel Vadot const: fck 712eb4d8dcSEmmanuel Vadot 722eb4d8dcSEmmanuel Vadot resets: 732eb4d8dcSEmmanuel Vadot maxItems: 1 742eb4d8dcSEmmanuel Vadot 752eb4d8dcSEmmanuel Vadot dmas: 762eb4d8dcSEmmanuel Vadot minItems: 1 772eb4d8dcSEmmanuel Vadot maxItems: 2 782eb4d8dcSEmmanuel Vadot 792eb4d8dcSEmmanuel Vadot dma-names: 802eb4d8dcSEmmanuel Vadot minItems: 1 812eb4d8dcSEmmanuel Vadot items: 822eb4d8dcSEmmanuel Vadot - const: rx 832eb4d8dcSEmmanuel Vadot - const: rx 842eb4d8dcSEmmanuel Vadot 852eb4d8dcSEmmanuel Vadot renesas,bonding: 862eb4d8dcSEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/phandle 872eb4d8dcSEmmanuel Vadot description: 882eb4d8dcSEmmanuel Vadot The phandle to the other internal channel of DRIF 892eb4d8dcSEmmanuel Vadot 902eb4d8dcSEmmanuel Vadot power-domains: 912eb4d8dcSEmmanuel Vadot maxItems: 1 922eb4d8dcSEmmanuel Vadot 932eb4d8dcSEmmanuel Vadot renesas,primary-bond: 942eb4d8dcSEmmanuel Vadot type: boolean 952eb4d8dcSEmmanuel Vadot description: 962eb4d8dcSEmmanuel Vadot Indicates that the channel acts as primary among the bonded channels. 972eb4d8dcSEmmanuel Vadot 982eb4d8dcSEmmanuel Vadot port: 99*354d7675SEmmanuel Vadot $ref: /schemas/graph.yaml#/$defs/port-base 1002eb4d8dcSEmmanuel Vadot unevaluatedProperties: false 1012eb4d8dcSEmmanuel Vadot description: 1022eb4d8dcSEmmanuel Vadot Child port node corresponding to the data input. The port node must 1032eb4d8dcSEmmanuel Vadot contain at least one endpoint. 1042eb4d8dcSEmmanuel Vadot 1052eb4d8dcSEmmanuel Vadot properties: 1062eb4d8dcSEmmanuel Vadot endpoint: 1072eb4d8dcSEmmanuel Vadot $ref: /schemas/graph.yaml#/$defs/endpoint-base 1082eb4d8dcSEmmanuel Vadot unevaluatedProperties: false 1092eb4d8dcSEmmanuel Vadot 1102eb4d8dcSEmmanuel Vadot properties: 1112eb4d8dcSEmmanuel Vadot sync-active: 1122eb4d8dcSEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/uint32 1132eb4d8dcSEmmanuel Vadot enum: [0, 1] 1142eb4d8dcSEmmanuel Vadot description: 1152eb4d8dcSEmmanuel Vadot Indicates sync signal polarity, 0/1 for low/high respectively. 1162eb4d8dcSEmmanuel Vadot This property maps to SYNCAC bit in the hardware manual. The 1172eb4d8dcSEmmanuel Vadot default is 1 (active high). 1182eb4d8dcSEmmanuel Vadot 1192eb4d8dcSEmmanuel Vadotrequired: 1202eb4d8dcSEmmanuel Vadot - compatible 1212eb4d8dcSEmmanuel Vadot - reg 1222eb4d8dcSEmmanuel Vadot - interrupts 1232eb4d8dcSEmmanuel Vadot - clocks 1242eb4d8dcSEmmanuel Vadot - clock-names 1252eb4d8dcSEmmanuel Vadot - resets 1262eb4d8dcSEmmanuel Vadot - dmas 1272eb4d8dcSEmmanuel Vadot - dma-names 1282eb4d8dcSEmmanuel Vadot - renesas,bonding 1292eb4d8dcSEmmanuel Vadot - power-domains 1302eb4d8dcSEmmanuel Vadot 1312eb4d8dcSEmmanuel VadotallOf: 1322eb4d8dcSEmmanuel Vadot - if: 1332eb4d8dcSEmmanuel Vadot required: 1342eb4d8dcSEmmanuel Vadot - renesas,primary-bond 1352eb4d8dcSEmmanuel Vadot then: 1362eb4d8dcSEmmanuel Vadot required: 1372eb4d8dcSEmmanuel Vadot - pinctrl-0 1382eb4d8dcSEmmanuel Vadot - pinctrl-names 1392eb4d8dcSEmmanuel Vadot - port 1402eb4d8dcSEmmanuel Vadot 1412eb4d8dcSEmmanuel Vadot - if: 1422eb4d8dcSEmmanuel Vadot required: 1432eb4d8dcSEmmanuel Vadot - port 1442eb4d8dcSEmmanuel Vadot then: 1452eb4d8dcSEmmanuel Vadot required: 1462eb4d8dcSEmmanuel Vadot - pinctrl-0 1472eb4d8dcSEmmanuel Vadot - pinctrl-names 1482eb4d8dcSEmmanuel Vadot else: 1492eb4d8dcSEmmanuel Vadot properties: 1502eb4d8dcSEmmanuel Vadot pinctrl-0: false 1512eb4d8dcSEmmanuel Vadot pinctrl-names: false 1522eb4d8dcSEmmanuel Vadot 1532eb4d8dcSEmmanuel VadotadditionalProperties: false 1542eb4d8dcSEmmanuel Vadot 1552eb4d8dcSEmmanuel Vadotexamples: 1562eb4d8dcSEmmanuel Vadot # Example with both internal channels enabled. 1572eb4d8dcSEmmanuel Vadot # 1582eb4d8dcSEmmanuel Vadot # When interfacing with a third party tuner device with two data pins as shown 1592eb4d8dcSEmmanuel Vadot # below. 1602eb4d8dcSEmmanuel Vadot # 1612eb4d8dcSEmmanuel Vadot # +---------------------+ +---------------------+ 1622eb4d8dcSEmmanuel Vadot # | |-----SCK------->|CLK | 1632eb4d8dcSEmmanuel Vadot # | Master |-----SS-------->|SYNC DRIFn (slave) | 1642eb4d8dcSEmmanuel Vadot # | |-----SD0------->|D0 | 1652eb4d8dcSEmmanuel Vadot # | |-----SD1------->|D1 | 1662eb4d8dcSEmmanuel Vadot # +---------------------+ +---------------------+ 1672eb4d8dcSEmmanuel Vadot - | 1682eb4d8dcSEmmanuel Vadot #include <dt-bindings/clock/r8a7795-cpg-mssr.h> 1692eb4d8dcSEmmanuel Vadot #include <dt-bindings/interrupt-controller/arm-gic.h> 1702eb4d8dcSEmmanuel Vadot #include <dt-bindings/power/r8a7795-sysc.h> 1712eb4d8dcSEmmanuel Vadot 1722eb4d8dcSEmmanuel Vadot soc { 1732eb4d8dcSEmmanuel Vadot #address-cells = <2>; 1742eb4d8dcSEmmanuel Vadot #size-cells = <2>; 1752eb4d8dcSEmmanuel Vadot 1762eb4d8dcSEmmanuel Vadot drif00: rif@e6f40000 { 1772eb4d8dcSEmmanuel Vadot compatible = "renesas,r8a7795-drif", 1782eb4d8dcSEmmanuel Vadot "renesas,rcar-gen3-drif"; 1792eb4d8dcSEmmanuel Vadot reg = <0 0xe6f40000 0 0x64>; 1802eb4d8dcSEmmanuel Vadot interrupts = <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>; 1812eb4d8dcSEmmanuel Vadot clocks = <&cpg CPG_MOD 515>; 1822eb4d8dcSEmmanuel Vadot clock-names = "fck"; 1832eb4d8dcSEmmanuel Vadot dmas = <&dmac1 0x20>, <&dmac2 0x20>; 1842eb4d8dcSEmmanuel Vadot dma-names = "rx", "rx"; 1852eb4d8dcSEmmanuel Vadot power-domains = <&sysc R8A7795_PD_ALWAYS_ON>; 1862eb4d8dcSEmmanuel Vadot renesas,bonding = <&drif01>; 1872eb4d8dcSEmmanuel Vadot resets = <&cpg 515>; 1882eb4d8dcSEmmanuel Vadot renesas,primary-bond; 1892eb4d8dcSEmmanuel Vadot pinctrl-0 = <&drif0_pins>; 1902eb4d8dcSEmmanuel Vadot pinctrl-names = "default"; 1912eb4d8dcSEmmanuel Vadot port { 1922eb4d8dcSEmmanuel Vadot drif0_ep: endpoint { 1932eb4d8dcSEmmanuel Vadot remote-endpoint = <&tuner_ep>; 1942eb4d8dcSEmmanuel Vadot }; 1952eb4d8dcSEmmanuel Vadot }; 1962eb4d8dcSEmmanuel Vadot }; 1972eb4d8dcSEmmanuel Vadot 1982eb4d8dcSEmmanuel Vadot drif01: rif@e6f50000 { 1992eb4d8dcSEmmanuel Vadot compatible = "renesas,r8a7795-drif", 2002eb4d8dcSEmmanuel Vadot "renesas,rcar-gen3-drif"; 2012eb4d8dcSEmmanuel Vadot reg = <0 0xe6f50000 0 0x64>; 2022eb4d8dcSEmmanuel Vadot interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>; 2032eb4d8dcSEmmanuel Vadot clocks = <&cpg CPG_MOD 514>; 2042eb4d8dcSEmmanuel Vadot clock-names = "fck"; 2052eb4d8dcSEmmanuel Vadot dmas = <&dmac1 0x22>, <&dmac2 0x22>; 2062eb4d8dcSEmmanuel Vadot dma-names = "rx", "rx"; 2072eb4d8dcSEmmanuel Vadot power-domains = <&sysc R8A7795_PD_ALWAYS_ON>; 2082eb4d8dcSEmmanuel Vadot renesas,bonding = <&drif00>; 2092eb4d8dcSEmmanuel Vadot resets = <&cpg 514>; 2102eb4d8dcSEmmanuel Vadot }; 2112eb4d8dcSEmmanuel Vadot }; 2122eb4d8dcSEmmanuel Vadot 2132eb4d8dcSEmmanuel Vadot # Example with internal channel 1 alone enabled. 2142eb4d8dcSEmmanuel Vadot # 2152eb4d8dcSEmmanuel Vadot # When interfacing with a third party tuner device with one data pin as shown 2162eb4d8dcSEmmanuel Vadot # below. 2172eb4d8dcSEmmanuel Vadot # 2182eb4d8dcSEmmanuel Vadot # +---------------------+ +---------------------+ 2192eb4d8dcSEmmanuel Vadot # | |-----SCK------->|CLK | 2202eb4d8dcSEmmanuel Vadot # | Master |-----SS-------->|SYNC DRIFn (slave) | 2212eb4d8dcSEmmanuel Vadot # | | |D0 (unused) | 2222eb4d8dcSEmmanuel Vadot # | |-----SD-------->|D1 | 2232eb4d8dcSEmmanuel Vadot # +---------------------+ +---------------------+ 2242eb4d8dcSEmmanuel Vadot - | 2252eb4d8dcSEmmanuel Vadot #include <dt-bindings/clock/r8a7795-cpg-mssr.h> 2262eb4d8dcSEmmanuel Vadot #include <dt-bindings/interrupt-controller/arm-gic.h> 2272eb4d8dcSEmmanuel Vadot #include <dt-bindings/power/r8a7795-sysc.h> 2282eb4d8dcSEmmanuel Vadot 2292eb4d8dcSEmmanuel Vadot soc { 2302eb4d8dcSEmmanuel Vadot #address-cells = <2>; 2312eb4d8dcSEmmanuel Vadot #size-cells = <2>; 2322eb4d8dcSEmmanuel Vadot 2332eb4d8dcSEmmanuel Vadot drif10: rif@e6f60000 { 2342eb4d8dcSEmmanuel Vadot compatible = "renesas,r8a7795-drif", 2352eb4d8dcSEmmanuel Vadot "renesas,rcar-gen3-drif"; 2362eb4d8dcSEmmanuel Vadot reg = <0 0xe6f60000 0 0x64>; 2372eb4d8dcSEmmanuel Vadot interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>; 2382eb4d8dcSEmmanuel Vadot clocks = <&cpg CPG_MOD 513>; 2392eb4d8dcSEmmanuel Vadot clock-names = "fck"; 2402eb4d8dcSEmmanuel Vadot dmas = <&dmac1 0x24>, <&dmac2 0x24>; 2412eb4d8dcSEmmanuel Vadot dma-names = "rx", "rx"; 2422eb4d8dcSEmmanuel Vadot power-domains = <&sysc R8A7795_PD_ALWAYS_ON>; 2432eb4d8dcSEmmanuel Vadot resets = <&cpg 513>; 2442eb4d8dcSEmmanuel Vadot renesas,bonding = <&drif11>; 2452eb4d8dcSEmmanuel Vadot }; 2462eb4d8dcSEmmanuel Vadot 2472eb4d8dcSEmmanuel Vadot drif11: rif@e6f70000 { 2482eb4d8dcSEmmanuel Vadot compatible = "renesas,r8a7795-drif", 2492eb4d8dcSEmmanuel Vadot "renesas,rcar-gen3-drif"; 2502eb4d8dcSEmmanuel Vadot reg = <0 0xe6f70000 0 0x64>; 2512eb4d8dcSEmmanuel Vadot interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>; 2522eb4d8dcSEmmanuel Vadot clocks = <&cpg CPG_MOD 512>; 2532eb4d8dcSEmmanuel Vadot clock-names = "fck"; 2542eb4d8dcSEmmanuel Vadot dmas = <&dmac1 0x26>, <&dmac2 0x26>; 2552eb4d8dcSEmmanuel Vadot dma-names = "rx", "rx"; 2562eb4d8dcSEmmanuel Vadot power-domains = <&sysc R8A7795_PD_ALWAYS_ON>; 2572eb4d8dcSEmmanuel Vadot resets = <&cpg 512>; 2582eb4d8dcSEmmanuel Vadot renesas,bonding = <&drif10>; 2592eb4d8dcSEmmanuel Vadot pinctrl-0 = <&drif1_pins>; 2602eb4d8dcSEmmanuel Vadot pinctrl-names = "default"; 2612eb4d8dcSEmmanuel Vadot port { 2622eb4d8dcSEmmanuel Vadot drif1_ep: endpoint { 2632eb4d8dcSEmmanuel Vadot remote-endpoint = <&tuner_ep1>; 2642eb4d8dcSEmmanuel Vadot sync-active = <0>; 2652eb4d8dcSEmmanuel Vadot }; 2662eb4d8dcSEmmanuel Vadot }; 2672eb4d8dcSEmmanuel Vadot }; 2682eb4d8dcSEmmanuel Vadot }; 2692eb4d8dcSEmmanuel Vadot... 270