Skip to contentSkip to conversation

ppc_4xx:netstal/common fixes wrong check for flash erase

PATCH New Niklaus Giger 2 participants 2 messages Jan 14, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ppc_4xx:netstal/common fixes wrong check for flash erase

Fixed an error in the Netstal specific code, where sometimes a flash was declared as not erased, even when it was.

---
 board/netstal/common/hcu_flash.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)
board/netstal/common/hcu_flash.c +3 -7
index be2cb37..d41d579 100644
@@ -30,6 +30,9 @@
  * Modified 6/6/2007
  * Added isync
  * Niklaus Giger, Netstal Maschinen, niklaus.giger at netstal.com
+ * Modified 13/3/2007
+ * Removed check whether flash is already erased. Gave false errors.
+ * Niklaus Giger, Netstal Maschinen, niklaus.giger at netstal.com
  *
  */
 
@@ -480,7 +483,6 @@ int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
  * Write a word to Flash, returns:
  * 0 - OK
  * 1 - write timeout
- * 2 - Flash not erased
  */
 static int write_word (flash_info_t * info, ulong dest, ulong data)
 {
@@ -491,12 +493,6 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)
 	ulong start;
 	int i;
 
-	/* Check if Flash is (sufficiently) erased */
-	if ((*((volatile FLASH_WORD_SIZE *) dest) &
-	    (FLASH_WORD_SIZE) data) != (FLASH_WORD_SIZE) data) {
-		return (2);
-	}
-
 	for (i = 0; i < 4 / sizeof (FLASH_WORD_SIZE); i++) {
 		int flag;
 
Signature · 7 lines
1.5.2.5


-- 
Niklaus Giger
Netstal Maschinen AG
CH-8752 Naefels
#1 lore raw

PATCH 1/1 ppc_4xx:netstal/common fixes wrong check for flash erase

Quoted 13 lines · Niklaus Giger

Fixed an error in the Netstal specific code, where sometimes a flash was declared as not erased, even when it was.

---
 board/netstal/common/hcu_flash.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)
(quoted diff) +0 -0

b/board/netstal/common/hcu_flash.c index be2cb37..d41d579 100644

board/netstal/common/hcu_flash.c line 35

Quoted 6 lines
board/netstal/common/hcu_flash.c +3 -0
@@ -30,6 +30,9 @@
  * Modified 6/6/2007
  * Added isync
  * Niklaus Giger, Netstal Maschinen, niklaus.giger at netstal.com
+ * Modified 13/3/2007
+ * Removed check whether flash is already erased. Gave false errors.
+ * Niklaus Giger, Netstal Maschinen, niklaus.giger at netstal.com

Don't add commit logs to the source code. We have git for this. So please add descriptive commit texts to your commit logs.

Quoted 12 lines
board/netstal/common/hcu_flash.c +0 -0
  *
  */
 
@@ -480,7 +483,6 @@ int write_buff (flash_info_t * info, uchar * src, ulong

addr, ulong cnt) * Write a word to Flash, returns:
* 0 - OK
* 1 - write timeout
- * 2 - Flash not erased
*/
static int write_word (flash_info_t * info, ulong dest, ulong data) {

board/netstal/common/hcu_flash.c static int write_word (flash_info_t * info, ulong · line 499

Quoted 9 lines
board/netstal/common/hcu_flash.c +0 -6
@@ -491,12 +493,6 @@ static int write_word (flash_info_t * info, ulong
 dest, ulong data) ulong start;
 	int i;
 
-	/* Check if Flash is (sufficiently) erased */
-	if ((*((volatile FLASH_WORD_SIZE *) dest) &
-	    (FLASH_WORD_SIZE) data) != (FLASH_WORD_SIZE) data) {
-		return (2);
-	}
-

Wow. I don't think you really solve this problem with this patch. You are just lucky that everything works with this change. Could be that the pointer accesses are the main source of this problem. I suggest that you try to move to the common CFI driver which now supports non CFI flash chips via the JEDEC code.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================