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.

L137 SPI Master Drivers

Other Parts Discussed in Thread: OMAP-L137, OMAP-L138

I am trying to install the Linux SPI master drivers.   There are several links on the TI site and elsewhere around the internet that provide some guidance, but it's not clear to me how or if these apply to the L137.  From the Arago GIT, I got the 2.6.37 kernel which was suggested in order to get latest SPI drivers.

# uname -a
Linux da830-omapl137-evm 2.6.37+ #1 PREEMPT Mon Oct 31 08:11:01 CDT 2011 armv5tejl unknown

There is much discussion on the net about modifications to the board-da850-evm.c file.  Indeed in the kernel code I have that file has many references to spi functionality.   The problem is that I am compiling board-da830-evm.c  (no da850).   I configure the kernel build with the da830_omapl137_defconfig option. Specifically to make I use:

 

#  make da830_omapl137_defconfig ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- xconfig

# make uImage ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-

 

Should I not be using da830_omapl137_defconfig?    Can someone explain what needs to be done to get the SPI drivers installed and then available in the /dev/ directory?

Or maybe a link to a site I haven't found yet?

Thanks

  • Hi,

    I suggest you download the source code from 03.21.00.05 branch of arago tree at http://arago-project.org/git/projects/?p=linux-davinci.git;a=summary. This branch has support for OMAP-L137. You should be able to correlate the changes required to get /dev/spi working in this tree. In master branch, I don't think SPI platform data is present for OMAP-L137.

    You should be using da830_omapl137_defconfig to compile the kernel for OMAP-L137.

    Regards, Sudhakar

  • Thanks Sudhakar,

    I downloaded that branch and do now have a board-da830.c file that contains SPI information.  For the last couple days I have been unable to "carrelate the changes required to get /dev/spi working".   I am using the EVM with all of the default pin muxing from TI.  I have tried adding the "[1]" element to the structure (from board-da830.c) below.  I have tried most combinations of things for the ???? below, but never found anything pop up in /dev/  The links to other people's attempts have lead to incomplete, irrelevant or confusing conclusions.  For example, I have seen no reference to the .controller_data variable.

    Obviously I'm fairly new to messing around in kernel code and would like to stay that way as much as possible :-)   

    What do I need to to replace my ????'s with and/or what else should I do to get a /dev entry that I can use?  I know things like the .mode depend on my peripheral, but I just want to get something up at this point.

    static struct spi_board_info da830evm_spi_info[] = {
        [0] = {
            .modalias        = "m25p80",
            .platform_data        = &da830evm_spiflash_data,
            .controller_data    = &da830evm_spiflash_cfg,
            .mode            = SPI_MODE_0,
            .max_speed_hz        = 30000000,    /* max sample rate at 3V */
            .bus_num        = 0,
            .chip_select        = 0,
        },
        [1] = {
            .modalias         = "spidev",
            .platform_data        = ?????
            .controller_data    = ?????????
            .mode            =  ?????????
            .max_speed_hz      =  ???????
            .bus_num        =  ???????? ,
            .chip_select        = ???????,
        },
    };

     

    Thanks!

  • Hi,

    I am not sure whether you have gone through the below link but it seems, following the steps mentioned in this link has helped someone to get spidev interface working on OMAP-L138.

    https://e2e.ti.com/support/embedded/int-embedded_software/f/118/p/35720/124661.aspx

    Regards, Sudhakar

  • Thanks,

    I get  "Group Not Found" from that link.

     

     

  • Hi,

    I did not observe that the link was pointing to an internal forum which is accessible only from TI. I am attaching the forum conversation in this reply. Let me know in case you are not able see it.

    Regards, Sudhakar

    SPI_reply.doc
  • Yes, thanks!  that was enough info to get the /dev/spidev0.1 up.   I will not be able to test it for a week, but it looks good.  thanks for the info.  To help others, here is what I ended up doing to get the /dev/spidev0.1 file to appear on the L-137 EVM.

    Start with the kernel code Sudhakar gave link to above. 

    You will find  board-da830-evm.c in  linux-davinci/arch/arm/mach-davinci/

    In that code, add to the structure as given in red below:

    static struct spi_board_info da830evm_spi_info[] = {
        [0] = {
            .modalias        = "m25p80",
            .platform_data        = &da830evm_spiflash_data,
            .controller_data    = &da830evm_spiflash_cfg,
            .mode            = SPI_MODE_0,
            .max_speed_hz        = 30000000,    /* max sample rate at 3V */
            .bus_num        = 0,
            .chip_select        = 0,
        },
        [1] = {
            .modalias         = "spidev",
            //.platform_data        = &da830evm_spiflash_data,
            //.controller_data    = &da830evm_spiflash_cfg,
            .mode            = SPI_MODE_0,
            .max_speed_hz        = 30000000,    /* max sample rate at 3V */
            .bus_num        = 0,
            .chip_select        = 1,

        },
    };

    And, ...

    static struct davinci_spi_platform_data da830evm_spi0_pdata = {
        .version    = SPI_VERSION_2,
        .num_chipselect    = 2,
        .intr_line    = 1,
    };

    Prepare the kernel make  using

    #  make da830_omapl137_defconfig ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- menuconfig

    and select the option

    Device Drivers ---> SPI ---> User mode SPI device driver support

    now make the uImage kernel...

    #  make uImage ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-

     

    Using that kernel you should be able to see the /dev/spidev0.1   (0.1 is bus 0, chip select 1)

    Note that documentation and a test program exists in linux-davinci/Documentation/spi/

  • A  follow up.  The above gets a spidev driver going on SPI0.  See the discussion below for setting up SPI1 on the L-137.

    http://e2e.ti.com/support/embedded/f/354/p/147226/532395.aspx#532395