summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Borneo <borneo.antonio@gmail.com>2010-12-31 19:46:07 +0800
committerØyvind Harboe <oyvind.harboe@zylin.com>2011-01-02 19:58:26 +0100
commit5e27647e2227368d3a81bb682dd736c575e55568 (patch)
treeb442764f0e4963e8a616ccc529dce44b1a297d24
parent457556b146c30fe485f21a7b3d9a198a3450bb04 (diff)
downloadopenocd+libswd-5e27647e2227368d3a81bb682dd736c575e55568.tar.gz
openocd+libswd-5e27647e2227368d3a81bb682dd736c575e55568.tar.bz2
openocd+libswd-5e27647e2227368d3a81bb682dd736c575e55568.tar.xz
openocd+libswd-5e27647e2227368d3a81bb682dd736c575e55568.zip
NAND/NUC910: remove private "target" copy
Remove "target" form private data, and use common one in struct nand_block. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
-rw-r--r--src/flash/nand/nuc910.c28
1 files changed, 7 insertions, 21 deletions
diff --git a/src/flash/nand/nuc910.c b/src/flash/nand/nuc910.c
index 26d377ff..e7e78556 100644
--- a/src/flash/nand/nuc910.c
+++ b/src/flash/nand/nuc910.c
@@ -33,14 +33,12 @@
struct nuc910_nand_controller
{
- struct target *target;
struct arm_nand_data io;
};
static int validate_target_state(struct nand_device *nand)
{
- struct nuc910_nand_controller *nuc910_nand = nand->controller_priv;
- struct target *target = nuc910_nand->target;
+ struct target *target = nand->target;
if (target->state != TARGET_HALTED) {
LOG_ERROR("Target not halted");
@@ -52,8 +50,7 @@ static int validate_target_state(struct nand_device *nand)
static int nuc910_nand_command(struct nand_device *nand, uint8_t command)
{
- struct nuc910_nand_controller *nuc910_nand = nand->controller_priv;
- struct target *target = nuc910_nand->target;
+ struct target *target = nand->target;
int result;
if ((result = validate_target_state(nand)) != ERROR_OK)
@@ -65,8 +62,7 @@ static int nuc910_nand_command(struct nand_device *nand, uint8_t command)
static int nuc910_nand_address(struct nand_device *nand, uint8_t address)
{
- struct nuc910_nand_controller *nuc910_nand = nand->controller_priv;
- struct target *target = nuc910_nand->target;
+ struct target *target = nand->target;
int result;
if ((result = validate_target_state(nand)) != ERROR_OK)
@@ -78,8 +74,7 @@ static int nuc910_nand_address(struct nand_device *nand, uint8_t address)
static int nuc910_nand_read(struct nand_device *nand, void *data)
{
- struct nuc910_nand_controller *nuc910_nand = nand->controller_priv;
- struct target *target = nuc910_nand->target;
+ struct target *target = nand->target;
int result;
if ((result = validate_target_state(nand)) != ERROR_OK)
@@ -91,8 +86,7 @@ static int nuc910_nand_read(struct nand_device *nand, void *data)
static int nuc910_nand_write(struct nand_device *nand, uint16_t data)
{
- struct nuc910_nand_controller *nuc910_nand = nand->controller_priv;
- struct target *target = nuc910_nand->target;
+ struct target *target = nand->target;
int result;
if ((result = validate_target_state(nand)) != ERROR_OK)
@@ -155,8 +149,7 @@ static int nuc910_nand_reset(struct nand_device *nand)
static int nuc910_nand_ready(struct nand_device *nand, int timeout)
{
- struct nuc910_nand_controller *nuc910_nand = nand->controller_priv;
- struct target *target = nuc910_nand->target;
+ struct target *target = nand->target;
uint32_t status;
do {
@@ -181,20 +174,13 @@ NAND_DEVICE_COMMAND_HANDLER(nuc910_nand_device_command)
}
nand->controller_priv = nuc910_nand;
- nuc910_nand->target = get_target(CMD_ARGV[1]);
- if (!nuc910_nand->target) {
- LOG_ERROR("target '%s' not defined", CMD_ARGV[1]);
- free(nuc910_nand);
- return ERROR_NAND_DEVICE_INVALID;
- }
-
return ERROR_OK;
}
static int nuc910_nand_init(struct nand_device *nand)
{
struct nuc910_nand_controller *nuc910_nand = nand->controller_priv;
- struct target *target = nuc910_nand->target;
+ struct target *target = nand->target;
int bus_width = nand->bus_width ? : 8;
int result;