Skip to contentSkip to conversation

SPI:rewrite the Freescale DSPI driver.

PATCH Superseded Chao Fu 2 participants 9 messages Nov 18, 2013

Subsystems (5)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Chao Fu

author
#0 lore raw

PATCH 1/4 SPI:rewrite the Freescale DSPI driver.

From: Chao Fu <[email protected]>

Freescale DSPI module is used on both the ColdFire platform and the ARM platform. The original DSPI driver is written for ColdFire platform only, this patch rewrite the driver to make it be used across the platforms. The rewrite including the following changes:

Rename the file name :

	cf_spi.c -> fsl_dspi.c
Move the file:
	arch/m68k/include/asm/coldfire/dspi.h -> include/fsl_dspi.h
Rename the functions and variables:
	cfxxx -> dspixxx

Keep the following functions for ColdFire:
cfspi_port_conf()
cfspi_claim_bus()
cfspi_release_bus()

---
 arch/m68k/include/asm/coldfire/dspi.h | 142 --------------
 drivers/spi/Makefile                  |   2 +-
 drivers/spi/cf_spi.c                  | 347 ---------------------------------
 drivers/spi/fsl_dspi.c                | 352 ++++++++++++++++++++++++++++++++++
 include/fsl_dspi.h                    | 147 ++++++++++++++
 5 files changed, 500 insertions(+), 490 deletions(-)
 delete mode 100644 arch/m68k/include/asm/coldfire/dspi.h
 delete mode 100644 drivers/spi/cf_spi.c
 create mode 100644 drivers/spi/fsl_dspi.c
 create mode 100644 include/fsl_dspi.h
