diff options
author | Ronald G. Minnich <rminnich@gmail.com> | 2003-09-12 22:41:53 +0000 |
---|---|---|
committer | Ronald G. Minnich <rminnich@gmail.com> | 2003-09-12 22:41:53 +0000 |
commit | 616f35c32aed329276a8d043ecfe3a3e4d8cb2d6 (patch) | |
tree | 4ddad443cb40d4f090ba476bb48ddd47b98790a6 /w49f002u.c | |
parent | 24d0f7dbb597046482e06a8288c2c821c4b2f355 (diff) | |
download | flashrom-616f35c32aed329276a8d043ecfe3a3e4d8cb2d6.zip flashrom-616f35c32aed329276a8d043ecfe3a3e4d8cb2d6.tar.gz |
Changes from NIKI
Corresponding to coreboot v1 svn r873.
Diffstat (limited to 'w49f002u.c')
-rw-r--r-- | w49f002u.c | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -25,13 +25,15 @@ * $Id */ +#include <stdio.h> #include "flash.h" #include "jedec.h" +#include "w49f002u.h" int probe_49f002 (struct flashchip * flash) { volatile char * bios = flash->virt_addr; - unsigned char id1, id2, id3; + unsigned char id1, id2; *(bios + 0x5555) = 0xAA; *(bios + 0x2AAA) = 0x55; @@ -56,7 +58,6 @@ int erase_49f002 (struct flashchip * flash) { volatile char * bios = flash->virt_addr; - again: *(bios + 0x5555) = 0xAA; *(bios + 0x2AAA) = 0x55; *(bios + 0x5555) = 0x80; @@ -80,14 +81,15 @@ int erase_49f002 (struct flashchip * flash) *(bios + 0x3bfff) = 0x30; #endif + return(0); } -int write_49f002 (struct flashchip * flash, char * buf) +int write_49f002 (struct flashchip * flash, unsigned char * buf) { int i; - int total_size = flash->total_size * 1024, page_size = flash->page_size; + int total_size = flash->total_size * 1024; volatile char * bios = flash->virt_addr; - volatile char * dst = bios, * src = buf; + volatile char * dst = bios; *bios = 0xF0; myusec_delay(10); @@ -98,7 +100,7 @@ int write_49f002 (struct flashchip * flash, char * buf) for (i = 0; i < total_size; i++) { /* write to the sector */ if ((i & 0xfff) == 0) - printf ("address: 0x%08lx", i); + printf ("address: 0x%08lx", (unsigned long)i); *(bios + 0x5555) = 0xAA; *(bios + 0x2AAA) = 0x55; *(bios + 0x5555) = 0xA0; @@ -112,4 +114,6 @@ int write_49f002 (struct flashchip * flash, char * buf) } #endif printf("\n"); + + return(0); } |