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]

Viper - Use AMD FLASH driver


... plus some other cleanups to get it working.

Index: ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/ChangeLog,v
retrieving revision 1.68
diff -u -5 -p -r1.68 ChangeLog
--- ChangeLog	23 May 2002 22:59:53 -0000	1.68
+++ ChangeLog	20 Jun 2002 21:53:57 -0000
@@ -1,5 +1,9 @@
+2002-06-20  Gary Thomas  <gary@chez-thomas.org>
+
+	* ecos.db: A&M Viper now uses generic AMD FLASH drivers.
+
 2002-05-08  Jesper Skov  <jskov@redhat.com>
 
 	* ecos.db: Removed special SH2 SCIF driver. The changes have been
 	merged into the SH3 (now generic SH) driver.
 2002-04-24  Yoshinori Sato  <qzb04471@nifty.ne.jp>
Index: ecos.db
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/ecos.db,v
retrieving revision 1.62
diff -u -5 -p -r1.62 ecos.db
--- ecos.db	29 May 2002 18:28:04 -0000	1.62
+++ ecos.db	20 Jun 2002 13:16:08 -0000
@@ -3561,10 +3561,11 @@ target viper {
                           CYGPKG_HAL_POWERPC_VIPER
                           CYGPKG_HAL_QUICC 
                           CYGPKG_IO_SERIAL_POWERPC_QUICC_SMC
                           CYGPKG_DEVS_ETH_POWERPC_FEC
                           CYGPKG_DEVS_FLASH_VIPER
+                          CYGPKG_DEVS_FLASH_AMD_AM29XXXXX
         }
         description "
             The viper target provides the packages needed to run
             eCos on a A&M Viper PPC860 board."
 }
Index: devs/flash/amd/am29xxxxx/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/devs/flash/amd/am29xxxxx/current/ChangeLog,v
retrieving revision 1.12
diff -u -5 -p -r1.12 ChangeLog
--- devs/flash/amd/am29xxxxx/current/ChangeLog	23 May 2002 23:00:49 -0000	1.12
+++ devs/flash/amd/am29xxxxx/current/ChangeLog	20 Jun 2002 21:55:21 -0000
@@ -1,5 +1,13 @@
+2002-06-20  Gary Thomas  <gary@chez-thomas.org>
+
+	* include/flash_am29xxxxx.inl: Add cache disable/enable code
+	since this is required on most platforms.
+
+	* include/flash_am29xxxxx_parts.inl: 
+	* cdl/flash_amd_am29xxxxx.cdl: Add support for AM29LV320D{T|B}
+
 2002-04-24  Bob Koninckx <bob.koninckx@mech.kuleuven.ac.be>
 
 	* cdl/flash_amd_am29xxxxx.cdl: Support AM29LV200 and ST M29W200B.
 	* include/flash_am29xxxxx_parts.inl: Likewise.
 
Index: devs/flash/amd/am29xxxxx/current/cdl/flash_amd_am29xxxxx.cdl
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/devs/flash/amd/am29xxxxx/current/cdl/flash_amd_am29xxxxx.cdl,v
retrieving revision 1.7
diff -u -5 -p -r1.7 flash_amd_am29xxxxx.cdl
--- devs/flash/amd/am29xxxxx/current/cdl/flash_amd_am29xxxxx.cdl	23 May 2002 23:00:49 -0000	1.7
+++ devs/flash/amd/am29xxxxx/current/cdl/flash_amd_am29xxxxx.cdl	20 Jun 2002 13:28:25 -0000
@@ -84,10 +84,20 @@ cdl_package CYGPKG_DEVS_FLASH_AMD_AM29XX
             When this option is enabled, the AMD flash driver will be
             able to recognize and handle the AMD29LV160
             part in the family."
     }
 
