SPI Delay Probing

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SPI Delay Probing

Jump to solution
3,002 Views
manish-sharma
NXP Employee
NXP Employee

Hi All,

We have one SPI device (spi-device-1)which needs reset HIGH before probe happen. To make it, we used 

pinctrl-assert-gpios = <&gpio4 20 GPIO_ACTIVE_HIGH>;

Now, probe fails even adding above property so we added some delay around 1.5s which made it work but we need a property in the device tree which can handle such case.

&lpspi3 {
        #address-cells = <1>;
        #size-cells = <0>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_lpspi3>;
        pinctrl-assert-gpios = <&gpio4 20 GPIO_ACTIVE_HIGH>;
        num-cs = <1>;
        status = "okay";
        cs-gpios = <&gpio2 8 GPIO_ACTIVE_LOW>;
 
spi-device-1: device1@0 {
compatible = "device-nxp, device1";
reg = <0x0>;
        spi-max-frequency = <12000000>;
interrupt-parent = <&gpio1>;      /* GPIO Bank 3 */
interrupts = <9 0x1>;            /* Index: 25, rising edge */
spi-cpha;                         /* SPI mode: CPHA=1 */
spi-cpol;                         /* SPI mode: CPOL=1 */
local-mac-address = [ A0 B0 C0 D0 E0 F0 ];
};
};
 
Regards,
MKS
 
iMX8X #linux
Labels (1)
0 Kudos
Reply
1 Solution
2,945 Views
Chavira
NXP TechSupport
NXP TechSupport

Hi @manish-sharma!

There's no existing mechanism that device tree can handle the delay. User needs to create a new property and handle it in the driver.

Best Regards!

Chavira

View solution in original post

0 Kudos
Reply
3 Replies
2,984 Views
Chavira
NXP TechSupport
NXP TechSupport

Hi @manish-sharma!
Thank you for contacting NXP Support!

You can add the gpio like the "gpio-leds" device.

If you need the pin in high state since the u-boot stage, you can add on the device tree of the u-boot and the device tree of the Linux kernel.

https://github.com/nxp-imx/linux-imx/blob/lf-6.1.y/arch/arm64/boot/dts/freescale/imx8mp-evk.dts#L20

https://github.com/nxp-imx/uboot-imx/blob/lf_v2022.04/arch/arm/dts/imx8mp-evk.dts#L20

Best Regards!
Chavira

0 Kudos
Reply
2,960 Views
manish-sharma
NXP Employee
NXP Employee

Hi @Chavira ,

Thanks for the response.

I rephrase the problem: The gpio4 (RESET) goes high before device1 probe but device1 needs some more time before it invokes probe function, however, in my case it happens immediately while we checked manual insertion (module-based insertion as .ko) and found that device1 needs 1.5 seconds before invocation of its probe function so need a mechanism where probe happens after 1.5s of gpio4 goes high. Is the any mechanism in device tree to achieve this?

 

nxg04383_0-1705409113233.png

 

Please see above diagram which needs to be achieved using above dts (kindly see above dts)

 

Regards,

MKS

0 Kudos
Reply
2,946 Views
Chavira
NXP TechSupport
NXP TechSupport

Hi @manish-sharma!

There's no existing mechanism that device tree can handle the delay. User needs to create a new property and handle it in the driver.

Best Regards!

Chavira

0 Kudos
Reply