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