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