[ECOS] flash ROM support for cq7750.

Koichi Nagashima naga@r-lab.co.jp
Thu Dec 20 09:26:00 GMT 2001


Hi, folks,

Attached patch provides flash ROM support for cq7750.

This patch modifies and adds some codes as following.
1. am29xxxxx codes are slightly modified suite for AM29LV800-B
   and its compatible chip. This change may work with another 
   am29xxxxx chip, I think.
2. a new flash ROM data, Toshiba TC58FVB800, is added to the AMD 
   am29xxxxx family.
3. a new flash package for cq7750 paltform is added.

Here, fis commands on redboot are available for CqREEK/SH4 (cq7750),
I have succeeded in booting from flash ROM on my CqREEK/SH4,
after booting from RAM and writing another redboot image that
boots from ROM.

I don't know if other revisions of CqREEK/SH4 exist or not, but 
I have tested my CqREEK/SH4 board with a flash ROM, TC58FVB800.

Have fun.

+++++++++++++++++++++++++++++++++++++++++++
Koichi Nagsahima, R-lab Inc. (Tokyo, Japan)
E-mail: naga@r-lab.co.jp
+++++++++++++++++++++++++++++++++++++++++++
-------------- next part --------------
diff -urN --exclude=CVS packages.old/devs/flash/amd/am29xxxxx/current/cdl/flash_amd_am29xxxxx.cdl packages/devs/flash/amd/am29xxxxx/current/cdl/flash_amd_am29xxxxx.cdl
--- packages.old/devs/flash/amd/am29xxxxx/current/cdl/flash_amd_am29xxxxx.cdl	Sat Nov  3 01:12:33 2001
+++ packages/devs/flash/amd/am29xxxxx/current/cdl/flash_amd_am29xxxxx.cdl	Thu Dec 20 17:44:00 2001
@@ -116,4 +116,13 @@
             able to recognize and handle the AM29LV800
             part in the family."
     }
+
+    cdl_option CYGHWR_DEVS_FLASH_AMD_TC58FVB800 {
+        display       "Toshiba TC58FVB800 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 Toshiba TC58FVB800."
+    }
 }
diff -urN --exclude=CVS packages.old/devs/flash/amd/am29xxxxx/current/include/flash_am29xxxxx.inl packages/devs/flash/amd/am29xxxxx/current/include/flash_am29xxxxx.inl
--- packages.old/devs/flash/amd/am29xxxxx/current/include/flash_am29xxxxx.inl	Wed Oct  3 03:28:25 2001
+++ packages/devs/flash/amd/am29xxxxx/current/include/flash_am29xxxxx.inl	Fri Dec 21 00:45:56 2001
@@ -67,7 +67,7 @@
 // Common device details.
 #define FLASH_Read_ID                   FLASHWORD( 0x90 )
 #define FLASH_WP_State                  FLASHWORD( 0x90 )
-#define FLASH_Reset                     FLASHWORD( 0xFF )
+#define FLASH_Reset                     FLASHWORD( 0xF0 )
 #define FLASH_Program                   FLASHWORD( 0xA0 )
 #define FLASH_Block_Erase               FLASHWORD( 0x30 )
 
