xref: /freebsd/sys/contrib/device-tree/Bindings/mux/reg-mux.yaml (revision 8bab661a3316d8bd9b9fbd11a3b4371b91507bd2)
15956d97fSEmmanuel Vadot# SPDX-License-Identifier: GPL-2.0
25956d97fSEmmanuel Vadot%YAML 1.2
35956d97fSEmmanuel Vadot---
45956d97fSEmmanuel Vadot$id: http://devicetree.org/schemas/mux/reg-mux.yaml#
55956d97fSEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
65956d97fSEmmanuel Vadot
7*8bab661aSEmmanuel Vadottitle: Generic register bitfield-based multiplexer controller
85956d97fSEmmanuel Vadot
95956d97fSEmmanuel Vadotmaintainers:
105956d97fSEmmanuel Vadot  - Peter Rosin <peda@axentia.se>
115956d97fSEmmanuel Vadot
125956d97fSEmmanuel Vadotdescription: |+
135956d97fSEmmanuel Vadot  Define register bitfields to be used to control multiplexers. The parent
145956d97fSEmmanuel Vadot  device tree node must be a device node to provide register r/w access.
155956d97fSEmmanuel Vadot
165956d97fSEmmanuel Vadotproperties:
175956d97fSEmmanuel Vadot  compatible:
185956d97fSEmmanuel Vadot    enum:
195956d97fSEmmanuel Vadot      - reg-mux   # parent device of mux controller is not syscon device
205956d97fSEmmanuel Vadot      - mmio-mux  # parent device of mux controller is syscon device
215956d97fSEmmanuel Vadot
225956d97fSEmmanuel Vadot  reg: true
235956d97fSEmmanuel Vadot
245956d97fSEmmanuel Vadot  '#mux-control-cells':
255956d97fSEmmanuel Vadot    const: 1
265956d97fSEmmanuel Vadot
275956d97fSEmmanuel Vadot  mux-reg-masks:
28d5b0e70fSEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32-matrix
29d5b0e70fSEmmanuel Vadot    items:
30d5b0e70fSEmmanuel Vadot      items:
31d5b0e70fSEmmanuel Vadot        - description: register offset
32d5b0e70fSEmmanuel Vadot        - description: pre-shifted bitfield mask
33d5b0e70fSEmmanuel Vadot    description: Each entry pair describes a single mux control.
345956d97fSEmmanuel Vadot
355956d97fSEmmanuel Vadot  idle-states: true
365956d97fSEmmanuel Vadot
375956d97fSEmmanuel Vadotrequired:
385956d97fSEmmanuel Vadot  - compatible
395956d97fSEmmanuel Vadot  - mux-reg-masks
405956d97fSEmmanuel Vadot  - '#mux-control-cells'
415956d97fSEmmanuel Vadot
425956d97fSEmmanuel VadotadditionalProperties: false
435956d97fSEmmanuel Vadot
445956d97fSEmmanuel Vadotexamples:
455956d97fSEmmanuel Vadot  - |
465956d97fSEmmanuel Vadot    /* The parent device of mux controller is not a syscon device. */
475956d97fSEmmanuel Vadot
485956d97fSEmmanuel Vadot    #include <dt-bindings/mux/mux.h>
495956d97fSEmmanuel Vadot
505956d97fSEmmanuel Vadot    mux-controller {
515956d97fSEmmanuel Vadot        compatible = "reg-mux";
525956d97fSEmmanuel Vadot        #mux-control-cells = <1>;
535956d97fSEmmanuel Vadot        mux-reg-masks =
545956d97fSEmmanuel Vadot            <0x54 0xf8>, /* 0: reg 0x54, bits 7:3 */
555956d97fSEmmanuel Vadot            <0x54 0x07>; /* 1: reg 0x54, bits 2:0 */
565956d97fSEmmanuel Vadot    };
575956d97fSEmmanuel Vadot
585956d97fSEmmanuel Vadot    mdio-mux-1 {
595956d97fSEmmanuel Vadot        compatible = "mdio-mux-multiplexer";
605956d97fSEmmanuel Vadot        mux-controls = <&mux1 0>;
615956d97fSEmmanuel Vadot        mdio-parent-bus = <&emdio1>;
625956d97fSEmmanuel Vadot        #address-cells = <1>;
635956d97fSEmmanuel Vadot        #size-cells = <0>;
645956d97fSEmmanuel Vadot
655956d97fSEmmanuel Vadot        mdio@0 {
665956d97fSEmmanuel Vadot            reg = <0x0>;
675956d97fSEmmanuel Vadot            #address-cells = <1>;
685956d97fSEmmanuel Vadot            #size-cells = <0>;
695956d97fSEmmanuel Vadot        };
705956d97fSEmmanuel Vadot
715956d97fSEmmanuel Vadot        mdio@8 {
725956d97fSEmmanuel Vadot            reg = <0x8>;
735956d97fSEmmanuel Vadot            #address-cells = <1>;
745956d97fSEmmanuel Vadot            #size-cells = <0>;
755956d97fSEmmanuel Vadot        };
765956d97fSEmmanuel Vadot    };
775956d97fSEmmanuel Vadot
785956d97fSEmmanuel Vadot    mdio-mux-2 {
795956d97fSEmmanuel Vadot        compatible = "mdio-mux-multiplexer";
805956d97fSEmmanuel Vadot        mux-controls = <&mux1 1>;
815956d97fSEmmanuel Vadot        mdio-parent-bus = <&emdio2>;
825956d97fSEmmanuel Vadot        #address-cells = <1>;
835956d97fSEmmanuel Vadot        #size-cells = <0>;
845956d97fSEmmanuel Vadot
855956d97fSEmmanuel Vadot        mdio@0 {
865956d97fSEmmanuel Vadot            reg = <0x0>;
875956d97fSEmmanuel Vadot            #address-cells = <1>;
885956d97fSEmmanuel Vadot            #size-cells = <0>;
895956d97fSEmmanuel Vadot        };
905956d97fSEmmanuel Vadot
915956d97fSEmmanuel Vadot        mdio@1 {
925956d97fSEmmanuel Vadot            reg = <0x1>;
935956d97fSEmmanuel Vadot            #address-cells = <1>;
945956d97fSEmmanuel Vadot            #size-cells = <0>;
955956d97fSEmmanuel Vadot        };
965956d97fSEmmanuel Vadot    };
975956d97fSEmmanuel Vadot
985956d97fSEmmanuel Vadot  - |
995956d97fSEmmanuel Vadot    /* The parent device of mux controller is syscon device. */
1005956d97fSEmmanuel Vadot
1015956d97fSEmmanuel Vadot    #include <dt-bindings/mux/mux.h>
1025956d97fSEmmanuel Vadot    syscon@1000 {
1035956d97fSEmmanuel Vadot        reg = <0x1000 0x100>;
1045956d97fSEmmanuel Vadot
1055956d97fSEmmanuel Vadot        mux2: mux-controller {
1065956d97fSEmmanuel Vadot            compatible = "mmio-mux";
1075956d97fSEmmanuel Vadot            #mux-control-cells = <1>;
1085956d97fSEmmanuel Vadot
1095956d97fSEmmanuel Vadot            mux-reg-masks =
1105956d97fSEmmanuel Vadot                <0x3 0x30>, /* 0: reg 0x3, bits 5:4 */
1115956d97fSEmmanuel Vadot                <0x3 0x40>; /* 1: reg 0x3, bit 6 */
1125956d97fSEmmanuel Vadot            idle-states = <MUX_IDLE_AS_IS>, <0>;
1135956d97fSEmmanuel Vadot        };
1145956d97fSEmmanuel Vadot    };
1155956d97fSEmmanuel Vadot
1165956d97fSEmmanuel Vadot    video-mux {
1175956d97fSEmmanuel Vadot        compatible = "video-mux";
1185956d97fSEmmanuel Vadot        mux-controls = <&mux2 0>;
1195956d97fSEmmanuel Vadot        #address-cells = <1>;
1205956d97fSEmmanuel Vadot        #size-cells = <0>;
1215956d97fSEmmanuel Vadot
1225956d97fSEmmanuel Vadot        ports {
1235956d97fSEmmanuel Vadot            #address-cells = <1>;
1245956d97fSEmmanuel Vadot            #size-cells = <0>;
1255956d97fSEmmanuel Vadot
1265956d97fSEmmanuel Vadot            /* inputs 0..3 */
1275956d97fSEmmanuel Vadot            port@0 {
1285956d97fSEmmanuel Vadot                reg = <0>;
1295956d97fSEmmanuel Vadot            };
1305956d97fSEmmanuel Vadot            port@1 {
1315956d97fSEmmanuel Vadot                reg = <1>;
1325956d97fSEmmanuel Vadot            };
1335956d97fSEmmanuel Vadot            port@2 {
1345956d97fSEmmanuel Vadot                reg = <2>;
1355956d97fSEmmanuel Vadot            };
1365956d97fSEmmanuel Vadot            port@3 {
1375956d97fSEmmanuel Vadot                reg = <3>;
1385956d97fSEmmanuel Vadot            };
1395956d97fSEmmanuel Vadot
1405956d97fSEmmanuel Vadot            /* output */
1415956d97fSEmmanuel Vadot            port@4 {
1425956d97fSEmmanuel Vadot                reg = <4>;
1435956d97fSEmmanuel Vadot            };
1445956d97fSEmmanuel Vadot        };
1455956d97fSEmmanuel Vadot    };
1465956d97fSEmmanuel Vadot...
147