arch/m68k/include/asm/coldfire/dspi.h deleted +0 -142
deleted file mode 100644
index fda7138..0000000
@@ -1,142 +0,0 @@
-/*
- * MCF5227x Internal Memory Map
- *
- * Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
- * TsiChung Liew (Tsi-Chung.Liew at freescale.com)
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-#ifndef __DSPI_H__
-#define __DSPI_H__
-
-/* DMA Serial Peripheral Interface (DSPI) */
-typedef struct dspi {
-	u32 mcr;	/* 0x00 */
-	u32 resv0;	/* 0x04 */
-	u32 tcr;	/* 0x08 */
-	u32 ctar[8];	/* 0x0C - 0x28 */
-	u32 sr;		/* 0x2C */
-	u32 irsr;	/* 0x30 */
-	u32 tfr;	/* 0x34 - PUSHR */
-	u16 resv1;	/* 0x38 */
-	u16 rfr;	/* 0x3A - POPR */
-#ifdef CONFIG_MCF547x_8x
-	u32 tfdr[4];	/* 0x3C */
-	u8 resv2[0x30];	/* 0x40 */
-	u32 rfdr[4];	/* 0x7C */
-#else
-	u32 tfdr[16];	/* 0x3C */
-	u32 rfdr[16];	/* 0x7C */
-#endif
-} dspi_t;
-
-/* Module configuration */
-#define DSPI_MCR_MSTR			(0x80000000)
-#define DSPI_MCR_CSCK			(0x40000000)
-#define DSPI_MCR_DCONF(x)		(((x)&0x03)<<28)
-#define DSPI_MCR_FRZ			(0x08000000)
-#define DSPI_MCR_MTFE			(0x04000000)
-#define DSPI_MCR_PCSSE			(0x02000000)
-#define DSPI_MCR_ROOE			(0x01000000)
-#define DSPI_MCR_CSIS7			(0x00800000)
-#define DSPI_MCR_CSIS6			(0x00400000)
-#define DSPI_MCR_CSIS5			(0x00200000)
-#define DSPI_MCR_CSIS4			(0x00100000)
-#define DSPI_MCR_CSIS3			(0x00080000)
-#define DSPI_MCR_CSIS2			(0x00040000)
-#define DSPI_MCR_CSIS1			(0x00020000)
-#define DSPI_MCR_CSIS0			(0x00010000)
-#define DSPI_MCR_MDIS			(0x00004000)
-#define DSPI_MCR_DTXF			(0x00002000)
-#define DSPI_MCR_DRXF			(0x00001000)
-#define DSPI_MCR_CTXF			(0x00000800)
-#define DSPI_MCR_CRXF			(0x00000400)
-#define DSPI_MCR_SMPL_PT(x)		(((x)&0x03)<<8)
-#define DSPI_MCR_HALT			(0x00000001)
-
-/* Transfer count */
-#define DSPI_TCR_SPI_TCNT(x)		(((x)&0x0000FFFF)<<16)
-
-/* Clock and transfer attributes */
-#define DSPI_CTAR_DBR			(0x80000000)
-#define DSPI_CTAR_TRSZ(x)		(((x)&0x0F)<<27)
-#define DSPI_CTAR_CPOL			(0x04000000)
-#define DSPI_CTAR_CPHA			(0x02000000)
-#define DSPI_CTAR_LSBFE			(0x01000000)
-#define DSPI_CTAR_PCSSCK(x)		(((x)&0x03)<<22)
-#define DSPI_CTAR_PCSSCK_7CLK		(0x00A00000)
-#define DSPI_CTAR_PCSSCK_5CLK		(0x00800000)
-#define DSPI_CTAR_PCSSCK_3CLK		(0x00400000)
-#define DSPI_CTAR_PCSSCK_1CLK		(0x00000000)
-#define DSPI_CTAR_PASC(x)		(((x)&0x03)<<20)
-#define DSPI_CTAR_PASC_7CLK		(0x00300000)
-#define DSPI_CTAR_PASC_5CLK		(0x00200000)
-#define DSPI_CTAR_PASC_3CLK		(0x00100000)
-#define DSPI_CTAR_PASC_1CLK		(0x00000000)
-#define DSPI_CTAR_PDT(x)		(((x)&0x03)<<18)
-#define DSPI_CTAR_PDT_7CLK		(0x000A0000)
-#define DSPI_CTAR_PDT_5CLK		(0x00080000)
-#define DSPI_CTAR_PDT_3CLK		(0x00040000)
-#define DSPI_CTAR_PDT_1CLK		(0x00000000)
-#define DSPI_CTAR_PBR(x)		(((x)&0x03)<<16)
-#define DSPI_CTAR_PBR_7CLK		(0x00030000)
-#define DSPI_CTAR_PBR_5CLK		(0x00020000)
-#define DSPI_CTAR_PBR_3CLK		(0x00010000)
-#define DSPI_CTAR_PBR_1CLK		(0x00000000)
-#define DSPI_CTAR_CSSCK(x)		(((x)&0x0F)<<12)
-#define DSPI_CTAR_ASC(x)		(((x)&0x0F)<<8)
-#define DSPI_CTAR_DT(x)			(((x)&0x0F)<<4)
-#define DSPI_CTAR_BR(x)			(((x)&0x0F))
-
-/* Status */
-#define DSPI_SR_TCF			(0x80000000)
-#define DSPI_SR_TXRXS			(0x40000000)
-#define DSPI_SR_EOQF			(0x10000000)
-#define DSPI_SR_TFUF			(0x08000000)
-#define DSPI_SR_TFFF			(0x02000000)
-#define DSPI_SR_RFOF			(0x00080000)
-#define DSPI_SR_RFDF			(0x00020000)
-#define DSPI_SR_TXCTR(x)		(((x)&0x0F)<<12)
-#define DSPI_SR_TXPTR(x)		(((x)&0x0F)<<8)
-#define DSPI_SR_RXCTR(x)		(((x)&0x0F)<<4)
-#define DSPI_SR_RXPTR(x)		(((x)&0x0F))
-
-/* DMA/interrupt request selct and enable */
-#define DSPI_IRSR_TCFE			(0x80000000)
-#define DSPI_IRSR_EOQFE			(0x10000000)
-#define DSPI_IRSR_TFUFE			(0x08000000)
-#define DSPI_IRSR_TFFFE			(0x02000000)
-#define DSPI_IRSR_TFFFS			(0x01000000)
-#define DSPI_IRSR_RFOFE			(0x00080000)
-#define DSPI_IRSR_RFDFE			(0x00020000)
-#define DSPI_IRSR_RFDFS			(0x00010000)
-
-/* Transfer control - 32-bit access */
-#define DSPI_TFR_CONT			(0x80000000)
-#define DSPI_TFR_CTAS(x)		(((x)&0x07)<<12)
-#define DSPI_TFR_EOQ			(0x08000000)
-#define DSPI_TFR_CTCNT			(0x04000000)
-#define DSPI_TFR_CS7			(0x00800000)
-#define DSPI_TFR_CS6			(0x00400000)
-#define DSPI_TFR_CS5			(0x00200000)
-#define DSPI_TFR_CS4			(0x00100000)
-#define DSPI_TFR_CS3			(0x00080000)
-#define DSPI_TFR_CS2			(0x00040000)
-#define DSPI_TFR_CS1			(0x00020000)
-#define DSPI_TFR_CS0			(0x00010000)
-
-/* Transfer Fifo */
-#define DSPI_TFR_TXDATA(x)		(((x)&0xFFFF))
-
-/* Bit definitions and macros for DRFR */
-#define DSPI_RFR_RXDATA(x)		(((x)&0xFFFF))
-
-/* Bit definitions and macros for DTFDR group */
-#define DSPI_TFDR_TXDATA(x)		(((x)&0x0000FFFF))
-#define DSPI_TFDR_TXCMD(x)		(((x)&0x0000FFFF)<<16)
-
-/* Bit definitions and macros for DRFDR group */
-#define DSPI_RFDR_RXDATA(x)		(((x)&0x0000FFFF))
-
-#endif				/* __DSPI_H__ */
drivers/spi/Makefile +1 -1
index 27902fe..a047f02 100644
@@ -15,7 +15,7 @@ obj-$(CONFIG_ATMEL_DATAFLASH_SPI) += atmel_dataflash_spi.o
 obj-$(CONFIG_ATMEL_SPI) += atmel_spi.o
 obj-$(CONFIG_BFIN_SPI) += bfin_spi.o
 obj-$(CONFIG_BFIN_SPI6XX) += bfin_spi6xx.o