@@ -314,7 +314,8 @@
         timeout = 10000000;              // how many retries?
         while (true) {
             state = *b_v;
-            if ((state & FLASH_Sector_Erase_Timer) == 0) break;
+            if ((state & FLASH_Sector_Erase_Timer)
+				== FLASH_Sector_Erase_Timer) break;
 
             if (--timeout == 0) {
                 res = FLASH_ERR_DRV_TIMEOUT;
@@ -330,6 +331,8 @@
                 if (FLASH_BlankValue == state) {
                     break;
                 }
+
+		if((state & FLASH_Busy) == (*b_v & FLASH_Busy)) break;
 
                 // Don't check for FLASH_Err here since it will fail
                 // with devices in parallel because these may finish
diff -urN --exclude=CVS packages.old/devs/flash/amd/am29xxxxx/current/include/flash_am29xxxxx_parts.inl packages/devs/flash/amd/am29xxxxx/current/include/flash_am29xxxxx_parts.inl
--- packages.old/devs/flash/amd/am29xxxxx/current/include/flash_am29xxxxx_parts.inl	Sat Nov  3 01:12:33 2001
+++ packages/devs/flash/amd/am29xxxxx/current/include/flash_am29xxxxx_parts.inl	Thu Dec 20 23:42:24 2001
@@ -208,6 +208,24 @@
         banked     : false
     },
 #endif
+#ifdef CYGHWR_DEVS_FLASH_AMD_TC58FVB800
+    {   // Toshiba TC58FVB800 (compatible with AM29LV800-B except for IDs.)
+        device_id  : FLASHWORD(0xCE),
+        block_size : 0x10000 * CYGNUM_FLASH_INTERLEAVE,
+        block_count: 16,
+        device_size: 0x100000 * CYGNUM_FLASH_INTERLEAVE,
+        base_mask  : ~(0x100000 * CYGNUM_FLASH_INTERLEAVE - 1),
+        bootblock  : true,
+        bootblocks : { 0x000000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x004000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x008000 * CYGNUM_FLASH_INTERLEAVE,
+                       0
+                     },
+        banked     : false
+    },
+#endif
 
 #else // 16 bit devices
 
@@ -361,7 +379,6 @@
         banked     : false
     },
 #endif
-
 #ifdef CYGHWR_DEVS_FLASH_AMD_AM29LV640
     {   // MBM29LV640xx
         device_id  : FLASHWORD(0x22d7),
@@ -370,6 +387,24 @@
         device_size: 0x800000 * CYGNUM_FLASH_INTERLEAVE,
         base_mask  : ~(0x800000 * CYGNUM_FLASH_INTERLEAVE - 1),
         bootblock  : false,  
+        banked     : false
+    },
+#endif
+#ifdef CYGHWR_DEVS_FLASH_AMD_TC58FVB800
+    {   // Toshiba TC58FVB800 (compatible with AM29LV800-B except for IDs.)
+        device_id  : FLASHWORD(0xCE),
+        block_size : 0x10000 * CYGNUM_FLASH_INTERLEAVE,
+        block_count: 16,
+        device_size: 0x100000 * CYGNUM_FLASH_INTERLEAVE,
+        base_mask  : ~(0x100000 * CYGNUM_FLASH_INTERLEAVE - 1),
+        bootblock  : true,
+        bootblocks : { 0x000000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x004000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x008000 * CYGNUM_FLASH_INTERLEAVE,
+                       0
+                     },
         banked     : false
     },
 #endif
