SPI Bus -- Device Tree Values -- Doubts

Hi,

In Kernel source, in path, Documentation/devicetree/bindings/spi/spi-bus.txt

  • spi-cpol - (optional) Empty property indicating device requires
    inverse clock polarity (CPOL) mode
  • spi-cpha - (optional) Empty property indicating device requires
    shifted clock phase (CPHA) mode
  • spi-cs-high - (optional) Empty property indicating device requires
    chip select active high
  • spi-3wire - (optional) Empty property indicating device requires
    3-wire mode.
  • spi-lsb-first - (optional) Empty property indicating device requires
    LSB first mode.
  • spi-lsbyte-first - (optional) Empty property indicating device requires
    Least Significant Byte first mode.
  • spi-tx-bus-width - (optional) The bus width(number of data wires) that
    used for MOSI. Defaults to 1 if not present.
  • spi-rx-bus-width - (optional) The bus width(number of data wires) that
    used for MISO. Defaults to 1 if not present.

How to assign these values? Getting little bit confusions.

The device values:

spi-cpol => Falling edge comes first, inverse values, i.e. CPOL = 1
spi-cpha => Data is valid in low to high transition, CPHA = 1
spi-cs-high => Chip select active low
spi-3wire => The device uses CS, Clk, MoSi
spi-lsb-first => Most significant bit first
spi-lsbyte-first => Use only one byte, then what value for this.
spi-tx-bus-width => only one Mosi used
spi-rx-bus-width => Not used.

The device node is as:

/* spi4 controller */
spi@3240000 {

     status = "okay";
    
     spi_device@0{

            compatible = "driver_name"; 

            status = "okay";

            reg = <0>;  /* chip select */
            spi-max-frequency = <16000000>; 

            controller-data{
                            
                   nvidia,enable-hw-based-cs;
                   //nvidia,cs-setup-clk-count = <0x1e>;

                    };

            };

    };

Have the below doubts?

spi-cpol => define or empty ???
spi-cpha => define or empty ???
spi-cs-high => define or empty ???
spi-3wire => define or empty ??? Used only CS, CLK, Mosi. Then what is this value?
spi-lsb-first => define or empty ???
spi-lsbyte-first => define or empty ??? Use only one byte, then what value for this.
spi-rx-bus-width => define or empty ??? Not used this, then what value for this.

Thanks for the reply.

Looking into spi bus core (spi.c) and spi-tegra114.c files.

-Thanks.

@BalajiNP
Those config is for the SPI device driver not for the host driver. You have to check with device vendor.

Hi ShaneCCC,

Got the values from device data sheet, need the information about how to represent in device tree.
Need to port this device driver to Nvidia board. Trying this. This may generic information request.

-Thanks.

#BalajiNP
The device tree config is depend on how the device driver implement. You also can ignore the DT config only need to fill those config from you device driver.