Skip to contentSkip to conversation

Patches for SPI support on Lilly1131 modules

PATCH New Daniel Mack 2 participants 7 messages Oct 17, 2009 – Oct 19, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Here come four patches to support SPI on Lilly1131 modules in general and the mc13783 in particular.

They apply to -rc5.

Daniel

[PATCH 1/4] ARM: MX3: remove I2C defintions from mx31lilly.c [PATCH 2/4] ARM: MX3: add SPI functions for lilly1131-db
[PATCH 3/4] ARM: MX3: add support for mc13783 on lilly-db
[PATCH 4/4] ARM: MX3: add MX3X_UART1_BASE_ADDR for uncompression on lilly1131

#1 lore raw

PATCH 1/4 ARM: MX3: remove I2C defintions from mx31lilly.c

The module does not use these pins for I2C but for SPI.

---
 arch/arm/mach-mx3/mx31lilly.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
arch/arm/mach-mx3/mx31lilly.c +0 -3
index 0a93407..e0f4cd2 100644
@@ -245,7 +245,6 @@ static struct mxc_usbh_platform_data usbh2_pdata = {
 static struct platform_device *devices[] __initdata = {
 	&smsc91x_device,
 	&physmap_flash_device,
-	&mxc_i2c_device1,
 };
 
 static int mx31lilly_baseboard;
@@ -265,8 +264,6 @@ static void __init mx31lilly_board_init(void)
 	}
 
 	mxc_iomux_alloc_pin(MX31_PIN_CS4__CS4, "Ethernet CS");
-	mxc_iomux_alloc_pin(MX31_PIN_CSPI2_MOSI__SCL, "I2C SCL");
-	mxc_iomux_alloc_pin(MX31_PIN_CSPI2_MISO__SDA, "I2C SDA");
 
 	platform_add_devices(devices, ARRAY_SIZE(devices));
 
Signature · 1 line
1.6.3.3
#2 lore raw

PATCH 2/4 ARM: MX3: add SPI functions for lilly1131-db

This adds support for the two SPI busses found on the lilly1131 module.

---
 arch/arm/mach-mx3/mx31lilly.c |   37 +++++++++++++++++++++++++++++++++++++
 1 files changed, 37 insertions(+), 0 deletions(-)
arch/arm/mach-mx3/mx31lilly.c +37 -0
index e0f4cd2..de69a4e 100644
@@ -47,6 +47,7 @@
 #include <mach/board-mx31lilly.h>
 #include <mach/mxc_ehci.h>
 #include <mach/ulpi.h>
+#include <mach/spi.h>
 
 #include "devices.h"
 
@@ -247,6 +248,22 @@ static struct platform_device *devices[] __initdata = {
 	&physmap_flash_device,
 };
 
+static int spi_internal_chipselect[] = {
+	MXC_SPI_CS(0),
+	MXC_SPI_CS(1),
+	MXC_SPI_CS(2),
+};
+
+static struct spi_imx_master spi0_pdata = {
+	.chipselect = spi_internal_chipselect,
+	.num_chipselect = ARRAY_SIZE(spi_internal_chipselect),
+};
+
+static struct spi_imx_master spi1_pdata = {
+	.chipselect = spi_internal_chipselect,
+	.num_chipselect = ARRAY_SIZE(spi_internal_chipselect),
+};
+
 static int mx31lilly_baseboard;
 core_param(mx31lilly_baseboard, mx31lilly_baseboard, int, 0444);
 
@@ -265,6 +282,26 @@ static void __init mx31lilly_board_init(void)
 
 	mxc_iomux_alloc_pin(MX31_PIN_CS4__CS4, "Ethernet CS");
 