diff -urN --exclude=CVS packages.old/devs/flash/sh/cq7750/current/ChangeLog packages/devs/flash/sh/cq7750/current/ChangeLog
--- packages.old/devs/flash/sh/cq7750/current/ChangeLog	Thu Jan  1 09:00:00 1970
+++ packages/devs/flash/sh/cq7750/current/ChangeLog	Thu Dec 20 23:44:41 2001
@@ -0,0 +1,29 @@
+2001-12-20  Koichi Nagashima  <naga@r-lab.co.jp>
+
+	* Cloned from EDK7708 flash package.
+
+//===========================================================================
+//####COPYRIGHTBEGIN####
+//                                                                          
+// -------------------------------------------                              
+// The contents of this file are subject to the Red Hat eCos Public License 
+// Version 1.1 (the "License"); you may not use this file except in         
+// compliance with the License.  You may obtain a copy of the License at    
+// http://www.redhat.com/                                                   
+//                                                                          
+// Software distributed under the License is distributed on an "AS IS"      
+// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the 
+// License for the specific language governing rights and limitations under 
+// the License.                                                             
+//                                                                          
+// The Original Code is eCos - Embedded Configurable Operating System,      
+// released September 30, 1998.                                             
+//                                                                          
+// The Initial Developer of the Original Code is Red Hat.                   
+// Portions created by Red Hat are                                          
+// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc.
+// All Rights Reserved.                                                     
+// -------------------------------------------                              
+//                                                                          
+//####COPYRIGHTEND####
+//===========================================================================
diff -urN --exclude=CVS packages.old/devs/flash/sh/cq7750/current/cdl/flash_cq7750.cdl packages/devs/flash/sh/cq7750/current/cdl/flash_cq7750.cdl
--- packages.old/devs/flash/sh/cq7750/current/cdl/flash_cq7750.cdl	Thu Jan  1 09:00:00 1970
+++ packages/devs/flash/sh/cq7750/current/cdl/flash_cq7750.cdl	Fri Dec 21 00:52:31 2001
@@ -0,0 +1,62 @@
+# ====================================================================
+#
+#      flash_cq7750.cdl
+#
+#      FLASH memory - Hardware support on CqREEK SH7750 board
+#
+# ====================================================================
+#####COPYRIGHTBEGIN####
+#                                                                          
+# -------------------------------------------                              
+# The contents of this file are subject to the Red Hat eCos Public License 
+# Version 1.1 (the "License"); you may not use this file except in         
+# compliance with the License.  You may obtain a copy of the License at    
+# http://www.redhat.com/                                                   
+#                                                                          
+# Software distributed under the License is distributed on an "AS IS"      
+# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the 
+# License for the specific language governing rights and limitations under 
+# the License.                                                             
+#                                                                          
+# The Original Code is eCos - Embedded Configurable Operating System,      
+# released September 30, 1998.                                             
+#                                                                          
+# The Initial Developer of the Original Code is Red Hat.                   
+# Portions created by Red Hat are                                          
+# Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc.
+# All Rights Reserved.                                                     
+# -------------------------------------------                              
+#                                                                          
+#####COPYRIGHTEND####
+# ====================================================================
+######DESCRIPTIONBEGIN####
+#
+# Author(s):      gthomas, hmt, jskov
+# Original data:  gthomas
+# Contributors:   gthomas
+# Date:           2001-02-20
+#
+#####DESCRIPTIONEND####
+#
+# ====================================================================
+
+cdl_package CYGPKG_DEVS_FLASH_CQ7750 {
+    display       "CqREEK SH7750 board FLASH memory support"
+    description   "FLASH memory device support for CqREEK SH7750  board"
+
+    parent        CYGPKG_IO_FLASH
+    active_if	  CYGPKG_IO_FLASH
+    requires	  CYGPKG_HAL_SH_SH7750_CQ7750
+
+    compile       cq7750_flash.c
+
+    # Arguably this should do in the generic package
+    # but then there is a logic loop so you can never enable it.
+    cdl_interface CYGINT_DEVS_FLASH_AMD_AM29XXXXX_REQUIRED {
+        display   "Generic AMD AM29LV800B driver required"
+    }
+
+    implements    CYGINT_DEVS_FLASH_AMD_AM29XXXXX_REQUIRED
+    requires	  CYGHWR_DEVS_FLASH_AMD_TC58FVB800
+    # requires      CYGHWR_DEVS_FLASH_AMD_AM29LV800
+}
diff -urN --exclude=CVS packages.old/devs/flash/sh/cq7750/current/src/cq7750_flash.c packages/devs/flash/sh/cq7750/current/src/cq7750_flash.c
--- packages.old/devs/flash/sh/cq7750/current/src/cq7750_flash.c	Thu Jan  1 09:00:00 1970
+++ packages/devs/flash/sh/cq7750/current/src/cq7750_flash.c	Fri Dec 21 00:52:12 2001
@@ -0,0 +1,57 @@
+//==========================================================================
+//
+//      cq7750_flash.c
+//
+//      Flash programming for Atmel device on Hitachi EDK7708 board
+//
+//==========================================================================
+//####COPYRIGHTBEGIN####
+//                                                                          
+// -------------------------------------------                              
+// The contents of this file are subject to the Red Hat eCos Public License 
+// Version 1.1 (the "License"); you may not use this file except in         
+// compliance with the License.  You may obtain a copy of the License at    
+// http://www.redhat.com/                                                   
+//                                                                          
+// Software distributed under the License is distributed on an "AS IS"      
+// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the 
+// License for the specific language governing rights and limitations under 
+// the License.                                                             
+//                                                                          
+// The Original Code is eCos - Embedded Configurable Operating System,      
+// released September 30, 1998.                                             
+//                                                                          
+// The Initial Developer of the Original Code is Red Hat.                   
+// Portions created by Red Hat are                                          
+// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc.
+// All Rights Reserved.                                                     
+// -------------------------------------------                              
+//                                                                          
+//####COPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):    jskov
+// Contributors: jskov
+// Date:         2001-09-13
+// Purpose:      
+// Description:  
+//              
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+// A Toshiba TC58FVB800FT-85 is equipped with the CQ7750 platform.
+
+#define CYGNUM_FLASH_INTERLEAVE	(1)
+#define CYGNUM_FLASH_SERIES	(1)
+#define CYGNUM_FLASH_WIDTH	(16)
+#define CYGNUM_FLASH_BASE 	(0x80000000u)
+// #define CYGHWR_FLASH_AM29XXXXX_NO_WRITE_PROTECT
+
+#include "cyg/io/flash_am29xxxxx.inl"
+
+
+// ------------------------------------------------------------------------
+// EOF cq7750_flash.c
diff -urN --exclude=CVS packages.old/ecos.db packages/ecos.db
--- packages.old/ecos.db	Sat Nov 24 02:12:53 2001
+++ packages/ecos.db	Fri Dec 21 00:51:02 2001
@@ -173,6 +173,16 @@
 	   on the Hitachi EDK7708 platform."
 }
 
