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