-obj-$(CONFIG_CF_SPI) += cf_spi.o
+obj-$(CONFIG_FSL_DSPI) += fsl_dspi.o
 obj-$(CONFIG_CF_QSPI) += cf_qspi.o
 obj-$(CONFIG_DAVINCI_SPI) += davinci_spi.o
 obj-$(CONFIG_EXYNOS_SPI) += exynos_spi.o
drivers/spi/cf_spi.c deleted +0 -347

347 lines not on this page · raw message

drivers/spi/fsl_dspi.c new file +352 -0

352 lines not on this page · raw message

include/fsl_dspi.h new file +147 -0

147 lines not on this page · raw message

Signature · 1 line
1.8.4
author
#1 lore raw

PATCH 2/4 arm:vf610:Enable the DSPI for Freescale vf610 platform

From: Chao Fu <[email protected]>

This patch enable the DSPI moudle on VF610 platform with following udpate:
Add get_dspi_clk() function and enable DPSI clock gate.
Add DSPI iomux definition and set the iomux for DSPI.
Add the SPI configuration for the vf610twr boards.

---
 arch/arm/cpu/armv7/vf610/generic.c            |  7 +++++++
 arch/arm/include/asm/arch-vf610/clock.h       |  1 +
 arch/arm/include/asm/arch-vf610/crm_regs.h    |  1 +
 arch/arm/include/asm/arch-vf610/iomux-vf610.h |  8 ++++++++
 arch/arm/include/asm/imx-common/iomux-v3.h    |  2 ++
 board/freescale/vf610twr/vf610twr.c           | 15 ++++++++++++++-
 include/configs/vf610twr.h                    | 15 +++++++++++++++
 7 files changed, 48 insertions(+), 1 deletion(-)
arch/arm/cpu/armv7/vf610/generic.c +7 -0
index a26d63e..266343e 100644
@@ -196,6 +196,11 @@ static u32 get_i2c_clk(void)
 	return get_ipg_clk();
 }
 