+package CYGPKG_DEVS_FLASH_CQ7750 {
+	alias 		{ "Support for flash memory on qREEK SH7750 board" flash_cq7750 }
+	directory	devs/flash/sh/cq7750
+	script		flash_cq7750.cdl
+	hardware
+        description "
+           This package contains hardware support for flash memory
+	   on the CqREEK SH7750 platform."
+}
+
 package CYGPKG_DEVS_FLASH_MIPS_OCELOT {
 	alias 		{ "Support for flash memory on PMC-Sierra/Ocelot board" flash_qed_ocelot }
 	directory	devs/flash/mips/ocelot
@@ -2209,6 +2219,8 @@
         packages { CYGPKG_HAL_SH
                    CYGPKG_HAL_SH_SH4
                    CYGPKG_HAL_SH_SH7750_CQ7750
+		   CYGPKG_DEVS_FLASH_CQ7750
+		   CYGPKG_DEVS_FLASH_AMD_AM29XXXXX
                    CYGPKG_IO_SERIAL_SH_SCIF }
         description "
            The sh7750 target provides the packages needed to run
diff -urN --exclude=CVS packages.old/hal/sh/cq7750/current/cdl/hal_sh_sh7750_cq7750.cdl packages/hal/sh/cq7750/current/cdl/hal_sh_sh7750_cq7750.cdl
--- packages.old/hal/sh/cq7750/current/cdl/hal_sh_sh7750_cq7750.cdl	Sat Nov 24 02:13:00 2001
+++ packages/hal/sh/cq7750/current/cdl/hal_sh_sh7750_cq7750.cdl	Fri Dec 21 00:57:28 2001
@@ -55,6 +55,7 @@
     implements    CYGINT_HAL_DEBUG_GDB_STUBS
     implements    CYGINT_HAL_DEBUG_GDB_STUBS_BREAK
     implements    CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT
+#    implements    CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT_NOT_GUARANTEED 
     implements    CYGINT_HAL_SH_PLF_BIGENDIAN_DEFAULT
 
     define_proc {


More information about the Ecos-discuss mailing list