+	/* SPI */
+	mxc_iomux_alloc_pin(MX31_PIN_CSPI1_SCLK__SCLK, "SPI1_CLK");
+	mxc_iomux_alloc_pin(MX31_PIN_CSPI1_MOSI__MOSI, "SPI1_TX");
+	mxc_iomux_alloc_pin(MX31_PIN_CSPI1_MISO__MISO, "SPI1_RX");
+	mxc_iomux_alloc_pin(MX31_PIN_CSPI1_SPI_RDY__SPI_RDY, "SPI1_RDY");
+	mxc_iomux_alloc_pin(MX31_PIN_CSPI1_SS0__SS0, "SPI1_SS0");
+	mxc_iomux_alloc_pin(MX31_PIN_CSPI1_SS1__SS1, "SPI1_SS1");
+	mxc_iomux_alloc_pin(MX31_PIN_CSPI1_SS2__SS2, "SPI1_SS2");
+
+	mxc_iomux_alloc_pin(MX31_PIN_CSPI2_SCLK__SCLK, "SPI2_CLK");
+	mxc_iomux_alloc_pin(MX31_PIN_CSPI2_MOSI__MOSI, "SPI2_TX");
+	mxc_iomux_alloc_pin(MX31_PIN_CSPI2_MISO__MISO, "SPI2_RX");
+	mxc_iomux_alloc_pin(MX31_PIN_CSPI2_SPI_RDY__SPI_RDY, "SPI2_RDY");
+	mxc_iomux_alloc_pin(MX31_PIN_CSPI2_SS0__SS0, "SPI2_SS0");
+	mxc_iomux_alloc_pin(MX31_PIN_CSPI2_SS1__SS1, "SPI2_SS1");
+	mxc_iomux_alloc_pin(MX31_PIN_CSPI2_SS2__SS2, "SPI2_SS2");
+
+	mxc_register_device(&imx_spi_device0, &spi0_pdata);
+	mxc_register_device(&imx_spi_device1, &spi1_pdata);
+
 	platform_add_devices(devices, ARRAY_SIZE(devices));
 
 	/* USB */
Signature · 1 line
1.6.3.3
#3 lore raw

PATCH 3/4 ARM: MX3: add support for mc13783 on lilly-db

The chip is actually located on the module, not on the base board. But other base boards might add more SPI devices, so the spi_board_info struct must be separated from the module code.

---
 arch/arm/mach-mx3/mx31lilly-db.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
arch/arm/mach-mx3/mx31lilly-db.c +19 -0
index 3b3a78f..60f2d15 100644
@@ -29,6 +29,8 @@
 #include <linux/init.h>
 #include <linux/gpio.h>
 #include <linux/platform_device.h>
+#include <linux/spi/spi.h>
+#include <linux/mfd/mc13783.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -202,6 +204,22 @@ static void __init mx31lilly_init_fb(void)
 	gpio_direction_output(LCD_VCC_EN_GPIO, 1);
 }
 
+/* SPI */
+
+static struct mc13783_platform_data mc13783_pdata __initdata = {
+	.flags = MC13783_USE_RTC | MC13783_USE_TOUCHSCREEN,
+};
+
+static struct spi_board_info lilly_spi_devs[] __initdata = {
+	{
+		.modalias	= "mc13783",
+		.max_speed_hz	= 1000000,
+		.bus_num	= 1,
+		.chip_select	= 0,
+		.platform_data	= &mc13783_pdata,
+	},
+};
+
 void __init mx31lilly_db_init(void)
 {
 	mxc_iomux_setup_multiple_pins(lilly_db_board_pins,
@@ -212,5 +230,6 @@ void __init mx31lilly_db_init(void)
 	mxc_register_device(&mxc_uart_device2, &uart_pdata);
 	mxc_register_device(&mxcsdhc_device0, &mmc_pdata);
 	mx31lilly_init_fb();
+	spi_register_board_info(lilly_spi_devs, ARRAY_SIZE(lilly_spi_devs));
 }
 
Signature · 1 line
1.6.3.3
#4 lore raw

PATCH 4/4 ARM: MX3: add MX3X_UART1_BASE_ADDR for uncompression on lilly1131

---
 arch/arm/plat-mxc/include/mach/uncompress.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/plat-mxc/include/mach/uncompress.h +1 -0
index 082a390..0e12876 100644
@@ -94,6 +94,7 @@ static __inline__ void __arch_decomp_setup(unsigned long arch_id)
 	case MACH_TYPE_MX31ADS:
 	case MACH_TYPE_MX35_3DS:
 	case MACH_TYPE_PCM043:
+	case MACH_TYPE_LILLY1131:
 		uart_base = MX3X_UART1_BASE_ADDR;
 		break;
 	case MACH_TYPE_MAGX_ZN5:
Signature · 1 line
1.6.3.3
#5 lore raw
In reply to Daniel Mack
Quoted 4 lines · Daniel Mack

Here come four patches to support SPI on Lilly1131 modules in general and the mc13783 in particular.

They apply to -rc5.

Ah, sorry. I didn't see that my tree has the MXC USB bits which haven't been merged yet, so these patches won't apply on your side before that happens. Which is hopefully soon. There will be another development round though, hopefully next week.

Daniel

maintainer
#6 lore raw
Quoted 10 lines · Daniel Mack
Quoted 4 lines · Daniel Mack

Here come four patches to support SPI on Lilly1131 modules in general and the mc13783 in particular.

They apply to -rc5.

Ah, sorry. I didn't see that my tree has the MXC USB bits which haven't been merged yet, so these patches won't apply on your side before that happens. Which is hopefully soon. There will be another development round though, hopefully next week.

Ok, so I'll wait for you to ping me.

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |