1*8d13bc63SEmmanuel Vadot# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2*8d13bc63SEmmanuel Vadot%YAML 1.2
3*8d13bc63SEmmanuel Vadot---
4*8d13bc63SEmmanuel Vadot$id: http://devicetree.org/schemas/net/lantiq,pef2256.yaml#
5*8d13bc63SEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
6*8d13bc63SEmmanuel Vadot
7*8d13bc63SEmmanuel Vadottitle: Lantiq PEF2256
8*8d13bc63SEmmanuel Vadot
9*8d13bc63SEmmanuel Vadotmaintainers:
10*8d13bc63SEmmanuel Vadot  - Herve Codina <herve.codina@bootlin.com>
11*8d13bc63SEmmanuel Vadot
12*8d13bc63SEmmanuel Vadotdescription:
13*8d13bc63SEmmanuel Vadot  The Lantiq PEF2256, also known as Infineon PEF2256 or FALC56, is a framer and
14*8d13bc63SEmmanuel Vadot  line interface component designed to fulfill all required interfacing between
15*8d13bc63SEmmanuel Vadot  an analog E1/T1/J1 line and the digital PCM system highway/H.100 bus.
16*8d13bc63SEmmanuel Vadot
17*8d13bc63SEmmanuel Vadotproperties:
18*8d13bc63SEmmanuel Vadot  compatible:
19*8d13bc63SEmmanuel Vadot    items:
20*8d13bc63SEmmanuel Vadot      - const: lantiq,pef2256
21*8d13bc63SEmmanuel Vadot
22*8d13bc63SEmmanuel Vadot  reg:
23*8d13bc63SEmmanuel Vadot    maxItems: 1
24*8d13bc63SEmmanuel Vadot
25*8d13bc63SEmmanuel Vadot  clocks:
26*8d13bc63SEmmanuel Vadot    items:
27*8d13bc63SEmmanuel Vadot      - description: Master Clock
28*8d13bc63SEmmanuel Vadot      - description: System Clock Receive
29*8d13bc63SEmmanuel Vadot      - description: System Clock Transmit
30*8d13bc63SEmmanuel Vadot
31*8d13bc63SEmmanuel Vadot  clock-names:
32*8d13bc63SEmmanuel Vadot    items:
33*8d13bc63SEmmanuel Vadot      - const: mclk
34*8d13bc63SEmmanuel Vadot      - const: sclkr
35*8d13bc63SEmmanuel Vadot      - const: sclkx
36*8d13bc63SEmmanuel Vadot
37*8d13bc63SEmmanuel Vadot  interrupts:
38*8d13bc63SEmmanuel Vadot    maxItems: 1
39*8d13bc63SEmmanuel Vadot
40*8d13bc63SEmmanuel Vadot  reset-gpios:
41*8d13bc63SEmmanuel Vadot    description:
42*8d13bc63SEmmanuel Vadot      GPIO used to reset the device.
43*8d13bc63SEmmanuel Vadot    maxItems: 1
44*8d13bc63SEmmanuel Vadot
45*8d13bc63SEmmanuel Vadot  pinctrl:
46*8d13bc63SEmmanuel Vadot    $ref: /schemas/pinctrl/pinctrl.yaml#
47*8d13bc63SEmmanuel Vadot    additionalProperties: false
48*8d13bc63SEmmanuel Vadot
49*8d13bc63SEmmanuel Vadot    patternProperties:
50*8d13bc63SEmmanuel Vadot      '-pins$':
51*8d13bc63SEmmanuel Vadot        type: object
52*8d13bc63SEmmanuel Vadot        $ref: /schemas/pinctrl/pinmux-node.yaml#
53*8d13bc63SEmmanuel Vadot        additionalProperties: false
54*8d13bc63SEmmanuel Vadot
55*8d13bc63SEmmanuel Vadot        properties:
56*8d13bc63SEmmanuel Vadot          pins:
57*8d13bc63SEmmanuel Vadot            enum: [ RPA, RPB, RPC, RPD, XPA, XPB, XPC, XPD ]
58*8d13bc63SEmmanuel Vadot
59*8d13bc63SEmmanuel Vadot          function:
60*8d13bc63SEmmanuel Vadot            enum: [ SYPR, RFM, RFMB, RSIGM, RSIG, DLR, FREEZE, RFSP, LOS,
61*8d13bc63SEmmanuel Vadot                    SYPX, XFMS, XSIG, TCLK, XMFB, XSIGM, DLX, XCLK, XLT,
62*8d13bc63SEmmanuel Vadot                    GPI, GPOH, GPOL ]
63*8d13bc63SEmmanuel Vadot
64*8d13bc63SEmmanuel Vadot        required:
65*8d13bc63SEmmanuel Vadot          - pins
66*8d13bc63SEmmanuel Vadot          - function
67*8d13bc63SEmmanuel Vadot
68*8d13bc63SEmmanuel Vadot  lantiq,data-rate-bps:
69*8d13bc63SEmmanuel Vadot    enum: [2048000, 4096000, 8192000, 16384000]
70*8d13bc63SEmmanuel Vadot    default: 2048000
71*8d13bc63SEmmanuel Vadot    description:
72*8d13bc63SEmmanuel Vadot      Data rate (bit per seconds) on the system highway.
73*8d13bc63SEmmanuel Vadot
74*8d13bc63SEmmanuel Vadot  lantiq,clock-falling-edge:
75*8d13bc63SEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/flag
76*8d13bc63SEmmanuel Vadot    description:
77*8d13bc63SEmmanuel Vadot      Data is sent on falling edge of the clock (and received on the rising
78*8d13bc63SEmmanuel Vadot      edge). If 'clock-falling-edge' is not present, data is sent on the
79*8d13bc63SEmmanuel Vadot      rising edge (and received on the falling edge).
80*8d13bc63SEmmanuel Vadot
81*8d13bc63SEmmanuel Vadot  lantiq,channel-phase:
82*8d13bc63SEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32
83*8d13bc63SEmmanuel Vadot    enum: [0, 1, 2, 3, 4, 5, 6, 7]
84*8d13bc63SEmmanuel Vadot    default: 0
85*8d13bc63SEmmanuel Vadot    description: |
86*8d13bc63SEmmanuel Vadot      The pef2256 delivers a full frame (32 8-bit time-slots in E1 and 24 8-bit
87*8d13bc63SEmmanuel Vadot      time-slots 8 8-bit signaling in E1/J1) every 125us. This lead to a data
88*8d13bc63SEmmanuel Vadot      rate of 2048000 bit/s. When lantiq,data-rate-bps is more than 2048000
89*8d13bc63SEmmanuel Vadot      bit/s, the data (all 32 8-bit) present in the frame are interleave with
90*8d13bc63SEmmanuel Vadot      unused time-slots. The lantiq,channel-phase property allows to set the
91*8d13bc63SEmmanuel Vadot      correct alignment of the interleave mechanism.
92*8d13bc63SEmmanuel Vadot      For instance, suppose lantiq,data-rate-bps = 8192000 (ie 4*2048000), and
93*8d13bc63SEmmanuel Vadot      lantiq,channel-phase = 2, the interleave schema with unused time-slots
94*8d13bc63SEmmanuel Vadot      (nu) and used time-slots (XX) for TSi is
95*8d13bc63SEmmanuel Vadot        nu nu XX nu nu nu XX nu nu nu XX nu
96*8d13bc63SEmmanuel Vadot        <-- TSi --> <- TSi+1 -> <- TSi+2 ->
97*8d13bc63SEmmanuel Vadot      With lantiq,data-rate-bps = 8192000, and lantiq,channel-phase = 1, the
98*8d13bc63SEmmanuel Vadot      interleave schema is
99*8d13bc63SEmmanuel Vadot        nu XX nu nu nu XX nu nu nu XX nu nu
100*8d13bc63SEmmanuel Vadot        <-- TSi --> <- TSi+1 -> <- TSi+2 ->
101*8d13bc63SEmmanuel Vadot      With lantiq,data-rate-bps = 4096000 (ie 2*2048000), and
102*8d13bc63SEmmanuel Vadot      lantiq,channel-phase = 1, the interleave schema is
103*8d13bc63SEmmanuel Vadot        nu    XX    nu    XX    nu    XX
104*8d13bc63SEmmanuel Vadot        <-- TSi --> <- TSi+1 -> <- TSi+2 ->
105*8d13bc63SEmmanuel Vadot
106*8d13bc63SEmmanuel VadotpatternProperties:
107*8d13bc63SEmmanuel Vadot  '^codec(-([0-9]|[1-2][0-9]|3[0-1]))?$':
108*8d13bc63SEmmanuel Vadot    type: object
109*8d13bc63SEmmanuel Vadot    $ref: /schemas/sound/dai-common.yaml
110*8d13bc63SEmmanuel Vadot    unevaluatedProperties: false
111*8d13bc63SEmmanuel Vadot    description:
112*8d13bc63SEmmanuel Vadot      Codec provided by the pef2256. This codec allows to use some of the PCM
113*8d13bc63SEmmanuel Vadot      system highway time-slots as audio channels to transport audio data over
114*8d13bc63SEmmanuel Vadot      the E1/T1/J1 lines.
115*8d13bc63SEmmanuel Vadot      The time-slots used by the codec must be set and so, the properties
116*8d13bc63SEmmanuel Vadot      'dai-tdm-slot-num', 'dai-tdm-slot-width', 'dai-tdm-slot-tx-mask' and
117*8d13bc63SEmmanuel Vadot      'dai-tdm-slot-rx-mask' must be present in the sound card node for
118*8d13bc63SEmmanuel Vadot      sub-nodes that involve the codec. The codec uses 8-bit time-slots.
119*8d13bc63SEmmanuel Vadot      'dai-tdm-tdm-slot-with' must be set to 8.
120*8d13bc63SEmmanuel Vadot      The tx and rx masks define the pef2256 time-slots assigned to the codec.
121*8d13bc63SEmmanuel Vadot
122*8d13bc63SEmmanuel Vadot    properties:
123*8d13bc63SEmmanuel Vadot      compatible:
124*8d13bc63SEmmanuel Vadot        const: lantiq,pef2256-codec
125*8d13bc63SEmmanuel Vadot
126*8d13bc63SEmmanuel Vadot      '#sound-dai-cells':
127*8d13bc63SEmmanuel Vadot        const: 0
128*8d13bc63SEmmanuel Vadot
129*8d13bc63SEmmanuel Vadot    required:
130*8d13bc63SEmmanuel Vadot      - compatible
131*8d13bc63SEmmanuel Vadot      - '#sound-dai-cells'
132*8d13bc63SEmmanuel Vadot
133*8d13bc63SEmmanuel Vadotrequired:
134*8d13bc63SEmmanuel Vadot  - compatible
135*8d13bc63SEmmanuel Vadot  - reg
136*8d13bc63SEmmanuel Vadot  - clocks
137*8d13bc63SEmmanuel Vadot  - clock-names
138*8d13bc63SEmmanuel Vadot  - interrupts
139*8d13bc63SEmmanuel Vadot
140*8d13bc63SEmmanuel VadotadditionalProperties: false
141*8d13bc63SEmmanuel Vadot
142*8d13bc63SEmmanuel Vadotexamples:
143*8d13bc63SEmmanuel Vadot  - |
144*8d13bc63SEmmanuel Vadot    #include <dt-bindings/gpio/gpio.h>
145*8d13bc63SEmmanuel Vadot    #include <dt-bindings/interrupt-controller/irq.h>
146*8d13bc63SEmmanuel Vadot
147*8d13bc63SEmmanuel Vadot    pef2256: framer@2000000 {
148*8d13bc63SEmmanuel Vadot      compatible = "lantiq,pef2256";
149*8d13bc63SEmmanuel Vadot      reg = <0x2000000 0x100>;
150*8d13bc63SEmmanuel Vadot      interrupts = <8 IRQ_TYPE_LEVEL_LOW>;
151*8d13bc63SEmmanuel Vadot      interrupt-parent = <&intc>;
152*8d13bc63SEmmanuel Vadot      clocks = <&clk_mclk>, <&clk_sclkr>, <&clk_sclkx>;
153*8d13bc63SEmmanuel Vadot      clock-names = "mclk", "sclkr", "sclkx";
154*8d13bc63SEmmanuel Vadot      reset-gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
155*8d13bc63SEmmanuel Vadot      lantiq,data-rate-bps = <4096000>;
156*8d13bc63SEmmanuel Vadot
157*8d13bc63SEmmanuel Vadot      pinctrl {
158*8d13bc63SEmmanuel Vadot        pef2256_rpa_sypr: rpa-pins {
159*8d13bc63SEmmanuel Vadot          pins = "RPA";
160*8d13bc63SEmmanuel Vadot          function = "SYPR";
161*8d13bc63SEmmanuel Vadot        };
162*8d13bc63SEmmanuel Vadot        pef2256_xpa_sypx: xpa-pins {
163*8d13bc63SEmmanuel Vadot          pins = "XPA";
164*8d13bc63SEmmanuel Vadot          function = "SYPX";
165*8d13bc63SEmmanuel Vadot        };
166*8d13bc63SEmmanuel Vadot      };
167*8d13bc63SEmmanuel Vadot
168*8d13bc63SEmmanuel Vadot      pef2256_codec0: codec-0 {
169*8d13bc63SEmmanuel Vadot        compatible = "lantiq,pef2256-codec";
170*8d13bc63SEmmanuel Vadot        #sound-dai-cells = <0>;
171*8d13bc63SEmmanuel Vadot        sound-name-prefix = "PEF2256_0";
172*8d13bc63SEmmanuel Vadot      };
173*8d13bc63SEmmanuel Vadot
174*8d13bc63SEmmanuel Vadot      pef2256_codec1: codec-1 {
175*8d13bc63SEmmanuel Vadot        compatible = "lantiq,pef2256-codec";
176*8d13bc63SEmmanuel Vadot        #sound-dai-cells = <0>;
177*8d13bc63SEmmanuel Vadot        sound-name-prefix = "PEF2256_1";
178*8d13bc63SEmmanuel Vadot      };
179*8d13bc63SEmmanuel Vadot    };
180*8d13bc63SEmmanuel Vadot
181*8d13bc63SEmmanuel Vadot    sound {
182*8d13bc63SEmmanuel Vadot      compatible = "simple-audio-card";
183*8d13bc63SEmmanuel Vadot      #address-cells = <1>;
184*8d13bc63SEmmanuel Vadot      #size-cells = <0>;
185*8d13bc63SEmmanuel Vadot      simple-audio-card,dai-link@0 { /* CPU DAI1 - pef2256 codec 1 */
186*8d13bc63SEmmanuel Vadot        reg = <0>;
187*8d13bc63SEmmanuel Vadot        cpu {
188*8d13bc63SEmmanuel Vadot          sound-dai = <&cpu_dai1>;
189*8d13bc63SEmmanuel Vadot        };
190*8d13bc63SEmmanuel Vadot        codec {
191*8d13bc63SEmmanuel Vadot          sound-dai = <&pef2256_codec0>;
192*8d13bc63SEmmanuel Vadot          dai-tdm-slot-num = <4>;
193*8d13bc63SEmmanuel Vadot          dai-tdm-slot-width = <8>;
194*8d13bc63SEmmanuel Vadot          /* TS 1, 2, 3, 4 */
195*8d13bc63SEmmanuel Vadot          dai-tdm-slot-tx-mask = <0 1 1 1 1>;
196*8d13bc63SEmmanuel Vadot          dai-tdm-slot-rx-mask = <0 1 1 1 1>;
197*8d13bc63SEmmanuel Vadot        };
198*8d13bc63SEmmanuel Vadot      };
199*8d13bc63SEmmanuel Vadot      simple-audio-card,dai-link@1 { /* CPU DAI2 - pef2256 codec 2 */
200*8d13bc63SEmmanuel Vadot        reg = <1>;
201*8d13bc63SEmmanuel Vadot        cpu {
202*8d13bc63SEmmanuel Vadot          sound-dai = <&cpu_dai2>;
203*8d13bc63SEmmanuel Vadot        };
204*8d13bc63SEmmanuel Vadot        codec {
205*8d13bc63SEmmanuel Vadot          sound-dai = <&pef2256_codec1>;
206*8d13bc63SEmmanuel Vadot          dai-tdm-slot-num = <4>;
207*8d13bc63SEmmanuel Vadot          dai-tdm-slot-width = <8>;
208*8d13bc63SEmmanuel Vadot          /* TS 5, 6, 7, 8 */
209*8d13bc63SEmmanuel Vadot          dai-tdm-slot-tx-mask = <0 0 0 0 0 1 1 1 1>;
210*8d13bc63SEmmanuel Vadot          dai-tdm-slot-rx-mask = <0 0 0 0 0 1 1 1 1>;
211*8d13bc63SEmmanuel Vadot        };
212*8d13bc63SEmmanuel Vadot      };
213*8d13bc63SEmmanuel Vadot    };
214