+static u32 get_dspi_clk(void)
+{
+	return get_ipg_clk();
+}
+
 unsigned int mxc_get_clock(enum mxc_clock clk)
 {
 	switch (clk) {
@@ -213,6 +218,8 @@ unsigned int mxc_get_clock(enum mxc_clock clk)
 		return get_fec_clk();
 	case MXC_I2C_CLK:
 		return get_i2c_clk();
+	case MXC_DSPI_CLK:
+		return get_dspi_clk();
 	default:
 		break;
 	}
arch/arm/include/asm/arch-vf610/clock.h +1 -0
index 535adad..e5a5c6d 100644
@@ -17,6 +17,7 @@ enum mxc_clock {
 	MXC_ESDHC_CLK,
 	MXC_FEC_CLK,
 	MXC_I2C_CLK,
+	MXC_DSPI_CLK,
 };
 
 void enable_ocotp_clk(unsigned char enable);
arch/arm/include/asm/arch-vf610/crm_regs.h +1 -0
index 85f1fda..a03c627 100644
@@ -165,6 +165,7 @@ struct anadig_reg {
 
 #define CCM_REG_CTRL_MASK			0xffffffff
 #define CCM_CCGR0_UART1_CTRL_MASK		(0x3 << 16)
+#define CCM_CCGR0_DSPI0_CTRL_MASK		(0x3 << 24)
 #define CCM_CCGR1_PIT_CTRL_MASK			(0x3 << 14)
 #define CCM_CCGR1_WDOGA5_CTRL_MASK		(0x3 << 28)
 #define CCM_CCGR2_IOMUXC_CTRL_MASK		(0x3 << 16)
arch/arm/include/asm/arch-vf610/iomux-vf610.h +8 -0
index 4a39eb0..2942ebd 100644
@@ -19,6 +19,10 @@
 #define VF610_DDR_PAD_CTRL	PAD_CTL_DSE_25ohm
 #define VF610_I2C_PAD_CTRL	(PAD_CTL_PUS_47K_UP | PAD_CTL_DSE_50ohm | \
 				PAD_CTL_SPEED_HIGH | PAD_CTL_OBE_IBE_ENABLE)
+#define VF610_DSPI_PAD_CTRL	(PAD_CTL_OBE | PAD_CTL_DSE_25ohm | \
+				PAD_CTL_SPEED_MED)
+#define VF610_DSPI_SIN_PAD_CTRL	(PAD_CTL_IBE | PAD_CTL_DSE_25ohm | \
+				PAD_CTL_SPEED_MED)
 
 enum {
 	VF610_PAD_PTA6__RMII0_CLKIN		= IOMUX_PAD(0x0000, 0x0000, 2, __NA_, 0, VF610_ENET_PAD_CTRL),
@@ -41,6 +45,10 @@ enum {
 	VF610_PAD_PTA29__ESDHC1_DAT3		= IOMUX_PAD(0x004c, 0x004c, 5, __NA_, 0, VF610_SDHC_PAD_CTRL),
 	VF610_PAD_PTB14__I2C0_SCL		= IOMUX_PAD(0x0090, 0x0090, 2, 0x033c, 1, VF610_I2C_PAD_CTRL),
 	VF610_PAD_PTB15__I2C0_SDA		= IOMUX_PAD(0x0094, 0x0094, 2, 0x0340, 1, VF610_I2C_PAD_CTRL),
+	VF610_PAD_PTB19__DSPI0_CS0		= IOMUX_PAD(0x00a4, 0x00a4, 1, __NA_, 0, VF610_DSPI_PAD_CTRL),
+	VF610_PAD_PTB20__DSPI0_SIN		= IOMUX_PAD(0x00a8, 0x00a8, 1, __NA_, 0, VF610_DSPI_SIN_PAD_CTRL),
+	VF610_PAD_PTB21__DSPI0_SOUT		= IOMUX_PAD(0x00ac, 0x00ac, 1, __NA_, 0, VF610_DSPI_PAD_CTRL),
+	VF610_PAD_PTB22__DSPI0_SCK		= IOMUX_PAD(0x00b0, 0x00b0, 1, __NA_, 0, VF610_DSPI_PAD_CTRL),
 	VF610_PAD_DDR_A15__DDR_A_15		= IOMUX_PAD(0x0220, 0x0220, 0, __NA_, 0, VF610_DDR_PAD_CTRL),
 	VF610_PAD_DDR_A14__DDR_A_14		= IOMUX_PAD(0x0224, 0x0224, 0, __NA_, 0, VF610_DDR_PAD_CTRL),
 	VF610_PAD_DDR_A13__DDR_A_13		= IOMUX_PAD(0x0228, 0x0228, 0, __NA_, 0, VF610_DDR_PAD_CTRL),
arch/arm/include/asm/imx-common/iomux-v3.h +2 -0
index dc2b3ef..bd07758 100644
@@ -124,6 +124,8 @@ typedef u64 iomux_v3_cfg_t;
 #define PAD_CTL_PUS_100K_UP	(2 << 4 | PAD_CTL_PUE)
 #define PAD_CTL_PKE		(1 << 3)
 #define PAD_CTL_PUE		(1 << 2 | PAD_CTL_PKE)
+#define PAD_CTL_OBE		(1 << 1)
+#define PAD_CTL_IBE		(1 << 0)
 
 #define PAD_CTL_OBE_IBE_ENABLE	(3 << 0)
 
board/freescale/vf610twr/vf610twr.c +14 -1
index 699ea7f..ee6612f 100644
@@ -278,6 +278,18 @@ static void setup_iomux_i2c(void)
 	imx_iomux_v3_setup_multiple_pads(i2c0_pads, ARRAY_SIZE(i2c0_pads));
 }
 
+static void setup_iomux_dspi(void)
+{
+	static const iomux_v3_cfg_t dspi0_pads[] = {
+		VF610_PAD_PTB19__DSPI0_CS0,
+		VF610_PAD_PTB20__DSPI0_SIN,
+		VF610_PAD_PTB21__DSPI0_SOUT,
+		VF610_PAD_PTB22__DSPI0_SCK,
+	};
+
+	imx_iomux_v3_setup_multiple_pads(dspi0_pads, ARRAY_SIZE(dspi0_pads));
+}
+
 #ifdef CONFIG_FSL_ESDHC
 struct fsl_esdhc_cfg esdhc_cfg[1] = {
 	{ESDHC1_BASE_ADDR},
@@ -315,7 +327,7 @@ static void clock_init(void)
 	struct anadig_reg *anadig = (struct anadig_reg *)ANADIG_BASE_ADDR;
 
 	clrsetbits_le32(&ccm->ccgr0, CCM_REG_CTRL_MASK,
-		CCM_CCGR0_UART1_CTRL_MASK);
+		CCM_CCGR0_UART1_CTRL_MASK | CCM_CCGR0_DSPI0_CTRL_MASK);
 	clrsetbits_le32(&ccm->ccgr1, CCM_REG_CTRL_MASK,
 		CCM_CCGR1_PIT_CTRL_MASK | CCM_CCGR1_WDOGA5_CTRL_MASK);
 	clrsetbits_le32(&ccm->ccgr2, CCM_REG_CTRL_MASK,
@@ -386,6 +398,7 @@ int board_early_init_f(void)
 	setup_iomux_uart();
 	setup_iomux_enet();
 	setup_iomux_i2c();
+	setup_iomux_dspi();
 
 	return 0;
 }
include/configs/vf610twr.h +15 -0
index 8d0a00d..73f96e7 100644
@@ -74,6 +74,21 @@
 #define CONFIG_SYS_I2C_MXC
 #define CONFIG_SYS_SPD_BUS_NUM		0
 
+/* DSPI Configs */
+#define CONFIG_CMD_SPI
+#define CONFIG_CMD_SF
+#define CONFIG_FSL_DSPI
+#define CONFIG_SPI_FLASH
+#define CONFIG_SPI_FLASH_ATMEL
+#define MMAP_DSPI  SPI0_BASE_ADDR
+#define CONFIG_SYS_DSPI_CTAR0	(DSPI_CTAR_TRSZ(7) | \
+					 DSPI_CTAR_PCSSCK_1CLK | \
+					 DSPI_CTAR_PASC(0) | \
+					 DSPI_CTAR_PDT(0) | \
+					 DSPI_CTAR_CSSCK(0) | \
+					 DSPI_CTAR_ASC(0) | \
+					 DSPI_CTAR_DT(0))
+
 #define CONFIG_BOOTDELAY		3
 
 #define CONFIG_LOADADDR			0x82000000
