xref: /freebsd/sys/contrib/device-tree/Bindings/spi/spi-mux.yaml (revision 2eb4d8dc723da3cf7d735a3226ae49da4c8c5dbc)
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:
33c66ec88fSEmmanuel Vadot  - $ref: "/schemas/spi/spi-controller.yaml#"
34c66ec88fSEmmanuel Vadot
35c66ec88fSEmmanuel Vadotmaintainers:
36c66ec88fSEmmanuel Vadot  - Chris Packham <chris.packham@alliedtelesis.co.nz>
37c66ec88fSEmmanuel Vadot
38c66ec88fSEmmanuel Vadotproperties:
39c66ec88fSEmmanuel Vadot  compatible:
40c66ec88fSEmmanuel Vadot    const: spi-mux
41c66ec88fSEmmanuel Vadot
42c66ec88fSEmmanuel Vadot  mux-controls:
43c66ec88fSEmmanuel Vadot    maxItems: 1
44c66ec88fSEmmanuel Vadot
45c66ec88fSEmmanuel Vadotrequired:
46c66ec88fSEmmanuel Vadot  - compatible
47c66ec88fSEmmanuel Vadot  - reg
48c66ec88fSEmmanuel Vadot  - spi-max-frequency
49c66ec88fSEmmanuel Vadot  - mux-controls
50c66ec88fSEmmanuel Vadot
516be33864SEmmanuel VadotunevaluatedProperties: false
526be33864SEmmanuel Vadot
53c66ec88fSEmmanuel Vadotexamples:
54c66ec88fSEmmanuel Vadot  - |
55c66ec88fSEmmanuel Vadot    #include <dt-bindings/gpio/gpio.h>
56c66ec88fSEmmanuel Vadot    mux: mux-controller {
57c66ec88fSEmmanuel Vadot        compatible = "gpio-mux";
58c66ec88fSEmmanuel Vadot        #mux-control-cells = <0>;
59c66ec88fSEmmanuel Vadot
60c66ec88fSEmmanuel Vadot        mux-gpios = <&gpio0 3 GPIO_ACTIVE_HIGH>;
61c66ec88fSEmmanuel Vadot    };
62c66ec88fSEmmanuel Vadot
63c66ec88fSEmmanuel Vadot    spi {
64c66ec88fSEmmanuel Vadot        #address-cells = <1>;
65c66ec88fSEmmanuel Vadot        #size-cells = <0>;
66c66ec88fSEmmanuel Vadot        spi@0 {
67c66ec88fSEmmanuel Vadot            compatible = "spi-mux";
68c66ec88fSEmmanuel Vadot            reg = <0>;
69c66ec88fSEmmanuel Vadot            #address-cells = <1>;
70c66ec88fSEmmanuel Vadot            #size-cells = <0>;
71c66ec88fSEmmanuel Vadot            spi-max-frequency = <100000000>;
72c66ec88fSEmmanuel Vadot
73c66ec88fSEmmanuel Vadot            mux-controls = <&mux>;
74c66ec88fSEmmanuel Vadot
75*2eb4d8dcSEmmanuel Vadot            flash@0 {
76c66ec88fSEmmanuel Vadot                compatible = "jedec,spi-nor";
77c66ec88fSEmmanuel Vadot                reg = <0>;
78c66ec88fSEmmanuel Vadot                spi-max-frequency = <40000000>;
79c66ec88fSEmmanuel Vadot            };
80c66ec88fSEmmanuel Vadot
81*2eb4d8dcSEmmanuel Vadot            sensor@1 {
82*2eb4d8dcSEmmanuel Vadot                compatible = "bosch,bme680";
83c66ec88fSEmmanuel Vadot                reg = <1>;
84c66ec88fSEmmanuel Vadot                spi-max-frequency = <10000000>;
85c66ec88fSEmmanuel Vadot            };
86c66ec88fSEmmanuel Vadot        };
87c66ec88fSEmmanuel Vadot    };
88