Hi Øyvind,

--- Øyvind Harboe <oyvind.har...@zylin.com> schrieb am Mo, 29.11.2010:

> Let me know when you think the change is ready to go in.
>

Patch 0001 addresses the segfault that occurred when an unknown device was 
probed twice.

Patch 0002 adds support for a new member of the LPC2900 device family.

Patch 0003 will help identifying the problem in case another engineering 
silicon part appears on a customer board :-)

This is ready to go in.

Regards,
Rolf


From 093e68452e10dfa23df749b97a32ff4c3f6efaa9 Mon Sep 17 00:00:00 2001
From: Rolf Meeser <rolfm_...@yahoo.de>
Date: Sat, 27 Nov 2010 23:09:59 +0100
Subject: [PATCH 1/3] LPC2900: Avoid false positive reprobing if first probing fails

---
 src/flash/nor/lpc2900.c |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/flash/nor/lpc2900.c b/src/flash/nor/lpc2900.c
index e17823e..99d6d1d 100644
--- a/src/flash/nor/lpc2900.c
+++ b/src/flash/nor/lpc2900.c
@@ -132,6 +132,11 @@
 struct lpc2900_flash_bank
 {
 	/**
+	 * This flag is set when the device has been successfully probed.
+	 */
+	bool is_probed;
+
+	/**
 	 * Holds the value read from CHIPID register.
 	 * The driver will not load if the chipid doesn't match the expected
 	 * value of 0x209CE02B of the LPC2900 family. A probe will only be done
@@ -255,7 +260,7 @@ static uint32_t lpc2900_is_ready( struct flash_bank *bank )
 {
 	struct lpc2900_flash_bank *lpc2900_info = bank->driver_priv;
 
-	if( lpc2900_info->chipid != EXPECTED_CHIPID )
+	if( !lpc2900_info->is_probed )
 	{
 		return ERROR_FLASH_BANK_NOT_PROBED;
 	}
@@ -512,8 +517,6 @@ static uint32_t lpc2900_calc_tr( uint32_t clock_var, uint32_t time_var )
 	/*           ((time[µs]/1e6) * f[Hz]) + 511
 	 * FPTR.TR = -------------------------------
 	 *                         512
-	 *
-	 * The result is the
 	 */
 
 	uint32_t tr_val = (uint32_t)((((time_var / 1e6) * clock_var) + 511.0) / 512.0);
@@ -1050,6 +1053,7 @@ FLASH_BANK_COMMAND_HANDLER(lpc2900_flash_bank_command)
 
 	/* Chip ID will be obtained by probing the device later */
 	lpc2900_info->chipid = 0;
+	lpc2900_info->is_probed = false;
 
 	return ERROR_OK;
 }
@@ -1554,10 +1558,8 @@ static int lpc2900_probe(struct flash_bank *bank)
 		return ERROR_TARGET_NOT_HALTED;
 	}
 
-	/* We want to do this only once. Check if we already have a valid CHIPID,
-	 * because then we will have already successfully probed the device.
-	 */
-	if (lpc2900_info->chipid == EXPECTED_CHIPID)
+	/* We want to do this only once. */
+	if (lpc2900_info->is_probed)
 	{
 		return ERROR_OK;
 	}
@@ -1723,6 +1725,8 @@ static int lpc2900_probe(struct flash_bank *bank)
 		offset += bank->sectors[i].size;
 	}
 
+	lpc2900_info->is_probed = true;
+
 	/* Read sector security status */
 	if ( lpc2900_read_security_status(bank) != ERROR_OK )
 	{
-- 
1.7.2.3

From 14888b9bac22441a0a7b27c0308078a23148fb62 Mon Sep 17 00:00:00 2001
From: Rolf Meeser <rolfm_...@yahoo.de>
Date: Wed, 1 Dec 2010 08:22:29 +0100
Subject: [PATCH 2/3] lpc2900.c: Add support for new device LPC2926

---
 src/flash/nor/lpc2900.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/flash/nor/lpc2900.c b/src/flash/nor/lpc2900.c
index 99d6d1d..590c393 100644
--- a/src/flash/nor/lpc2900.c
+++ b/src/flash/nor/lpc2900.c
@@ -1638,7 +1638,11 @@ static int lpc2900_probe(struct flash_bank *bank)
 		else if ( package_code == 4 )
 		{
 			/* 144-pin package */
-			if ( (bank->size == 512*KiB) && (feat3 == 0xFFFFFCF0) )
+			if ( (bank->size == 256*KiB) && (feat3 == 0xFFFFFFE9) )
+			{
+				lpc2900_info->target_name = "LPC2926";
+			}
+			else if ( (bank->size == 512*KiB) && (feat3 == 0xFFFFFCF0) )
 			{
 				lpc2900_info->target_name = "LPC2917/01";
 			}
-- 
1.7.2.3

From 8baa80a387e20c39ee2b1f6e542b5325bfbfc384 Mon Sep 17 00:00:00 2001
From: Rolf Meeser <rolfm_...@yahoo.de>
Date: Wed, 1 Dec 2010 08:28:43 +0100
Subject: [PATCH 3/3] lpc2900.c: Improve debug output for device probing

---
 src/flash/nor/lpc2900.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/flash/nor/lpc2900.c b/src/flash/nor/lpc2900.c
index 590c393..1c1c90f 100644
--- a/src/flash/nor/lpc2900.c
+++ b/src/flash/nor/lpc2900.c
@@ -1676,7 +1676,11 @@ static int lpc2900_probe(struct flash_bank *bank)
 
 	if ( !found )
 	{
-		LOG_WARNING("Unknown LPC29xx derivative");
+		LOG_WARNING("Unknown LPC29xx derivative"
+		            " (FEATx="
+		            "%08" PRIx32 ":%08" PRIx32 ":%08" PRIx32 ":%08" PRIx32 ")",
+					feat0, feat1, feat2, feat3
+					);
 		return ERROR_FLASH_OPERATION_FAILED;
 	}
 
-- 
1.7.2.3

_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to