SPI support for i.MX25 with kernel 3.2.60

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SPI support for i.MX25 with kernel 3.2.60

Jump to solution
1,465 Views
fmvalero
Contributor II

Hi,

I'm developing a custom board based on i.MX25 PDK with kernel 3.2.60 and I'm having problems to compile when I add SPI support. This is what I have added to mach-mx25_3ds.c file (based on eukrea_mbimxsd25-baseboard.c):

#include <linux/spi/spi.h>

----------------------------------------------------------------------------------------------------

In mx25pdk_pads:

/* CSPI1 */

MX25_PAD_CSPI1_MOSI__CSPI1_MOSI,

MX25_PAD_CSPI1_MISO__CSPI1_MISO,

MX25_PAD_CSPI1_SS0__GPIO_1_16,

MX25_PAD_CSPI1_SCLK__CSPI1_SCLK,

----------------------------------------------------------------------------------------------------

#defineGPIO_SPI1_SS0IMX_GPIO_NR(1, 16)

static struct spi_board_info mx25_spi_board_info[] __initdata = {

{
.modalias = "spidev",
.max_speed_hz = 20000000,
.bus_num = 0,
.chip_select = 0,
.mode = SPI_MODE_3,
},

};

static int mx25_spi_cs[] = {GPIO_SPI1_SS0};

static const struct spi_imx_master mx25_spi0_data __initconst = {

  .chipselect     = mx25_spi_cs,

  .num_chipselect = ARRAY_SIZE(mx25_spi_cs),

};

----------------------------------------------------------------------------------------------------

In mx25pdk_init:

imx25_add_spi_imx0(&mx25_spi0_data);

spi_register_board_info(mx25_spi_board_info,

       ARRAY_SIZE(mx25_spi_board_info));

----------------------------------------------------------------------------------------------------

In menuconfig, I have the following configuration:

Device Drivers  --->

     [*] SPI support  --->

          <*>   Freescale i.MX SPI controllers

          <*>   User mode SPI device driver support

But when I try to build uImage, I get the following error message:

     arch/arm/mach-imx/built-in.o: In function `mx25pdk_init':

     mach-mx25_3ds.c:(.init.text+0x27c): undefined reference to `imx_add_spi_imx'

     mach-mx25_3ds.c:(.init.text+0x74c): undefined reference to `imx25_cspi_data'

     make: *** [.tmp_vmlinux1] Error 1

I don´t understand why I'm getting this error. Both imx_add_spi_imx and imx25_cspi_data are defined in \arch\arm\plat-mxc\devices\platform-spi_imx.c

Can anyone please help?

Thanks,

Fernando.

Labels (1)
Tags (4)
0 Kudos
1 Solution
683 Views
fabio_estevam
NXP Employee
NXP Employee

Ok, you can try this:

--- a/arch/arm/mach-imx/Kconfig

+++ b/arch/arm/mach-imx/Kconfig

@@ -171,6 +171,7 @@ config MACH_MX25_3DS

        select IMX_HAVE_PLATFORM_IMX_FB

        select IMX_HAVE_PLATFORM_IMX_I2C

        select IMX_HAVE_PLATFORM_IMX_KEYPAD

+       select IMX_HAVE_PLATFORM_SPI_IMX

        select IMX_HAVE_PLATFORM_IMX_UART

        select IMX_HAVE_PLATFORM_MXC_EHCI

        select IMX_HAVE_PLATFORM_MXC_NAND

View solution in original post

0 Kudos
4 Replies
683 Views
fabio_estevam
NXP Employee
NXP Employee

Please try 3.16 instead.

3.16 uses device tree and there are lots of imx dts files that use spi.

0 Kudos
683 Views
fmvalero
Contributor II

Hi Fabio,

I have some problems with that:

  • I have to use a kernel version where real time patch can be applied (it's a software requirement). So the last version I can use is 3.14.12.

  • I tried several higher versions (3.6, 3.8, 3.14) and I have problems with the LCD in all of them. The backlight turns on, but the screen is black. I use the same video modes as in the version 3.2.60 (where LCD works fine). Also, I've tried a lot of video modes, and the result is always the same. Maybe I start a new discussion with the LCD problem, but at the moment, I'd like the solve the SPI problem with this version, if possible.


Otherwise, I am not very skilled in Linux (I'm a hardware engineer) and I have never used device tree.


Regards,

Fernando.

0 Kudos
684 Views
fabio_estevam
NXP Employee
NXP Employee

Ok, you can try this:

--- a/arch/arm/mach-imx/Kconfig

+++ b/arch/arm/mach-imx/Kconfig

@@ -171,6 +171,7 @@ config MACH_MX25_3DS

        select IMX_HAVE_PLATFORM_IMX_FB

        select IMX_HAVE_PLATFORM_IMX_I2C

        select IMX_HAVE_PLATFORM_IMX_KEYPAD

+       select IMX_HAVE_PLATFORM_SPI_IMX

        select IMX_HAVE_PLATFORM_IMX_UART

        select IMX_HAVE_PLATFORM_MXC_EHCI

        select IMX_HAVE_PLATFORM_MXC_NAND

0 Kudos
683 Views
fmvalero
Contributor II

It worked. Now I can build the kernel and the node spidev0.0 is created.

Thank you very much.

0 Kudos