changeset 941:6b0b2f6dbb20

gsm-fw/services/ffs/drv.c: AMD multi-bank flash driver fixed for Pirelli and future FreeCalypso hardware
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Sun, 01 Nov 2015 00:07:09 +0000
parents 0fb9b7f2ef87
children 042c178ebac5
files gsm-fw/services/ffs/drv.c
diffstat 1 files changed, 10 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/gsm-fw/services/ffs/drv.c	Sat Oct 31 23:39:41 2015 +0000
+++ b/gsm-fw/services/ffs/drv.c	Sun Nov 01 00:07:09 2015 +0000
@@ -209,7 +209,7 @@
 
 void ffsdrv_amd_write_halfword(volatile uint16 *addr, uint16 value)
 {
-    volatile char *flash = dev.base;
+    volatile uint16 *flash = (volatile uint16 *)dev.base;
     uint32 cpsr;
 
     tlw(led_on(LED_WRITE));
@@ -226,9 +226,9 @@
     cpsr = int_disable();
     tlw(led_toggle(LED_WRITE_SUSPEND));
     dev.state = DEV_WRITE;
-    flash[0xAAAA] = 0xAA; // unlock cycle 1
-    flash[0x5555] = 0x55; // unlock cycle 2
-    flash[0xAAAA] = 0xA0;
+    flash[0x555] = 0xAA; // unlock cycle 1
+    flash[0x2AA] = 0x55; // unlock cycle 2
+    flash[0x555] = 0xA0;
     *addr         = value;
     int_enable(cpsr);
     tlw(led_toggle(LED_WRITE_SUSPEND));
@@ -274,7 +274,7 @@
 
 void ffsdrv_amd_erase(uint8 block)
 {
-    volatile char *flash = dev.base;
+    volatile uint16 *flash = (volatile uint16 *)dev.base;
     uint32 cpsr;
 
     tlw(led_on(LED_ERASE));
@@ -284,11 +284,11 @@
 
     cpsr = int_disable();
     dev.state = DEV_ERASE;
-    flash[0xAAAA] = 0xAA; // unlock cycle 1
-    flash[0x5555] = 0x55; // unlock cycle 2
-    flash[0xAAAA] = 0x80; 
-    flash[0xAAAA] = 0xAA; // unlock cycle 1
-    flash[0x5555] = 0x55; // unlock cycle 2
+    flash[0x555] = 0xAA; // unlock cycle 1
+    flash[0x2AA] = 0x55; // unlock cycle 2
+    flash[0x555] = 0x80; 
+    flash[0x555] = 0xAA; // unlock cycle 1
+    flash[0x2AA] = 0x55; // unlock cycle 2
     *dev.addr = 0x30; // AMD erase sector command
     int_enable(cpsr);