xref: /freebsd/sys/contrib/device-tree/Bindings/spi/spi-mux.yaml (revision c66ec88fed842fbaad62c30d510644ceb7bd2d71)
1*c66ec88fSEmmanuel Vadot# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2*c66ec88fSEmmanuel Vadot%YAML 1.2
3*c66ec88fSEmmanuel Vadot---
4*c66ec88fSEmmanuel Vadot$id: http://devicetree.org/schemas/spi/spi-mux.yaml#
5*c66ec88fSEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
6*c66ec88fSEmmanuel Vadot
7*c66ec88fSEmmanuel Vadottitle: Generic SPI Multiplexer
8*c66ec88fSEmmanuel Vadot
9*c66ec88fSEmmanuel Vadotdescription: |
10*c66ec88fSEmmanuel Vadot  This binding describes a SPI bus multiplexer to route the SPI chip select
11*c66ec88fSEmmanuel Vadot  signals. This can be used when you need more devices than the SPI controller
12*c66ec88fSEmmanuel Vadot  has chip selects available. An example setup is shown in ASCII art; the actual
13*c66ec88fSEmmanuel Vadot  setting of the multiplexer to a channel needs to be done by a specific SPI mux
14*c66ec88fSEmmanuel Vadot  driver.
15*c66ec88fSEmmanuel Vadot
16*c66ec88fSEmmanuel Vadot        MOSI /--------------------------------+--------+--------+--------\
17*c66ec88fSEmmanuel Vadot        MISO |/------------------------------+|-------+|-------+|-------\|
18*c66ec88fSEmmanuel Vadot         SCL ||/----------------------------+||------+||------+||------\||
19*c66ec88fSEmmanuel Vadot             |||                            |||      |||      |||      |||
20*c66ec88fSEmmanuel Vadot      +------------+                        |||      |||      |||      |||
21*c66ec88fSEmmanuel Vadot      | SoC  |||   |                      +-+++-+  +-+++-+  +-+++-+  +-+++-+
22*c66ec88fSEmmanuel Vadot      |      |||   |                      | dev |  | dev |  | dev |  | dev |
23*c66ec88fSEmmanuel Vadot      |   +--+++-+ | CS-X  +------+\      +--+--+  +--+--+  +--+--+  +--+--+
24*c66ec88fSEmmanuel Vadot      |   | SPI  +-|-------+ Mux  |\\   CS-0 |        |        |        |
25*c66ec88fSEmmanuel Vadot      |   +------+ |       +--+---+\\\-------/   CS-1 |        |        |
26*c66ec88fSEmmanuel Vadot      |            |          |    \\\----------------/   CS-2 |        |
27*c66ec88fSEmmanuel Vadot      |   +------+ |          |     \\-------------------------/   CS-3 |
28*c66ec88fSEmmanuel Vadot      |   | ?    +-|----------/      \----------------------------------/
29*c66ec88fSEmmanuel Vadot      |   +------+ |
30*c66ec88fSEmmanuel Vadot      +------------+
31*c66ec88fSEmmanuel Vadot
32*c66ec88fSEmmanuel VadotallOf:
33*c66ec88fSEmmanuel Vadot  - $ref: "/schemas/spi/spi-controller.yaml#"
34*c66ec88fSEmmanuel Vadot
35*c66ec88fSEmmanuel Vadotmaintainers:
36*c66ec88fSEmmanuel Vadot  - Chris Packham <chris.packham@alliedtelesis.co.nz>
37*c66ec88fSEmmanuel Vadot
38*c66ec88fSEmmanuel Vadotproperties:
39*c66ec88fSEmmanuel Vadot  compatible:
40*c66ec88fSEmmanuel Vadot    const: spi-mux
41*c66ec88fSEmmanuel Vadot
42*c66ec88fSEmmanuel Vadot  mux-controls:
43*c66ec88fSEmmanuel Vadot    maxItems: 1
44*c66ec88fSEmmanuel Vadot
45*c66ec88fSEmmanuel Vadotrequired:
46*c66ec88fSEmmanuel Vadot  - compatible
47*c66ec88fSEmmanuel Vadot  - reg
48*c66ec88fSEmmanuel Vadot  - spi-max-frequency
49*c66ec88fSEmmanuel Vadot  - mux-controls
50*c66ec88fSEmmanuel Vadot
51*c66ec88fSEmmanuel Vadotexamples:
52*c66ec88fSEmmanuel Vadot  - |
53*c66ec88fSEmmanuel Vadot    #include <dt-bindings/gpio/gpio.h>
54*c66ec88fSEmmanuel Vadot    mux: mux-controller {
55*c66ec88fSEmmanuel Vadot        compatible = "gpio-mux";
56*c66ec88fSEmmanuel Vadot        #mux-control-cells = <0>;
57*c66ec88fSEmmanuel Vadot
58*c66ec88fSEmmanuel Vadot        mux-gpios = <&gpio0 3 GPIO_ACTIVE_HIGH>;
59*c66ec88fSEmmanuel Vadot    };
60*c66ec88fSEmmanuel Vadot
61*c66ec88fSEmmanuel Vadot    spi {
62*c66ec88fSEmmanuel Vadot        #address-cells = <1>;
63*c66ec88fSEmmanuel Vadot        #size-cells = <0>;
64*c66ec88fSEmmanuel Vadot        spi@0 {
65*c66ec88fSEmmanuel Vadot            compatible = "spi-mux";
66*c66ec88fSEmmanuel Vadot            reg = <0>;
67*c66ec88fSEmmanuel Vadot            #address-cells = <1>;
68*c66ec88fSEmmanuel Vadot            #size-cells = <0>;
69*c66ec88fSEmmanuel Vadot            spi-max-frequency = <100000000>;
70*c66ec88fSEmmanuel Vadot
71*c66ec88fSEmmanuel Vadot            mux-controls = <&mux>;
72*c66ec88fSEmmanuel Vadot
73*c66ec88fSEmmanuel Vadot            spi-flash@0 {
74*c66ec88fSEmmanuel Vadot                compatible = "jedec,spi-nor";
75*c66ec88fSEmmanuel Vadot                reg = <0>;
76*c66ec88fSEmmanuel Vadot                #address-cells = <1>;
77*c66ec88fSEmmanuel Vadot                #size-cells = <0>;
78*c66ec88fSEmmanuel Vadot                spi-max-frequency = <40000000>;
79*c66ec88fSEmmanuel Vadot            };
80*c66ec88fSEmmanuel Vadot
81*c66ec88fSEmmanuel Vadot            spi-device@1 {
82*c66ec88fSEmmanuel Vadot                compatible = "lineartechnology,ltc2488";
83*c66ec88fSEmmanuel Vadot                reg = <1>;
84*c66ec88fSEmmanuel Vadot                #address-cells = <1>;
85*c66ec88fSEmmanuel Vadot                #size-cells = <0>;
86*c66ec88fSEmmanuel Vadot                spi-max-frequency = <10000000>;
87*c66ec88fSEmmanuel Vadot            };
88*c66ec88fSEmmanuel Vadot        };
89*c66ec88fSEmmanuel Vadot    };
90