zephyr,mspi-bitbang-controller

Description

These nodes are “mspi” bus nodes.

Bitbang MSPI controller

MSPI controller implemented in software on GPIO pins.

The controller supports synchronous programmed I/O transfers in controller
mode, half duplex, with all I/O modes up to the number of io-gpios entries,
all data rates and all clock polarity and phase modes.

Limitations:

- Asynchronous transfers are rejected with -ENOTSUP.

- The MSPI_DMA and MSPI_MEMMAP transfer modes are rejected with -ENOTSUP.

- Full duplex and DQS are rejected with -ENOTSUP.

- Callbacks, memory mapping (XIP), scrambling and timing configuration are
  not implemented.

- The priority of a transfer and the callback mask of a packet are ignored.

- The clock rate is limited to the frequency a device requests and to
  250 kHz, whichever is lower, because each quarter of a clock period is a
  busy wait of at least one microsecond. The time the GPIO accesses take
  comes on top, so the actual rate is still lower. Without any frequency,
  that is a device that requests 0 on a controller without clock-frequency,
  there are no waits and the GPIO accesses alone set the rate.

- The maximum CE active time of a device (time_to_break) is not enforced. CE
  stays asserted for a whole packet; a packet is never interrupted to
  release and reassert CE, however long it takes.

- The memory boundary of a device (mem_boundary) is not enforced. A packet
  that crosses the boundary is not split, so the device driver has to issue
  one packet per boundary-aligned block itself.

- With hold_ce set, CE stays asserted between the packets of a transfer and
  after it, and a following transfer on the same CE line continues with CE
  asserted. CE is released by a transfer without hold_ce, by a transfer on
  another CE line, by a transfer that times out, by
  mspi_get_channel_status() and by mspi_config(). While CE is held,
  mspi_dev_config() for the same device from the thread that holds the
  controller is allowed and leaves CE asserted. mspi_dev_config() for
  another device returns -EBUSY as long as the controller has not been
  released.

Examples

mspi0: mspi-bitbang-controller {
    compatible = "zephyr,mspi-bitbang-controller";
    #address-cells = <1>;
    #size-cells = <0>;
    sck-gpios = <&gpio3 7 GPIO_ACTIVE_HIGH>;
    io-gpios = <&gpio3 8 GPIO_ACTIVE_HIGH>,
               <&gpio3 9 GPIO_ACTIVE_HIGH>,
               <&gpio3 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>,
               <&gpio3 11 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
    ce-gpios = <&gpio3 0 GPIO_ACTIVE_LOW>;
    clock-frequency = <DT_FREQ_K(250)>;

    flash@0 {
        compatible = "jedec,nor";
        reg = <0>;
        size = <DT_SIZE_M(64)>;
        jedec-id = [ef 40 17];
        mspi-max-frequency = <DT_FREQ_K(250)>;
        mspi-io-mode = "MSPI_IO_MODE_QUAD_1_1_4";
        mspi-data-rate = "MSPI_DATA_RATE_SINGLE";
        mspi-cpp-mode = "MSPI_CPP_MODE_0";
        mspi-endian = "MSPI_BIG_ENDIAN";
        mspi-ce-polarity = "MSPI_CE_ACTIVE_LOW";
    };
};

Properties

Properties not inherited from the base binding file.

Name

Type

Details

sck-gpios

phandle-array

Serial clock output.

This property is required.

io-gpios

phandle-array

Data lines, up to sixteen, indexed like the IO0 .. IO15 pins of a
multi-bit SPI device. In single I/O mode IO0 is the data output and IO1
the data input; a multi-line phase uses IO0 .. IOn in both directions.

This property is required.

clock-frequency

int

Clock frequency the MSPI peripheral is being driven at, in Hz.

op-mode

string

Indicate MSPI controller or peripheral mode of the controller.
The controller driver may use this during initialization.

Legal values: MSPI_OP_MODE_CONTROLLER, MSPI_OP_MODE_PERIPHERAL

duplex

string

Indicate MSPI Duplex mode, full or half.
The controller driver may check this setting against its
capabilities.

Legal values: MSPI_HALF_DUPLEX, MSPI_FULL_DUPLEX

dqs-support

boolean

Indicate whether the hardware supports DQS.
The controller driver may check this setting against its
capabilities.

software-multiperipheral

boolean

Indicate whether the controller driver enables support for
software managed multi peripheral feature.
At the minimum, the controller driver should use it to allow
or disallow calling mspi_dev_config with MSPI_DEVICE_CONFIG_NONE.

ce-gpios

phandle-array

An array of chip select GPIOs to use. Each element
in the array specifies a GPIO. The index in the array
corresponds to the child node that the CE gpio controls.

Example:

  mspi@... {
          ce-gpios = <&gpio0 23 GPIO_ACTIVE_LOW>,
                        <&gpio1 10 GPIO_ACTIVE_LOW>,
                        ...;

          mspi-device@0 {
                  reg = <0>;
                  ...
          };
          mspi-device@1 {
                  reg = <1>;
                  ...
          };
          ...
  };

The child node "mspi-device@0" specifies a mspi device with
chip select controller gpio0, pin 23, and devicetree
GPIO flags GPIO_ACTIVE_LOW. Similarly, "mspi-device@1" has CE GPIO
controller gpio1, pin 10, and flags GPIO_ACTIVE_LOW. Additional
devices can be configured in the same way.

If unsure about the flags cell, GPIO_ACTIVE_LOW is generally a safe
choice for a typical "CEn" pin. GPIO_ACTIVE_HIGH may be used if
intervening hardware inverts the signal to the peripheral device or
the line itself is active high.

Regardless of whether the CE pin may need software control or MSPI
controller has dedicated CE pin, this field should be defined to
help manage multiple devices on the same MSPI controller.

packet-data-limit

int

Specifies the maximum length of data that the controller can transfer
in a single packet. Transceive requests made to the controller must be
split into multiple packets if a single one would exceed this value.
If not specified, no limit is imposed.