(i.MX8) How SPI driver control the LPSPI3 CS1 pin if it can not config to GPIO ?

cancel
Showing results for 
Search instead for 
Did you mean: 

(i.MX8) How SPI driver control the LPSPI3 CS1 pin if it can not config to GPIO ?

556 Views
Contributor II

Hi, 

   I am using i.MX8QXP custom board with 4.9.88_beta 2 SDK to develop.

We connect 2 spi slave devices to the LPSPI3 port, but I found the SPI3_CS1 can not config to GPIO.

   In the spi-fsl-lpspi.c , the chipselect should be gpio to let the driver control which spi device to be select.

So my questions are

1.  In LPSPI3 ,  the driver how to control SPI3_CS1 if this pin can not config to GPIO

2. IF SPI3_CS0 , SPI3_CS1 can be set to gpio , what is the correct representation in dts ?

     like below ??

     cs-gpios = <&gpio1 16 GPIO_ACTIVE_LOW> ,  <&gpio1 17 GPIO_ACTIVE_LOW> ,  

  

spi-fsl-lpspi.c

for (i = 0; i < master->num_chipselect; i++) {
int cs_gpio = of_get_named_gpio(np, "cs-gpios", i);

if (!gpio_is_valid(cs_gpio) && lpspi_platform_info)
cs_gpio = lpspi_platform_info->chipselect[i];

fsl_lpspi->chipselect[i] = cs_gpio;
if (!gpio_is_valid(cs_gpio))
continue;

ret = devm_gpio_request(&pdev->dev, fsl_lpspi->chipselect[i],
DRIVER_NAME);
if (ret) {
dev_err(&pdev->dev, "can't get cs gpios\n");
goto out_master_put;
}
}

my spi3 dts part

pinctrl_lpspi3: lpspi3grp {
fsl,pins = <
SC_P_SPI3_SCK_ADMA_SPI3_SCK 0x0600004c
SC_P_SPI3_SDO_ADMA_SPI3_SDO 0x0600004c
SC_P_SPI3_SDI_ADMA_SPI3_SDI 0x0600004c
SC_P_SPI3_CS1_ADMA_SPI3_CS1 0x0600004c
>;
};

pinctrl_lpspi3_cs0: lpspi3_cs0 {
fsl,pins = <
SC_P_SPI3_CS0_LSIO_GPIO0_IO16 0x21

>;
}

&lpspi3 {
#address-cells = <1>;
#size-cells = <0>;
fsl,spi-num-chipselects = <2>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_lpspi3 &pinctrl_lpspi3_cs0>;
cs-gpios = <&gpio1 16 GPIO_ACTIVE_LOW>;
status = "okay";


spidev@0 {
compatible = "rohm,dh2228fv";
spi-max-frequency = <500000>;
reg = <0>;
}

spidev@1 {
compatible = "rohm,dh2228fv";
spi-max-frequency = <500000>;
reg = <0>;
};

};

Best,

Andy

0 Kudos
4 Replies

35 Views
Contributor I

Hi Andy and Sharmila,

How did you work around this issue?   I got into the same issue.

Thanks,

Dionie

0 Kudos

35 Views
NXP TechSupport
NXP TechSupport

You have two chipselects but only configure 1 gpio in cs-gpios.

For your examples, you may refer to this:

Imx6s cannot find spi device in linux  

https://community.nxp.com/message/866806 

0 Kudos

35 Views
Contributor II

Hi Jimmy,

   Thanks for your reply.

But as I said, in the i.MX8 platform,  I can not config the SPI3 CS1 to GPIO.

There is no GPIO option for SPI3  CS1 .

SPI3_CS1.JPG

Do you have any comment ?

Best,

Andy

0 Kudos

35 Views
Contributor III

Hi Jimmy,

 I am also working on i.MX8 platform, we do use SPI3 and as you told we cannot configure SPI3 CS1 to GPIO. The lpspi driver doesnot support native chip select. So I have the issue with chip select. Problem is chip select is not going low. Do you have any suggestions/solution on this ?

Regards,

Sharmila

0 Kudos