Patchwork [U-Boot,3/3] arm:vf610:vf610-twr:Enable the DSPI for Freesacale vf610-twr board

login
register
mail settings
Submitter Chao Fu
Date June 25, 2014, 9:11 a.m.
Message ID <1403687499-20037-3-git-send-email-b44548@freescale.com>
Download mbox | patch
Permalink /patch/363926/
State Under Review
Delegated to: Jagannadha Sutradharudu Teki
Headers show

Comments

Chao Fu - June 25, 2014, 9:11 a.m.
From: Chao Fu <B44548@freescale.com>

Enable DSPI iomux for vf610twr board.
Add the SPI configuration for vf610twr board.

Signed-off-by: Chao Fu <b44548@freescale.com>
---
Change in v2 :
	New.
Change in v3 :
	None.
Change in v4 :
	None.

 board/freescale/vf610twr/vf610twr.c | 15 ++++++++++++++-
 include/configs/vf610twr.h          | 13 +++++++++++++
 2 files changed, 27 insertions(+), 1 deletion(-)

Patch

diff --git a/board/freescale/vf610twr/vf610twr.c b/board/freescale/vf610twr/vf610twr.c
index 54a9f2c..08200b5 100644
--- a/board/freescale/vf610twr/vf610twr.c
+++ b/board/freescale/vf610twr/vf610twr.c
@@ -298,6 +298,18 @@  static void setup_iomux_qspi(void)
 	imx_iomux_v3_setup_multiple_pads(qspi0_pads, ARRAY_SIZE(qspi0_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},
@@ -335,7 +347,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,
@@ -411,6 +423,7 @@  int board_early_init_f(void)
 	setup_iomux_enet();
 	setup_iomux_i2c();
 	setup_iomux_qspi();
+	setup_iomux_dspi();
 
 	return 0;
 }
diff --git a/include/configs/vf610twr.h b/include/configs/vf610twr.h
index 0342550..8c89a6b 100644
--- a/include/configs/vf610twr.h
+++ b/include/configs/vf610twr.h
@@ -80,6 +80,19 @@ 
 #define CONFIG_SYS_FSL_QSPI_LE
 #endif
 
+/* DSPI Configs */
+#ifdef CONFIG_FSL_DSPI
+#define MMAP_DSPI  SPI0_BASE_ADDR
+#define CONFIG_SYS_FSL_DSPI_LE
+#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))
+#endif
+
 /* I2C Configs */
 #define CONFIG_CMD_I2C
 #define CONFIG_SYS_I2C