summaryrefslogtreecommitdiffstats
path: root/sst49lf040.c
diff options
context:
space:
mode:
authorOllie Lho <ollie@sis.com.tw>2005-01-11 02:48:22 +0000
committerOllie Lho <ollie@sis.com.tw>2005-01-11 02:48:22 +0000
commita1439cfdee780d20eafb787cfef2abae9eea00b1 (patch)
tree606d368c9e428ab5d10ef1e4b4718a0aaa360163 /sst49lf040.c
parentefa28589b1c2c402e62c8d5b1e32e5e45b164c2d (diff)
downloadast2050-flashrom-a1439cfdee780d20eafb787cfef2abae9eea00b1.zip
ast2050-flashrom-a1439cfdee780d20eafb787cfef2abae9eea00b1.tar.gz
Add dedicated chip erase function for SST49LF040
Corresponding to flashrom svn r31 and coreboot v2 svn r1852.
Diffstat (limited to 'sst49lf040.c')
-rw-r--r--sst49lf040.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/sst49lf040.c b/sst49lf040.c
index 624a865..f19b91e 100644
--- a/sst49lf040.c
+++ b/sst49lf040.c
@@ -30,6 +30,21 @@
#include "jedec.h"
#include "sst49lf040.h"
+int erase_49lf040(struct flashchip *flash)
+{
+ int i;
+ int total_size = flash->total_size * 1024;
+ int page_size = flash->page_size;
+ volatile char *bios = flash->virt_addr;
+
+ for (i = 0; i < total_size / page_size; i++) {
+ /* Chip erase only works in parallel programming mode
+ * for the 49lf040. Use sector-erase instead */
+ erase_sector_jedec(bios, i * page_size);
+ }
+ return 0;
+}
+
int write_49lf040(struct flashchip *flash, unsigned char *buf)
{
int i;
@@ -40,8 +55,8 @@ int write_49lf040(struct flashchip *flash, unsigned char *buf)
printf("Programming Page: ");
for (i = 0; i < total_size / page_size; i++) {
/* erase the page before programming
- * Chip erase only works in parallel programming mode for the 49lf040.
- * Use sector-erase instead */
+ * Chip erase only works in parallel programming mode
+ * for the 49lf040. Use sector-erase instead */
erase_sector_jedec(bios, i * page_size);
/* write to the sector */
OpenPOWER on IntegriCloud