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,
----------------------------------------------------------------------------------------------------
#define | GPIO_SPI1_SS0 | IMX_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.
Solved! Go to Solution.
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
Please try 3.16 instead.
3.16 uses device tree and there are lots of imx dts files that use spi.
Hi Fabio,
I have some problems with that:
Otherwise, I am not very skilled in Linux (I'm a hardware engineer) and I have never used device tree.
Regards,
Fernando.
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
It worked. Now I can build the kernel and the node spidev0.0 is created.
Thank you very much.