After upgrade to Linux 5.15.148, SPI CS changes to active high

  • After upgrading to Linux 5.15.148, the chip select on spidev on ecspi3 goes high when active instead of low. I've tested using unmodified device tree files on armStoneA9r2q. Running on kernel 5.4.70 works fine. ecspi2 spidev seems to work as expected. Any reason why this would happen?


    Verified using downloaded F&S Kirkstone sdcard image and spidev_test.c application.

  • Hello,


    in fact, cs-gpio has been set to active high in the device tree since the beginning:

    https://github.com/FSEmbedded/…armstonea9r2qdl.dtsi#L549


    but you are right, it should be active low by default.

    For some reason, this device tree entry seemed to be ignored in earlier releases, and now seems to work.


    We will investigate on this.

    Could you try to set this entry to active low and check, if it works correctly then?


    Code
    1. cs-gpios = <&gpio2 26 GPIO_ACTIVE_LOW>;



    Your F&S Support Team

  • Thanks. It did not make any difference for me, but what actually worked was changing the chip select to use GPIO instead of native chip select line:


    Code
    1. pinctrl_ecspi3_cs: ecspi3cs {
    2. fsl,pins = <
    3. /* ECSPI3_SS0 - slave (chip) select 0 */
    4. MX6QDL_PAD_DISP0_DAT3__GPIO4_IO24 0x1b0b0
    5. >;
    6. };

    Using GPIO instead of native chip select is also mentioned here:
    kernel.org/doc/Documentation/devicetree/bindings/spi/fsl-imx-cspi.txt


    I don't understand why the native chip selected suddenly changed to active high. The reason for using GPIO instead was not related to that. I really haven't looked into changing that though.


    Also, the fsl,spi-num-chipselects is obsolete and should be replaced by num-cs. If not, the value defaults to 3.