native cs and gpio cs in spi - imx6

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

native cs and gpio cs in spi - imx6

跳至解决方案
9,343 次查看
surendradhobale
Contributor III

Hello,

         We are using four ecspi from imx6ul.When i used cs as gpio then everything works fine.

But when i used CS as native. It wont work.

Following configuration i have done for native CS in dts as,

&ecspi1 {
 fsl,spi-num-chipselects = <1>;
 cs-gpios = <0>;
 pinctrl-names = "default";
  pinctrl-0 = <&pinctrl_ecspi1 &pinctrl_spi_cs1>;
 status = "okay";

  spi1_max14830: max14830@0 {
                   compatible = "maxim,max14830";
                   reg = <0>;
                    mode = <0>;
                   clocks = <&clk10m>;
                   clock-names = "osc";
                     interrupt-parent = <&gpio4>;
                    interrupts = <10 IRQ_TYPE_EDGE_FALLING >;
                         gpio-controller;
                       #gpio-cells = <2>;
                   spi-max-frequency = <10000000>;
 };
};

Pin Mux

pinctrl_ecspi1: ecspi1grp {
   fsl,pins = <
    MX6UL_PAD_CSI_DATA04__ECSPI1_SCLK 0x10a0
    /* MX6UL_PAD_CSI_DATA05__ECSPI1_SS0 0x10b0 */
    /* MX6UL_PAD_CSI_DATA05__GPIO4_IO26 0x10a0 */
    MX6UL_PAD_CSI_DATA06__ECSPI1_MOSI 0x10a0
    MX6UL_PAD_CSI_DATA07__ECSPI1_MISO 0x10a0
    MX6UL_PAD_NAND_ALE__GPIO4_IO10  0x10a0
   >;
  };

 pinctrl_spi_cs1: spi_cs1 {
   fsl,pins = <
    MX6UL_PAD_CSI_DATA05__ECSPI1_SS0 0x10b0
   >;
  };

When I configure same interface with CS as gpio

cs-gpios = <&gpio4 26 GPIO_ACTIVE_LOW>;

It works fine.

Why it doesnot work with native cs?

I am using the Kernel 4.9 and spi-imx driver. Can you please help me in this issue.

Regards,

Surendra

标签 (3)
标记 (2)
0 项奖励
回复
1 解答
6,158 次查看
fabio_estevam
NXP Employee
NXP Employee

Hi Surendra,

Natve chip select usage on spi-imx driver has been fixed commit 602c8f4485cd1e6de67e41c78db96fa4f6808e53
Author: Greg Ungerer <gerg@linux-m68k.org>
Date:   Tue Jul 11 14:22:11 2017 +1000

    spi: imx: fix use of native chip-selects with devicetree

from 4.14 kernel.

So you could either use GPIO chip select or backport this fix into 4.9.

Regards,

Fabio Estevam

在原帖中查看解决方案

0 项奖励
回复
6 回复数
6,159 次查看
fabio_estevam
NXP Employee
NXP Employee

Hi Surendra,

Natve chip select usage on spi-imx driver has been fixed commit 602c8f4485cd1e6de67e41c78db96fa4f6808e53
Author: Greg Ungerer <gerg@linux-m68k.org>
Date:   Tue Jul 11 14:22:11 2017 +1000

    spi: imx: fix use of native chip-selects with devicetree

from 4.14 kernel.

So you could either use GPIO chip select or backport this fix into 4.9.

Regards,

Fabio Estevam

0 项奖励
回复
6,160 次查看
surendradhobale
Contributor III

Hello Fabio,

I am using the imx6ul. In spi-imx driver configuration is under mx51_ecspi_config.

The patch you mentioned is only for the mx31_config and mx21_config. So this patch not applicable to mx51 ecspi configuration.

Thanks,

Surendra

0 项奖励
回复
6,160 次查看
igorpadykov
NXP Employee
NXP Employee

Hi Surendra

please try below patch

kernel/git/next/linux-next.git - The linux-next integration testing tree 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复
6,160 次查看
surendradhobale
Contributor III

Hello igor,

      Thanks for quick reply . I have applied same patch. But same result.

Same results. ( when i configure cs-gpio = <0> and with this patch). When i debuggging the code spi->chip_select is configured, but doesnot reading the correct data ( like REV ID) from the slave device.

The functionality of the spi-imx driver working fine with native CS?

Thanks & Regards,

Surendra

0 项奖励
回复
6,160 次查看
igorpadykov
NXP Employee
NXP Employee

Hi Surendra

 

please post this on kernel mail list,

Majordomo Lists at VGER.KERNEL.ORG 

nxp bsp does not support native CS.

 

Best regards
igor

0 项奖励
回复
6,160 次查看
surendradhobale
Contributor III

Hello Igor,

 I am using NXP repository kernel 4.9 

This does not have native CS support'?

Means I can use only GPIO Chip select ?

0 项奖励
回复