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: SPI Device Tree Question

Part Number: AM5728

Hey,

I'm just wondering where is spidev@# defined in for the device tree file? 

As an example I see the following to setup spi: 

P17_37 -> mmc3_dat4.spi4_clk

 P17_35-> mmc3_dat5.spi4_d1

 P17_38 ->mmc3_dat6.spi4_d0

 P17_6    ->mmc3_dat7.spi4_cs0

I added the following in am57xx-beagle-x15.dts:

mcspi4_pins: mcspi4_pins{

             pinctrl-single,pins = <

                       0x394 (PIN_INPUT_PULLUP | MANUAL_MODE | MUX_MODE1) /*mmc3_dat4.spi4_clk*/

                       0x398 (PIN_INPUT_PULLUP | MANUAL_MODE | MUX_MODE1) /*mmc3_dat5.spi4_d1*/

                       0x39C (PIN_OUTPUT_PULLUP | MANUAL_MODE | MUX_MODE1) /*mmc3_dat6.spi4_d0*/

                       0x3A0 (PIN_OUTPUT_PULLUP | MANUAL_MODE | MUX_MODE1) /*mmc3_dat7.spi4_cs0*/

             >;

};

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

So then where is spidev@4 defined in? 

  • Hi David,

    spidev driver is located at:

    linux-kernel/drivers/spi/spidev.c


    You also need to enable spidev in your .config file, as it is by default disabled in linux-kernel/arch/arm/configs/tisdk_am57xx-evm_defconfig file.


    AM57x pinmux should be done in MLO/SBL, not in kernel DTS file.

    Regards,
    Pavel

  • Hey Pavel, 

    Thanks for the info! I checked the .config file and spidev is enabled right now! 

    When you mean pinmux in the MLO/SBL, do you mean in the u-boot? I've seen some posts about that here on the forums. 

    A follow-up question I have is what if I used spidev@3 instead of spidev@4, does the kernel enumerate it was /dev/spidev3.0 instead of /dev/spidev4.0? Or is spidev@ totally arbitrary? 

  • David,

    David Tan21 said:
    When you mean pinmux in the MLO/SBL, do you mean in the u-boot? I've seen some posts about that here on the forums. 

    I mean in MLO, which is part of u-boot: u-boot/board/ti/am57xx/mux_data.h

    Refer to the below e2e thread for details:

    David Tan21 said:
    A follow-up question I have is what if I used spidev@3 instead of spidev@4, does the kernel enumerate it was /dev/spidev3.0 instead of /dev/spidev4.0? Or is spidev@ totally arbitrary? 

    /dev/spidevB.C - B is bus (i.e. mcspi4), C is chip select (i.e. CS0) - /dev/spidev4.0

    Regards,
    Pavel