summaryrefslogtreecommitdiff
path: root/packages/u-boot/u-boot-1.1.4/at32stk1000/avr32-boards-fix-flash-read.patch
diff options
context:
space:
mode:
authorStelios Koroneos <skoroneos@digital-opsis.com>2008-05-01 13:43:48 +0000
committerStelios Koroneos <skoroneos@digital-opsis.com>2008-05-01 13:43:48 +0000
commit6827eda9aeb9ea33d9ca56bf864b7b0605e0447d (patch)
tree6025d86bc0cec366692fdb6864da7b25cef2cd36 /packages/u-boot/u-boot-1.1.4/at32stk1000/avr32-boards-fix-flash-read.patch
parent93c598646b4a192331b77816048fbde223f57924 (diff)
parent4677e9577829e07467b025e476c9ec96d00fb21f (diff)
merge of '9bb9579fd7698d62103b3f88f6d0910f8ba1e53d'
and 'd8f83de5204562e9c23bd329d59d35006de0f0f8'
Diffstat (limited to 'packages/u-boot/u-boot-1.1.4/at32stk1000/avr32-boards-fix-flash-read.patch')
-rw-r--r--packages/u-boot/u-boot-1.1.4/at32stk1000/avr32-boards-fix-flash-read.patch120
1 files changed, 120 insertions, 0 deletions
diff --git a/packages/u-boot/u-boot-1.1.4/at32stk1000/avr32-boards-fix-flash-read.patch b/packages/u-boot/u-boot-1.1.4/at32stk1000/avr32-boards-fix-flash-read.patch
new file mode 100644
index 0000000000..a1e9fe89e5
--- /dev/null
+++ b/packages/u-boot/u-boot-1.1.4/at32stk1000/avr32-boards-fix-flash-read.patch
@@ -0,0 +1,120 @@
+Index: u-boot-orig/board/atmel/ngw/flash.c
+===================================================================
+--- u-boot-orig.orig/board/atmel/ngw/flash.c 2007-01-03 11:31:44.000000000 +0100
++++ u-boot-orig/board/atmel/ngw/flash.c 2007-01-03 11:33:13.000000000 +0100
+@@ -161,7 +161,7 @@
+ {
+ unsigned long flags;
+ uint16_t *base, *p, *s, *end;
+- uint16_t word, status;
++ uint16_t word, status,status1;
+ int ret = ERR_OK;
+
+ if (addr < info->start[0]
+@@ -196,20 +196,36 @@
+ sync_write_buffer();
+
+ /* Wait for completion */
+- do {
++ status1 = readw(p);
++ do {
+ /* TODO: Timeout */
+- status = readw(p);
+- } while ((status != word) && !(status & 0x28));
+-
++ status = status1;
++ status1=readw(p);
++ } while ( ((status ^ status1) & 0x40) && // toggle bit has toggled
++ !(status1 & 0x28) // status is "working"
++ );
++
++ // We'll need to check once again for toggle bit because the toggle bit
++ // may stop toggling as I/O5 changes to "1" (ref at49bv642.pdf p9)
++ status1=readw(p);
++ status=readw(p);
++ if ((status ^ status1) & 0x40)
++ {
++ printf("Flash write error at address 0x%p: 0x%02x != 0x%02x\n",
++ p, status,word);
++ ret = ERR_PROG_ERROR;
++ writew(0xf0, base);
++ readw(base);
++ break;
++ }
++ // we can now verify status==word if we want to.
++
++ // is this Product ID Exit command really required??
++ // --If configuration is 00 (the default) the device is allready in read mode,
++ // and the instruction is not required!
+ writew(0xf0, base);
+ readw(base);
+
+- if (status != word) {
+- printf("Flash write error at address 0x%p: 0x%02x\n",
+- p, status);
+- ret = ERR_PROG_ERROR;
+- break;
+- }
+ }
+
+ local_irq_restore(flags);
+Index: u-boot-orig/board/atstk1000/flash.c
+===================================================================
+--- u-boot-orig.orig/board/atstk1000/flash.c 2007-01-03 11:31:44.000000000 +0100
++++ u-boot-orig/board/atstk1000/flash.c 2007-01-03 11:33:13.000000000 +0100
+@@ -160,7 +160,7 @@
+ {
+ unsigned long flags;
+ uint16_t *base, *p, *s, *end;
+- uint16_t word, status;
++ uint16_t word, status,status1;
+ int ret = ERR_OK;
+
+ if (addr < info->start[0]
+@@ -195,20 +195,36 @@
+ sync_write_buffer();
+
+ /* Wait for completion */
+- do {
++ status1 = readw(p);
++ do {
+ /* TODO: Timeout */
+- status = readw(p);
+- } while ((status != word) && !(status & 0x28));
+-
++ status = status1;
++ status1=readw(p);
++ } while ( ((status ^ status1) & 0x40) && // toggle bit has toggled
++ !(status1 & 0x28) // status is "working"
++ );
++
++ // We'll need to check once again for toggle bit because the toggle bit
++ // may stop toggling as I/O5 changes to "1" (ref at49bv642.pdf p9)
++ status1=readw(p);
++ status=readw(p);
++ if ((status ^ status1) & 0x40)
++ {
++ printf("Flash write error at address 0x%p: 0x%02x != 0x%02x\n",
++ p, status,word);
++ ret = ERR_PROG_ERROR;
++ writew(0xf0, base);
++ readw(base);
++ break;
++ }
++ // we can now verify status==word if we want to.
++
++ // is this Product ID Exit command really required??
++ // --If configuration is 00 (the default) the device is allready in read mode,
++ // and the instruction is not required!
+ writew(0xf0, base);
+ readw(base);
+
+- if (status != word) {
+- printf("Flash write error at address 0x%p: 0x%02x\n",
+- p, status);
+- ret = ERR_PROG_ERROR;
+- break;
+- }
+ }
+
+ local_irq_restore(flags);