Hello,
after wondering why flash_rom wasn't working, i found that the compiler
did some optimization on the reading/writing from/to the flash. So i
made the variables for accessing the flash 'volatile', now it works!
could you apply the patch to the linuxbios cvs?
thanks
Felix Kloeckner
ps
this patch is for jedec flash only, other parts probably have the
same problem
diff -uwr freebios/util/sis/jedec.c freebios-mod/util/sis/jedec.c
--- freebios/util/sis/jedec.c Mon Nov 6 02:53:36 2000
+++ freebios-mod/util/sis/jedec.c Wed Jul 9 11:02:26 2003
@@ -29,7 +29,7 @@
int probe_jedec (struct flashchip * flash)
{
- char * bios = flash->virt_addr;
+ char * volatile bios = flash->virt_addr;
unsigned char id1, id2;
*(char *) (bios + 0x5555) = 0xAA;
@@ -55,7 +55,7 @@
int erase_jedec (struct flashchip * flash)
{
- char * bios = flash->virt_addr;
+ char * volatile bios = flash->virt_addr;
*(char *) (bios + 0x5555) = 0xAA;
*(char *) (bios + 0x2AAA) = 0x55;
diff -uwr freebios/util/sis/jedec.h freebios-mod/util/sis/jedec.h
--- freebios/util/sis/jedec.h Mon Nov 6 02:53:36 2000
+++ freebios-mod/util/sis/jedec.h Wed Jul 9 11:02:26 2003
@@ -2,7 +2,7 @@
extern int erase_jedec (struct flashchip * flash);
extern int write_jedec (struct flashchip * flash, char * buf);
-extern __inline__ void toggle_ready_jedec (char * dst)
+extern __inline__ void toggle_ready_jedec (char * volatile dst)
{
unsigned int i = 0;
char tmp1, tmp2;
@@ -18,7 +18,7 @@
}
}
-extern __inline__ void data_polling_jedec (char * dst, char data)
+extern __inline__ void data_polling_jedec (char * volatile dst, char data)
{
unsigned int i = 0;
char tmp;
@@ -33,7 +33,7 @@
}
}
-extern __inline__ void protect_jedec (char * bios)
+extern __inline__ void protect_jedec (char * volatile bios)
{
*(char *) (bios + 0x5555) = 0xAA;
*(char *) (bios + 0x2AAA) = 0x55;
@@ -42,7 +42,7 @@
usleep(200);
}
-extern __inline__ void write_page_jedec (char * bios, char * src, char * dst,
+extern __inline__ void write_page_jedec (char * volatile bios, char * volatile src, char * volatile dst,
int page_size)
{
int i;