+    cdl_option CYGHWR_DEVS_FLASH_AMD_AM29LV320D {
+        display       "AMD AM29LV320 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 AMD29LV320
+            part in the family."
+    }
+
     cdl_option CYGHWR_DEVS_FLASH_AMD_AM29LV200 {
         display       "AMD AM29LV200 flash memory support"
         default_value 0
         implements    CYGINT_DEVS_FLASH_AMD_VARIANTS
         description   "
Index: devs/flash/amd/am29xxxxx/current/include/flash_am29xxxxx.inl
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/devs/flash/amd/am29xxxxx/current/include/flash_am29xxxxx.inl,v
retrieving revision 1.11
diff -u -5 -p -r1.11 flash_am29xxxxx.inl
--- devs/flash/amd/am29xxxxx/current/include/flash_am29xxxxx.inl	23 May 2002 23:00:49 -0000	1.11
+++ devs/flash/amd/am29xxxxx/current/include/flash_am29xxxxx.inl	20 Jun 2002 15:43:07 -0000
@@ -160,17 +160,18 @@ int  flash_program_buf(void* addr, void*
 //
 // Only reads the manufacturer and part number codes for the first
 // device(s) in series. It is assumed that any devices in series
 // will be of the same type.
 
-void
-flash_query(void* data)
+static void
+_flash_query(void* data)
 {
     volatile flash_data_t *ROM;
     volatile flash_data_t *f_s1, *f_s2;
     flash_data_t* id = (flash_data_t*) data;
     flash_data_t w;
+    long timeout = 500000;
 
     ROM = (flash_data_t*) CYGNUM_FLASH_BASE;
     f_s1 = FLASH_P2V(ROM+FLASH_Setup_Addr1);
     f_s2 = FLASH_P2V(ROM+FLASH_Setup_Addr2);
 
@@ -190,11 +191,27 @@ flash_query(void* data)
     id[1] = *(FLASH_P2V(ROM+FLASH_DeviceID_Addr));
 
     *(FLASH_P2V(ROM)) = FLASH_Reset;
 
     // Stall, waiting for flash to return to read mode.
-    while (w != *(FLASH_P2V(ROM)));
+    while ((--timeout != 0) && (w != *(FLASH_P2V(ROM)))) ;
+}
+
+void
+flash_query(void* data)
+{
+    int cache_on;
+
+    HAL_DCACHE_IS_ENABLED(cache_on);
+    if (cache_on) {
+        HAL_DCACHE_SYNC();
+        HAL_DCACHE_DISABLE();
+    }
+    _flash_query(data);
+    if (cache_on) {
+        HAL_DCACHE_ENABLE();
+    }
 }
 
 //----------------------------------------------------------------------------
 // Initialize driver details
 int
@@ -250,12 +267,12 @@ flash_code_overlaps(void *start, void *e
 }
 
 //----------------------------------------------------------------------------
 // Erase Block
 
-int
-flash_erase_block(void* block, unsigned int size)
+static int
+_flash_erase_block(void* block, unsigned int size)
 {
     volatile flash_data_t* ROM, *BANK;
     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;
@@ -370,14 +387,30 @@ flash_erase_block(void* block, unsigned 
             len = flash_dev_info->bootblocks[len_ix++];
     }
     return res;
 }
 
+int
+flash_erase_block(void* block, unsigned int size)
+{
+    int ret, cache_on;
+    HAL_DCACHE_IS_ENABLED(cache_on);
+    if (cache_on) {
+        HAL_DCACHE_SYNC();
+        HAL_DCACHE_DISABLE();
+    }
+    ret = _flash_erase_block(block, size);
+    if (cache_on) {
+        HAL_DCACHE_ENABLE();
+    }
+    return ret;
+}
+
 //----------------------------------------------------------------------------
 // Program Buffer
-int
-flash_program_buf(void* addr, void* data, int len)
+static int
+_flash_program_buf(void* addr, void* data, int len)
 {
     volatile flash_data_t* ROM;
     volatile flash_data_t* BANK;
     volatile flash_data_t* data_ptr = (volatile flash_data_t*) data;
     volatile flash_data_t* addr_v;
@@ -451,7 +484,23 @@ flash_program_buf(void* addr, void* data
     }
 
     // Ideally, we'd want to return not only the failure code, but also
     // the address/device that reported the error.
     return res;
+}
+
+int
+flash_program_buf(void* addr, void* data, int len)
+{
+    int ret, cache_on;
+    HAL_DCACHE_IS_ENABLED(cache_on);
+    if (cache_on) {
+        HAL_DCACHE_SYNC();
+        HAL_DCACHE_DISABLE();
+    }
+    ret = _flash_program_buf(addr, data, len);
+    if (cache_on) {
+        HAL_DCACHE_ENABLE();
+    }
+    return ret;
 }
 #endif // CYGONCE_DEVS_FLASH_AMD_AM29XXXXX_INL
Index: devs/flash/amd/am29xxxxx/current/include/flash_am29xxxxx_parts.inl
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/devs/flash/amd/am29xxxxx/current/include/flash_am29xxxxx_parts.inl,v
retrieving revision 1.6
diff -u -5 -p -r1.6 flash_am29xxxxx_parts.inl
--- devs/flash/amd/am29xxxxx/current/include/flash_am29xxxxx_parts.inl	23 May 2002 23:00:49 -0000	1.6
+++ devs/flash/amd/am29xxxxx/current/include/flash_am29xxxxx_parts.inl	20 Jun 2002 21:46:01 -0000
@@ -133,10 +133,52 @@
                        0
                      },
         banked     : false
     },
 #endif
