This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMDS64GPEVM: Enable spidev node in linux

Part Number: TMDS64GPEVM

hi, 

i want to enable the SPI-4 on linux . i have generated the dtsi file  by sysconfig tool and modified k3-am642-evm.dts as given below but spi is not enabled when system boots up.

Am i doing something wrong ?

  • Hello Paras,

    which device tree file did you modify, and what were your modifications?

    Regards,

    Nick

  • I have added the following nodes by taking spi0 as reference=

    &main_spi4 {
    pinctrl-names = "default";
    pinctrl-0 = <&main_spi4_pins_default>;
    ti,pindir-d0-out-d1-in = <1>;
    };

    And I have added the following pinmux setting as generated by sysvonfig tool =


    main_spi4_pins_default: main-spi4-pins-default {
    pinctrl-single,pins = <
    AM64X_IOPAD(0x0238, PIN_INPUT, 6) /* (B16) UART0_CTSn.SPI4_CLK */
    AM64X_IOPAD(0x024c, PIN_INPUT, 6) /* (E16) UART1_RTSn.SPI4_CS0 */
    AM64X_IOPAD(0x0250, PIN_INPUT, 6) /* (A17) MCAN0_TX.SPI4_CS1 */
    AM64X_IOPAD(0x0254, PIN_INPUT, 6) /* (B17) MCAN0_RX.SPI4_CS2 */
    AM64X_IOPAD(0x0270, PIN_INPUT, 6) /* (D18) ECAP0_IN_APWM_OUT.SPI4_CS3 */
    AM64X_IOPAD(0x023c, PIN_INPUT, 6) /* (A16) UART0_RTSn.SPI4_D0 */
    AM64X_IOPAD(0x0248, PIN_INPUT, 6) /* (D16) UART1_CTSn.SPI4_D1 */
    >;

    But still I cannot find any spi node in /dev dir .

  • Any update on this ?

  • Hi Paras,

    it looks like you are missing the declaration of a SPI device in the device tree. In the most generic way you can instantiate SPIDEV. Note that for this to work you'll also need to re-build the kernel with the CONFIG_SPI_SPIDEV option enabled, as this is disabled in the default TI SDK builds.

    Please see below for some additional guidance/details. You can also search for SPIDEV in general, there's a wealth of information out there.

    https://e2e.ti.com/support/processors-group/processors/f/processors-forum/947437/faq-ccs-tda4vm-how-to-use-spi-spi_dev-on-tda4-j721e

    Regards, Andreas

  • Hi Andreas, 

    Thanks, Now Spi is working but only one spidev is created for chipselect -->  CS0 . I want to use CS0,CS1, CS2 and CS3. 

    I have made the following modification to create multiple spidev file 

    &main_spi4 {
    pinctrl-names = "default";
    pinctrl-0 = <&main_spi4_pins_default>;
    status="okay";


    spidev@0 {

    spi-max-frequency = <24000000>;
    reg = <0>;
    compatible = "linux,spidev";
    };

    spidev@1 {

    spi-max-frequency = <24000000>;
    reg = <1>;
    compatible = "linux,spidev";
    };

    spidev@2 {

    spi-max-frequency = <24000000>;
    reg = <2>;
    compatible = "linux,spidev";
    };

    spidev@3 {

    spi-max-frequency = <24000000>;
    reg = <3>;
    compatible = "linux,spidev";
    };

    };

    main_spi4_pins_default: main-spi4-pins-default {
    pinctrl-single,pins = <
    AM64X_IOPAD(0x0238, PIN_INPUT, 6) /* (B16) UART0_CTSn.SPI4_CLK */
    AM64X_IOPAD(0x024c, PIN_INPUT, 6) /* (E16) UART1_RTSn.SPI4_CS0 */
    AM64X_IOPAD(0x0250, PIN_INPUT, 6) /* (A17) MCAN0_TX.SPI4_CS1 */
    AM64X_IOPAD(0x0254, PIN_INPUT, 6) /* (B17) MCAN0_RX.SPI4_CS2 */
    AM64X_IOPAD(0x0270, PIN_INPUT, 6) /* (D18) ECAP0_IN_APWM_OUT.SPI4_CS3 */
    AM64X_IOPAD(0x023c, PIN_INPUT, 6) /* (A16) UART0_RTSn.SPI4_D0 */
    AM64X_IOPAD(0x0248, PIN_INPUT, 6) /* (D16) UART1_CTSn.SPI4_D1 */
    >;

    };

    I am getting the this error after adding multiple sub nodes in spidev4 

    1.407748] omap2_mcspi 20140000.spi: cs1 >= max 1
    [ 1.412599] spi_master spi5: spi_device register error /bus@f4000/spi@20140000/spidev@1
    [ 1.420615] spi_master spi5: Failed to create SPI device for /bus@f4000/spi@20140000/spidev@1

    omap2_mcspi 20140000.spi: cs1 >= max 1
     spi_master spi5: spi_device register error /bus@f4000/spi@20140000/spidev@2
    spi_master spi5: Failed to create SPI device for /bus@f4000/spi@20140000/spidev@2

    omap2_mcspi 20140000.spi: cs1 >= max 1
    spi_master spi5: spi_device register error /bus@f4000/spi@20140000/spidev@3
    spi_master spi5: Failed to create SPI device for /bus@f4000/spi@20140000/spidev@3

    I have taken refrence from this https://e2e.ti.com/support/processors-group/processors/f/processors-forum/845157/am3354-multiple-cs-support-for-spi 

    but still only one spidev5.0 is created . 

    So what am i doing wrong ?