Skip to contentSkip to conversation

arm: socfpga: scan: Clean up scan_chain_engine_is_idle()

PATCH New Marek Vasut 2 participants 13 messages Aug 3, 2015 – Aug 8, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/6 arm: socfpga: scan: Clean up scan_chain_engine_is_idle()

Rework this function so it's clear that it is only polling for certain bits to be cleared. Add kerneldoc. Fix it's return value to be either 0 on success and -ETIMEDOUT on error and propagate this through the scan manager code.

---
 arch/arm/mach-socfpga/include/mach/scan_manager.h |  9 ----
 arch/arm/mach-socfpga/scan_manager.c              | 53 +++++++++++++++--------
 2 files changed, 34 insertions(+), 28 deletions(-)
arch/arm/mach-socfpga/include/mach/scan_manager.h +0 -9
index 94ad50b..ddf8790 100644
@@ -59,15 +59,6 @@ struct socfpga_scan_manager {
 /* Position of second command byte for TDI_TDO packet */
 #define TDI_TDO_HEADER_SECOND_BYTE_SHIFT	8
 
-/*
- * Maximum polling loop to wait for IO scan chain engine
- * becomes idle to prevent infinite loop
- */
-#define SCAN_MAX_DELAY				100
-
-#define SCANMGR_STAT_ACTIVE_GET(x) (((x) & 0x80000000) >> 31)
-#define SCANMGR_STAT_WFIFOCNT_GET(x) (((x) & 0x70000000) >> 28)
-
 int scan_mgr_configure_iocsr(void);
 int iocsr_get_config_table(const unsigned int chain_id,
 			   const unsigned long **table,
arch/arm/mach-socfpga/scan_manager.c +34 -19

99 lines not on this page · raw message

Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/6 arm: socfpga: scan: Clean up scan_chain_engine_is_idle()

Quoted 6 lines · Marek Vasut

Rework this function so it's clear that it is only polling for certain bits to be cleared. Add kerneldoc. Fix it's return value to be either 0 on success and -ETIMEDOUT on error and propagate this through the scan manager code.

Hi Dinh,

in case you missed this small patchset :-)

Best regards,
Marek Vasut

#2 lore raw

PATCH 1/6 arm: socfpga: scan: Clean up scan_chain_engine_is_idle()

In reply to Marek Vasut
Quoted 6 lines · Marek Vasut

Rework this function so it's clear that it is only polling for certain bits to be cleared. Add kerneldoc. Fix it's return value to be either 0 on success and -ETIMEDOUT on error and propagate this through the scan manager code.

Whole series applied to u-boot-socfpga/master .

Best regards,
Marek Vasut

#3 lore raw

PATCH 2/6 arm: socfpga: scan: Introduce generic JTAG accessor

In reply to Marek Vasut

Introduce generic function for accessing the JTAG scan chains in the SCC manager. Make use of this function throughout the SCC manager to replace the ad-hoc writes to registers and make the code less cryptic.

---
 arch/arm/mach-socfpga/scan_manager.c | 104 +++++++++++++++++++++--------------
 1 file changed, 63 insertions(+), 41 deletions(-)
arch/arm/mach-socfpga/scan_manager.c +63 -41
index db47f4f..962e3bd 100644
@@ -50,13 +50,57 @@ static u32 scan_chain_engine_is_idle(uint32_t max_iter)
 	return -ETIMEDOUT;
 }
 