+#ifdef CYGHWR_DEVS_FLASH_AMD_AM29LV320D
+    {   // AM29LV320DT
+        device_id  : FLASHWORD(0xF6),
+        block_size : 0x10000 * CYGNUM_FLASH_INTERLEAVE,
+        block_count: 64,
+        device_size: 0x400000 * CYGNUM_FLASH_INTERLEAVE,
+        base_mask  : ~(0x400000 * CYGNUM_FLASH_INTERLEAVE - 1),
+        bootblock  : true,
+        bootblocks : { 0x3f0000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0
+                     },
+        banked     : false
+    },
+    {   // AM29LV320D
+        device_id  : FLASHWORD(0xF9),
+        block_size : 0x10000 * CYGNUM_FLASH_INTERLEAVE,
+        block_count: 64,
+        device_size: 0x400000 * CYGNUM_FLASH_INTERLEAVE,
+        base_mask  : ~(0x400000 * CYGNUM_FLASH_INTERLEAVE - 1),
+        bootblock  : true,
+        bootblocks : { 0x000000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0
+                     },
+        banked     : false
+    },
+#endif
 #ifdef CYGHWR_DEVS_FLASH_AMD_AM29DL324D
     {   // AM29DL324D-T
         device_id  : FLASHWORD(0x5c),
         block_size : 0x10000 * CYGNUM_FLASH_INTERLEAVE,
         block_count: 64,
@@ -367,10 +409,53 @@
         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
+#ifdef CYGHWR_DEVS_FLASH_AMD_AM29LV320D
+#warning *** Untested ***
+    {   // AM29LV320DT
+        device_id  : FLASHWORD(0x01F6),
+        block_size : 0x10000 * CYGNUM_FLASH_INTERLEAVE,
+        block_count: 64,
+        device_size: 0x400000 * CYGNUM_FLASH_INTERLEAVE,
+        base_mask  : ~(0x400000 * CYGNUM_FLASH_INTERLEAVE - 1),
+        bootblock  : true,
+        bootblocks : { 0x3f0000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0
+                     },
+        banked     : false
+    },
+    {   // AM29LV320D
+        device_id  : FLASHWORD(0x01F9),
+        block_size : 0x10000 * CYGNUM_FLASH_INTERLEAVE,
+        block_count: 64,
+        device_size: 0x400000 * CYGNUM_FLASH_INTERLEAVE,
+        base_mask  : ~(0x400000 * CYGNUM_FLASH_INTERLEAVE - 1),
+        bootblock  : true,
+        bootblocks : { 0x000000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
                        0
                      },
         banked     : false
     },
 #endif
Index: devs/flash/powerpc/viper/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/devs/flash/powerpc/viper/current/ChangeLog,v
retrieving revision 1.5
diff -u -5 -p -r1.5 ChangeLog
--- devs/flash/powerpc/viper/current/ChangeLog	23 May 2002 23:01:04 -0000	1.5
+++ devs/flash/powerpc/viper/current/ChangeLog	20 Jun 2002 21:56:29 -0000
@@ -1,5 +1,15 @@
+2002-06-20  Gary Thomas  <gary@chez-thomas.org>
+
+	* src/flash_query.c: 
+	* src/flash_program_buf.c: 
+	* src/flash_erase_block.c: 
+	* src/flash.h: Removed file(s).
+
+	* src/viper_flash.c: 
+	* cdl/flash_viper.cdl: Update to use generic AMD FLASH drivers.
+
 2001-06-11  Gary Thomas  <gthomas@redhat.com>
 
 	* src/viper_flash.c: Remove dependency on printf() via user functions.
 
 2001-05-23  Jesper Skov  <jskov@redhat.com>
Index: devs/flash/powerpc/viper/current/cdl/flash_viper.cdl
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/devs/flash/powerpc/viper/current/cdl/flash_viper.cdl,v
retrieving revision 1.4
diff -u -5 -p -r1.4 flash_viper.cdl
--- devs/flash/powerpc/viper/current/cdl/flash_viper.cdl	23 May 2002 23:01:04 -0000	1.4
+++ devs/flash/powerpc/viper/current/cdl/flash_viper.cdl	20 Jun 2002 21:55:48 -0000
@@ -1,8 +1,8 @@
 # ====================================================================
 #
-#      flash_mbx.cdl
+#      flash_viper.cdl
 #
 #      FLASH memory - Hardware support on A&M PowerPC/8xx Viper
 #
 # ====================================================================
 #####ECOSGPLCOPYRIGHTBEGIN####
@@ -48,47 +48,27 @@
 #####DESCRIPTIONEND####
 #
 # ====================================================================
 
 cdl_package CYGPKG_DEVS_FLASH_VIPER {
-    display       "Motorola PowerPC/860 FLASH memory support"
+    display       "A&M Viper (PowerPC/860) FLASH memory support"
 
     parent        CYGPKG_IO_FLASH
     active_if	  CYGPKG_IO_FLASH
     requires	  CYGPKG_HAL_POWERPC_VIPER
 
     implements    CYGHWR_IO_FLASH_DEVICE
-    implements    CYGHWR_IO_FLASH_DEVICE_NOT_IN_RAM
 
-    include_dir   .
-    include_files ; # none _exported_ whatsoever
-    description   "FLASH memory device support for A&M PowerPC/8xx VIPER boards"
     compile       viper_flash.c
 
-    make -priority 1 {
-        flash_query.o: $(REPOSITORY)/$(PACKAGE)/src/flash_query.c
-        $(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0  -msoft-float -mcpu=860 -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_query.c
-        echo " .globl flash_query_end" >>flash_query.s
-        echo "flash_query_end:" >>flash_query.s
-        $(CC) -c -o flash_query.o flash_query.s
-        $(AR) rcs $(PREFIX)/lib/libtarget.a flash_query.o
+    # 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 flash driver required"
     }
 
-    make -priority 1 {
-        flash_erase_block.o: $(REPOSITORY)/$(PACKAGE)/src/flash_erase_block.c
-        $(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0  -msoft-float -mcpu=860 -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_erase_block.c
-        echo " .globl flash_erase_block_end" >>flash_erase_block.s
-        echo "flash_erase_block_end:" >>flash_erase_block.s
-        $(CC) -c -o flash_erase_block.o flash_erase_block.s
-        $(AR) rcs $(PREFIX)/lib/libtarget.a flash_erase_block.o
-    }
+    implements    CYGINT_DEVS_FLASH_AMD_AM29XXXXX_REQUIRED
+    requires      CYGHWR_DEVS_FLASH_AMD_AM29LV320D
+    requires      CYGHWR_DEVS_FLASH_AMD_AM29F800
 
-    make -priority 1 {
-        flash_program_buf.o: $(REPOSITORY)/$(PACKAGE)/src/flash_program_buf.c
-        $(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0  -msoft-float -mcpu=860 -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_program_buf.c
-        echo " .globl flash_program_buf_end" >>flash_program_buf.s
-        echo "flash_program_buf_end:" >>flash_program_buf.s
-        $(CC) -c -o flash_program_buf.o flash_program_buf.s
-        $(AR) rcs $(PREFIX)/lib/libtarget.a flash_program_buf.o
-    }
 }
 
Index: devs/flash/powerpc/viper/current/src/flash.h
===================================================================
RCS file: devs/flash/powerpc/viper/current/src/flash.h
diff -N devs/flash/powerpc/viper/current/src/flash.h
--- devs/flash/powerpc/viper/current/src/flash.h	23 May 2002 23:01:04 -0000	1.3
+++ devs/flash/powerpc/viper/current/src/flash.h	1 Jan 1970 00:00:00 -0000
@@ -1,72 +0,0 @@
-//==========================================================================
-//
-//      flash.h
-//
-//      Flash programming - device constants, etc.
-//
-//==========================================================================
-//####ECOSGPLCOPYRIGHTBEGIN####
-// -------------------------------------------
-// This file is part of eCos, the Embedded Configurable Operating System.
-// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
-//
-// eCos is free software; you can redistribute it and/or modify it under
-// the terms of the GNU General Public License as published by the Free
-// Software Foundation; either version 2 or (at your option) any later version.
-//
-// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or
-// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with eCos; if not, write to the Free Software Foundation, Inc.,
-// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-//
-// As a special exception, if other files instantiate templates or use macros
-// or inline functions from this file, or you compile this file and link it
-// with other works to produce a work based on this file, this file does not
-// by itself cause the resulting work to be covered by the GNU General Public
-// License. However the source code for this file must still be made available
-// in accordance with section (3) of the GNU General Public License.
-//
-// This exception does not invalidate any other reasons why a work based on
-// this file might be covered by the GNU General Public License.
-//
-// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
-// at http://sources.redhat.com/ecos/ecos-license/
-// -------------------------------------------
-//####ECOSGPLCOPYRIGHTEND####
-//==========================================================================
-//#####DESCRIPTIONBEGIN####
-//
-// Author(s):    gthomas
-// Contributors: gthomas
-// Date:         2000-10-20
-// Purpose:      
-// Description:  
-//              
-//####DESCRIPTIONEND####
-//
-//==========================================================================
-
-#ifndef _FLASH_HWR_H_
-#define _FLASH_HWR_H_
-
-#define FLASH_Read_ID      0x90
-#define FLASH_Reset        0xFF
-#define FLASH_Program      0xA0
-#define FLASH_Block_Erase  0x30
-
-#define FLASH_Busy         0x40 // "Toggle" bit
-#define FLASH_Err          0x20
-
-#define FLASH_Setup_Addr1  0xAAA
-#define FLASH_Setup_Addr2  0x555
-#define FLASH_Setup_Code1  0xAA
-#define FLASH_Setup_Code2  0x55
-#define FLASH_Setup_Erase  0x80
-
-#define FLASH_BLOCK_SIZE   0x10000
-
-#endif  // _FLASH_HWR_H_
Index: devs/flash/powerpc/viper/current/src/flash_erase_block.c
===================================================================
RCS file: devs/flash/powerpc/viper/current/src/flash_erase_block.c
diff -N devs/flash/powerpc/viper/current/src/flash_erase_block.c
--- devs/flash/powerpc/viper/current/src/flash_erase_block.c	23 May 2002 23:01:04 -0000	1.3
+++ devs/flash/powerpc/viper/current/src/flash_erase_block.c	1 Jan 1970 00:00:00 -0000
@@ -1,135 +0,0 @@
-//==========================================================================
-//
-//      flash_erase_block.c
-//
-//      Flash programming
-//
-//==========================================================================
-//####ECOSGPLCOPYRIGHTBEGIN####
-// -------------------------------------------
-// This file is part of eCos, the Embedded Configurable Operating System.
-// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
-//
-// eCos is free software; you can redistribute it and/or modify it under
-// the terms of the GNU General Public License as published by the Free
-// Software Foundation; either version 2 or (at your option) any later version.
-//
-// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or
-// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with eCos; if not, write to the Free Software Foundation, Inc.,
-// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-//
-// As a special exception, if other files instantiate templates or use macros
-// or inline functions from this file, or you compile this file and link it
-// with other works to produce a work based on this file, this file does not
-// by itself cause the resulting work to be covered by the GNU General Public
-// License. However the source code for this file must still be made available
-// in accordance with section (3) of the GNU General Public License.
-//
-// This exception does not invalidate any other reasons why a work based on
-// this file might be covered by the GNU General Public License.
-//
-// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
-// at http://sources.redhat.com/ecos/ecos-license/
-// -------------------------------------------
-//####ECOSGPLCOPYRIGHTEND####
-//==========================================================================
-//#####DESCRIPTIONBEGIN####
-//
-// Author(s):    gthomas
-// Contributors: gthomas
-// Date:         2000-07-14
-// Purpose:      
-// Description:  
-//              
-//####DESCRIPTIONEND####
-//
-//==========================================================================
-
-#include "flash.h"
-
-#include <pkgconf/hal.h>
-#include <cyg/hal/hal_arch.h>
-#include <cyg/hal/hal_cache.h>
-
-//
-// CAUTION!  This code must be copied to RAM before execution.  Therefore,
-// it must not contain any code which might be position dependent!
-//
-
-int flash_erase_block(volatile unsigned char *block)
-{
-    volatile unsigned char *ROM;
-    volatile unsigned char *sector = block;
-    int timeout = 50000;
-    int cache_on;
-    int len, sector_size;
-    int erase_state, new_state;
-    long offset;
-
-    HAL_DCACHE_IS_ENABLED(cache_on);
-    if (cache_on) {
-        HAL_DCACHE_SYNC();
-        HAL_DCACHE_DISABLE();
-    }
-
-    ROM = (volatile unsigned char *)((unsigned long)block & 0xFF800000);
-
-    // We treat the low 4 sectors like a single block
-    // These sectors are 0x4000, 0x2000, 0x2000, 0x8000 long
-    offset = ((unsigned long)block - (unsigned long)ROM);
-    if (offset < FLASH_BLOCK_SIZE) {
-        sector_size = 0x4000;
-    } else {
-        sector_size = FLASH_BLOCK_SIZE;
-    }
-
-    len = 0;
-    while (len < FLASH_BLOCK_SIZE) {
-        // Erase block - six step sequence
-        ROM[FLASH_Setup_Addr1] = FLASH_Setup_Code1;
-        ROM[FLASH_Setup_Addr2] = FLASH_Setup_Code2;
-        ROM[FLASH_Setup_Addr1] = FLASH_Setup_Erase;
-        ROM[FLASH_Setup_Addr1] = FLASH_Setup_Code1;
-        ROM[FLASH_Setup_Addr2] = FLASH_Setup_Code2;
-        *sector = FLASH_Block_Erase;
-        for (timeout = 50;  timeout--;  timeout > 0) ;
-        erase_state = *sector & FLASH_Busy;
-        timeout = 5000000;
-        while (true) {
-            new_state = *sector;
-            if ((new_state & FLASH_Busy) == erase_state) break;  // "toggle" stopped
-            erase_state = new_state & FLASH_Busy;
-            if (new_state & FLASH_Err) break;
-            if (--timeout == 0) break;
-        }
-        sector += sector_size;
-        len += sector_size;
-        offset += sector_size;
-        if (offset == 0x4000) {
-            sector_size = 0x2000;
-        } else if (offset == 0x8000) {
-            sector_size = 0x8000;
-        }
-    }
-
-    // Restore ROM to "normal" mode
-    ROM[0] = FLASH_Reset;
-
-    len = FLASH_BLOCK_SIZE;
-    while (len > 0) {
-        if (*block++ != 0xFF) break;
-        len -= sizeof(*block);
-    }
-    if (len == 0) new_state = 0;
-
-    if (cache_on) {
-        HAL_DCACHE_ENABLE();
-    }
-
-    return new_state;
-}
Index: devs/flash/powerpc/viper/current/src/flash_program_buf.c
===================================================================
RCS file: devs/flash/powerpc/viper/current/src/flash_program_buf.c
diff -N devs/flash/powerpc/viper/current/src/flash_program_buf.c
--- devs/flash/powerpc/viper/current/src/flash_program_buf.c	23 May 2002 23:01:04 -0000	1.3
+++ devs/flash/powerpc/viper/current/src/flash_program_buf.c	1 Jan 1970 00:00:00 -0000
@@ -1,112 +0,0 @@
-//==========================================================================
-//
-//      flash_program_buf.c
-//
-//      Flash programming
-//
-//==========================================================================
-//####ECOSGPLCOPYRIGHTBEGIN####
-// -------------------------------------------
-// This file is part of eCos, the Embedded Configurable Operating System.
-// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
-//
-// eCos is free software; you can redistribute it and/or modify it under
-// the terms of the GNU General Public License as published by the Free
-// Software Foundation; either version 2 or (at your option) any later version.
-//
-// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or
-// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with eCos; if not, write to the Free Software Foundation, Inc.,
-// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-//
-// As a special exception, if other files instantiate templates or use macros
-// or inline functions from this file, or you compile this file and link it
-// with other works to produce a work based on this file, this file does not
-// by itself cause the resulting work to be covered by the GNU General Public
-// License. However the source code for this file must still be made available
-// in accordance with section (3) of the GNU General Public License.
-//
-// This exception does not invalidate any other reasons why a work based on
-// this file might be covered by the GNU General Public License.
-//
-// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
-// at http://sources.redhat.com/ecos/ecos-license/
-// -------------------------------------------
-//####ECOSGPLCOPYRIGHTEND####
-//==========================================================================
-//#####DESCRIPTIONBEGIN####
-//
-// Author(s):    gthomas
-// Contributors: gthomas
-// Date:         2000-07-14
-// Purpose:      
-// Description:  
-//              
-//####DESCRIPTIONEND####
-//
-//==========================================================================
-
-#include "flash.h"
-
-#include <pkgconf/hal.h>
-#include <cyg/hal/hal_arch.h>
-#include <cyg/hal/hal_cache.h>
-
-//
-// CAUTION!  This code must be copied to RAM before execution.  Therefore,
-// it must not contain any code which might be position dependent!
-//
-
-int
-flash_program_buf(volatile unsigned char *addr, unsigned char *data, int len)
-{
-    volatile unsigned char *ROM;
-    int timeout = 50000;
-    int cache_on;
-    int erase_state, new_state;
-
-    HAL_DCACHE_IS_ENABLED(cache_on);
-    if (cache_on) {
-        HAL_DCACHE_SYNC();
-        HAL_DCACHE_DISABLE();
-    }
-
-    ROM = (volatile unsigned long *)((unsigned long)addr & 0xFF800000);
-
-    while (len > 0) {
-        // Program data [byte] - 4 step sequence
-        ROM[FLASH_Setup_Addr1] = FLASH_Setup_Code1;
-        ROM[FLASH_Setup_Addr2] = FLASH_Setup_Code2;
-        ROM[FLASH_Setup_Addr1] = FLASH_Program;
-        *addr = *data;
-        for (timeout = 50;  timeout--;  timeout > 0) ;
-        erase_state = *addr & FLASH_Busy;
-        while (true) {
-            new_state = *addr;
-            if ((new_state & FLASH_Busy) == erase_state) break;  // "toggle" stopped
-            erase_state = new_state & FLASH_Busy;
-            if (new_state & FLASH_Err) break;
-            if (--timeout == 0) break;
-        }
-        ROM[0] = FLASH_Reset;            
-        if (*addr++ != *data++) {
-            new_state = 0xFF;
-            break;
-        }
-        len -= sizeof(*data);
-    }
-    if (len == 0) new_state = 0;  // Success
-
-    // Restore ROM to "normal" mode
- bad:
-    ROM[0] = FLASH_Reset;            
-
-    if (cache_on) {
-        HAL_DCACHE_ENABLE();
-    }
-    return new_state;
-}
Index: devs/flash/powerpc/viper/current/src/flash_query.c
===================================================================
RCS file: devs/flash/powerpc/viper/current/src/flash_query.c
diff -N devs/flash/powerpc/viper/current/src/flash_query.c
--- devs/flash/powerpc/viper/current/src/flash_query.c	23 May 2002 23:01:04 -0000	1.3
+++ devs/flash/powerpc/viper/current/src/flash_query.c	1 Jan 1970 00:00:00 -0000
@@ -1,96 +0,0 @@
-//==========================================================================
-//
-//      flash_query.c
-//
-//      Flash programming - query device
-//
-//==========================================================================
-//####ECOSGPLCOPYRIGHTBEGIN####
-// -------------------------------------------
-// This file is part of eCos, the Embedded Configurable Operating System.
-// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
-//
-// eCos is free software; you can redistribute it and/or modify it under
-// the terms of the GNU General Public License as published by the Free
-// Software Foundation; either version 2 or (at your option) any later version.
-//
-// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or
-// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with eCos; if not, write to the Free Software Foundation, Inc.,
-// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-//
-// As a special exception, if other files instantiate templates or use macros
-// or inline functions from this file, or you compile this file and link it
-// with other works to produce a work based on this file, this file does not
-// by itself cause the resulting work to be covered by the GNU General Public
-// License. However the source code for this file must still be made available
-// in accordance with section (3) of the GNU General Public License.
-//
-// This exception does not invalidate any other reasons why a work based on
-// this file might be covered by the GNU General Public License.
-//
-// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
-// at http://sources.redhat.com/ecos/ecos-license/
-// -------------------------------------------
-//####ECOSGPLCOPYRIGHTEND####
-//==========================================================================
-//#####DESCRIPTIONBEGIN####
-//
-// Author(s):    gthomas
-// Contributors: gthomas
-// Date:         2000-10-20
-// Purpose:      
-// Description:  
-//              
-//####DESCRIPTIONEND####
-//
-//==========================================================================
-
-#include "flash.h"
-
-#include <pkgconf/hal.h>
-#include <cyg/hal/hal_arch.h>
-#include <cyg/hal/hal_cache.h>
-#include CYGHWR_MEMORY_LAYOUT_H
-
-//
-// CAUTION!  This code must be copied to RAM before execution.  Therefore,
-// it must not contain any code which might be position dependent!
-//
-
-int
-flash_query(unsigned char *data)
-{
-    volatile unsigned char *ROM;
-    int cnt;
-    int cache_on;
-
-    HAL_DCACHE_IS_ENABLED(cache_on);
-    if (cache_on) {
-        HAL_DCACHE_SYNC();
-        HAL_DCACHE_DISABLE();
-    }
-
-    ROM = (volatile unsigned char *)0xFE000000;
-
-    ROM[FLASH_Setup_Addr1] = FLASH_Setup_Code1;
-    ROM[FLASH_Setup_Addr2] = FLASH_Setup_Code2;
-    ROM[FLASH_Setup_Addr1] = FLASH_Read_ID;
-
-    // Manufacturers' code
-    *data++ = ROM[0x00];
-    // Part number
-    *data++ = ROM[0x02];
-
-    ROM[0] = FLASH_Reset;
-
-    if (cache_on) {
-        HAL_DCACHE_ENABLE();
-    }
-
-    return 0;
-}
Index: devs/flash/powerpc/viper/current/src/viper_flash.c
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/devs/flash/powerpc/viper/current/src/viper_flash.c,v
retrieving revision 1.4
diff -u -5 -p -r1.4 viper_flash.c
--- devs/flash/powerpc/viper/current/src/viper_flash.c	23 May 2002 23:01:04 -0000	1.4
+++ devs/flash/powerpc/viper/current/src/viper_flash.c	20 Jun 2002 21:43:14 -0000
@@ -1,10 +1,10 @@
 //==========================================================================
 //
-//      mbx_flash.c
+//      viper_flash.c
 //
-//      Flash programming
+//      Flash programming support
 //
 //==========================================================================
 //####ECOSGPLCOPYRIGHTBEGIN####
 // -------------------------------------------
 // This file is part of eCos, the Embedded Configurable Operating System.
@@ -48,74 +48,28 @@
 //              
 //####DESCRIPTIONEND####
 //
 //==========================================================================
 
-#include <pkgconf/hal.h>
-#include <cyg/hal/hal_arch.h>
-#include <cyg/hal/hal_cache.h>
-
-#define  _FLASH_PRIVATE_
-#include <cyg/io/flash.h>
-
-#include "flash.h"
-
-int
-flash_hwr_init(void)
-{
-    int region_size = 0x10000;
-    int num_regions = 16;
-    extern char flash_query, flash_query_end;
-    typedef int code_fun(unsigned char *);
-    code_fun *_flash_query;
-    int code_len, stat;
-    unsigned char info[4];
-
-    // Copy 'program' code to RAM for execution
-    code_len = (unsigned long)&flash_query_end - (unsigned long)&flash_query;
-    _flash_query = (code_fun *)flash_info.work_space;
-    memcpy(_flash_query, &flash_query, code_len);
-    HAL_DCACHE_SYNC();  // Should guarantee this code will run
-
-    stat = (*_flash_query)(info);
-#if 0
-    (*flash_info.pf)("stat = %x\n", stat);
-    dump_buf(info, sizeof(info));
-#endif
-
-    // Hard wired for now
-    flash_info.block_size = region_size;
-    flash_info.blocks = num_regions;
-    flash_info.start = (void *)0xFE000000;
-    flash_info.end = (void *)(0xFE000000+(num_regions*region_size));
-    return FLASH_ERR_OK;
-}
-
-// Map a hardware status to a package error
-int
-flash_hwr_map_error(int err)
-{
-    if (err & 0x007E007E) {
-        (*flash_info.pf)("Err = %x\n", err);
-        if (err & 0x00100010) {
-            return FLASH_ERR_PROGRAM;
-        } else 
-        if (err & 0x00200020) {
-            return FLASH_ERR_ERASE;
-        } else 
-        return FLASH_ERR_HWR;  // FIXME
-    } else {
-        return FLASH_ERR_OK;
-    }
-}
-
-// See if a range of FLASH addresses overlaps currently running code
-bool
-flash_code_overlaps(void *start, void *end)
-{
-    extern char _stext[], _etext[];
-
-    return ((((unsigned long)&_stext >= (unsigned long)start) &&
-             ((unsigned long)&_stext < (unsigned long)end)) ||
-            (((unsigned long)&_etext >= (unsigned long)start) &&
-             ((unsigned long)&_etext < (unsigned long)end)));
-}
+#include <cyg/infra/cyg_type.h>
+
+//--------------------------------------------------------------------------
+// Device properties
+
+#define CYGNUM_FLASH_INTERLEAVE	(1)
+#define CYGNUM_FLASH_SERIES	(1)
+#define CYGNUM_FLASH_WIDTH      (8)
+#define CYGNUM_FLASH_BASE 	(0xFE000000)
+#define CYGNUM_FLASH_16AS8      (1)
+
+//static cyg_uint32 plf_flash_base;
+
+//--------------------------------------------------------------------------
+// Platform specific extras
+#define CYGHWR_FLASH_AM29XXXXX_NO_WRITE_PROTECT  // This feature fails :-(
+
+//--------------------------------------------------------------------------
+// Now include the driver code.
+#include "cyg/io/flash_am29xxxxx.inl"
+
+// ------------------------------------------------------------------------
+// EOF viper_flash.c
Index: hal/powerpc/mpc8xx/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/hal/powerpc/mpc8xx/current/ChangeLog,v
retrieving revision 1.14
diff -u -5 -p -r1.14 ChangeLog
--- hal/powerpc/mpc8xx/current/ChangeLog	23 May 2002 23:04:27 -0000	1.14
+++ hal/powerpc/mpc8xx/current/ChangeLog	20 Jun 2002 21:57:00 -0000
@@ -1,5 +1,9 @@
+2002-06-20  Gary Thomas  <gary@chez-thomas.org>
+
+	* include/var_regs.h (MI_RPN_LPS): Fix define.
+
 2002-05-03  Gary Thomas  <gthomas@redhat.com>
 
 	* tests/intr0.c: Fiddle to make this test run on all current MPC8xx
 	boards (the MBX is especially cranky).  The problem lies with the
 	fact that the timers used to run the test are very platform specific.
Index: hal/powerpc/mpc8xx/current/include/var_regs.h
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/hal/powerpc/mpc8xx/current/include/var_regs.h,v
retrieving revision 1.5
diff -u -5 -p -r1.5 var_regs.h
--- hal/powerpc/mpc8xx/current/include/var_regs.h	23 May 2002 23:04:27 -0000	1.5
+++ hal/powerpc/mpc8xx/current/include/var_regs.h	20 Jun 2002 15:50:16 -0000
@@ -153,11 +153,11 @@
 #define MI_EPN_EPNMASK  0xfffff000      // effective page no mask
 #define MI_EPN_EV       0x00000200      // entry valid
 
 #define MI_RPN_RPNMASK  0xfffff000      // real page no mask
 #define MI_RPN_PPRWRW   0x000008f0      // page protection (rw/rw, page valid)
-#define MI_RPN_LPS      0x00000008      // large page size
+#define MI_RPN_LPS      0x0000000C      // large page size
 #define MI_RPN_SH       0x00000004      // shared page (1 = no ASID cmp)
 #define MI_RPN_CI       0x00000002      // cache inhibited
 #define MI_RPN_V        0x00000001      // entry valid
 
 #define MI_TWC_PS8MB    0x0000000c      // page size = 8MB
Index: hal/powerpc/viper/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/hal/powerpc/viper/current/ChangeLog,v
retrieving revision 1.5
diff -u -5 -p -r1.5 ChangeLog
--- hal/powerpc/viper/current/ChangeLog	31 May 2002 01:05:55 -0000	1.5
+++ hal/powerpc/viper/current/ChangeLog	20 Jun 2002 21:57:53 -0000
@@ -1,5 +1,10 @@
+2002-06-20  Gary Thomas  <gary@chez-thomas.org>
+
+	* src/viper.S: 
+	* src/hal_aux.c: Support up to 8M of FLASH space.
+
 2002-05-30  John Dallaway  <jld@redhat.com>
 
 	* include/pkgconf/mlt*: Regenerated memory layout files.
 
 2002-04-30  Nick Garnett  <nickg@redhat.com>
Index: hal/powerpc/viper/current/src/hal_aux.c
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/hal/powerpc/viper/current/src/hal_aux.c,v
retrieving revision 1.3
diff -u -5 -p -r1.3 hal_aux.c
--- hal/powerpc/viper/current/src/hal_aux.c	23 May 2002 23:04:34 -0000	1.3
+++ hal/powerpc/viper/current/src/hal_aux.c	20 Jun 2002 15:10:15 -0000
@@ -61,11 +61,11 @@
 
 // The memory map is weakly defined, allowing the application to redefine
 // it if necessary. The regions defined below are the minimum requirements.
 CYGARC_MEMDESC_TABLE CYGBLD_ATTRIB_WEAK = {
     // Mapping for the Viper 855/860 development boards
-    CYGARC_MEMDESC_CACHE(   0xfe000000, 0x00400000 ), // ROM region
+    CYGARC_MEMDESC_CACHE(   0xfe000000, 0x00800000 ), // ROM region
     CYGARC_MEMDESC_NOCACHE( 0xff000000, 0x00100000 ), // MCP registers
     CYGARC_MEMDESC_NOCACHE( 0xfa000000, 0x00400000 ), // Control/Status+LEDs
     CYGARC_MEMDESC_CACHE(   CYGMEM_REGION_ram, CYGMEM_REGION_ram_SIZE ), // Main memory
 
     CYGARC_MEMDESC_TABLE_END
Index: hal/powerpc/viper/current/src/viper.S
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/hal/powerpc/viper/current/src/viper.S,v
retrieving revision 1.3
diff -u -5 -p -r1.3 viper.S
--- hal/powerpc/viper/current/src/viper.S	23 May 2002 23:04:35 -0000	1.3
+++ hal/powerpc/viper/current/src/viper.S	20 Jun 2002 21:57:53 -0000
@@ -264,11 +264,11 @@ FUNC_START( hal_hardware_init )
 	 * Base Register initialization.
 	 */
 
        	/* BOOT ROM */
         lwi	r3,0xFE000401	# 8-bit, GPCM
-        lwi	r5,0xFFF00774   # 7 wait states
+        lwi	r5,0xFF800774   # 7 wait states, up to 8MB
         stw	r3,BR0(r4)
         stw	r5,OR0(r4)
 
 	/* Misc I/O, 16 bit port */
         lwi	r3,0xFA100801




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