Skip to contentSkip to conversation

board/t104xrdb: Add support of CPLD

PATCH New Prabhakar Kushwaha 2 participants 2 messages Apr 3, 2014 – Apr 23, 2014

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/1 board/t104xrdb: Add support of CPLD

T1040RDB and T1042RDB_PI has CPLD. Here CPLD controls board mux/features.

This support of CPLD includes
- files and register defintion
- Commands to swtich alternate bank and default bank

---
Changes for v2:
- Updated the cpld command
Changes for v3:
- fix typo
Changes for v4:
- fix typo
Changes for v5:
- fix cpld registers while printing
- rebased on top of below patch
powerpc/t104xrdb: Unification of T104xRDB header files
http://patchwork.ozlabs.org/patch/335207/

 board/freescale/t104xrdb/Makefile   |    1 +
 board/freescale/t104xrdb/cpld.c     |  112 +++++++++++++++++++++++++++++++++++
 board/freescale/t104xrdb/cpld.h     |   40 +++++++++++++
 board/freescale/t104xrdb/t104xrdb.c |   13 ++++
 include/configs/T104xRDB.h          |    8 +++
 5 files changed, 174 insertions(+)
 create mode 100644 board/freescale/t104xrdb/cpld.c
 create mode 100644 board/freescale/t104xrdb/cpld.h
board/freescale/t104xrdb/Makefile +1 -0
index e51fb7a..7e7bfb1 100644
@@ -6,6 +6,7 @@
 
 
 obj-y	+= t104xrdb.o
+obj-y	+= cpld.o
 obj-y	+= ddr.o
 obj-y	+= eth.o
 obj-$(CONFIG_PCI)	+= pci.o
board/freescale/t104xrdb/cpld.c new file +112 -0

112 lines not on this page · raw message

board/freescale/t104xrdb/cpld.h new file +40 -0
new file mode 100644
index 0000000..0da9a01
@@ -0,0 +1,40 @@
+/**
+ * Copyright 2013 Freescale Semiconductor
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ *
+ * This file provides support for the ngPIXIS, a board-specific FPGA used on
+ * some Freescale reference boards.
+ */
+
+/*
+ * CPLD register set. Feel free to add board-specific #ifdefs where necessary.
+ */
+struct cpld_data {
+	u8 cpld_ver;		/* 0x00 - CPLD Major Revision Register */
+	u8 cpld_ver_sub;	/* 0x01 - CPLD Minor Revision Register */
+	u8 hw_ver;		/* 0x02 - Hardware Revision Register */
+	u8 sw_ver;		/* 0x03 - Software Revision register */
+	u8 res0[12];		/* 0x04 - 0x0F - not used */
+	u8 reset_ctl1;		/* 0x10 - Reset control Register1 */
+	u8 reset_ctl2;		/* 0x11 - Reset control Register2 */
+	u8 int_status;		/* 0x12 - Interrupt status Register */
+	u8 flash_ctl_status;	/* 0x13 - Flash control and status register */
+	u8 fan_ctl_status;	/* 0x14 - Fan control and status register  */
+	u8 led_ctl_status;	/* 0x15 - LED control and status register */
+	u8 sfp_ctl_status;	/* 0x16 - SFP control and status register  */
+	u8 misc_ctl_status;	/* 0x17 - Miscellanies ctrl & status register*/
+	u8 boot_override;	/* 0x18 - Boot override register */
+	u8 boot_config1;	/* 0x19 - Boot config override register*/
+	u8 boot_config2;	/* 0x1A - Boot config override register*/
+} cpld_data_t;
+
+
+/* Pointer to the CPLD register set */
+
+u8 cpld_read(unsigned int reg);
+void cpld_write(unsigned int reg, u8 value);
+
+#define CPLD_READ(reg) cpld_read(offsetof(struct cpld_data, reg))
+#define CPLD_WRITE(reg, value)\
+		cpld_write(offsetof(struct cpld_data, reg), value)
board/freescale/t104xrdb/t104xrdb.c +13 -0
index 6e29d64..b48133a 100644
@@ -19,14 +19,27 @@
 #include <fm_eth.h>
 
 #include "t104xrdb.h"
+#include "cpld.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
 int checkboard(void)
 {
 	struct cpu_type *cpu = gd->arch.cpu;
+	u8 sw;
 
 	printf("Board: %sRDB\n", cpu->name);
+	printf("Board rev: 0x%02x CPLD ver: 0x%02x, ",
+	       CPLD_READ(hw_ver), CPLD_READ(sw_ver));
+
+	sw = CPLD_READ(flash_ctl_status);
+	sw = ((sw & CPLD_LBMAP_MASK) >> CPLD_LBMAP_SHIFT);
+
+	if (sw <= 7)
+		printf("vBank: %d\n", sw);
+	else
+		printf("Unsupported Bank=%x\n", sw);
+
 	return 0;
 }
 
include/configs/T104xRDB.h +8 -0
index 8d2fdb0..2bbb78c 100644
@@ -179,6 +179,14 @@
 #define CONFIG_SYS_FLASH_BANKS_LIST	{CONFIG_SYS_FLASH_BASE_PHYS}
 
 /* CPLD on IFC */
+#define CPLD_LBMAP_MASK			0x3F
+#define CPLD_BANK_SEL_MASK		0x07
+#define CPLD_BANK_OVERRIDE		0x40
+#define CPLD_LBMAP_ALTBANK		0x44 /* BANK OR | BANK 4 */
+#define CPLD_LBMAP_DFLTBANK		0x40 /* BANK OR | BANK0 */
+#define CPLD_LBMAP_RESET		0xFF
+#define CPLD_LBMAP_SHIFT		0x03
+
 #define CONFIG_SYS_CPLD_BASE	0xffdf0000
 #define CONFIG_SYS_CPLD_BASE_PHYS	(0xf00000000ull | CONFIG_SYS_CPLD_BASE)
 #define CONFIG_SYS_CSPR2_EXT	(0xf)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v5 1/1 board/t104xrdb: Add support of CPLD

Quoted 7 lines · Prabhakar Kushwaha

T1040RDB and T1042RDB_PI has CPLD. Here CPLD controls board mux/features.

This support of CPLD includes
- files and register defintion
- Commands to swtich alternate bank and default bank

Quoted 13 lines

---
Changes for v2:
- Updated the cpld command
Changes for v3:
- fix typo
Changes for v4:
- fix typo
Changes for v5:
- fix cpld registers while printing
- rebased on top of below patch
powerpc/t104xrdb: Unification of T104xRDB header files
http://patchwork.ozlabs.org/patch/335207/

Applied to u-boot-mpc85xx/master, thanks.

York