From ef5779d1ddee6b83dfe04ff343e4b7d290fd24d7 Mon Sep 17 00:00:00 2001 From: "Ronald G. Minnich" Date: Tue, 29 Jan 2002 20:18:02 +0000 Subject: Fixes - switch to volatile everywhere - use myusec_delay instead of usleep Corresponding to coreboot v1 svn r492. --- mx29f002.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'mx29f002.c') diff --git a/mx29f002.c b/mx29f002.c index e5c2c08..7b7f1e1 100644 --- a/mx29f002.c +++ b/mx29f002.c @@ -30,20 +30,21 @@ int probe_29f002 (struct flashchip * flash) { - char * bios = flash->virt_addr; + volatile char * bios = flash->virt_addr; unsigned char id1, id2, id3; *(bios + 0x5555) = 0xAA; *(bios + 0x2AAA) = 0x55; *(bios + 0x5555) = 0x90; - id1 = *(unsigned char *) bios; - id2 = *(unsigned char *) (bios + 0x01); + id1 = *(volatile unsigned char *) bios; + id2 = *(volatile unsigned char *) (bios + 0x01); *bios = 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; @@ -52,7 +53,7 @@ int probe_29f002 (struct flashchip * flash) int erase_29f002 (struct flashchip * flash) { - char * bios = flash->virt_addr; + volatile char * bios = flash->virt_addr; again: *(bios + 0x555) = 0xF0; @@ -63,7 +64,7 @@ int erase_29f002 (struct flashchip * flash) *(bios + 0x2AA) = 0x55; *(bios + 0x555) = 0x10; - usleep(100); + myusec_delay(100); toggle_ready_jedec(bios); // while ((*bios & 0x40) != 0x40) @@ -85,11 +86,11 @@ int write_29f002 (struct flashchip * flash, char * buf) { int i; int total_size = flash->total_size * 1024, page_size = flash->page_size; - char * bios = flash->virt_addr; - char * dst = bios, * src = buf; + volatile char * bios = flash->virt_addr; + volatile char * dst = bios, * src = buf; *bios = 0xF0; - usleep(10); + myusec_delay(10); erase_29f002(flash); //*bios = 0xF0; #if 1 -- cgit v1.1