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.

AM5728: getting McSPI4 to work

Part Number: AM5728
Other Parts Discussed in Thread: ADS7844

I'm trying to get the McSPI4 operational on our board.  The pin mux settings in mux_data.h are:

{GPMC_A8, (M8 | PIN_INPUT)},        /* N7 gpmc_a8.spi4_sclk */

{GPMC_A9, (M8 | PIN_INPUT)},        /* R4 gpmc_a9.spi4_d1 */

{GPMC_A10, (M8 | PIN_OUTPUT)},  /* N9 gpmc_a10.spi4_d0 */

{GPMC_A11, (M8 | PIN_OUTPUT)},  /* P9 gpmc_a11.spi4_cs0 */

{GPMC_A12, (M8 | PIN_OUTPUT)},  /* P4 gpmc_a12.spi4_cs1 */

I see that all 4 of the multichannel serial peripheral interface ports are defined in dra7.x.  All have their status = "disabled".  So I added the following entry to our .dtsi file for our board and did the necessary rebuild of the kernel.

// ADS7844 interface
&mcspi4 {
status = "okay";
};

After restarting I don't see anything in the /dev directory for spi devices. On my old system I see /dev/spidev0.0  What am I missing?

  • Actually our pin mux settings are:

    {GPMC_A8, (M8 | PIN_OUTPUT)}, /* N7 gpmc_a8.spi4_sclk */
    {GPMC_A9, (M8 | PIN_INPUT)}, /* R4 gpmc_a9.spi4_d1 */
    {GPMC_A10, (M8 | PIN_OUTPUT)}, /* N9 gpmc_a10.spi4_d0 */
    {GPMC_A11, (M8 | PIN_OUTPUT)}, /* P9 gpmc_a11.spi4_cs0 */
    {GPMC_A12, (M8 | PIN_OUTPUT)}, /* P4 gpmc_a12.spi4_cs1 */

    We are master to two slave devices.  I made the changes and rebuilt u-boot but still no entries for spidev in /dev/

  • I mistakenly said I rebuilt kernel. What I did was rebuilt the device tree .dtb file and replaced the old one one the uSD card.

  • I don't understand why I would need to create a pinmux node in the device tree if I have already created the .pinmux file generated genericFileFormatPadConf.txt and genericFileFormatIOdelay.txt, converted them to padconf.txt and iodelay.txt and populated the mux_data.h file with their contents and rebuilt MLO and u-boot.  I can see that the pins have been configured as I defined them. I just don't see any corresponding device

    root@mitysom-am57x:~# devmem2 0x4a003460
    /dev/mem opened.
    Memory mapped at address 0xb6fc8000.
    Read at address 0x4A003460 (0xb6fc8460): 0x00010008
    root@mitysom-am57x:~# devmem2 0x4a003464
    /dev/mem opened.
    Memory mapped at address 0xb6f1a000.
    Read at address 0x4A003464 (0xb6f1a464): 0x00050008
    root@mitysom-am57x:~# devmem2 0x4a003468
    /dev/mem opened.
    Memory mapped at address 0xb6fe7000.
    Read at address 0x4A003468 (0xb6fe7468): 0x00010008
    root@mitysom-am57x:~# devmem2 0x4a00346c
    /dev/mem opened.
    Memory mapped at address 0xb6f29000.
    Read at address 0x4A00346C (0xb6f2946c): 0x00010008
    root@mitysom-am57x:~# devmem2 0x4a003470
    /dev/mem opened.
    Memory mapped at address 0xb6f95000.
    Read at address 0x4A003470 (0xb6f95470): 0x00010008

    Why in the example are all the pins in the example yo u referenced defined as inputs?  That doesn't seem correct.

  • Hi Stanley,

    I just asked you to look at it as a reference. The thread i pointed to was for TDA4.

    Have you added spidev node like in the example:

    +&main_spi6 {
    +    pinctrl-names = "default";
    +    pinctrl-0 = <&spi6_pins_default>;
    +    status="okay";
    +
    +    spidev@0 {
    +
    +       spi-max-frequency = <24000000>;
    +       reg = <0>;
    +       compatible = "linux,spidev";
    +};
    +};

    If you have already verified the pinmux in an older system then it should be fine.

    Why in the example are all the pins in the example yo u referenced defined as inputs?

    It is the working example showed on thread. By default INPUT will also enable output.

    My point was more on the above DT node where in you need to add spidev.

    - Keerthy

  • thanks for the clarification on the pins. I had no idea. Okay I followed the example you gave and based on the contents of dra7.dtsi which is included in dra74x.dtsi which is included in dra74x-p.dtsi which is included in my board file am57xx-mitysom.dtsi.

    from dra7.dtsi

    mcspi4: spi@480ba000 {
       compatible = "ti,omap4-mcspi";
       reg = <0x480ba000 0x200>;
       interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>;
       #address-cells = <1>;
       #size-cells = <0>;
       ti,hwmods = "mcspi4";
       ti,spi-num-cs = <1>; 
       dmas = <&sdma_xbar 70>, <&sdma_xbar 71>;
       dma-names = "tx0", "rx0";
      status = "disabled";
    };

    I added this to my  am57xx-mitysom.dtsi file:

    &mcspi4 {
       status = "okay";
       pinctrl-names = "default";
       // not sure following line appiles since i used MLO/mux_data.h
       //pinctrl-0 = <&spi6_pins_default>;
       spidev@0 {
           spi-max-frequency = <24000000>;
           reg = <0>;
           compatible = "ti,omap4-mcspi";
    };
    };

    I see the master but not the spidev1.0 entry. By the way does the spidev@0 specify the chip select??

    root@mitysom-am57x:~# ls -l /sys/class/spi*
    lrwxrwxrwx 1 root root 0 Aug 5 17:17 spi0 -> ../../devices/platform/44000000.ocp/4b300000.spi/spi_master/spi0
    lrwxrwxrwx 1 root root 0 Aug 5 17:17 spi1 -> ../../devices/platform/44000000.ocp/480ba000.spi/spi_master/spi1

  • Stanley,

    Enable CONFIG_SPI_SPIDEV=y explicitly in your defconfig. If you are using the SDK. then it is under arch/arm/configs/tisdk_am57xx_evm_defconfig.

    You should see an entry with spidev.


    Best Regards,
    Keerthy

  • Thanks I was able to set it up in the config file for my board. I now see spidev1.0. I will do some testing tomorrow.

    I have some questions.

    1. Does  the 0 in spidev@0  mean chip select 0?

    2. I changed the compatible in the spidev to  "linux,spidev" or should it be   "rohm,dh2228fv"?  The device I will be interfacing with is a TI ADS7844.

    &mcspi4 {
       status = "okay";
       pinctrl-names = "default";
       // not sure following line appiles since i used MLO/mux_data.h
       //pinctrl-0 = <&spi6_pins_default>;
       spidev@0 {
           spi-max-frequency = <24000000>;
           reg = <0>;
           compatible = "linux, spidev";
    };

    root@mitysom-am57x:~# ls -l /sys/class/spi*
    /sys/class/spi_master:
    lrwxrwxrwx 1 root root 0 Aug 5 17:17 spi0 -> ../../devices/platform/44000000.ocp/4b300000.spi/spi_master/spi0
    lrwxrwxrwx 1 root root 0 Aug 5 17:17 spi1 -> ../../devices/platform/44000000.ocp/480ba000.spi/spi_master/spi1

    /sys/class/spidev:
    lrwxrwxrwx 1 root root 0 Aug 5 17:17 spidev1.0 -> ../../devices/platform/44000000.ocp/480ba000.spi/spi_master/spi1/spi1.0/spidev/spidev1.0

  • 1. Does  the 0 in spidev@0  mean chip select 0?

    Yes, it's CS and reg value should be set to that of CS to which client device is attached.

    2. I changed the compatible in the spidev to  "linux,spidev" or should it be   "rohm,dh2228fv"?  The device I will be interfacing with is a TI ADS7844.

    Spidev is only for debug purposes & non-production systems. If you want to get the functionality of ADS7844 you should add a new driver or if it exists add the device tree node corresponding to ADS7844.

    Resolve this thread if no further questions.

    - Keerthy

  • Thank you so much for  your help.  I'm sure there will be more questions but I believe we can move forward.