diff options
author | Ronald G. Minnich <rminnich@gmail.com> | 2002-01-29 20:18:02 +0000 |
---|---|---|
committer | Ronald G. Minnich <rminnich@gmail.com> | 2002-01-29 20:18:02 +0000 |
commit | ef5779d1ddee6b83dfe04ff343e4b7d290fd24d7 (patch) | |
tree | 4e9514f6bc1d73b14490747d1d18ab1ef9e7b6fa /jedec.c | |
parent | f4cf2baec9ba699c7e7387de7fd528fca06b25d6 (diff) | |
download | flashrom-ef5779d1ddee6b83dfe04ff343e4b7d290fd24d7.tar.gz flashrom-ef5779d1ddee6b83dfe04ff343e4b7d290fd24d7.tar.bz2 flashrom-ef5779d1ddee6b83dfe04ff343e4b7d290fd24d7.zip |
Fixes
- switch to volatile everywhere
- use myusec_delay instead of usleep
Corresponding to coreboot v1 svn r492.
Diffstat (limited to 'jedec.c')
-rw-r--r-- | jedec.c | 41 |
1 files changed, 21 insertions, 20 deletions
@@ -29,24 +29,25 @@ int probe_jedec (struct flashchip * flash) { - char * bios = flash->virt_addr; + volatile char * bios = flash->virt_addr; unsigned char id1, id2; - *(char *) (bios + 0x5555) = 0xAA; - *(char *) (bios + 0x2AAA) = 0x55; - *(char *) (bios + 0x5555) = 0x90; + *(volatile char *) (bios + 0x5555) = 0xAA; + *(volatile char *) (bios + 0x2AAA) = 0x55; + *(volatile char *) (bios + 0x5555) = 0x90; - usleep(10); + myusec_delay(10); - id1 = *(unsigned char *) bios; - id2 = *(unsigned char *) (bios + 0x01); + id1 = *(volatile unsigned char *) bios; + id2 = *(volatile unsigned char *) (bios + 0x01); - *(char *) (bios + 0x5555) = 0xAA; - *(char *) (bios + 0x2AAA) = 0x55; - *(char *) (bios + 0x5555) = 0xF0; + *(volatile char *) (bios + 0x5555) = 0xAA; + *(volatile char *) (bios + 0x2AAA) = 0x55; + *(volatile char *) (bios + 0x5555) = 0xF0; - usleep(10); + myusec_delay(10); + printf(__FUNCTION__ "id1 %d, id2 %d\n", id1, id2); if (id1 == flash->manufacture_id && id2 == flash->model_id) return 1; @@ -55,17 +56,17 @@ int probe_jedec (struct flashchip * flash) int erase_jedec (struct flashchip * flash) { - char * bios = flash->virt_addr; + volatile char * bios = flash->virt_addr; - *(char *) (bios + 0x5555) = 0xAA; - *(char *) (bios + 0x2AAA) = 0x55; - *(char *) (bios + 0x5555) = 0x80; + *(volatile char *) (bios + 0x5555) = 0xAA; + *(volatile char *) (bios + 0x2AAA) = 0x55; + *(volatile char *) (bios + 0x5555) = 0x80; - *(char *) (bios + 0x5555) = 0xAA; - *(char *) (bios + 0x2AAA) = 0x55; - *(char *) (bios + 0x5555) = 0x10; + *(volatile char *) (bios + 0x5555) = 0xAA; + *(volatile char *) (bios + 0x2AAA) = 0x55; + *(volatile char *) (bios + 0x5555) = 0x10; - usleep(10); + myusec_delay(10); toggle_ready_jedec(bios); } @@ -73,7 +74,7 @@ int write_jedec (struct flashchip * flash, char * buf) { int i; int total_size = flash->total_size *1024, page_size = flash->page_size; - char * bios = flash->virt_addr; + volatile char * bios = flash->virt_addr; erase_jedec (flash); printf ("Programming Page: "); |