changeset 2554:2c23316741a8

FLASH support on MPL PATI (MPC555) system
author asl
date Mon, 15 Sep 2008 19:34:34 +0000
parents 514095c1a69f
children 62ca80ce06e5
files packages/devs/flash/powerpc/pati/current/ChangeLog packages/devs/flash/powerpc/pati/current/cdl/flash_pati.cdl packages/devs/flash/powerpc/pati/current/src/powerpc_pati_flash.c
diffstat 3 files changed, 197 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
new file mode 100644
--- /dev/null
+++ b/packages/devs/flash/powerpc/pati/current/ChangeLog
@@ -0,0 +1,37 @@
+2008-06-18  Steven Clugston  <steven.clugston@ncl.ac.uk>
+
+	* src/powerpc_pati_flash.c: 
+	* cdl/flash_pati.cdl: New package - FLASH support on MPL PATI
+	  (MPC555) system.
+
+//===========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 2008 Free Software Foundation, 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.
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//===========================================================================
new file mode 100644
--- /dev/null
+++ b/packages/devs/flash/powerpc/pati/current/cdl/flash_pati.cdl
@@ -0,0 +1,68 @@
+# ====================================================================
+#
+#      flash_pati.cdl
+#
+#      FLASH memory - Hardware support on MPC555 MPL PATI Board
+#
+# ====================================================================
+#####ECOSGPLCOPYRIGHTBEGIN####
+## -------------------------------------------
+## This file is part of eCos, the Embedded Configurable Operating System.
+## Copyright (C) 2008 Free Software Foundation, 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.
+## -------------------------------------------
+#####ECOSGPLCOPYRIGHTEND####
+# ====================================================================
+######DESCRIPTIONBEGIN####
+#
+# Author(s):      Steven Clugston
+# Original data:  pfine, gthomas
+# Contributors:
+# Date:           2008-05-08
+#
+#####DESCRIPTIONEND####
+#
+# ====================================================================
+
+cdl_package CYGPKG_DEVS_FLASH_PATI {
+    display       "MPL PATI flash memory support"
+
+    parent        CYGPKG_IO_FLASH
+    active_if	  CYGPKG_IO_FLASH
+    requires	  CYGPKG_HAL_POWERPC_PATI
+
+    implements    CYGHWR_IO_FLASH_DEVICE
+
+    compile       powerpc_pati_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_INTEL_28FXXX_REQUIRED {
+        display   "Generic INTEL 28FXXX driver required"
+    }
+
+    implements    CYGINT_DEVS_FLASH_INTEL_28FXXX_REQUIRED 
+    requires      CYGHWR_DEVS_FLASH_INTEL_28F320C3
+}
new file mode 100644
--- /dev/null
+++ b/packages/devs/flash/powerpc/pati/current/src/powerpc_pati_flash.c
@@ -0,0 +1,92 @@
+//==========================================================================
+//
+//      powerpc_pati_flash.c
+//
+//      Flash programming for INTEL device on PowerPC MPC555 MPL PATI
+//      board
+//
+//==========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 2008 Free Software Foundation, 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.
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):    Steven Clugston
+// Original:     jskov
+// Contributors: 
+// Date:         2008-06-18
+// Purpose:      
+// Description:  
+//              
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+#include <cyg/hal/hal_intr.h>
+#include <cyg/hal/plf_misc.h>
+
+//--------------------------------------------------------------------------
+// Device properties
+
+// One 28F320C3T part used on the board
+/// 32Mbit top boot block
+#define CYGNUM_FLASH_INTERLEAVE	(1)
+#define CYGNUM_FLASH_SERIES	(1)
+#define CYGNUM_FLASH_WIDTH      (16)
+#define CYGNUM_FLASH_BASE 	(CYGMEM_REGION_eflash)
+
+
+//--------------------------------------------------------------------------
+// Platform specific extras
+
+// The programming voltage is switched on/off by setting a register bit in
+// the on board EPLD.
+#define CYGHWR_FLASH_WRITE_ENABLE()                      \
+{cyg_uint32 epld_misc;                                   \
+HAL_READ_UINT32(CYGPLF_REG_PLD_MISC_CONFIG, epld_misc);  \
+epld_misc |= CYGPLF_REG_PLD_MISC_EXT_VPP;                \
+HAL_WRITE_UINT32(CYGPLF_REG_PLD_MISC_CONFIG, epld_misc);}\
+
+#define CYGHWR_FLASH_WRITE_DISABLE()                     \
+{cyg_uint32 epld_misc;                                   \
+HAL_READ_UINT32(CYGPLF_REG_PLD_MISC_CONFIG, epld_misc);  \
+epld_misc &= ~(CYGPLF_REG_PLD_MISC_EXT_VPP);             \
+HAL_WRITE_UINT32(CYGPLF_REG_PLD_MISC_CONFIG, epld_misc);}\
+
+// Force a reset of the flash to keep driver happy
+# define CYGHWR_FLASH_28FXXX_PLF_INIT()                  \
+HAL_WRITE_UINT16(CYGNUM_FLASH_BASE,0xFF);                \
+HAL_DELAY_US(10);                                        \
+
+//--------------------------------------------------------------------------
+// Now include the driver code.
+#include "cyg/io/flash_28fxxx.inl"
+
+// ------------------------------------------------------------------------
+// EOF powerpc_pati_flash.c