This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

another AMD flash device


This patch adds support for the AM29PL160. In addition it provides a
bit more control over the various delay loops. This chip seems very
slow at erase operations, so the default iteration counts led to
spurious error messages. With these changes platform-specific code can
specify larger values for e.g. CYGNUM_FLASH_TIMEOUT_ERASE_COMPLETE,
but by default the old values will be used so existing ports should be
unaffected.

Bart

2003-08-17  Bart Veer  <bartv@ecoscentric.com>

	* include/flash_am29xxxxx.inl:
	Allow platform-specific code to override the default loop counts
	used for timeouts.

	* include/flash_am29xxxxx_parts.inl, cdl/flash_amd_am29xxxxx.cdl:
	Add AM29PL160 device

Index: cdl/flash_amd_am29xxxxx.cdl
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/flash/amd/am29xxxxx/current/cdl/flash_amd_am29xxxxx.cdl,v
retrieving revision 1.13
diff -u -r1.13 flash_amd_am29xxxxx.cdl
--- cdl/flash_amd_am29xxxxx.cdl	26 Jul 2003 05:10:28 -0000	1.13
+++ cdl/flash_amd_am29xxxxx.cdl	17 Aug 2003 18:22:06 -0000
@@ -87,6 +87,16 @@
             part in the family."
     }
 
+    cdl_option CYGHWR_DEVS_FLASH_AMD_AM29PL160 {
+        display       "AMD AM29PL160 flash memory support"
+        default_value 0
+        implements    CYGINT_DEVS_FLASH_AMD_VARIANTS
+        description   "
+            When this option is enabled, the AMD flash driver will be
+            able to recognize and handle the AMD29PL160
+            part in the family."
+    }
+
     cdl_option CYGHWR_DEVS_FLASH_AMD_AM29LV320D {
         display       "AMD AM29LV320 flash memory support"
         default_value 0
Index: include/flash_am29xxxxx_parts.inl
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/flash/amd/am29xxxxx/current/include/flash_am29xxxxx_parts.inl,v
retrieving revision 1.14
diff -u -r1.14 flash_am29xxxxx_parts.inl
--- include/flash_am29xxxxx_parts.inl	26 Jul 2003 05:10:28 -0000	1.14
+++ include/flash_am29xxxxx_parts.inl	17 Aug 2003 18:22:24 -0000
@@ -507,6 +507,24 @@
         banked     : false
     },
 #endif
+#ifdef CYGHWR_DEVS_FLASH_AMD_AM29PL160
+    {   // AM29PL160
+        device_id  : FLASHWORD(0x2245),
+        block_size : 0x00040000 * CYGNUM_FLASH_INTERLEAVE,
+        block_count: 8,
+        device_size: 0x00200000 * CYGNUM_FLASH_INTERLEAVE,
+        base_mask  : ~(0x00200000 * CYGNUM_FLASH_INTERLEAVE - 1),
+        bootblock  : true,
+        bootblocks : { 0x000000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x004000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x038000 * CYGNUM_FLASH_INTERLEAVE,
+                       _LAST_BOOTBLOCK
+                     },
+        banked     : false
+    },
+#endif
 #ifdef CYGHWR_DEVS_FLASH_AMD_AM29LV200
     {   // AM29LV200-T
         device_id  : FLASHWORD(0x223b),
Index: include/flash_am29xxxxx.inl
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/flash/amd/am29xxxxx/current/include/flash_am29xxxxx.inl,v
retrieving revision 1.18
diff -u -r1.18 flash_am29xxxxx.inl
--- include/flash_am29xxxxx.inl	4 Apr 2003 04:24:46 -0000	1.18
+++ include/flash_am29xxxxx.inl	17 Aug 2003 18:23:00 -0000
@@ -121,6 +121,23 @@
 // #define CYGNUM_FLASH_WIDTH           : Width of devices on platform
 // #define CYGNUM_FLASH_BASE            : Address of first device
 
+// Platform code may define some or all of the below, to provide
+// timeouts appropriate to the target hardware. The timeout
+// values depend partly on the flash part being used, partly
+// on the target (including bus and cpu speeds).
+#ifndef CYGNUM_FLASH_TIMEOUT_QUERY
+# define CYGNUM_FLASH_TIMEOUT_QUERY		  500000
+#endif
+#ifndef CYGNUM_FLASH_TIMEOUT_ERASE_TIMER
+# define CYGNUM_FLASH_TIMEOUT_ERASE_TIMER	10000000
+#endif
+#ifndef CYGNUM_FLASH_TIMEOUT_ERASE_COMPLETE
+# define CYGNUM_FLASH_TIMEOUT_ERASE_COMPLETE	10000000
+#endif
+#ifndef CYGNUM_FLASH_TIMEOUT_PROGRAM
+# define CYGNUM_FLASH_TIMEOUT_PROGRAM		10000000
+#endif
+
 #define CYGNUM_FLASH_BLANK              (1)
 
 #ifndef FLASH_P2V
@@ -183,7 +200,7 @@
     volatile flash_data_t *f_s1, *f_s2;
     flash_data_t* id = (flash_data_t*) data;
     flash_data_t w;
-    long timeout = 500000;
+    long timeout = CYGNUM_FLASH_TIMEOUT_QUERY;
 
     ROM = (flash_data_t*) CYGNUM_FLASH_BASE;
     f_s1 = FLASH_P2V(ROM+FLASH_Setup_Addr1);
@@ -282,14 +299,13 @@
     volatile flash_data_t* b_p = (flash_data_t*) block;
     volatile flash_data_t *b_v;
     volatile flash_data_t *f_s0, *f_s1, *f_s2;
-    int timeout = 50000;
+    int timeout = CYGNUM_FLASH_TIMEOUT_QUERY;
     int len = 0;
     int res = FLASH_ERR_OK;
     flash_data_t state;
     cyg_bool bootblock = false;
     cyg_uint32 *bootblocks = (cyg_uint32 *)0;
     CYG_ADDRWORD bank_offset;
-
     BANK = ROM = (volatile flash_data_t*)((unsigned long)block & flash_dev_info->base_mask);
 
     // If this is a banked device, find the bank where commands should
@@ -355,7 +371,7 @@
         *b_v = FLASH_Block_Erase;
 
         // Now poll for the completion of the sector erase timer (50us)
-        timeout = 10000000;              // how many retries?
+        timeout = CYGNUM_FLASH_TIMEOUT_ERASE_TIMER;              // how many retries?
         while (true) {
             state = *b_v;
             if ((state & FLASH_Sector_Erase_Timer)
@@ -369,7 +385,7 @@
 
         // Then wait for erase completion.
         if (FLASH_ERR_OK == res) {
-            timeout = 10000000;
+            timeout = CYGNUM_FLASH_TIMEOUT_ERASE_COMPLETE;
             while (true) {
                 state = *b_v;
                 if (FLASH_BlankValue == state) {
@@ -462,7 +478,7 @@
         *f_s1 = FLASH_Program;
         *addr_v = *data_ptr;
 
-        timeout = 10000000;
+        timeout = CYGNUM_FLASH_TIMEOUT_PROGRAM;
         while (true) {
             state = *addr_v;
             if (*data_ptr == state) {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]