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