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.

Linux/AM5728: SPI configuration

Part Number: AM5728
Other Parts Discussed in Thread: DRA742,

Tool/software: Linux

I am trying to enable spi on my am57xx-evm board. I have enabled through menuconfig the spidev support and can now see it under /sys/class/spidev. I have also modified my device tree file,

am57xx-evm-common.dtsi with the following:

mcspi4_pins: mcspi4_pins {
                pinctrl-single,pins = <
                        0x350 (PIN_OUTPUT | MUX_MODE2)
                        0x34C (PIN_OUTPUT | MUX_MODE2)
                        0x348 (PIN_INPUT | MUX_MODE2) 
                        0x344 (PIN_OUTPUT | MUX_MODE2)
                >;
        };

&mcspi4 {
        pinctrl-names = "default";
        pinctrl-0 = <&mcspi4_pins>;
        status = "okay";
        spidev@4 {
                  compatible = "linux, spidev";
                  spi-max-frequency = <48000000>;
                  reg = <0x0>;
                  status = "okay";
        };
};

However, I am still unable to see the spi device under /dev after rebuilding the kernel, dts files, and rebooting.

My suspicions are that:

- I may have placed these blocks of code in the wrong place in the device tree file ( or in the wrong dts file).

- And I am also not sure of what the hex values mean in the pinctrl.

I am following the instructions here to build the kernel files and dts files: http://processors.wiki.ti.com/index.php/Linux_Kernel_Users_Guide 

Please let me know of what I may be doing wrong. Thanks!

  • The software team have been notified. They will respond here.

    One thing you should correct is to enable the input on the SPI clock signal. This is used for retiming of SPI receive data and SPI receive will not work otherwise.
  • Hello Eeshan,

    Please, check this guide.
    The hex value in pinctrl is the offset address of that pin followed by mux mode and direction settings.

    Best regards,
    Kemal

  • Hello,
    Thanks for the clarification. my am57xx-evm.dts file is shown below exactly as how i have wrote it. Please let me know what may be wrong.

    #include "am57xx-evm-base.dts"
    #include "am57xx-evm-common-cam-mt9t111.dtsi"

    / {
    compatible = "ti,am5728-evm", "ti,am572x-beagle-x15", "ti,am5728", "ti,dra742", "ti,dra74", "ti,dra7";
    mcspi4_pins: mcspi4_pins {
    pinctrl-single,pins = <
    0x350 (PIN_OUTPUT_PULLUP | MUX_MODE2) /*mcasp5_axr1.spi4_cs0*/
    0x34C (PIN_OUTPUT_PULLUP | MUX_MODE2) /*mcasp5_axr0.spi4_d0*/
    0x348 (PIN_INPUT_PULLUP | MUX_MODE2) /*mcasp5_fsx.spi4_d1*/
    0x344 (PIN_INPUT_PULLUP | MUX_MODE2) /*mcasp5_aclkx.spi4_clk*/
    >;
    };

    };

    &mcspi4 {
    pinctrl-names = "default";
    pinctrl-0 = <&mcspi4_pins>;
    status = "okay";
    ti,pindir-d0-out-d1-in = <1>;
    spidev@0 {
    compatible = "rohm,dh2228fv";
    spi-max-frequency = <48000000>;
    reg = <0x0>;
    status = "okay";
    };
    };


    #include "am57xx-evm-cmem.dtsi"

    Please let me know if there is anything wrong here.