[PATCH] i.MX35: add cspi1 support

Eric Bénard eric at eukrea.com
Tue Aug 28 17:35:17 EDT 2012


tested with a m25p128 flash both in nand boot & spi boot.

Signed-off-by: Eric Bénard <eric at eukrea.com>
---
 arch/arm/mach-imx/include/mach/devices-imx35.h |    5 +++++
 arch/arm/mach-imx/include/mach/imx35-regs.h    |    2 ++
 arch/arm/mach-imx/speed-imx35.c                |    5 +++++
 drivers/spi/Kconfig                            |    2 +-
 drivers/spi/imx_spi.c                          |    2 +-
 5 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-imx/include/mach/devices-imx35.h b/arch/arm/mach-imx/include/mach/devices-imx35.h
index 6c0d750..9ecaa35 100644
--- a/arch/arm/mach-imx/include/mach/devices-imx35.h
+++ b/arch/arm/mach-imx/include/mach/devices-imx35.h
@@ -16,6 +16,11 @@ static inline struct device_d *imx35_add_i2c2(struct i2c_platform_data *pdata)
 	return imx_add_i2c((void *)IMX_I2C3_BASE, 2, pdata);
 }
 
+static inline struct device_d *imx35_add_spi0(struct spi_imx_master *pdata)
+{
+	return imx_add_spi((void *)IMX_CSPI1_BASE, 0, pdata);
+}
+
 static inline struct device_d *imx35_add_uart0(void)
 {
 	return imx_add_uart((void *)IMX_UART1_BASE, 0);
diff --git a/arch/arm/mach-imx/include/mach/imx35-regs.h b/arch/arm/mach-imx/include/mach/imx35-regs.h
index fafcd61..91d4b9b 100644
--- a/arch/arm/mach-imx/include/mach/imx35-regs.h
+++ b/arch/arm/mach-imx/include/mach/imx35-regs.h
@@ -49,6 +49,7 @@
 #define IMX_I2C1_BASE		0x43F80000
 #define IMX_I2C2_BASE		0x43F98000
 #define IMX_I2C3_BASE		0x43F84000
+#define IMX_CSPI1_BASE		0x43FA4000
 #define IMX_SDHC1_BASE		0x53FB4000
 #define IMX_SDHC2_BASE		0x53FB8000
 #define IMX_SDHC3_BASE		0x53FBC000
@@ -75,6 +76,7 @@
 #define CCM_CGR2	0x34
 #define CCM_CGR3	0x38
 
+#define CCM_CGR0_CSPI1_SHIFT	10
 #define CCM_CGR1_FEC_SHIFT	0
 #define CCM_CGR1_I2C1_SHIFT	10
 #define CCM_CGR1_SDHC1_SHIFT	26
diff --git a/arch/arm/mach-imx/speed-imx35.c b/arch/arm/mach-imx/speed-imx35.c
index 684dc14..5f0e229 100644
--- a/arch/arm/mach-imx/speed-imx35.c
+++ b/arch/arm/mach-imx/speed-imx35.c
@@ -186,6 +186,11 @@ ulong imx_get_i2cclk(void)
 	return imx_get_ipg_perclk();
 }
 
+unsigned long imx_get_cspiclk(void)
+{
+	return imx_get_ipgclk();
+}
+
 void imx_dump_clocks(void)
 {
 	printf("mpll:    %10ld Hz\n", imx_get_mpllclk());
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 609bafd..7a2f54a 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -16,7 +16,7 @@ config DRIVER_SPI_IMX_0_0
 
 config DRIVER_SPI_IMX_0_7
 	bool
-	depends on ARCH_IMX25
+	depends on ARCH_IMX25 || ARCH_IMX35
 	default y
 
 config DRIVER_SPI_IMX_2_3
diff --git a/drivers/spi/imx_spi.c b/drivers/spi/imx_spi.c
index 42358f2..06cee86 100644
--- a/drivers/spi/imx_spi.c
+++ b/drivers/spi/imx_spi.c
@@ -517,7 +517,7 @@ static int imx_spi_probe(struct device_d *dev)
 		version = SPI_IMX_VER_0_0;
 #endif
 #ifdef CONFIG_DRIVER_SPI_IMX_0_7
-	if (cpu_is_mx25())
+	if (cpu_is_mx25() || cpu_is_mx35())
 		version = SPI_IMX_VER_0_7;
 #endif
 #ifdef CONFIG_DRIVER_SPI_IMX_2_3
-- 
1.7.7.6




More information about the barebox mailing list