SPI chip select on WP77xx


#1

Hello Forum,
I have added a WiFi card with SPI to a WP77xx module and it is running. The spisvc example module was used to combine the wifi driver with the SPI driver, which worked straight forward.
The problem is, that the chip select signal (on GPIO 2) is not used by the SPI driver, though it seems to be configured in the DTS file (mdm9607-wp76xx.dtsi).

                    spi1_cs0_active: cs0_active {
                            /* CS */
                            mux {
                                    pins = "gpio2";
                                    function = "blsp_spi3";
                            };

So my question: How can I tell the SPI driver to use the GPIO 2 pin as chip select?

Thanks!


#2

Hi,

For GPIO 2 is used as chip select as part of SOC below command(cs-gpio) need to enable.
cs-gpio = <gpio2 24 GPIO_ACTIVE_HIGH>

Example:
spi_0: spi_hub: spi@f9926000 {
compatible = “qlspi,qlspi_eoss3”;
reg = <1>;
interrupt-parent = <&msmgpio>;
interrupts = <94 0>;
/* spi-max-frequency = <18000000>; /
spi-max-frequency = <6000000>;
qlspi,irq-gpio = <&msmgpio 59 0x00>;
qlspi,cs-gpio = <&msmgpio 21 0x00>;
qlspi,mosi-gpio = <&msmgpio 52 0x00>;
qlspi,miso-gpio = <&msmgpio 53 0x00>;
qlspi,clk-gpio = <&msmgpio 58 0x00>;
/ qlspi,sw_intr_1_gpio = <&msmgpio 94 0x00>; /
/ SPI device on the slave device which it has to enumerate in spi_0 dev node.
spidev0@1 {
compatible = “sierra,spidev”;
spi-max-frequency = <50000000>;
reg = <0>;
};
};

In the above dts example Where 21 is chip select of msmgpio. Similarly mosi-gpio,miso-gpio can also be configured.
cs-gpio internaly informs driver about chipselect.
Also refer “arch/arm/boot/dts/imx28-tx28.dts” of “spi_gpio” node.