Signature · 1 line
1.8.4
#2 lore raw

PATCH 2/4 arm:vf610:Enable the DSPI for Freescale vf610 platform

Hi Chao,

Quoted 8 lines · Chao Fu

From: Chao Fu <[email protected]>

This patch enable the DSPI moudle on VF610 platform with following udpate:
Add get_dspi_clk() function and enable DPSI clock gate.
Add DSPI iomux definition and set the iomux for DSPI.
Add the SPI configuration for the vf610twr boards.

Quoted 10 lines
---
 arch/arm/cpu/armv7/vf610/generic.c            |  7 +++++++
 arch/arm/include/asm/arch-vf610/clock.h       |  1 +
 arch/arm/include/asm/arch-vf610/crm_regs.h    |  1 +
 arch/arm/include/asm/arch-vf610/iomux-vf610.h |  8 ++++++++
 arch/arm/include/asm/imx-common/iomux-v3.h    |  2 ++
 board/freescale/vf610twr/vf610twr.c           | 15 ++++++++++++++-
 include/configs/vf610twr.h                    | 15 +++++++++++++++
 7 files changed, 48 insertions(+), 1 deletion(-)

You mix here changes for the SOC (platform) with changes in a specific board. Please move the changes for the vf610twr board in a separate patch.

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#3 lore raw

PATCH 3/4 mtd:vf610twr:add Flash at26df081a for vf610twr platform

In reply to Chao Fu

From: Chao Fu <[email protected]>

AT26DF081 is used on vf610twr board through the DSPI bus, this patch add AT26DF081 into the spi flash params table.

---
 drivers/mtd/spi/sf_probe.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mtd/spi/sf_probe.c +1 -0
