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