summaryrefslogtreecommitdiff
path: root/src/flash
diff options
context:
space:
mode:
authorAntonio Borneo <borneo.antonio@gmail.com>2010-12-31 19:46:09 +0800
committerØyvind Harboe <oyvind.harboe@zylin.com>2011-01-02 19:58:58 +0100
commit093ec6656ab7fb523b8a811f4bd628e3b50f8367 (patch)
tree456ca54797aad5484fc6a5d868fedf48da2e0fab /src/flash
parentf49283a062192800a3263dcef620911010ffc718 (diff)
downloadopenocd_libswd-093ec6656ab7fb523b8a811f4bd628e3b50f8367.tar.gz
openocd_libswd-093ec6656ab7fb523b8a811f4bd628e3b50f8367.tar.bz2
openocd_libswd-093ec6656ab7fb523b8a811f4bd628e3b50f8367.tar.xz
openocd_libswd-093ec6656ab7fb523b8a811f4bd628e3b50f8367.zip
NAND/S3CXXXX: 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>
Diffstat (limited to 'src/flash')
-rw-r--r--src/flash/nand/s3c2410.c12
-rw-r--r--src/flash/nand/s3c2412.c3
-rw-r--r--src/flash/nand/s3c2440.c9
-rw-r--r--src/flash/nand/s3c2443.c3
-rw-r--r--src/flash/nand/s3c24xx.c17
-rw-r--r--src/flash/nand/s3c24xx.h2
-rw-r--r--src/flash/nand/s3c6400.c3
7 files changed, 16 insertions, 33 deletions
diff --git a/src/flash/nand/s3c2410.c b/src/flash/nand/s3c2410.c
index 1827c74e..e998f65f 100644
--- a/src/flash/nand/s3c2410.c
+++ b/src/flash/nand/s3c2410.c
@@ -46,8 +46,7 @@ NAND_DEVICE_COMMAND_HANDLER(s3c2410_nand_device_command)
static int s3c2410_init(struct nand_device *nand)
{
- struct s3c24xx_nand_controller *s3c24xx_info = nand->controller_priv;
- struct target *target = s3c24xx_info->target;
+ struct target *target = nand->target;
target_write_u32(target, S3C2410_NFCONF,
S3C2410_NFCONF_EN | S3C2410_NFCONF_TACLS(3) |
@@ -58,8 +57,7 @@ static int s3c2410_init(struct nand_device *nand)
static int s3c2410_write_data(struct nand_device *nand, uint16_t data)
{
- struct s3c24xx_nand_controller *s3c24xx_info = nand->controller_priv;
- struct target *target = s3c24xx_info->target;
+ struct target *target = nand->target;
if (target->state != TARGET_HALTED) {
LOG_ERROR("target must be halted to use S3C24XX NAND flash controller");
@@ -72,8 +70,7 @@ static int s3c2410_write_data(struct nand_device *nand, uint16_t data)
static int s3c2410_read_data(struct nand_device *nand, void *data)
{
- struct s3c24xx_nand_controller *s3c24xx_info = nand->controller_priv;
- struct target *target = s3c24xx_info->target;
+ struct target *target = nand->target;
if (target->state != TARGET_HALTED) {
LOG_ERROR("target must be halted to use S3C24XX NAND flash controller");
@@ -86,8 +83,7 @@ static int s3c2410_read_data(struct nand_device *nand, void *data)
static int s3c2410_nand_ready(struct nand_device *nand, int timeout)
{
- struct s3c24xx_nand_controller *s3c24xx_info = nand->controller_priv;
- struct target *target = s3c24xx_info->target;
+ struct target *target = nand->target;
uint8_t status;
if (target->state != TARGET_HALTED) {
diff --git a/src/flash/nand/s3c2412.c b/src/flash/nand/s3c2412.c
index f43f8a69..7f4357ec 100644
--- a/src/flash/nand/s3c2412.c
+++ b/src/flash/nand/s3c2412.c
@@ -46,8 +46,7 @@ NAND_DEVICE_COMMAND_HANDLER(s3c2412_nand_device_command)
static int s3c2412_init(struct nand_device *nand)
{
- struct s3c24xx_nand_controller *s3c24xx_info = nand->controller_priv;
- struct target *target = s3c24xx_info->target;
+ struct target *target = nand->target;
target_write_u32(target, S3C2410_NFCONF,
S3C2440_NFCONF_TACLS(3) |
diff --git a/src/flash/nand/s3c2440.c b/src/flash/nand/s3c2440.c
index 797ce242..4221f3d7 100644
--- a/src/flash/nand/s3c2440.c
+++ b/src/flash/nand/s3c2440.c
@@ -47,8 +47,7 @@ NAND_DEVICE_COMMAND_HANDLER(s3c2440_nand_device_command)
static int s3c2440_init(struct nand_device *nand)
{
- struct s3c24xx_nand_controller *s3c24xx_info = nand->controller_priv;
- struct target *target = s3c24xx_info->target;
+ struct target *target = nand->target;
target_write_u32(target, S3C2410_NFCONF,
S3C2440_NFCONF_TACLS(3) |
@@ -64,7 +63,7 @@ static int s3c2440_init(struct nand_device *nand)
int s3c2440_nand_ready(struct nand_device *nand, int timeout)
{
struct s3c24xx_nand_controller *s3c24xx_info = nand->controller_priv;
- struct target *target = s3c24xx_info->target;
+ struct target *target = nand->target;
uint8_t status;
if (target->state != TARGET_HALTED) {
@@ -90,7 +89,7 @@ int s3c2440_nand_ready(struct nand_device *nand, int timeout)
int s3c2440_read_block_data(struct nand_device *nand, uint8_t *data, int data_size)
{
struct s3c24xx_nand_controller *s3c24xx_info = nand->controller_priv;
- struct target *target = s3c24xx_info->target;
+ struct target *target = nand->target;
uint32_t nfdata = s3c24xx_info->data;
uint32_t tmp;
@@ -126,7 +125,7 @@ int s3c2440_read_block_data(struct nand_device *nand, uint8_t *data, int data_si
int s3c2440_write_block_data(struct nand_device *nand, uint8_t *data, int data_size)
{
struct s3c24xx_nand_controller *s3c24xx_info = nand->controller_priv;
- struct target *target = s3c24xx_info->target;
+ struct target *target = nand->target;
uint32_t nfdata = s3c24xx_info->data;
uint32_t tmp;
diff --git a/src/flash/nand/s3c2443.c b/src/flash/nand/s3c2443.c
index 5fb2d927..8ad044cf 100644
--- a/src/flash/nand/s3c2443.c
+++ b/src/flash/nand/s3c2443.c
@@ -47,8 +47,7 @@ NAND_DEVICE_COMMAND_HANDLER(s3c2443_nand_device_command)
static int s3c2443_init(struct nand_device *nand)
{
- struct s3c24xx_nand_controller *s3c24xx_info = nand->controller_priv;
- struct target *target = s3c24xx_info->target;
+ struct target *target = nand->target;
target_write_u32(target, S3C2410_NFCONF,
S3C2440_NFCONF_TACLS(3) |
diff --git a/src/flash/nand/s3c24xx.c b/src/flash/nand/s3c24xx.c
index e3b5c2e2..eb20f35c 100644
--- a/src/flash/nand/s3c24xx.c
+++ b/src/flash/nand/s3c24xx.c
@@ -43,13 +43,6 @@ S3C24XX_DEVICE_COMMAND()
}
nand->controller_priv = s3c24xx_info;
-
- s3c24xx_info->target = get_target(CMD_ARGV[1]);
- if (s3c24xx_info->target == NULL) {
- LOG_ERROR("target '%s' not defined", CMD_ARGV[1]);
- return ERROR_COMMAND_SYNTAX_ERROR;
- }
-
*info = s3c24xx_info;
return ERROR_OK;
@@ -58,7 +51,7 @@ S3C24XX_DEVICE_COMMAND()
int s3c24xx_reset(struct nand_device *nand)
{
struct s3c24xx_nand_controller *s3c24xx_info = nand->controller_priv;
- struct target *target = s3c24xx_info->target;
+ struct target *target = nand->target;
if (target->state != TARGET_HALTED) {
LOG_ERROR("target must be halted to use S3C24XX NAND flash controller");
@@ -73,7 +66,7 @@ int s3c24xx_reset(struct nand_device *nand)
int s3c24xx_command(struct nand_device *nand, uint8_t command)
{
struct s3c24xx_nand_controller *s3c24xx_info = nand->controller_priv;
- struct target *target = s3c24xx_info->target;
+ struct target *target = nand->target;
if (target->state != TARGET_HALTED) {
LOG_ERROR("target must be halted to use S3C24XX NAND flash controller");
@@ -88,7 +81,7 @@ int s3c24xx_command(struct nand_device *nand, uint8_t command)
int s3c24xx_address(struct nand_device *nand, uint8_t address)
{
struct s3c24xx_nand_controller *s3c24xx_info = nand->controller_priv;
- struct target *target = s3c24xx_info->target;
+ struct target *target = nand->target;
if (target->state != TARGET_HALTED) {
LOG_ERROR("target must be halted to use S3C24XX NAND flash controller");
@@ -102,7 +95,7 @@ int s3c24xx_address(struct nand_device *nand, uint8_t address)
int s3c24xx_write_data(struct nand_device *nand, uint16_t data)
{
struct s3c24xx_nand_controller *s3c24xx_info = nand->controller_priv;
- struct target *target = s3c24xx_info->target;
+ struct target *target = nand->target;
if (target->state != TARGET_HALTED) {
LOG_ERROR("target must be halted to use S3C24XX NAND flash controller");
@@ -116,7 +109,7 @@ int s3c24xx_write_data(struct nand_device *nand, uint16_t data)
int s3c24xx_read_data(struct nand_device *nand, void *data)
{
struct s3c24xx_nand_controller *s3c24xx_info = nand->controller_priv;
- struct target *target = s3c24xx_info->target;
+ struct target *target = nand->target;
if (target->state != TARGET_HALTED) {
LOG_ERROR("target must be halted to use S3C24XX NAND flash controller");
diff --git a/src/flash/nand/s3c24xx.h b/src/flash/nand/s3c24xx.h
index 059c84d9..1535decd 100644
--- a/src/flash/nand/s3c24xx.h
+++ b/src/flash/nand/s3c24xx.h
@@ -33,8 +33,6 @@
struct s3c24xx_nand_controller
{
- struct target *target;
-
/* register addresses */
uint32_t cmd;
uint32_t addr;
diff --git a/src/flash/nand/s3c6400.c b/src/flash/nand/s3c6400.c
index 960447d9..a6f80431 100644
--- a/src/flash/nand/s3c6400.c
+++ b/src/flash/nand/s3c6400.c
@@ -43,8 +43,7 @@ NAND_DEVICE_COMMAND_HANDLER(s3c6400_nand_device_command)
static int s3c6400_init(struct nand_device *nand)
{
- struct s3c24xx_nand_controller *s3c24xx_info = nand->controller_priv;
- struct target *target = s3c24xx_info->target;
+ struct target *target = nand->target;
target_write_u32(target, S3C2410_NFCONF,
S3C2440_NFCONF_TACLS(3) |