Skip to contentSkip to conversation

MX3: SPI/MMC/I2C fixes for lilly-1131 modules

PATCH New Daniel Mack 2 participants 9 messages Oct 26, 2009 – Oct 30, 2009

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

As the EHCI/ULPI bits for MXC seem to take a little longer, I rebased the patches I sent earlier to apply without the USB code.

The following five patches address the mx31lilly modules and add support for SPI, proper fast slope pin config for MMC and a missing define in the uncompression code.

Daniel

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

#1 lore raw

PATCH 1/5 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 4230251..de5cf01 100644
@@ -108,7 +108,6 @@ static struct platform_device physmap_flash_device = {
 static struct platform_device *devices[] __initdata = {
 	&smsc91x_device,
 	&physmap_flash_device,
-	&mxc_i2c_device1,
 };
 
 static int mx31lilly_baseboard;
@@ -128,8 +127,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.5
#2 lore raw

PATCH 2/5 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 de5cf01..59b3526 100644
@@ -41,6 +41,7 @@
 #include <mach/common.h>
 #include <mach/iomux-mx3.h>
 #include <mach/board-mx31lilly.h>
+#include <mach/spi.h>
 
 #include "devices.h"
 
@@ -110,6 +111,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);
 
@@ -128,6 +145,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));
 }
 
Signature · 1 line
1.6.5
#3 lore raw

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

Hi Sascha,

did you pull this series already? I'm asking because after a recent rebase (Linus pulled the ARM bits just now), this one patch below breaks the build as the SPI device names appear to have changed. The other patches in these series are not affected.

I can either send a new version or a fixup patch, whatever makes more sense.

Thanks,
Daniel

Quoted 78 lines · Daniel Mack

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 de5cf01..59b3526 100644
@@ -41,6 +41,7 @@
 #include <mach/common.h>
 #include <mach/iomux-mx3.h>
 #include <mach/board-mx31lilly.h>
+#include <mach/spi.h>
 
 #include "devices.h"
 
@@ -110,6 +111,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);
 
@@ -128,6 +145,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));
 }
 
Signature · 7 lines
1.6.5


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
maintainer
#4 lore raw

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

Quoted 9 lines · Daniel Mack

Hi Sascha,

did you pull this series already? I'm asking because after a recent rebase (Linus pulled the ARM bits just now), this one patch below breaks the build as the SPI device names appear to have changed. The other patches in these series are not affected.

I can either send a new version or a fixup patch, whatever makes more sense.

Yes, I already pulled it. I amended the following into this patch:

commit acc8e6f7e1ace45b45229ac252ba72cc14061e6f

Author: Sascha Hauer <[email protected]>
Date:   Fri Oct 30 11:24:02 2009 +0100

add to 15419f65df1eddddd2afe3430f8dd8a9044a4dcc

arch/arm/mach-mx3/mx31lilly.c +2 -2
index 59b3526..f593a62 100644
@@ -162,8 +162,8 @@ static void __init mx31lilly_board_init(void)
 	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);
+	mxc_register_device(&mxc_spi_device0, &spi0_pdata);
+	mxc_register_device(&mxc_spi_device1, &spi1_pdata);
 
 	platform_add_devices(devices, ARRAY_SIZE(devices));
 }

Is this ok or missed I something?

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 |
#5 lore raw

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

Quoted 38 lines · Sascha Hauer
Quoted 9 lines · Daniel Mack

Hi Sascha,

did you pull this series already? I'm asking because after a recent rebase (Linus pulled the ARM bits just now), this one patch below breaks the build as the SPI device names appear to have changed. The other patches in these series are not affected.

I can either send a new version or a fixup patch, whatever makes more sense.

Yes, I already pulled it. I amended the following into this patch:

commit acc8e6f7e1ace45b45229ac252ba72cc14061e6f

Author: Sascha Hauer <[email protected]>
Date:   Fri Oct 30 11:24:02 2009 +0100

add to 15419f65df1eddddd2afe3430f8dd8a9044a4dcc

arch/arm/mach-mx3/mx31lilly.c +2 -2
index 59b3526..f593a62 100644
@@ -162,8 +162,8 @@ static void __init mx31lilly_board_init(void)
 	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);
+	mxc_register_device(&mxc_spi_device0, &spi0_pdata);
+	mxc_register_device(&mxc_spi_device1, &spi1_pdata);
 
 	platform_add_devices(devices, ARRAY_SIZE(devices));
 }
Quoted 1 line

Is this ok or missed I something?

No, perfect. That would have been my fixup patch :)

Thanks!
Daniel

#6 lore raw

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

In reply to Daniel Mack

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.5
#7 lore raw

PATCH 4/5 ARM: MX3: Add pad config for MMC pins on lilly-db

---
 arch/arm/mach-mx3/mx31lilly-db.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
arch/arm/mach-mx3/mx31lilly-db.c +10 -0
index 60f2d15..bb1e44f 100644
@@ -111,6 +111,9 @@ static int mxc_mmc1_get_ro(struct device *dev)
 
 static int gpio_det, gpio_wp;
 
+#define MMC_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
+			PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
+
 static int mxc_mmc1_init(struct device *dev,
 			 irq_handler_t detect_irq, void *data)
 {
@@ -119,6 +122,13 @@ static int mxc_mmc1_init(struct device *dev,
 	gpio_det = IOMUX_TO_GPIO(MX31_PIN_GPIO1_1);
 	gpio_wp = IOMUX_TO_GPIO(MX31_PIN_LCS0);
 
+	mxc_iomux_set_pad(MX31_PIN_SD1_DATA0, MMC_PAD_CFG);
+	mxc_iomux_set_pad(MX31_PIN_SD1_DATA1, MMC_PAD_CFG);
+	mxc_iomux_set_pad(MX31_PIN_SD1_DATA2, MMC_PAD_CFG);
+	mxc_iomux_set_pad(MX31_PIN_SD1_DATA3, MMC_PAD_CFG);
+	mxc_iomux_set_pad(MX31_PIN_SD1_CLK, MMC_PAD_CFG);
+	mxc_iomux_set_pad(MX31_PIN_SD1_CMD, MMC_PAD_CFG);
+
 	ret = gpio_request(gpio_det, "MMC detect");
 	if (ret)
 		return ret;
Signature · 1 line
1.6.5
#8 lore raw

PATCH 5/5 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.5