+#define JTAG_BP_INSN		(1 << 0)
+#define JTAG_BP_TMS		(1 << 1)
+#define JTAG_BP_PAYLOAD		(1 << 2)
+#define JTAG_BP_2BYTE		(1 << 3)
+#define JTAG_BP_4BYTE		(1 << 4)
+
+/**
+ * scan_mgr_jtag_io() - Access the JTAG chain
+ * @flags:	Control flags, used to configure the action on the JTAG
+ * @iarg:	Instruction argument
+ * @parg:	Payload argument or data
+ *
+ * Perform I/O on the JTAG chain
+ */
+static void scan_mgr_jtag_io(const u32 flags, const u8 iarg, const u32 parg)
+{
+	u32 data = parg;
+
+	if (flags & JTAG_BP_INSN) {	/* JTAG instruction */
+		/*
+		 * The SCC JTAG register is LSB first, so make
+		 * space for the instruction@the LSB.
+		 */
+		data <<= 8;
+		if (flags & JTAG_BP_TMS) {
+			data |= (0 << 7);	/* TMS instruction. */
+			data |= iarg & 0x3f;	/* TMS arg is 6 bits. */
+			if (flags & JTAG_BP_PAYLOAD)
+				data |= (1 << 6);
+		} else {
+			data |= (1 << 7);	/* TDI/TDO instruction. */
+			data |= iarg & 0xf;	/* TDI/TDO arg is 4 bits. */
+			if (flags & JTAG_BP_PAYLOAD)
+				data |= (1 << 4);
+		}
+	}
+
+	if (flags & JTAG_BP_4BYTE)
+		writel(data, &scan_manager_base->fifo_quad_byte);
+	else if (flags & JTAG_BP_2BYTE)
+		writel(data & 0xffff, &scan_manager_base->fifo_double_byte);
+	else
+		writel(data & 0xff, &scan_manager_base->fifo_single_byte);
+}
+
 /**
  * scan_mgr_io_scan_chain_prg() - Program HPS IO Scan Chain
  * @io_scan_chain_id:		IO scan chain ID
  */
 static int scan_mgr_io_scan_chain_prg(const unsigned int io_scan_chain_id)
 {
-	uint16_t tdi_tdo_header;
 	uint32_t io_program_iter;
 	uint32_t io_scan_chain_data_residual;
 	uint32_t residual;
@@ -101,27 +145,17 @@ static int scan_mgr_io_scan_chain_prg(const unsigned int io_scan_chain_id)
 	io_scan_chain_data_residual = io_scan_chain_len_in_bits &
 		IO_SCAN_CHAIN_128BIT_MASK;
 
-	/* Construct TDI_TDO packet for 128-bit IO scan chain (2 bytes) */
-	tdi_tdo_header = TDI_TDO_HEADER_FIRST_BYTE |
-		(TDI_TDO_MAX_PAYLOAD <<	TDI_TDO_HEADER_SECOND_BYTE_SHIFT);
-
 	/* Program IO scan chain in 128-bit iteration */
 	for (i = 0; i < io_program_iter; i++) {
-		/* write TDI_TDO packet header to scan manager */
-		writel(tdi_tdo_header,	&scan_manager_base->fifo_double_byte);
-
-		/* calculate array index. Multiply by 4 as write 4 x 32bits */
-		index = i * 4;
+		/* Write TDI_TDO packet header for 128-bit IO scan chain */
+		scan_mgr_jtag_io(JTAG_BP_INSN | JTAG_BP_2BYTE, 0x0,
+				 TDI_TDO_MAX_PAYLOAD);
 
 		/* write 4 successive 32-bit IO scan chain data into WFIFO */
-		writel(iocsr_scan_chain[index],
-		       &scan_manager_base->fifo_quad_byte);
-		writel(iocsr_scan_chain[index + 1],
-		       &scan_manager_base->fifo_quad_byte);
-		writel(iocsr_scan_chain[index + 2],
-		       &scan_manager_base->fifo_quad_byte);
-		writel(iocsr_scan_chain[index + 3],
-		       &scan_manager_base->fifo_quad_byte);
+		scan_mgr_jtag_io(JTAG_BP_4BYTE, 0x0, iocsr_scan_chain[index++]);
+		scan_mgr_jtag_io(JTAG_BP_4BYTE, 0x0, iocsr_scan_chain[index++]);
+		scan_mgr_jtag_io(JTAG_BP_4BYTE, 0x0, iocsr_scan_chain[index++]);
+		scan_mgr_jtag_io(JTAG_BP_4BYTE, 0x0, iocsr_scan_chain[index++]);
 
 		/*
 		 * Check if the scan chain engine has completed the
@@ -132,9 +166,6 @@ static int scan_mgr_io_scan_chain_prg(const unsigned int io_scan_chain_id)
 			goto error;
 	}
 
-	/* Calculate array index for final TDI_TDO packet */
-	index = io_program_iter * 4;
-
 	/* Final TDI_TDO packet if any */
 	if (io_scan_chain_data_residual) {
 		/*
@@ -145,29 +176,21 @@ static int scan_mgr_io_scan_chain_prg(const unsigned int io_scan_chain_id)
 			IO_SCAN_CHAIN_32BIT_SHIFT;
 
 		/*
-		 * Construct TDI_TDO packet for remaining IO
-		 * scan chain (2 bytes)
+		 * Program the last part of IO scan chain write TDI_TDO
+		 * packet header (2 bytes) to scan manager.
 		 */
-		tdi_tdo_header	= TDI_TDO_HEADER_FIRST_BYTE |
-			((io_scan_chain_data_residual - 1) <<
-			TDI_TDO_HEADER_SECOND_BYTE_SHIFT);
-
-		/*
-		 * Program the last part of IO scan chain write TDI_TDO packet
-		 * header (2 bytes) to scan manager
-		 */
-		writel(tdi_tdo_header, &scan_manager_base->fifo_double_byte);
+		scan_mgr_jtag_io(JTAG_BP_INSN | JTAG_BP_2BYTE, 0x0,
+				 io_scan_chain_data_residual - 1);
 
 		for (i = 0; i < io_program_iter; i++) {
 			/*
 			 * write remaining scan chain data into scan
 			 * manager WFIFO with 4 bytes write
-			*/
-			writel(iocsr_scan_chain[index + i],
-			       &scan_manager_base->fifo_quad_byte);
+			 */
+			scan_mgr_jtag_io(JTAG_BP_4BYTE, 0x0,
+					 iocsr_scan_chain[index++]);
 		}
 
-		index += io_program_iter;
 		residual = io_scan_chain_data_residual &
 			IO_SCAN_CHAIN_32BIT_MASK;
 
@@ -176,8 +199,8 @@ static int scan_mgr_io_scan_chain_prg(const unsigned int io_scan_chain_id)
 			 * write the last 4B scan chain data
 			 * into scan manager WFIFO
 			 */
-			writel(iocsr_scan_chain[index],
-			       &scan_manager_base->fifo_quad_byte);
+			scan_mgr_jtag_io(JTAG_BP_4BYTE, 0x0,
+					 iocsr_scan_chain[index]);
 		} else {
 			/*
 			 * write the remaining 1 - 3 bytes scan chain
@@ -189,9 +212,8 @@ static int scan_mgr_io_scan_chain_prg(const unsigned int io_scan_chain_id)
 			 * glitch)
 			 */
 			for (i = 0; i < residual; i += 8) {
-				writel(((iocsr_scan_chain[index] >> i)
-					& IO_SCAN_CHAIN_BYTE_MASK),
-					&scan_manager_base->fifo_single_byte);
+				scan_mgr_jtag_io(0, 0x0,
+					 iocsr_scan_chain[index] >> i);
 			}
 		}
 
Signature · 1 line
2.1.4
#4 lore raw

PATCH 2/6 arm: socfpga: scan: Introduce generic JTAG accessor

Quoted 9 lines · Marek Vasut

Introduce generic function for accessing the JTAG scan chains in the SCC manager. Make use of this function throughout the SCC manager to replace the ad-hoc writes to registers and make the code less cryptic.

---
 arch/arm/mach-socfpga/scan_manager.c | 104 +++++++++++++++++++++--------------
 1 file changed, 63 insertions(+), 41 deletions(-)

Thanks,
Dinh

#5 lore raw

PATCH 3/6 arm: socfpga: scan: Clean up horrible macros

In reply to Marek Vasut

Clean up the horrible macros present in the scan_manager.h . Firstly, the function scan_mgr_io_scan_chain_prg() is static, yet all the macros are used only within it, thus there is no point in having them in the header file. Moreover, the macros are just making the code much less readable, so remove them instead.

---
 arch/arm/mach-socfpga/include/mach/scan_manager.h | 42 --------------------
 arch/arm/mach-socfpga/scan_manager.c              | 47 ++++++++---------------
 2 files changed, 17 insertions(+), 72 deletions(-)
arch/arm/mach-socfpga/include/mach/scan_manager.h +0 -42
index ddf8790..3b55e37 100644
@@ -17,48 +17,6 @@ struct socfpga_scan_manager {
 	u32	fifo_quad_byte;
 };
 
-/*
- * Shift count to get number of IO scan chain data in granularity
- * of 128-bit ( N / 128 )
- */
-#define IO_SCAN_CHAIN_128BIT_SHIFT		7
-
-/*
- * Mask to get residual IO scan chain data in
- * granularity of 128-bit ( N mod 128 )
- */
-#define IO_SCAN_CHAIN_128BIT_MASK		0x7F
-
-/*
- * Shift count to get number of IO scan chain
- * data in granularity of 32-bit ( N / 32 )
- */
-#define IO_SCAN_CHAIN_32BIT_SHIFT		5
-
-/*
- * Mask to get residual IO scan chain data in
- * granularity of 32-bit ( N mod 32 )
- */
-#define IO_SCAN_CHAIN_32BIT_MASK		0x1F
-
-/* Byte mask */
-#define IO_SCAN_CHAIN_BYTE_MASK			0xFF
-
-/* 24-bits (3 bytes) IO scan chain payload definition */
-#define IO_SCAN_CHAIN_PAYLOAD_24BIT		24
-
-/*
- * Maximum length of TDI_TDO packet payload is 128 bits,
- * represented by (length - 1) in TDI_TDO header
- */
-#define TDI_TDO_MAX_PAYLOAD			127
-
-/* TDI_TDO packet header for IO scan chain program */
-#define TDI_TDO_HEADER_FIRST_BYTE		0x80
-
-/* Position of second command byte for TDI_TDO packet */
-#define TDI_TDO_HEADER_SECOND_BYTE_SHIFT	8
-
 int scan_mgr_configure_iocsr(void);
 int iocsr_get_config_table(const unsigned int chain_id,
 			   const unsigned long **table,
arch/arm/mach-socfpga/scan_manager.c +17 -30

86 lines not on this page · raw message

Signature · 1 line
2.1.4
#6 lore raw

PATCH 3/6 arm: socfpga: scan: Clean up horrible macros

Quoted 6 lines · Marek Vasut

Clean up the horrible macros present in the scan_manager.h . Firstly, the function scan_mgr_io_scan_chain_prg() is static, yet all the macros are used only within it, thus there is no point in having them in the header file. Moreover, the macros are just making the code much less readable, so remove them instead.

Quoted 6 lines
---
 arch/arm/mach-socfpga/include/mach/scan_manager.h | 42 --------------------
 arch/arm/mach-socfpga/scan_manager.c              | 47 ++++++++---------------
 2 files changed, 17 insertions(+), 72 deletions(-)

Thanks,
Dinh

#7 lore raw

PATCH 4/6 arm: socfpga: scan: Factor out IO chain programming

In reply to Marek Vasut

Factor out the code which sends JTAG instruction followed by data into separate function to tidy the code up a little.

---
 arch/arm/mach-socfpga/scan_manager.c | 113 +++++++++++++----------------------
 1 file changed, 42 insertions(+), 71 deletions(-)
arch/arm/mach-socfpga/scan_manager.c +42 -71
index 1f24e51..4f2c4b5 100644
@@ -102,15 +102,46 @@ static void scan_mgr_jtag_io(const u32 flags, const u8 iarg, const u32 parg)
 }
 
 /**
+ * scan_mgr_jtag_insn_data() - Send JTAG instruction and data
+ * @iarg:	Instruction argument
+ * @data:	Associated data
+ * @dlen:	Length of data in bits
+ *
+ * This function is used when programming the IO chains to submit the
+ * instruction followed by variable length payload.
+ */
+static int
+scan_mgr_jtag_insn_data(const u8 iarg, const unsigned long *data,
+			const unsigned int dlen)
+{
+	int i, j;
+
+	scan_mgr_jtag_io(JTAG_BP_INSN | JTAG_BP_2BYTE, iarg, dlen - 1);
+
+	/* 32 bits or more remain */
+	for (i = 0; i < dlen / 32; i++)
+		scan_mgr_jtag_io(JTAG_BP_4BYTE, 0x0, data[i]);
+
+	if ((dlen % 32) > 24) {	/* 31...24 bits remain */
+		scan_mgr_jtag_io(JTAG_BP_4BYTE, 0x0, data[i]);
+	} else if (dlen % 32) {	/* 24...1 bit remain */
+		for (j = 0; j < dlen % 32; j += 8)
+			scan_mgr_jtag_io(0, 0x0, data[i] >> j);
+	}
+
+	return scan_chain_engine_is_idle(SCANMGR_MAX_DELAY);
+}
+
+/**
  * scan_mgr_io_scan_chain_prg() - Program HPS IO Scan Chain
  * @io_scan_chain_id:		IO scan chain ID
  */
 static int scan_mgr_io_scan_chain_prg(const unsigned int io_scan_chain_id)
 {
-	u32 residual;
 	u32 io_scan_chain_len_in_bits;
 	const unsigned long *iocsr_scan_chain;
-	int i, ret, index = 0;
+	unsigned int rem, idx = 0;
+	int ret;
 
 	ret = iocsr_get_config_table(io_scan_chain_id, &iocsr_scan_chain,
 				     &io_scan_chain_len_in_bits);
@@ -139,78 +170,18 @@ static int scan_mgr_io_scan_chain_prg(const unsigned int io_scan_chain_id)
 	 */
 	setbits_le32(&scan_manager_base->en, 1 << io_scan_chain_id);
 
-	/* Program IO scan chain in 128-bit iteration */
-	for (i = 0; i < io_scan_chain_len_in_bits / 128; i++) {
-		/* Write TDI_TDO packet header for 128-bit IO scan chain */
-		scan_mgr_jtag_io(JTAG_BP_INSN | JTAG_BP_2BYTE, 0x0,
-				 TDI_TDO_MAX_PAYLOAD);
+	/* Program IO scan chain. */
+	while (io_scan_chain_len_in_bits) {
+		if (io_scan_chain_len_in_bits > 128)
+			rem = 128;
+		else
+			rem = io_scan_chain_len_in_bits;
 
-		/* write 4 successive 32-bit IO scan chain data into WFIFO */
-		scan_mgr_jtag_io(JTAG_BP_4BYTE, 0x0, iocsr_scan_chain[index++]);
-		scan_mgr_jtag_io(JTAG_BP_4BYTE, 0x0, iocsr_scan_chain[index++]);
-		scan_mgr_jtag_io(JTAG_BP_4BYTE, 0x0, iocsr_scan_chain[index++]);
-		scan_mgr_jtag_io(JTAG_BP_4BYTE, 0x0, iocsr_scan_chain[index++]);
-
-		/*
-		 * Check if the scan chain engine has completed the
-		 * IO scan chain data shifting
-		 */
-		ret = scan_chain_engine_is_idle(SCANMGR_MAX_DELAY);
-		if (ret)
-			goto error;
-	}
-
-	residual = io_scan_chain_len_in_bits % 128;
-
-	/* Final TDI_TDO packet (if chain length is not aligned to 128 bits) */
-	if (residual) {
-		/*
-		 * Program the last part of IO scan chain write TDI_TDO
-		 * packet header (2 bytes) to scan manager.
-		 */
-		scan_mgr_jtag_io(JTAG_BP_INSN | JTAG_BP_2BYTE, 0x0,
-				 residual - 1);
-
-		for (i = 0; i < residual / 32; i++) {
-			/*
-			 * write remaining scan chain data into scan
-			 * manager WFIFO with 4 bytes write
-			 */
-			scan_mgr_jtag_io(JTAG_BP_4BYTE, 0x0,
-					 iocsr_scan_chain[index++]);
-		}
-
-		residual = io_scan_chain_len_in_bits % 32;
-		if (residual > 24) {
-			/*
-			 * write the last 4B scan chain data
-			 * into scan manager WFIFO
-			 */
-			scan_mgr_jtag_io(JTAG_BP_4BYTE, 0x0,
-					 iocsr_scan_chain[index]);
-		} else {
-			/*
-			 * write the remaining 1 - 3 bytes scan chain
-			 * data into scan manager WFIFO byte by byte
-			 * to prevent JTAG engine shifting unused data
-			 * from the FIFO and mistaken the data as a
-			 * valid command (even though unused bits are
-			 * set to 0, but just to prevent hardware
-			 * glitch)
-			 */
-			for (i = 0; i < residual; i += 8) {
-				scan_mgr_jtag_io(0, 0x0,
-					 iocsr_scan_chain[index] >> i);
-			}
-		}
-
-		/*
-		 * Check if the scan chain engine has completed the
-		 * IO scan chain data shifting
-		 */
-		ret = scan_chain_engine_is_idle(SCANMGR_MAX_DELAY);
+		ret = scan_mgr_jtag_insn_data(0x0, &iocsr_scan_chain[idx], rem);
 		if (ret)
 			goto error;
+		io_scan_chain_len_in_bits -= rem;
+		idx += 4;
 	}
 
 	/* Disable IO Scan chain when configuration done*/
Signature · 1 line
2.1.4
#8 lore raw

PATCH 4/6 arm: socfpga: scan: Factor out IO chain programming

Quoted 8 lines · Marek Vasut

Factor out the code which sends JTAG instruction followed by data into separate function to tidy the code up a little.

---
 arch/arm/mach-socfpga/scan_manager.c | 113 +++++++++++++----------------------
 1 file changed, 42 insertions(+), 71 deletions(-)

Thanks,
Dinh

#9 lore raw

PATCH 5/6 arm: socfpga: scan: Add code to get FPGA ID

In reply to Marek Vasut

From: Dinh Nguyen <[email protected]>

Add code to get the FPGA type for Altera's SoCFPGA family of FPGA. The code uses the scan manager to send jtag pulses that will return the FPGA ID.

---
 arch/arm/mach-socfpga/include/mach/scan_manager.h |  1 +
 arch/arm/mach-socfpga/scan_manager.c              | 55 +++++++++++++++++++++++
 2 files changed, 56 insertions(+)
arch/arm/mach-socfpga/include/mach/scan_manager.h +1 -0
index 3b55e37..5ca6843 100644
@@ -18,6 +18,7 @@ struct socfpga_scan_manager {
 };
 
 int scan_mgr_configure_iocsr(void);
+u32 scan_mgr_get_fpga_id(void);
 int iocsr_get_config_table(const unsigned int chain_id,
 			   const unsigned long **table,
 			   unsigned int *table_len);
arch/arm/mach-socfpga/scan_manager.c +55 -0

70 lines not on this page · raw message

Signature · 1 line
2.1.4
#10 lore raw

PATCH 1/6 arm: socfpga: scan: Clean up scan_chain_engine_is_idle()

In reply to Marek Vasut
Quoted 11 lines · Marek Vasut

Rework this function so it's clear that it is only polling for certain bits to be cleared. Add kerneldoc. Fix it's return value to be either 0 on success and -ETIMEDOUT on error and propagate this through the scan manager code.

---
 arch/arm/mach-socfpga/include/mach/scan_manager.h |  9 ----
 arch/arm/mach-socfpga/scan_manager.c              | 53 +++++++++++++++--------
 2 files changed, 34 insertions(+), 28 deletions(-)

[...]

Quoted 4 lines
arch/arm/mach-socfpga/scan_manager.c +0 -0
@@ -16,26 +28,26 @@ static const struct socfpga_scan_manager *scan_manager_base =
 static const struct socfpga_freeze_controller *freeze_controller_base =
 		(void *)(SOCFPGA_SYSMGR_ADDRESS + SYSMGR_FRZCTRL_ADDRESS);
 

arch/arm/mach-socfpga/scan_manager.c static const struct socfpga_scan_manager *scan_manager_base = · line 38

Quoted 10 lines
arch/arm/mach-socfpga/scan_manager.c +5 -2
-/*
+/**
+ * scan_chain_engine_is_idle() - Check if the JTAG scan chain is idle
+ * @max_iter:	Maximum number of iterations to wait for idle
+ *
  * Function to check IO scan chain engine status and wait if the engine is
  * is active. Poll the IO scan chain engine till maximum iteration reached.
  */
-static inline uint32_t scan_chain_engine_is_idle(uint32_t max_iter)
+static u32 scan_chain_engine_is_idle(uint32_t max_iter)

Should you go ahead and change this to u32?

Only comment, otherwise:

Thanks,
Dinh

#11 lore raw

PATCH 1/6 arm: socfpga: scan: Clean up scan_chain_engine_is_idle()

Quoted 33 lines · Dinh Nguyen
Quoted 12 lines · Marek Vasut

Rework this function so it's clear that it is only polling for certain bits to be cleared. Add kerneldoc. Fix it's return value to be either 0 on success and -ETIMEDOUT on error and propagate this through the scan manager code.

---

 arch/arm/mach-socfpga/include/mach/scan_manager.h |  9 ----
 arch/arm/mach-socfpga/scan_manager.c              | 53

+++++++++++++++-------- 2 files changed, 34 insertions(+), 28 deletions(-)

[...]

Quoted 17 lines
arch/arm/mach-socfpga/scan_manager.c +4 -1
@@ -16,26 +28,26 @@ static const struct socfpga_scan_manager
 *scan_manager_base =
 
 static const struct socfpga_freeze_controller *freeze_controller_base =
 
 		(void *)(SOCFPGA_SYSMGR_ADDRESS + SYSMGR_FRZCTRL_ADDRESS);
 
-/*
+/**
+ * scan_chain_engine_is_idle() - Check if the JTAG scan chain is idle
+ * @max_iter:	Maximum number of iterations to wait for idle
+ *
 
  * Function to check IO scan chain engine status and wait if the engine
  is * is active. Poll the IO scan chain engine till maximum iteration
  reached. */
 
Quoted 6 lines

arch/arm/mach-socfpga/scan_manager.c static const struct socfpga_scan_manager *scan_manager_base = · line 38

Quoted 2 lines
arch/arm/mach-socfpga/scan_manager.c +1 -1
-static inline uint32_t scan_chain_engine_is_idle(uint32_t max_iter)
+static u32 scan_chain_engine_is_idle(uint32_t max_iter)

Should you go ahead and change this to u32?

Only comment, otherwise:

Ah nice, thanks! Fixed :)

Quoted 4 lines

Thanks,
Dinh

Best regards,
Marek Vasut

#12 lore raw

PATCH 6/6 arm: socfpga: misc: Add support for printing FPGA type

In reply to Marek Vasut

From: Dinh Nguyen <[email protected]>

Add code which uses the new functions for obtaining FPGA ID from the scan manager. This new code prints the FPGA model attached to the SoCFPGA during boot and sets environment variable "fpgatype", which can be used to determine the FPGA model in U-Boot scripts.

---
 arch/arm/mach-socfpga/Makefile |  4 +--
 arch/arm/mach-socfpga/misc.c   | 63 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 65 insertions(+), 2 deletions(-)
arch/arm/mach-socfpga/Makefile +2 -2
index 7524ef9..8a745c9 100644
@@ -8,5 +8,5 @@
 #
 
 obj-y	+= misc.o timer.o reset_manager.o system_manager.o clock_manager.o \
-	   fpga_manager.o
-obj-$(CONFIG_SPL_BUILD) += spl.o freeze_controller.o scan_manager.o
+	   fpga_manager.o scan_manager.o
+obj-$(CONFIG_SPL_BUILD) += spl.o freeze_controller.o
arch/arm/mach-socfpga/misc.c +63 -0

94 lines not on this page · raw message

Signature · 1 line
2.1.4