index 5eb8ffe..4df1961 100644
@@ -47,6 +47,7 @@ static const struct spi_flash_params spi_flash_params_table[] = {
 	{"AT45DB321D",	   0x1f2700, 0x0,	64 * 1024,    64,	       SECT_4K},
 	{"AT45DB641D",	   0x1f2800, 0x0,	64 * 1024,   128,	       SECT_4K},
 	{"AT25DF321",      0x1f4701, 0x0,	64 * 1024,    64,	       SECT_4K},
+	{"AT26DF081",      0x1f4501, 0x0,	64 * 1024,    64,	       SECT_4K},
 #endif
 #ifdef CONFIG_SPI_FLASH_EON		/* EON */
 	{"EN25Q32B",	   0x1c3016, 0x0,	64 * 1024,    64,	             0},
Signature · 1 line
1.8.4
author
#4 lore raw

PATCH 4/4 M68k:Update the DSPI interface based on the new DSPI driver.

In reply to Chao Fu

From: Chao Fu <[email protected]>

Freescale DSPI module is used on both the ColdFire platform and the ARM platform. There is patch-set to make the driver re-used by both platforms. Some files and macro were changed accordingly, this patch follow those changes to update the macro and include file for some ColdFire boards.

The updates include:
Rename the CONFIG_CF_DSPI to CONFIG_FSL_DSPI. Add the get_dspi_clk function for ColdFire platform.

---
 arch/m68k/cpu/mcf5227x/cpu_init.c     | 3 ++-
 arch/m68k/cpu/mcf5227x/speed.c        | 7 +++++++
 arch/m68k/cpu/mcf52x2/speed.c         | 7 +++++++
 arch/m68k/cpu/mcf5445x/cpu_init.c     | 3 ++-
 arch/m68k/cpu/mcf5445x/speed.c        | 7 +++++++
 arch/m68k/include/asm/immap_5227x.h   | 1 -
 arch/m68k/include/asm/immap_5301x.h   | 1 -
 arch/m68k/include/asm/immap_5441x.h   | 1 -
 arch/m68k/include/asm/immap_5445x.h   | 1 -
 arch/m68k/include/asm/immap_547x_8x.h | 1 -
 include/configs/M52277EVB.h           | 3 +--
 include/configs/M54418TWR.h           | 3 +--
 include/configs/M54451EVB.h           | 3 +--
 include/configs/M54455EVB.h           | 3 +--
 14 files changed, 29 insertions(+), 15 deletions(-)
arch/m68k/cpu/mcf5227x/cpu_init.c +2 -1
index 91b5fad..bd0b4ab 100644
@@ -16,6 +16,7 @@
 #include <asm/io.h>
 #include <asm/rtc.h>
 #include <linux/compiler.h>
+#include <fsl_dspi.h>
 
 /*
  * Breath some life into the CPU...
@@ -139,7 +140,7 @@ void uart_port_conf(int port)
 	}
 }
 
-#ifdef CONFIG_CF_DSPI
+#ifdef CONFIG_FSL_DSPI
 void cfspi_port_conf(void)
 {
 	gpio_t *gpio = (gpio_t *) MMAP_GPIO;
arch/m68k/cpu/mcf5227x/speed.c +7 -0
index 44de4a6..2bfff13 100644
@@ -124,3 +124,10 @@ int get_clocks(void)
 
 	return (0);
 }
+
+#ifdef CONFIG_FSL_DSPI
+int get_dspi_clk(void)
+{
+	return gd->bus_clk;
+}
+#endif
arch/m68k/cpu/mcf52x2/speed.c +7 -0
index c5961d4..69b49c7 100644
@@ -83,3 +83,10 @@ int get_clocks (void)
 
 	return (0);
 }
+
+#ifdef CONFIG_FSL_DSPI
+int get_dspi_clk(void)
+{
+	return gd->bus_clk;
+}
+#endif
arch/m68k/cpu/mcf5445x/cpu_init.c +2 -1
index 9c324dc..bb7a4cd 100644
@@ -16,6 +16,7 @@
 #include <asm/rtc.h>
 #include <asm/io.h>
 #include <linux/compiler.h>
+#include <fsl_dspi.h>
 
 #if defined(CONFIG_CMD_NET)
 #include <config.h>
@@ -423,7 +424,7 @@ int fecpin_setclear(struct eth_device *dev, int setclear)
 }
 #endif
 
-#ifdef CONFIG_CF_DSPI
+#ifdef CONFIG_FSL_DSPI
 void cfspi_port_conf(void)
 {
 	gpio_t *gpio = (gpio_t *) MMAP_GPIO;
arch/m68k/cpu/mcf5445x/speed.c +7 -0
index 07a9b35..29c858e 100644
@@ -279,3 +279,10 @@ int get_clocks(void)
 
 	return (0);
 }
+
+#ifdef CONFIG_FSL_DSPI
+int get_dspi_clk(void)
+{
+	return gd->bus_clk;
+}
+#endif
arch/m68k/include/asm/immap_5227x.h +0 -1
index 2cc4102..18a592e 100644
@@ -51,7 +51,6 @@
 #define MMAP_PLL	(CONFIG_SYS_MBAR + 0x000C0000)
 
 #include <asm/coldfire/crossbar.h>
-#include <asm/coldfire/dspi.h>
 #include <asm/coldfire/edma.h>
 #include <asm/coldfire/eport.h>
 #include <asm/coldfire/flexbus.h>
arch/m68k/include/asm/immap_5301x.h +0 -1
index 337fe73..6b19023 100644
@@ -52,7 +52,6 @@
 #define MMAP_ESDHC	(CONFIG_SYS_MBAR + 0x000CC000)
 
 #include <asm/coldfire/crossbar.h>
-#include <asm/coldfire/dspi.h>
 #include <asm/coldfire/edma.h>
 #include <asm/coldfire/eport.h>
 #include <asm/coldfire/flexbus.h>
arch/m68k/include/asm/immap_5441x.h +0 -1
index 4db6145..62cb681 100644
@@ -78,7 +78,6 @@
 #define MMAP_GPIO	0xEC094000
 
 #include <asm/coldfire/crossbar.h>
-#include <asm/coldfire/dspi.h>
 #include <asm/coldfire/edma.h>
 #include <asm/coldfire/eport.h>
 #include <asm/coldfire/flexbus.h>
arch/m68k/include/asm/immap_5445x.h +0 -1
index 2b12972..1525f9d 100644
@@ -55,7 +55,6 @@
 
 #include <asm/coldfire/ata.h>
 #include <asm/coldfire/crossbar.h>
-#include <asm/coldfire/dspi.h>
 #include <asm/coldfire/edma.h>
 #include <asm/coldfire/eport.h>
 #include <asm/coldfire/flexbus.h>
arch/m68k/include/asm/immap_547x_8x.h +0 -1
index e1ce220..baa7779 100644
@@ -41,7 +41,6 @@
 #define MMAP_SRAMCFG	(CONFIG_SYS_MBAR + 0x0001FF00)
 #define MMAP_SEC	(CONFIG_SYS_MBAR + 0x00020000)
 
-#include <asm/coldfire/dspi.h>
 #include <asm/coldfire/eport.h>
 #include <asm/coldfire/flexbus.h>
 #include <asm/coldfire/flexcan.h>
include/configs/M52277EVB.h +1 -2
index cde7305..485af4c 100644
@@ -137,8 +137,7 @@
 #define CONFIG_SYS_IMMR			CONFIG_SYS_MBAR
 
 /* DSPI and Serial Flash */
-#define CONFIG_CF_SPI
-#define CONFIG_CF_DSPI
+#define CONFIG_FSL_DSPI
 #define CONFIG_HARD_SPI
 #define CONFIG_SYS_SBFHDR_SIZE		0x7
 #ifdef CONFIG_CMD_SPI
include/configs/M54418TWR.h +1 -2
index de063b7..d8bb8cd 100644
@@ -207,8 +207,7 @@
 #define CONFIG_SYS_IMMR		CONFIG_SYS_MBAR
 
 /* DSPI and Serial Flash */
-#define CONFIG_CF_SPI
-#define CONFIG_CF_DSPI
+#define CONFIG_FSL_DSPI
 #define CONFIG_SERIAL_FLASH
 #define CONFIG_HARD_SPI
 #define CONFIG_SYS_SBFHDR_SIZE		0x7
include/configs/M54451EVB.h +1 -2
index 0f4b726..7141601 100644
@@ -148,8 +148,7 @@
 #define CONFIG_SYS_IMMR			CONFIG_SYS_MBAR
 
 /* DSPI and Serial Flash */
-#define CONFIG_CF_SPI
-#define CONFIG_CF_DSPI
+#define CONFIG_FSL_DSPI
 #define CONFIG_SERIAL_FLASH
 #define CONFIG_HARD_SPI
 #define CONFIG_SYS_SBFHDR_SIZE		0x7
include/configs/M54455EVB.h +1 -2
index 7a55d3c..15b7c40 100644
@@ -181,8 +181,7 @@
 #define CONFIG_SYS_IMMR		CONFIG_SYS_MBAR
 
 /* DSPI and Serial Flash */
-#define CONFIG_CF_SPI
-#define CONFIG_CF_DSPI
+#define CONFIG_FSL_DSPI
 #define CONFIG_HARD_SPI
 #define CONFIG_SYS_SBFHDR_SIZE		0x13
 #ifdef CONFIG_CMD_SPI
Signature · 1 line
1.8.4
#5 lore raw

PATCH 4/4 M68k:Update the DSPI interface based on the new DSPI driver.

Hi Chao,

Quoted 11 lines · Chao Fu

From: Chao Fu <[email protected]>

Freescale DSPI module is used on both the ColdFire platform and the ARM platform. There is patch-set to make the driver re-used by both platforms. Some files and macro were changed accordingly, this patch follow those changes to update the macro and include file for some ColdFire boards.

The updates include:
Rename the CONFIG_CF_DSPI to CONFIG_FSL_DSPI. Add the get_dspi_clk function for ColdFire platform.

I have not tested, but it seems you break Coldfire platform with previous patches until this patch is not applied. This makes the tree not bisectable. Is Coldfire buildable after applying only 1/4 ?

IMHO you should change the coldifire platform together with moving and renaming the driver to avoid breakages.

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#6 lore raw

PATCH 4/4 M68k:Update the DSPI interface based on the new DSPI driver.

Dear Stefano
Excuse me, I could not understand your mean absolutely clear.
I have tested all the four patches on Coldfire platforms.
Because only DSPI module is re-use on the two platforms , Coldfire is earlier, Only change config name of DSPI.
Do you mean I should rename other modules config names in Coldfire? Could you give me some detail examples?
Thank you very much!

Best regards,
Fu Chao

Quoted 33 lines

Hi Chao,

Quoted 4 lines · Chao Fu

From: Chao Fu <[email protected]>

Freescale DSPI module is used on both the ColdFire platform and the ARM platform. There is patch-set to make the driver re-used by both

platforms.

Quoted 7 lines

Some files and macro were changed accordingly, this patch follow those changes to update the macro and include file for some ColdFire boards.

The updates include:
Rename the CONFIG_CF_DSPI to CONFIG_FSL_DSPI. Add the get_dspi_clk function for ColdFire platform.

I have not tested, but it seems you break Coldfire platform with previous patches until this patch is not applied. This makes the tree not bisectable. Is Coldfire buildable after applying only 1/4 ?

IMHO you should change the coldifire platform together with moving and renaming the driver to avoid breakages.

Best regards,
Stefano Babic

--
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================

#7 lore raw

PATCH 4/4 M68k:Update the DSPI interface based on the new DSPI driver.

Hi Chao,

Quoted 3 lines · Chao Fu

Dear Stefano
Excuse me, I could not understand your mean absolutely clear. I have tested all the four patches on Coldfire platforms.

I have not tested at all and I can be wrong - so I try to be more clear. It is clear that after applying all patches the Coldfire platform is not broken - this is not the point.

Quoted 4 lines

Because only DSPI module is re-use on the two platforms , Coldfire is earlier, Only change config name of DSPI.
Do you mean I should rename other modules config names in Coldfire? Could you give me some detail examples?

The question is what happen when the 4/4 patch is not applied. It seems no me that Coldfire are broken, because they reference to a driver that does not exist anymore. Is it ?

Of course, all patches will be applied if they are ok after review - but this can make the tree not bisectable.

In fact, if looking at a problem we run "git bisect" and the tree is set to 3/4 of your patchset, the Coldfire platform results broken when we try to build.

For this reason I find better if you update the interface (this patch) together with moving the driver. The change in config name reflects then at the same time with the new driver name and the Coldfire platform is not broken.

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#8 lore raw

PATCH 1/4 SPI:rewrite the Freescale DSPI driver.

In reply to Chao Fu

Hi Chao,

Quoted 19 lines · Chao Fu

From: Chao Fu <[email protected]>

Freescale DSPI module is used on both the ColdFire platform and the ARM platform. The original DSPI driver is written for ColdFire platform only, this patch rewrite the driver to make it be used across the platforms. The rewrite including the following changes:

Rename the file name :

	cf_spi.c -> fsl_dspi.c
Move the file:
	arch/m68k/include/asm/coldfire/dspi.h -> include/fsl_dspi.h
Rename the functions and variables:
	cfxxx -> dspixxx

Keep the following functions for ColdFire:
cfspi_port_conf()
cfspi_claim_bus()
cfspi_release_bus()

Quoted 12 lines
---
 arch/m68k/include/asm/coldfire/dspi.h | 142 --------------
 drivers/spi/Makefile                  |   2 +-
 drivers/spi/cf_spi.c                  | 347 ---------------------------------
 drivers/spi/fsl_dspi.c                | 352 ++++++++++++++++++++++++++++++++++
 include/fsl_dspi.h                    | 147 ++++++++++++++
 5 files changed, 500 insertions(+), 490 deletions(-)
 delete mode 100644 arch/m68k/include/asm/coldfire/dspi.h
 delete mode 100644 drivers/spi/cf_spi.c
 create mode 100644 drivers/spi/fsl_dspi.c
 create mode 100644 include/fsl_dspi.h

When you deal with renaming and moving, you should add the option -C to git format-patch. This let git to recognize if a file is moved without deleting and creating the same file.

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================