Skip to contentSkip to conversation

powerpc/t4rdb: Add support of CPLD

PATCH New Chunhe Lan 2 participants 2 messages Oct 20, 2014 – Nov 25, 2014

lore
Share & tools
lore

Chunhe Lan

author
#0 lore raw

PATCH v2 1/1 powerpc/t4rdb: Add support of CPLD

This support of CPLD includes

- Files and register definitions
- Command to switch alternate bank
- Command to switch default bank

---
 board/freescale/t4rdb/Makefile   |    1 +
 board/freescale/t4rdb/cpld.c     |  136 ++++++++++++++++++++++++++++++++++++++
 board/freescale/t4rdb/cpld.h     |   49 ++++++++++++++
 board/freescale/t4rdb/law.c      |    3 +
 board/freescale/t4rdb/t4240rdb.c |   12 ++++
 board/freescale/t4rdb/tlb.c      |    5 ++
 include/configs/T4240RDB.h       |   23 +++++++
 7 files changed, 229 insertions(+), 0 deletions(-)
 create mode 100644 board/freescale/t4rdb/cpld.c
 create mode 100644 board/freescale/t4rdb/cpld.h
board/freescale/t4rdb/Makefile +1 -0
index f7f7fc0..3886e3d 100644
@@ -5,6 +5,7 @@
 #
 
 obj-$(CONFIG_T4240RDB) += t4240rdb.o
+obj-y	+= cpld.o
 obj-y	+= ddr.o
 obj-y	+= eth.o
 obj-$(CONFIG_PCI)	+= pci.o
board/freescale/t4rdb/cpld.c new file +136 -0

136 lines not on this page · raw message

board/freescale/t4rdb/cpld.h new file +49 -0

49 lines not on this page · raw message

board/freescale/t4rdb/law.c +3 -0
index 1f58768..39818fc 100644
@@ -16,6 +16,9 @@ struct law_entry law_table[] = {
 #ifdef CONFIG_SYS_QMAN_MEM_PHYS
 	SET_LAW(CONFIG_SYS_QMAN_MEM_PHYS, LAW_SIZE_32M, LAW_TRGT_IF_QMAN),
 #endif
+#ifdef CONFIG_SYS_CPLD_BASE_PHYS
+	SET_LAW(CONFIG_SYS_CPLD_BASE_PHYS, LAW_SIZE_4K, LAW_TRGT_IF_IFC),
+#endif
 #ifdef CONFIG_SYS_DCSRBAR_PHYS
 	/* Limit DCSR to 32M to access NPC Trace Buffer */
 	SET_LAW(CONFIG_SYS_DCSRBAR_PHYS, LAW_SIZE_32M, LAW_TRGT_IF_DCSR),
board/freescale/t4rdb/t4240rdb.c +12 -0
index 5448c86..027861f 100644
@@ -20,14 +20,26 @@
 #include <fm_eth.h>
 
 #include "t4rdb.h"
+#include "cpld.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
 int checkboard(void)
 {
 	struct cpu_type *cpu = gd->arch.cpu;
+	u8 sw;
 
 	printf("Board: %sRDB, ", cpu->name);
+	printf("Board rev: 0x%02x CPLD ver: 0x%02x%02x, ",
+	       CPLD_READ(hw_ver), CPLD_READ(sw_maj_ver), CPLD_READ(sw_min_ver));
+
+	sw = CPLD_READ(vbank);
+	sw = sw & CPLD_BANK_SEL_MASK;
+
+	if (sw <= 7)
+		printf("vBank: %d\n", sw);
+	else
+		printf("Unsupported Bank=%x\n", sw);
 
 	puts("SERDES Reference Clocks:\n");
 	printf("       SERDES1=100MHz SERDES2=156.25MHz\n"
board/freescale/t4rdb/tlb.c +5 -0
index 4b50bcd..474301e 100644
@@ -106,6 +106,11 @@ struct fsl_e_tlb_entry tlb_table[] = {
 		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 		      0, 16, BOOKE_PAGESZ_64K, 1),
 #endif
+#ifdef CONFIG_SYS_CPLD_BASE
+	SET_TLB_ENTRY(1, CONFIG_SYS_CPLD_BASE, CONFIG_SYS_CPLD_BASE_PHYS,
+		      MAS3_SW|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
+		      0, 17, BOOKE_PAGESZ_4K, 1),
+#endif
 };
 
 int num_tlb_entries = ARRAY_SIZE(tlb_table);
include/configs/T4240RDB.h +23 -0
index 183255d..7b7fce5 100644
@@ -513,6 +513,29 @@ unsigned long get_board_ddr_clk(void);
 #define CONFIG_SYS_CS2_FTIM2		CONFIG_SYS_NOR_FTIM2
 #define CONFIG_SYS_CS2_FTIM3		CONFIG_SYS_NOR_FTIM3
 
+/* CPLD on IFC */
+#define CONFIG_SYS_CPLD_BASE	0xffdf0000
+#define CONFIG_SYS_CPLD_BASE_PHYS	(0xf00000000ull | CONFIG_SYS_CPLD_BASE)
+#define CONFIG_SYS_CSPR3_EXT	(0xf)
+#define CONFIG_SYS_CSPR3	(CSPR_PHYS_ADDR(CONFIG_SYS_CPLD_BASE_PHYS) \
+				| CSPR_PORT_SIZE_8 \
+				| CSPR_MSEL_GPCM \
+				| CSPR_V)
+
+#define CONFIG_SYS_AMASK3	IFC_AMASK(4*1024)
+#define CONFIG_SYS_CSOR3	0x0
+
+/* CPLD Timing parameters for IFC CS3 */
+#define CONFIG_SYS_CS3_FTIM0		(FTIM0_GPCM_TACSE(0x0e) | \
+					FTIM0_GPCM_TEADC(0x0e) | \
+					FTIM0_GPCM_TEAHC(0x0e))
+#define CONFIG_SYS_CS3_FTIM1		(FTIM1_GPCM_TACO(0x0e) | \
+					FTIM1_GPCM_TRAD(0x1f))
+#define CONFIG_SYS_CS3_FTIM2		(FTIM2_GPCM_TCS(0x0e) | \
+					FTIM2_GPCM_TCH(0x8) | \
+					FTIM2_GPCM_TWP(0x1f))
+#define CONFIG_SYS_CS3_FTIM3		0x0
+
 #if defined(CONFIG_RAMBOOT_PBL)
 #define CONFIG_SYS_RAMBOOT
 #endif
Signature · 1 line
1.7.6.5
#1 lore raw

PATCH v2 1/1 powerpc/t4rdb: Add support of CPLD

Quoted 8 lines · Chunhe Lan

This support of CPLD includes

- Files and register definitions
- Command to switch alternate bank
- Command to switch default bank

---

The difference between v2 and v1 is applied to u-boot-mpc85xx master with new subject "powerpc/t4rdb: Fix CPLD timing". Awaiting upstream. Thanks.

York