changeset 2674:f85e58b7f2ad

* Flash driver v2 for LPC-E2294, LPC-H2294, LPC-L2294-1M boards * cdl/flash_olpcx2294.cdl, src/arm_olpcx2294_flash.c: New files.
author asl
date Tue, 02 Dec 2008 20:08:25 +0000
parents f3e0cac7b6d2
children b0cbed34a04d
files packages/devs/flash/arm/olpcx2294v2/current/ChangeLog packages/devs/flash/arm/olpcx2294v2/current/cdl/flash_olpcx2294.cdl packages/devs/flash/arm/olpcx2294v2/current/src/arm_olpcx2294_flash.c
diffstat 3 files changed, 186 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
new file mode 100644
--- /dev/null
+++ b/packages/devs/flash/arm/olpcx2294v2/current/ChangeLog
@@ -0,0 +1,4 @@
+2008-11-22  Sergei Gavrikov <sergei.gavrikov@gmail.com>
+
+	* Flash driver v2 for LPC-E2294, LPC-H2294, LPC-L2294-1M boards
+	* cdl/flash_olpcx2294.cdl, src/arm_olpcx2294_flash.c: New files.
new file mode 100644
--- /dev/null
+++ b/packages/devs/flash/arm/olpcx2294v2/current/cdl/flash_olpcx2294.cdl
@@ -0,0 +1,70 @@
+# ====================================================================
+#
+#      flash_olpcx2294.cdl
+#
+#      FLASH memory - Hardware support on Olimex LPC-X2294 boards
+#
+# ====================================================================
+#####ECOSGPLCOPYRIGHTBEGIN####
+## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+## Copyright (C) 2008 eCosCentric Limited
+##
+## 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):      Sergei Gavrikov
+# Contributors:   Sergei Gavrikov
+# Date:           2008-11-28
+#
+#####DESCRIPTIONEND####
+#
+# ====================================================================
+
+cdl_package CYGPKG_DEVS_FLASH_ARM_OLPCX2294_V2 {
+    display       "Support for FLASH memory parts on OLPC-X2294 boards."
+
+    compile       -library=libextras.a arm_olpcx2294_flash.c
+
+    parent        CYGPKG_IO_FLASH
+    active_if     CYGPKG_IO_FLASH
+
+    requires      (CYGPKG_HAL_ARM_LPC2XXX_OLPCE2294 || \
+                   CYGPKG_HAL_ARM_LPC2XXX_OLPCH2294 || \
+                   CYGPKG_HAL_ARM_LPC2XXX_OLPCL2294)
+
+    requires      CYGPKG_DEVS_FLASH_STRATA_V2
+
+    implements    CYGHWR_IO_FLASH_BLOCK_LOCKING
+
+    description "
+        Olimex LPC-X2294 boards all have strata family 28FxxxC3 flash
+        memory parts. These parts have boot blocks. There is no buffered
+        write capability. Individual blocks can be locked and unlocked
+        in software"
+
+}
+
new file mode 100644
--- /dev/null
+++ b/packages/devs/flash/arm/olpcx2294v2/current/src/arm_olpcx2294_flash.c
@@ -0,0 +1,112 @@
+//==========================================================================
+//
+//      arm_olpcx2294_flash.c
+//
+//      Flash programming for Intel FlashFile devices on Olimex LPC-X2294
+//
+//==========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+// Copyright (C) 2008 eCosCentric Limited
+//
+// 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):     Sergei Gavrikov
+// Contributors:  Sergei Gavrikov
+// Date:          2008-11-28
+// Purpose:
+// Description:
+//
+//####DESCRIPTIONEND####
+//
+//========================================================================*/
+
+#include <pkgconf/system.h>
+
+#if !defined(CYGPKG_HAL_ARM_LPC2XXX_OLPCE2294) && \
+    !defined(CYGPKG_HAL_ARM_LPC2XXX_OLPCH2294) && \
+    !defined(CYGPKG_HAL_ARM_LPC2XXX_OLPCL2294)
+# error Unsupported target
+#endif
+
+#ifdef CYGPKG_DEVS_FLASH_STRATA_V2
+
+#include <cyg/io/flash.h>
+#include <cyg/io/strata_dev.h>
+
+// Olimex LPC-E2294 development board and Olimex LPC-H2294 header board both
+// have 28F320C3-B flash memory part, Olimex LPC-L2294-1M development board has
+// 28F160C3-B flash memory part. All boards have 16-bit access to it's flash
+// devices.
+static const CYG_FLASH_FUNS(hal_olpcx2294_flash_strata_funs,
+    &cyg_strata_init_check_devid_16,
+    &cyg_flash_devfn_query_nop,
+    &cyg_strata_erase_16,
+    &cyg_strata_program_16,
+    (int (*)(struct cyg_flash_dev*, const cyg_flashaddr_t, void*, size_t))0,
+    &cyg_strata_lock_k3_16,
+    &cyg_strata_unlock_k3_16);
+
+static const cyg_strata_dev hal_olpcx2294_flash_priv = {
+    .manufacturer_code = CYG_FLASH_STRATA_MANUFACTURER_INTEL,
+#ifdef CYGPKG_HAL_ARM_LPC2XXX_OLPCL2294 
+    .device_code = 0x88c3, /* 16-Mbit x 16-B, 28F160C3-B */
+#else
+    .device_code = 0x88c5, /* 32-Mbit x 16-B, 28F320C3-B */
+#endif
+    .bufsize    = 1,
+    .block_info = {
+#ifdef CYGPKG_HAL_ARM_LPC2XXX_OLPCL2294 
+        { 0x00002000,  8 },/* boot bottom 8 x 8K blocks */
+        { 0x00010000, 31 } /* 31 x 64K blocks */
+#else
+        { 0x00002000,  8 },/* boot bottom 8 x 8K blocks */
+        { 0x00010000, 63 } /* 63 x 64K blocks */
+#endif
+    }
+};
+
+CYG_FLASH_DRIVER(hal_olpcx2294_flash,
+                 &hal_olpcx2294_flash_strata_funs,
+                 0,
+                 0x80000000,
+#ifdef CYGPKG_HAL_ARM_LPC2XXX_OLPCL2294 
+                 0x801fffff,
+#else
+                 0x803fffff,
+#endif
+                 2,
+                 hal_olpcx2294_flash_priv.block_info,
+                 &hal_olpcx2294_flash_priv
+);
+
+#endif//CYGPKG_DEVS_FLASH_STRATA_V2
+// ------------------------------------------------------------------------
+// EOF arm_olpcx2294_flash.c