1# SPDX-License-Identifier: GPL-2.0
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/display/allwinner,sun4i-a10-tcon.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Allwinner A10 Timings Controller (TCON) Device Tree Bindings
8
9maintainers:
10  - Chen-Yu Tsai <wens@csie.org>
11  - Maxime Ripard <mripard@kernel.org>
12
13description: |
14  The TCON acts as a timing controller for RGB, LVDS and TV
15  interfaces.
16
17properties:
18  "#clock-cells":
19    const: 0
20
21  compatible:
22    oneOf:
23      - const: allwinner,sun4i-a10-tcon
24      - const: allwinner,sun5i-a13-tcon
25      - const: allwinner,sun6i-a31-tcon
26      - const: allwinner,sun6i-a31s-tcon
27      - const: allwinner,sun7i-a20-tcon
28      - const: allwinner,sun8i-a23-tcon
29      - const: allwinner,sun8i-a33-tcon
30      - const: allwinner,sun8i-a83t-tcon-lcd
31      - const: allwinner,sun8i-a83t-tcon-tv
32      - const: allwinner,sun8i-r40-tcon-tv
33      - const: allwinner,sun8i-v3s-tcon
34      - const: allwinner,sun9i-a80-tcon-lcd
35      - const: allwinner,sun9i-a80-tcon-tv
36      - const: allwinner,sun20i-d1-tcon-lcd
37      - const: allwinner,sun20i-d1-tcon-tv
38
39      - items:
40          - enum:
41              - allwinner,sun7i-a20-tcon0
42              - allwinner,sun7i-a20-tcon1
43          - const: allwinner,sun7i-a20-tcon
44
45      - items:
46          - enum:
47              - allwinner,sun50i-a64-tcon-lcd
48          - const: allwinner,sun8i-a83t-tcon-lcd
49
50      - items:
51          - enum:
52              - allwinner,sun8i-h3-tcon-tv
53              - allwinner,sun50i-a64-tcon-tv
54          - const: allwinner,sun8i-a83t-tcon-tv
55
56      - items:
57          - enum:
58              - allwinner,sun50i-h6-tcon-tv
59          - const: allwinner,sun8i-r40-tcon-tv
60
61  reg:
62    maxItems: 1
63
64  interrupts:
65    maxItems: 1
66
67  clocks:
68    minItems: 1
69    maxItems: 4
70
71  clock-names:
72    minItems: 1
73    maxItems: 4
74
75  clock-output-names:
76    description:
77      Name of the LCD pixel clock created.
78    maxItems: 1
79
80  dmas:
81    maxItems: 1
82
83  resets:
84    anyOf:
85      - items:
86          - description: TCON Reset Line
87
88      - items:
89          - description: TCON Reset Line
90          - description: TCON LVDS Reset Line
91
92      - items:
93          - description: TCON Reset Line
94          - description: TCON eDP Reset Line
95
96      - items:
97          - description: TCON Reset Line
98          - description: TCON eDP Reset Line
99          - description: TCON LVDS Reset Line
100
101  reset-names:
102    oneOf:
103      - const: lcd
104
105      - items:
106          - const: lcd
107          - const: lvds
108
109      - items:
110          - const: lcd
111          - const: edp
112
113      - items:
114          - const: lcd
115          - const: edp
116          - const: lvds
117
118  ports:
119    $ref: /schemas/graph.yaml#/properties/ports
120
121    properties:
122      port@0:
123        $ref: /schemas/graph.yaml#/properties/port
124        description: |
125          Input endpoints of the controller.
126
127      port@1:
128        $ref: /schemas/graph.yaml#/$defs/port-base
129        unevaluatedProperties: false
130        description: |
131          Output endpoints of the controller.
132
133        patternProperties:
134          "^endpoint(@[0-9])$":
135            $ref: /schemas/graph.yaml#/$defs/endpoint-base
136            unevaluatedProperties: false
137
138            properties:
139              allwinner,tcon-channel:
140                $ref: /schemas/types.yaml#/definitions/uint32
141                description: |
142                  TCON can have 1 or 2 channels, usually with the
143                  first channel being used for the panels interfaces
144                  (RGB, LVDS, etc.), and the second being used for the
145                  outputs that require another controller (TV Encoder,
146                  HDMI, etc.).
147
148                  If that property is present, specifies the TCON
149                  channel the endpoint is associated to. If that
150                  property is not present, the endpoint number will be
151                  used as the channel number.
152
153    required:
154      - port@0
155      - port@1
156
157required:
158  - compatible
159  - reg
160  - interrupts
161  - clocks
162  - clock-names
163  - resets
164  - ports
165
166additionalProperties: false
167
168allOf:
169  - if:
170      properties:
171        compatible:
172          contains:
173            enum:
174              - allwinner,sun4i-a10-tcon
175              - allwinner,sun5i-a13-tcon
176              - allwinner,sun7i-a20-tcon
177
178    then:
179      properties:
180        clocks:
181          minItems: 3
182
183        clock-names:
184          items:
185            - const: ahb
186            - const: tcon-ch0
187            - const: tcon-ch1
188
189  - if:
190      properties:
191        compatible:
192          contains:
193            enum:
194              - allwinner,sun6i-a31-tcon
195              - allwinner,sun6i-a31s-tcon
196
197    then:
198      properties:
199        clocks:
200          minItems: 4
201
202        clock-names:
203          items:
204            - const: ahb
205            - const: tcon-ch0
206            - const: tcon-ch1
207            - const: lvds-alt
208
209  - if:
210      properties:
211        compatible:
212          contains:
213            enum:
214              - allwinner,sun8i-a23-tcon
215              - allwinner,sun8i-a33-tcon
216
217    then:
218      properties:
219        clocks:
220          minItems: 3
221
222        clock-names:
223          items:
224            - const: ahb
225            - const: tcon-ch0
226            - const: lvds-alt
227
228  - if:
229      properties:
230        compatible:
231          contains:
232            enum:
233              - allwinner,sun8i-a83t-tcon-lcd
234              - allwinner,sun8i-v3s-tcon
235              - allwinner,sun9i-a80-tcon-lcd
236
237    then:
238      properties:
239        clocks:
240          minItems: 2
241
242        clock-names:
243          items:
244            - const: ahb
245            - const: tcon-ch0
246
247  - if:
248      properties:
249        compatible:
250          contains:
251            enum:
252              - allwinner,sun8i-a83t-tcon-tv
253              - allwinner,sun8i-r40-tcon-tv
254              - allwinner,sun9i-a80-tcon-tv
255
256    then:
257      properties:
258        clocks:
259          minItems: 2
260
261        clock-names:
262          items:
263            - const: ahb
264            - const: tcon-ch1
265
266  - if:
267      properties:
268        compatible:
269          contains:
270            enum:
271              - allwinner,sun5i-a13-tcon
272              - allwinner,sun6i-a31-tcon
273              - allwinner,sun6i-a31s-tcon
274              - allwinner,sun7i-a20-tcon
275              - allwinner,sun8i-a23-tcon
276              - allwinner,sun8i-a33-tcon
277              - allwinner,sun8i-v3s-tcon
278              - allwinner,sun9i-a80-tcon-lcd
279              - allwinner,sun4i-a10-tcon
280              - allwinner,sun8i-a83t-tcon-lcd
281
282    then:
283      required:
284        - "#clock-cells"
285        - clock-output-names
286
287  - if:
288      properties:
289        compatible:
290          contains:
291            enum:
292              - allwinner,sun6i-a31-tcon
293              - allwinner,sun6i-a31s-tcon
294              - allwinner,sun8i-a23-tcon
295              - allwinner,sun8i-a33-tcon
296              - allwinner,sun8i-a83t-tcon-lcd
297
298    then:
299      properties:
300        resets:
301          minItems: 2
302
303        reset-names:
304          items:
305            - const: lcd
306            - const: lvds
307
308  - if:
309      properties:
310        compatible:
311          contains:
312            enum:
313              - allwinner,sun9i-a80-tcon-lcd
314
315    then:
316      properties:
317        resets:
318          minItems: 3
319
320        reset-names:
321          items:
322            - const: lcd
323            - const: edp
324            - const: lvds
325
326  - if:
327      properties:
328        compatible:
329          contains:
330            enum:
331              - allwinner,sun9i-a80-tcon-tv
332
333    then:
334      properties:
335        resets:
336          minItems: 2
337
338        reset-names:
339          items:
340            - const: lcd
341            - const: edp
342
343  - if:
344      properties:
345        compatible:
346          contains:
347            enum:
348              - allwinner,sun4i-a10-tcon
349              - allwinner,sun5i-a13-tcon
350              - allwinner,sun6i-a31-tcon
351              - allwinner,sun6i-a31s-tcon
352              - allwinner,sun7i-a20-tcon
353              - allwinner,sun8i-a23-tcon
354              - allwinner,sun8i-a33-tcon
355
356    then:
357      required:
358        - dmas
359
360examples:
361  - |
362    #include <dt-bindings/dma/sun4i-a10.h>
363
364    /*
365     * This comes from the clock/sun4i-a10-ccu.h and
366     * reset/sun4i-a10-ccu.h headers, but we can't include them since
367     * it would trigger a bunch of warnings for redefinitions of
368     * symbols with the other example.
369     */
370
371    #define CLK_AHB_LCD0	56
372    #define CLK_TCON0_CH0	149
373    #define CLK_TCON0_CH1	155
374    #define RST_TCON0		11
375
376    lcd-controller@1c0c000 {
377        compatible = "allwinner,sun4i-a10-tcon";
378        reg = <0x01c0c000 0x1000>;
379        interrupts = <44>;
380        resets = <&ccu RST_TCON0>;
381        reset-names = "lcd";
382        clocks = <&ccu CLK_AHB_LCD0>,
383                 <&ccu CLK_TCON0_CH0>,
384                 <&ccu CLK_TCON0_CH1>;
385        clock-names = "ahb",
386                      "tcon-ch0",
387                      "tcon-ch1";
388        clock-output-names = "tcon0-pixel-clock";
389        #clock-cells = <0>;
390        dmas = <&dma SUN4I_DMA_DEDICATED 14>;
391
392        ports {
393            #address-cells = <1>;
394            #size-cells = <0>;
395
396            port@0 {
397                #address-cells = <1>;
398                #size-cells = <0>;
399                reg = <0>;
400
401                endpoint@0 {
402                    reg = <0>;
403                    remote-endpoint = <&be0_out_tcon0>;
404                };
405
406                endpoint@1 {
407                    reg = <1>;
408                    remote-endpoint = <&be1_out_tcon0>;
409                };
410            };
411
412            port@1 {
413                #address-cells = <1>;
414                #size-cells = <0>;
415                reg = <1>;
416
417                endpoint@1 {
418                    reg = <1>;
419                    remote-endpoint = <&hdmi_in_tcon0>;
420                    allwinner,tcon-channel = <1>;
421                };
422            };
423        };
424    };
425
426    #undef CLK_AHB_LCD0
427    #undef CLK_TCON0_CH0
428    #undef CLK_TCON0_CH1
429    #undef RST_TCON0
430
431  - |
432    #include <dt-bindings/interrupt-controller/arm-gic.h>
433
434    /*
435     * This comes from the clock/sun6i-a31-ccu.h and
436     * reset/sun6i-a31-ccu.h headers, but we can't include them since
437     * it would trigger a bunch of warnings for redefinitions of
438     * symbols with the other example.
439     */
440
441    #define CLK_PLL_MIPI	15
442    #define CLK_AHB1_LCD0	47
443    #define CLK_LCD0_CH0	127
444    #define CLK_LCD0_CH1	129
445    #define RST_AHB1_LCD0	27
446    #define RST_AHB1_LVDS	41
447
448    lcd-controller@1c0c000 {
449        compatible = "allwinner,sun6i-a31-tcon";
450        reg = <0x01c0c000 0x1000>;
451        interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
452        dmas = <&dma 11>;
453        resets = <&ccu RST_AHB1_LCD0>, <&ccu RST_AHB1_LVDS>;
454        reset-names = "lcd", "lvds";
455        clocks = <&ccu CLK_AHB1_LCD0>,
456                 <&ccu CLK_LCD0_CH0>,
457                 <&ccu CLK_LCD0_CH1>,
458                 <&ccu CLK_PLL_MIPI>;
459        clock-names = "ahb",
460                      "tcon-ch0",
461                      "tcon-ch1",
462                      "lvds-alt";
463        clock-output-names = "tcon0-pixel-clock";
464        #clock-cells = <0>;
465
466        ports {
467            #address-cells = <1>;
468            #size-cells = <0>;
469
470            port@0 {
471                #address-cells = <1>;
472                #size-cells = <0>;
473                reg = <0>;
474
475                endpoint@0 {
476                    reg = <0>;
477                    remote-endpoint = <&drc0_out_tcon0>;
478                };
479
480                endpoint@1 {
481                    reg = <1>;
482                    remote-endpoint = <&drc1_out_tcon0>;
483                };
484            };
485
486            port@1 {
487                #address-cells = <1>;
488                #size-cells = <0>;
489                reg = <1>;
490
491                endpoint@1 {
492                    reg = <1>;
493                    remote-endpoint = <&hdmi_in_tcon0>;
494                    allwinner,tcon-channel = <1>;
495                };
496            };
497        };
498    };
499
500    #undef CLK_PLL_MIPI
501    #undef CLK_AHB1_LCD0
502    #undef CLK_LCD0_CH0
503    #undef CLK_LCD0_CH1
504    #undef RST_AHB1_LCD0
505    #undef RST_AHB1_LVDS
506
507  - |
508    #include <dt-bindings/interrupt-controller/arm-gic.h>
509
510    /*
511     * This comes from the clock/sun9i-a80-ccu.h and
512     * reset/sun9i-a80-ccu.h headers, but we can't include them since
513     * it would trigger a bunch of warnings for redefinitions of
514     * symbols with the other example.
515     */
516
517    #define CLK_BUS_LCD0	102
518    #define CLK_LCD0		58
519    #define RST_BUS_LCD0	22
520    #define RST_BUS_EDP		24
521    #define RST_BUS_LVDS	25
522
523    lcd-controller@3c00000 {
524        compatible = "allwinner,sun9i-a80-tcon-lcd";
525        reg = <0x03c00000 0x10000>;
526        interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
527        clocks = <&ccu CLK_BUS_LCD0>, <&ccu CLK_LCD0>;
528        clock-names = "ahb", "tcon-ch0";
529        resets = <&ccu RST_BUS_LCD0>, <&ccu RST_BUS_EDP>, <&ccu RST_BUS_LVDS>;
530        reset-names = "lcd", "edp", "lvds";
531        clock-output-names = "tcon0-pixel-clock";
532        #clock-cells = <0>;
533
534        ports {
535            #address-cells = <1>;
536            #size-cells = <0>;
537
538            port@0 {
539                reg = <0>;
540
541                endpoint {
542                    remote-endpoint = <&drc0_out_tcon0>;
543                };
544            };
545
546            port@1 {
547                reg = <1>;
548            };
549        };
550    };
551
552    #undef CLK_BUS_TCON0
553    #undef CLK_TCON0
554    #undef RST_BUS_TCON0
555    #undef RST_BUS_EDP
556    #undef RST_BUS_LVDS
557
558  - |
559    #include <dt-bindings/interrupt-controller/arm-gic.h>
560
561    /*
562     * This comes from the clock/sun8i-a83t-ccu.h and
563     * reset/sun8i-a83t-ccu.h headers, but we can't include them since
564     * it would trigger a bunch of warnings for redefinitions of
565     * symbols with the other example.
566     */
567
568    #define CLK_BUS_TCON0	36
569    #define CLK_TCON0		85
570    #define RST_BUS_TCON0	22
571    #define RST_BUS_LVDS	31
572
573    lcd-controller@1c0c000 {
574        compatible = "allwinner,sun8i-a83t-tcon-lcd";
575        reg = <0x01c0c000 0x1000>;
576        interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
577        clocks = <&ccu CLK_BUS_TCON0>, <&ccu CLK_TCON0>;
578        clock-names = "ahb", "tcon-ch0";
579        clock-output-names = "tcon-pixel-clock";
580        #clock-cells = <0>;
581        resets = <&ccu RST_BUS_TCON0>, <&ccu RST_BUS_LVDS>;
582        reset-names = "lcd", "lvds";
583
584        ports {
585            #address-cells = <1>;
586            #size-cells = <0>;
587
588            port@0 {
589                #address-cells = <1>;
590                #size-cells = <0>;
591                reg = <0>;
592
593                endpoint@0 {
594                    reg = <0>;
595                    remote-endpoint = <&mixer0_out_tcon0>;
596                };
597
598                endpoint@1 {
599                    reg = <1>;
600                    remote-endpoint = <&mixer1_out_tcon0>;
601                };
602            };
603
604            port@1 {
605                reg = <1>;
606            };
607        };
608    };
609
610    #undef CLK_BUS_TCON0
611    #undef CLK_TCON0
612    #undef RST_BUS_TCON0
613    #undef RST_BUS_LVDS
614
615  - |
616    #include <dt-bindings/interrupt-controller/arm-gic.h>
617
618    /*
619     * This comes from the clock/sun8i-r40-ccu.h and
620     * reset/sun8i-r40-ccu.h headers, but we can't include them since
621     * it would trigger a bunch of warnings for redefinitions of
622     * symbols with the other example.
623     */
624
625    #define CLK_BUS_TCON_TV0	73
626    #define RST_BUS_TCON_TV0	49
627
628    tcon_tv0: lcd-controller@1c73000 {
629        compatible = "allwinner,sun8i-r40-tcon-tv";
630        reg = <0x01c73000 0x1000>;
631        interrupts = <GIC_SPI 51 IRQ_TYPE_LEVEL_HIGH>;
632        clocks = <&ccu CLK_BUS_TCON_TV0>, <&tcon_top 0>;
633        clock-names = "ahb", "tcon-ch1";
634        resets = <&ccu RST_BUS_TCON_TV0>;
635        reset-names = "lcd";
636
637        ports {
638            #address-cells = <1>;
639            #size-cells = <0>;
640
641            port@0 {
642                #address-cells = <1>;
643                #size-cells = <0>;
644                reg = <0>;
645
646                endpoint@0 {
647                    reg = <0>;
648                    remote-endpoint = <&tcon_top_mixer0_out_tcon_tv0>;
649                };
650
651                endpoint@1 {
652                    reg = <1>;
653                    remote-endpoint = <&tcon_top_mixer1_out_tcon_tv0>;
654                };
655            };
656
657            tcon_tv0_out: port@1 {
658                #address-cells = <1>;
659                #size-cells = <0>;
660                reg = <1>;
661
662                endpoint@1 {
663                    reg = <1>;
664                    remote-endpoint = <&tcon_top_hdmi_in_tcon_tv0>;
665                };
666            };
667        };
668    };
669
670    #undef CLK_BUS_TCON_TV0
671    #undef RST_BUS_TCON_TV0
672
673...
674