summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/flash/davinci_nand.c6
-rw-r--r--src/flash/lpc3180_nand_controller.c7
-rw-r--r--src/flash/mx3_nand.c6
-rw-r--r--src/flash/nand.c11
-rw-r--r--src/flash/nand.h2
-rw-r--r--src/flash/orion_nand.c6
-rw-r--r--src/flash/s3c2410_nand.c1
-rw-r--r--src/flash/s3c2412_nand.c1
-rw-r--r--src/flash/s3c2440_nand.c1
-rw-r--r--src/flash/s3c2443_nand.c1
-rw-r--r--src/flash/s3c24xx_nand.c5
-rw-r--r--src/flash/s3c24xx_nand.h2
12 files changed, 8 insertions, 41 deletions
diff --git a/src/flash/davinci_nand.c b/src/flash/davinci_nand.c
index ebd9ba8d..72cd378a 100644
--- a/src/flash/davinci_nand.c
+++ b/src/flash/davinci_nand.c
@@ -78,11 +78,6 @@ static int halted(struct target *target, const char *label)
return false;
}
-static int davinci_register_commands(struct command_context *cmd_ctx)
-{
- return ERROR_OK;
-}
-
static int davinci_init(struct nand_device *nand)
{
struct davinci_nand *info = nand->controller_priv;
@@ -747,7 +742,6 @@ fail:
struct nand_flash_controller davinci_nand_controller = {
.name = "davinci",
.nand_device_command = davinci_nand_device_command,
- .register_commands = davinci_register_commands,
.init = davinci_init,
.reset = davinci_reset,
.command = davinci_command,
diff --git a/src/flash/lpc3180_nand_controller.c b/src/flash/lpc3180_nand_controller.c
index 2dec3e12..146c8438 100644
--- a/src/flash/lpc3180_nand_controller.c
+++ b/src/flash/lpc3180_nand_controller.c
@@ -893,15 +893,10 @@ static const struct command_registration lpc3180_command_handler[] = {
COMMAND_REGISTRATION_DONE
};
-static int lpc3180_register_commands(struct command_context *cmd_ctx)
-{
- return register_commands(cmd_ctx, NULL, lpc3180_command_handler);
-}
-
struct nand_flash_controller lpc3180_nand_controller = {
.name = "lpc3180",
+ .commands = lpc3180_command_handler,
.nand_device_command = lpc3180_nand_device_command,
- .register_commands = lpc3180_register_commands,
.init = lpc3180_init,
.reset = lpc3180_reset,
.command = lpc3180_command,
diff --git a/src/flash/mx3_nand.c b/src/flash/mx3_nand.c
index 459e2a60..1dc4fcbc 100644
--- a/src/flash/mx3_nand.c
+++ b/src/flash/mx3_nand.c
@@ -315,11 +315,6 @@ static int imx31_nand_ready (struct nand_device *nand, int timeout)
return imx31_controller_ready (nand, timeout);
}
-static int imx31_register_commands (struct command_context *cmd_ctx)
-{
- return ERROR_OK;
-}
-
static int imx31_reset (struct nand_device *nand)
{
/*
@@ -871,7 +866,6 @@ static int do_data_output (struct nand_device *nand)
struct nand_flash_controller imx31_nand_flash_controller = {
.name = "imx31",
.nand_device_command = &imx31_nand_device_command,
- .register_commands = &imx31_register_commands,
.init = &imx31_init,
.reset = &imx31_reset,
.command = &imx31_command,
diff --git a/src/flash/nand.c b/src/flash/nand.c
index bc0e3505..1e28ba26 100644
--- a/src/flash/nand.c
+++ b/src/flash/nand.c
@@ -214,11 +214,12 @@ COMMAND_HANDLER(handle_nand_list_drivers)
static COMMAND_HELPER(create_nand_device, const char *bank_name,
struct nand_flash_controller *controller)
{
- int retval = controller->register_commands(CMD_CTX);
- if (ERROR_OK != retval)
+ if (NULL != controller->commands)
{
- LOG_ERROR("couldn't register '%s' commands", controller->name);
- return retval;
+ int retval = register_commands(CMD_CTX, NULL,
+ controller->commands);
+ if (ERROR_OK != retval)
+ return retval;
}
struct nand_device *c = malloc(sizeof(struct nand_device));
@@ -233,7 +234,7 @@ static COMMAND_HELPER(create_nand_device, const char *bank_name,
c->use_raw = 0;
c->next = NULL;
- retval = CALL_COMMAND_HANDLER(controller->nand_device_command, c);
+ int retval = CALL_COMMAND_HANDLER(controller->nand_device_command, c);
if (ERROR_OK != retval)
{
LOG_ERROR("'%s' driver rejected nand flash", controller->name);
diff --git a/src/flash/nand.h b/src/flash/nand.h
index af52c770..b780f284 100644
--- a/src/flash/nand.h
+++ b/src/flash/nand.h
@@ -35,8 +35,8 @@ struct nand_device;
struct nand_flash_controller
{
char *name;
+ const struct command_registration *commands;
__NAND_DEVICE_COMMAND((*nand_device_command));
- int (*register_commands)(struct command_context *cmd_ctx);
int (*init)(struct nand_device *nand);
int (*reset)(struct nand_device *nand);
int (*command)(struct nand_device *nand, uint8_t command);
diff --git a/src/flash/orion_nand.c b/src/flash/orion_nand.c
index c8fc9698..77a03f27 100644
--- a/src/flash/orion_nand.c
+++ b/src/flash/orion_nand.c
@@ -120,11 +120,6 @@ static int orion_nand_controller_ready(struct nand_device *nand, int timeout)
return 1;
}
-static int orion_nand_register_commands(struct command_context *cmd_ctx)
-{
- return ERROR_OK;
-}
-
NAND_DEVICE_COMMAND_HANDLER(orion_nand_device_command)
{
struct orion_nand_controller *hw;
@@ -180,7 +175,6 @@ struct nand_flash_controller orion_nand_controller =
.reset = orion_nand_reset,
.controller_ready = orion_nand_controller_ready,
.nand_device_command = orion_nand_device_command,
- .register_commands = orion_nand_register_commands,
.init = orion_nand_init,
};
diff --git a/src/flash/s3c2410_nand.c b/src/flash/s3c2410_nand.c
index 6fe8bae7..ca50c994 100644
--- a/src/flash/s3c2410_nand.c
+++ b/src/flash/s3c2410_nand.c
@@ -110,7 +110,6 @@ static int s3c2410_nand_ready(struct nand_device *nand, int timeout)
struct nand_flash_controller s3c2410_nand_controller = {
.name = "s3c2410",
.nand_device_command = &s3c2410_nand_device_command,
- .register_commands = &s3c24xx_register_commands,
.init = &s3c2410_init,
.reset = &s3c24xx_reset,
.command = &s3c24xx_command,
diff --git a/src/flash/s3c2412_nand.c b/src/flash/s3c2412_nand.c
index 2ca4cd31..acc6d993 100644
--- a/src/flash/s3c2412_nand.c
+++ b/src/flash/s3c2412_nand.c
@@ -64,7 +64,6 @@ static int s3c2412_init(struct nand_device *nand)
struct nand_flash_controller s3c2412_nand_controller = {
.name = "s3c2412",
.nand_device_command = &s3c2412_nand_device_command,
- .register_commands = &s3c24xx_register_commands,
.init = &s3c2412_init,
.reset = &s3c24xx_reset,
.command = &s3c24xx_command,
diff --git a/src/flash/s3c2440_nand.c b/src/flash/s3c2440_nand.c
index 65e5a511..556f6f1e 100644
--- a/src/flash/s3c2440_nand.c
+++ b/src/flash/s3c2440_nand.c
@@ -156,7 +156,6 @@ int s3c2440_write_block_data(struct nand_device *nand, uint8_t *data, int data_s
struct nand_flash_controller s3c2440_nand_controller = {
.name = "s3c2440",
.nand_device_command = &s3c2440_nand_device_command,
- .register_commands = &s3c24xx_register_commands,
.init = &s3c2440_init,
.reset = &s3c24xx_reset,
.command = &s3c24xx_command,
diff --git a/src/flash/s3c2443_nand.c b/src/flash/s3c2443_nand.c
index 5afb26fc..311bb697 100644
--- a/src/flash/s3c2443_nand.c
+++ b/src/flash/s3c2443_nand.c
@@ -65,7 +65,6 @@ static int s3c2443_init(struct nand_device *nand)
struct nand_flash_controller s3c2443_nand_controller = {
.name = "s3c2443",
.nand_device_command = &s3c2443_nand_device_command,
- .register_commands = &s3c24xx_register_commands,
.init = &s3c2443_init,
.reset = &s3c24xx_reset,
.command = &s3c24xx_command,
diff --git a/src/flash/s3c24xx_nand.c b/src/flash/s3c24xx_nand.c
index 262569e8..e7afb48a 100644
--- a/src/flash/s3c24xx_nand.c
+++ b/src/flash/s3c24xx_nand.c
@@ -52,11 +52,6 @@ S3C24XX_DEVICE_COMMAND()
return ERROR_OK;
}
-int s3c24xx_register_commands(struct command_context *cmd_ctx)
-{
- return ERROR_OK;
-}
-
int s3c24xx_reset(struct nand_device *nand)
{
struct s3c24xx_nand_controller *s3c24xx_info = nand->controller_priv;
diff --git a/src/flash/s3c24xx_nand.h b/src/flash/s3c24xx_nand.h
index 4829c7c4..fad33a0c 100644
--- a/src/flash/s3c24xx_nand.h
+++ b/src/flash/s3c24xx_nand.h
@@ -59,8 +59,6 @@ S3C24XX_DEVICE_COMMAND();
return retval; \
} while (0)
-int s3c24xx_register_commands(struct command_context *cmd_ctx);
-
int s3c24xx_reset(struct nand_device *nand);
int s3c24xx_command(struct nand_device *nand, uint8_t command);