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