diff options
author | Dean Glazeski <dnglaze@gmail.com> | 2009-11-16 13:34:24 -0600 |
---|---|---|
committer | David Brownell <dbrownell@users.sourceforge.net> | 2009-12-03 17:29:41 -0800 |
commit | 66985bb30619c412984a2cfa1c0b3c4a324dbe78 (patch) | |
tree | e8f7bc05dc3266a072a2833c291d9d77332521fb | |
parent | 9a51b8b0e3d0b629915a8248e2c112a01ffc93dc (diff) | |
download | openocd+libswd-66985bb30619c412984a2cfa1c0b3c4a324dbe78.tar.gz openocd+libswd-66985bb30619c412984a2cfa1c0b3c4a324dbe78.tar.bz2 openocd+libswd-66985bb30619c412984a2cfa1c0b3c4a324dbe78.tar.xz openocd+libswd-66985bb30619c412984a2cfa1c0b3c4a324dbe78.zip |
ARM NAND I/O interface update
Modify the arm_nand_data struct to better support both read and
write operations while using the same struct. An additional
field was added, and initialized, to record the last operation
so that the correct code can be loaded to the working area.
[dbrownell@users.sourceforge.net: merge init patch, tweak GPL note]
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
-rw-r--r-- | src/flash/arm_nandio.h | 44 | ||||
-rw-r--r-- | src/flash/nand/davinci.c | 1 | ||||
-rw-r--r-- | src/flash/nand/orion.c | 1 |
3 files changed, 39 insertions, 7 deletions
diff --git a/src/flash/arm_nandio.h b/src/flash/arm_nandio.h index 27b3ad35..d3504f43 100644 --- a/src/flash/arm_nandio.h +++ b/src/flash/arm_nandio.h @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2009 by David Brownell + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the + * Free Software Foundation, Inc., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ #ifndef __ARM_NANDIO_H #define __ARM_NANDIO_H @@ -5,21 +23,33 @@ #include <helper/binarybuffer.h> /** + * Available operational states the arm_nand_data struct can be in. + */ +enum arm_nand_op { + ARM_NAND_NONE, /**< No operation performed. */ + ARM_NAND_READ, /**< Read operation performed. */ + ARM_NAND_WRITE, /**< Write operation performed. */ +}; + +/** * The arm_nand_data struct is used for defining NAND I/O operations on an ARM * core. */ struct arm_nand_data { - /** target is proxy for some ARM core */ - struct target *target; + /** Target is proxy for some ARM core. */ + struct target *target; - /** copy_area holds write-to-NAND loop and data to write */ + /** The copy area holds code loop and data for I/O operations. */ struct working_area *copy_area; - /** chunk_size == page or ECC unit */ - unsigned chunk_size; + /** The chunk size is the page size or ECC chunk. */ + unsigned chunk_size; + + /** Where data is read from or written to. */ + uint32_t data; - /** data == where to write the data */ - uint32_t data; + /** Last operation executed using this struct. */ + enum arm_nand_op op; /* currently implicit: data width == 8 bits (not 16) */ }; diff --git a/src/flash/nand/davinci.c b/src/flash/nand/davinci.c index 40be36d4..66770737 100644 --- a/src/flash/nand/davinci.c +++ b/src/flash/nand/davinci.c @@ -710,6 +710,7 @@ NAND_DEVICE_COMMAND_HANDLER(davinci_nand_device_command) info->io.target = target; info->io.data = info->data; + info->io.op = ARM_NAND_NONE; /* NOTE: for now we don't do any error correction on read. * Nothing else in OpenOCD currently corrects read errors, diff --git a/src/flash/nand/orion.c b/src/flash/nand/orion.c index 436151fb..b124deee 100644 --- a/src/flash/nand/orion.c +++ b/src/flash/nand/orion.c @@ -155,6 +155,7 @@ NAND_DEVICE_COMMAND_HANDLER(orion_nand_device_command) hw->io.target = hw->target; hw->io.data = hw->data; + hw->io.op = ARM_NAND_NONE; return ERROR_OK; } |