On 3/20/10 1:59 AM, Michael Karcher wrote:
Am Freitag, den 19.03.2010, 10:54 -0700 schrieb Sean Nelson:
+int unlock_82802ab(struct flashchip *flash)
+{
+       int i;
+       //chipaddr wrprotect = flash->virtual_registers + page + 2;
+
+       for (i = 0; i<  flash->total_size; i+= flash->page_size)
+       {
+               chip_writeb(0, flash->virtual_registers + i + 2);
+       }
+
+       return 0;
+}
Sorry for rushing in so late. This is wrong.

flash->total_size is in kilobytes, and flas->page_size is in bytes.

Regards,
   Michael Karcher

You're right! Here's a patch fix.
Signed-off-by: Sean Nelson <[email protected]>

Index: stm50flw0x0x.c
===================================================================
--- stm50flw0x0x.c      (revision 960)
+++ stm50flw0x0x.c      (working copy)
@@ -85,7 +85,7 @@
 {
        int i;
 
-       for (i = 0; i < flash->total_size; i+= flash->page_size) {
+       for (i = 0; i < flash->total_size * 1024; i+= flash->page_size) {
                if(unlock_block_stm50flw0x0x(flash, i)) {
                        fprintf(stderr, "UNLOCK FAILED!\n");
                        return -1;
Index: 82802ab.c
===================================================================
--- 82802ab.c   (revision 960)
+++ 82802ab.c   (working copy)
@@ -97,7 +97,7 @@
        int i;
        //chipaddr wrprotect = flash->virtual_registers + page + 2;
 
-       for (i = 0; i < flash->total_size; i+= flash->page_size)
+       for (i = 0; i < flash->total_size * 1024; i+= flash->page_size)
        {
                chip_writeb(0, flash->virtual_registers + i + 2);
        }
_______________________________________________
flashrom mailing list
[email protected]
http://www.flashrom.org/mailman/listinfo/flashrom

Reply via email to