summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/flash/davinci_nand.c38
-rw-r--r--src/flash/lpc3180_nand_controller.c26
-rw-r--r--src/flash/mx3_nand.c38
-rw-r--r--src/flash/nand.c56
-rw-r--r--src/flash/nand.h48
-rw-r--r--src/flash/nand_ecc.c2
-rw-r--r--src/flash/nand_ecc_kw.c2
-rw-r--r--src/flash/orion_nand.c18
-rw-r--r--src/flash/s3c2410_nand.c8
-rw-r--r--src/flash/s3c2412_nand.c2
-rw-r--r--src/flash/s3c2440_nand.c8
-rw-r--r--src/flash/s3c2443_nand.c2
-rw-r--r--src/flash/s3c24xx_nand.c12
-rw-r--r--src/flash/s3c24xx_nand.h20
14 files changed, 140 insertions, 140 deletions
diff --git a/src/flash/davinci_nand.c b/src/flash/davinci_nand.c
index cc144206..4cef4084 100644
--- a/src/flash/davinci_nand.c
+++ b/src/flash/davinci_nand.c
@@ -55,9 +55,9 @@ struct davinci_nand {
struct arm_nand_data io;
/* page i/o for the relevant flavor of hardware ECC */
- int (*read_page)(struct nand_device_s *nand, uint32_t page,
+ int (*read_page)(struct nand_device *nand, uint32_t page,
uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size);
- int (*write_page)(struct nand_device_s *nand, uint32_t page,
+ int (*write_page)(struct nand_device *nand, uint32_t page,
uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size);
};
@@ -83,7 +83,7 @@ static int davinci_register_commands(struct command_context_s *cmd_ctx)
return ERROR_OK;
}
-static int davinci_init(struct nand_device_s *nand)
+static int davinci_init(struct nand_device *nand)
{
struct davinci_nand *info = nand->controller_priv;
struct target *target = info->target;
@@ -108,12 +108,12 @@ static int davinci_init(struct nand_device_s *nand)
return ERROR_OK;
}
-static int davinci_reset(struct nand_device_s *nand)
+static int davinci_reset(struct nand_device *nand)
{
return ERROR_OK;
}
-static int davinci_nand_ready(struct nand_device_s *nand, int timeout)
+static int davinci_nand_ready(struct nand_device *nand, int timeout)
{
struct davinci_nand *info = nand->controller_priv;
struct target *target = info->target;
@@ -136,7 +136,7 @@ static int davinci_nand_ready(struct nand_device_s *nand, int timeout)
return 0;
}
-static int davinci_command(struct nand_device_s *nand, uint8_t command)
+static int davinci_command(struct nand_device *nand, uint8_t command)
{
struct davinci_nand *info = nand->controller_priv;
struct target *target = info->target;
@@ -148,7 +148,7 @@ static int davinci_command(struct nand_device_s *nand, uint8_t command)
return ERROR_OK;
}
-static int davinci_address(struct nand_device_s *nand, uint8_t address)
+static int davinci_address(struct nand_device *nand, uint8_t address)
{
struct davinci_nand *info = nand->controller_priv;
struct target *target = info->target;
@@ -160,7 +160,7 @@ static int davinci_address(struct nand_device_s *nand, uint8_t address)
return ERROR_OK;
}
-static int davinci_write_data(struct nand_device_s *nand, uint16_t data)
+static int davinci_write_data(struct nand_device *nand, uint16_t data)
{
struct davinci_nand *info = nand->controller_priv;
struct target *target = info->target;
@@ -172,7 +172,7 @@ static int davinci_write_data(struct nand_device_s *nand, uint16_t data)
return ERROR_OK;
}
-static int davinci_read_data(struct nand_device_s *nand, void *data)
+static int davinci_read_data(struct nand_device *nand, void *data)
{
struct davinci_nand *info = nand->controller_priv;
struct target *target = info->target;
@@ -186,7 +186,7 @@ static int davinci_read_data(struct nand_device_s *nand, void *data)
/* REVISIT a bit of native code should let block reads be MUCH faster */
-static int davinci_read_block_data(struct nand_device_s *nand,
+static int davinci_read_block_data(struct nand_device *nand,
uint8_t *data, int data_size)
{
struct davinci_nand *info = nand->controller_priv;
@@ -219,7 +219,7 @@ static int davinci_read_block_data(struct nand_device_s *nand,
return ERROR_OK;
}
-static int davinci_write_block_data(struct nand_device_s *nand,
+static int davinci_write_block_data(struct nand_device *nand,
uint8_t *data, int data_size)
{
struct davinci_nand *info = nand->controller_priv;
@@ -255,7 +255,7 @@ static int davinci_write_block_data(struct nand_device_s *nand,
return ERROR_OK;
}
-static int davinci_write_page(struct nand_device_s *nand, uint32_t page,
+static int davinci_write_page(struct nand_device *nand, uint32_t page,
uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
{
struct davinci_nand *info = nand->controller_priv;
@@ -306,7 +306,7 @@ static int davinci_write_page(struct nand_device_s *nand, uint32_t page,
return status;
}
-static int davinci_read_page(struct nand_device_s *nand, uint32_t page,
+static int davinci_read_page(struct nand_device *nand, uint32_t page,
uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
{
struct davinci_nand *info = nand->controller_priv;
@@ -319,7 +319,7 @@ static int davinci_read_page(struct nand_device_s *nand, uint32_t page,
return info->read_page(nand, page, data, data_size, oob, oob_size);
}
-static void davinci_write_pagecmd(struct nand_device_s *nand, uint8_t cmd, uint32_t page)
+static void davinci_write_pagecmd(struct nand_device *nand, uint8_t cmd, uint32_t page)
{
struct davinci_nand *info = nand->controller_priv;
struct target *target = info->target;
@@ -342,7 +342,7 @@ static void davinci_write_pagecmd(struct nand_device_s *nand, uint8_t cmd, uint3
target_write_u8(target, info->addr, page >> 24);
}
-static int davinci_writepage_tail(struct nand_device_s *nand,
+static int davinci_writepage_tail(struct nand_device *nand,
uint8_t *oob, uint32_t oob_size)
{
struct davinci_nand *info = nand->controller_priv;
@@ -374,7 +374,7 @@ static int davinci_writepage_tail(struct nand_device_s *nand,
/*
* All DaVinci family chips support 1-bit ECC on a per-chipselect basis.
*/
-static int davinci_write_page_ecc1(struct nand_device_s *nand, uint32_t page,
+static int davinci_write_page_ecc1(struct nand_device *nand, uint32_t page,
uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
{
unsigned oob_offset;
@@ -441,7 +441,7 @@ static int davinci_write_page_ecc1(struct nand_device_s *nand, uint32_t page,
* is read first, so its ECC data can be used incrementally), but the
* manufacturer bad block markers are safe. Contrast: old "infix" style.
*/
-static int davinci_write_page_ecc4(struct nand_device_s *nand, uint32_t page,
+static int davinci_write_page_ecc4(struct nand_device *nand, uint32_t page,
uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
{
static const uint8_t ecc512[] = {
@@ -543,7 +543,7 @@ static int davinci_write_page_ecc4(struct nand_device_s *nand, uint32_t page,
* older second stage loaders (ABL/U-Boot, etc) or other system software
* (MVL 4.x/5.x kernels, filesystems, etc) may need it more generally.
*/
-static int davinci_write_page_ecc4infix(struct nand_device_s *nand, uint32_t page,
+static int davinci_write_page_ecc4infix(struct nand_device *nand, uint32_t page,
uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
{
struct davinci_nand *info = nand->controller_priv;
@@ -600,7 +600,7 @@ static int davinci_write_page_ecc4infix(struct nand_device_s *nand, uint32_t pag
return davinci_writepage_tail(nand, NULL, 0);
}
-static int davinci_read_page_ecc4infix(struct nand_device_s *nand, uint32_t page,
+static int davinci_read_page_ecc4infix(struct nand_device *nand, uint32_t page,
uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
{
davinci_write_pagecmd(nand, NAND_CMD_READ0, page);
diff --git a/src/flash/lpc3180_nand_controller.c b/src/flash/lpc3180_nand_controller.c
index e4b0475f..4a15e364 100644
--- a/src/flash/lpc3180_nand_controller.c
+++ b/src/flash/lpc3180_nand_controller.c
@@ -24,8 +24,8 @@
#include "lpc3180_nand_controller.h"
#include "nand.h"
-static int lpc3180_reset(struct nand_device_s *nand);
-static int lpc3180_controller_ready(struct nand_device_s *nand, int timeout);
+static int lpc3180_reset(struct nand_device *nand);
+static int lpc3180_controller_ready(struct nand_device *nand, int timeout);
/* nand device lpc3180 <target#> <oscillator_frequency>
*/
@@ -144,7 +144,7 @@ static float lpc3180_cycle_time(struct lpc3180_nand_controller *lpc3180_info)
return cycle;
}
-static int lpc3180_init(struct nand_device_s *nand)
+static int lpc3180_init(struct nand_device *nand)
{
struct lpc3180_nand_controller *lpc3180_info = nand->controller_priv;
struct target *target = lpc3180_info->target;
@@ -274,7 +274,7 @@ static int lpc3180_init(struct nand_device_s *nand)
return ERROR_OK;
}
-static int lpc3180_reset(struct nand_device_s *nand)
+static int lpc3180_reset(struct nand_device *nand)
{
struct lpc3180_nand_controller *lpc3180_info = nand->controller_priv;
struct target *target = lpc3180_info->target;
@@ -316,7 +316,7 @@ static int lpc3180_reset(struct nand_device_s *nand)
return ERROR_OK;
}
-static int lpc3180_command(struct nand_device_s *nand, uint8_t command)
+static int lpc3180_command(struct nand_device *nand, uint8_t command)
{
struct lpc3180_nand_controller *lpc3180_info = nand->controller_priv;
struct target *target = lpc3180_info->target;
@@ -346,7 +346,7 @@ static int lpc3180_command(struct nand_device_s *nand, uint8_t command)
return ERROR_OK;
}
-static int lpc3180_address(struct nand_device_s *nand, uint8_t address)
+static int lpc3180_address(struct nand_device *nand, uint8_t address)
{
struct lpc3180_nand_controller *lpc3180_info = nand->controller_priv;
struct target *target = lpc3180_info->target;
@@ -376,7 +376,7 @@ static int lpc3180_address(struct nand_device_s *nand, uint8_t address)
return ERROR_OK;
}
-static int lpc3180_write_data(struct nand_device_s *nand, uint16_t data)
+static int lpc3180_write_data(struct nand_device *nand, uint16_t data)
{
struct lpc3180_nand_controller *lpc3180_info = nand->controller_priv;
struct target *target = lpc3180_info->target;
@@ -406,7 +406,7 @@ static int lpc3180_write_data(struct nand_device_s *nand, uint16_t data)
return ERROR_OK;
}
-static int lpc3180_read_data(struct nand_device_s *nand, void *data)
+static int lpc3180_read_data(struct nand_device *nand, void *data)
{
struct lpc3180_nand_controller *lpc3180_info = nand->controller_priv;
struct target *target = lpc3180_info->target;
@@ -468,7 +468,7 @@ static int lpc3180_read_data(struct nand_device_s *nand, void *data)
return ERROR_OK;
}
-static int lpc3180_write_page(struct nand_device_s *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
+static int lpc3180_write_page(struct nand_device *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
{
struct lpc3180_nand_controller *lpc3180_info = nand->controller_priv;
struct target *target = lpc3180_info->target;
@@ -607,7 +607,7 @@ static int lpc3180_write_page(struct nand_device_s *nand, uint32_t page, uint8_t
return ERROR_OK;
}
-static int lpc3180_read_page(struct nand_device_s *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
+static int lpc3180_read_page(struct nand_device *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
{
struct lpc3180_nand_controller *lpc3180_info = nand->controller_priv;
struct target *target = lpc3180_info->target;
@@ -754,7 +754,7 @@ static int lpc3180_read_page(struct nand_device_s *nand, uint32_t page, uint8_t
return ERROR_OK;
}
-static int lpc3180_controller_ready(struct nand_device_s *nand, int timeout)
+static int lpc3180_controller_ready(struct nand_device *nand, int timeout)
{
struct lpc3180_nand_controller *lpc3180_info = nand->controller_priv;
struct target *target = lpc3180_info->target;
@@ -788,7 +788,7 @@ static int lpc3180_controller_ready(struct nand_device_s *nand, int timeout)
return 0;
}
-static int lpc3180_nand_ready(struct nand_device_s *nand, int timeout)
+static int lpc3180_nand_ready(struct nand_device *nand, int timeout)
{
struct lpc3180_nand_controller *lpc3180_info = nand->controller_priv;
struct target *target = lpc3180_info->target;
@@ -843,7 +843,7 @@ COMMAND_HANDLER(handle_lpc3180_select_command)
unsigned num;
COMMAND_PARSE_NUMBER(uint, args[1], num);
- nand_device_t *nand = get_nand_device_by_num(num);
+ struct nand_device *nand = get_nand_device_by_num(num);
if (!nand)
{
command_print(cmd_ctx, "nand device '#%s' is out of bounds", args[0]);
diff --git a/src/flash/mx3_nand.c b/src/flash/mx3_nand.c
index 07a360f6..6c699179 100644
--- a/src/flash/mx3_nand.c
+++ b/src/flash/mx3_nand.c
@@ -49,17 +49,17 @@ unsigned char sign_of_sequental_byte_read;
static int test_iomux_settings (struct target * target, uint32_t value,
uint32_t mask, const char *text);
-static int initialize_nf_controller (struct nand_device_s *nand);
+static int initialize_nf_controller (struct nand_device *nand);
static int get_next_byte_from_sram_buffer (struct target * target, uint8_t * value);
static int get_next_halfword_from_sram_buffer (struct target * target,
uint16_t * value);
static int poll_for_complete_op (struct target * target, const char *text);
-static int validate_target_state (struct nand_device_s *nand);
-static int do_data_output (struct nand_device_s *nand);
+static int validate_target_state (struct nand_device *nand);
+static int do_data_output (struct nand_device *nand);
-static int imx31_command (struct nand_device_s *nand, uint8_t command);
-static int imx31_address (struct nand_device_s *nand, uint8_t address);
-static int imx31_controller_ready (struct nand_device_s *nand, int tout);
+static int imx31_command (struct nand_device *nand, uint8_t command);
+static int imx31_address (struct nand_device *nand, uint8_t address);
+static int imx31_controller_ready (struct nand_device *nand, int tout);
NAND_DEVICE_COMMAND_HANDLER(imx31_nand_device_command)
{
@@ -121,7 +121,7 @@ NAND_DEVICE_COMMAND_HANDLER(imx31_nand_device_command)
return ERROR_OK;
}
-static int imx31_init (struct nand_device_s *nand)
+static int imx31_init (struct nand_device *nand)
{
struct mx3_nf_controller *mx3_nf_info = nand->controller_priv;
struct target *target = mx3_nf_info->target;
@@ -264,7 +264,7 @@ static int imx31_init (struct nand_device_s *nand)
return ERROR_OK;
}
-static int imx31_read_data (struct nand_device_s *nand, void *data)
+static int imx31_read_data (struct nand_device *nand, void *data)
{
struct mx3_nf_controller *mx3_nf_info = nand->controller_priv;
struct target *target = mx3_nf_info->target;
@@ -304,13 +304,13 @@ static int imx31_read_data (struct nand_device_s *nand, void *data)
return ERROR_OK;
}
-static int imx31_write_data (struct nand_device_s *nand, uint16_t data)
+static int imx31_write_data (struct nand_device *nand, uint16_t data)
{
LOG_ERROR ("write_data() not implemented");
return ERROR_NAND_OPERATION_FAILED;
}
-static int imx31_nand_ready (struct nand_device_s *nand, int timeout)
+static int imx31_nand_ready (struct nand_device *nand, int timeout)
{
return imx31_controller_ready (nand, timeout);
}
@@ -320,7 +320,7 @@ static int imx31_register_commands (struct command_context_s *cmd_ctx)
return ERROR_OK;
}
-static int imx31_reset (struct nand_device_s *nand)
+static int imx31_reset (struct nand_device *nand)
{
/*
* validate target state
@@ -335,7 +335,7 @@ static int imx31_reset (struct nand_device_s *nand)
return ERROR_OK;
}
-static int imx31_command (struct nand_device_s *nand, uint8_t command)
+static int imx31_command (struct nand_device *nand, uint8_t command)
{
struct mx3_nf_controller *mx3_nf_info = nand->controller_priv;
struct target *target = mx3_nf_info->target;
@@ -409,7 +409,7 @@ static int imx31_command (struct nand_device_s *nand, uint8_t command)
return ERROR_OK;
}
-static int imx31_address (struct nand_device_s *nand, uint8_t address)
+static int imx31_address (struct nand_device *nand, uint8_t address)
{
struct mx3_nf_controller *mx3_nf_info = nand->controller_priv;
struct target *target = mx3_nf_info->target;
@@ -441,7 +441,7 @@ static int imx31_address (struct nand_device_s *nand, uint8_t address)
return ERROR_OK;
}
-static int imx31_controller_ready (struct nand_device_s *nand, int tout)
+static int imx31_controller_ready (struct nand_device *nand, int tout)
{
uint16_t poll_complete_status;
struct mx3_nf_controller *mx3_nf_info = nand->controller_priv;
@@ -472,7 +472,7 @@ static int imx31_controller_ready (struct nand_device_s *nand, int tout)
return tout;
}
-static int imx31_write_page (struct nand_device_s *nand, uint32_t page,
+static int imx31_write_page (struct nand_device *nand, uint32_t page,
uint8_t * data, uint32_t data_size, uint8_t * oob,
uint32_t oob_size)
{
@@ -579,7 +579,7 @@ static int imx31_write_page (struct nand_device_s *nand, uint32_t page,
return ERROR_OK;
}
-static int imx31_read_page (struct nand_device_s *nand, uint32_t page,
+static int imx31_read_page (struct nand_device *nand, uint32_t page,
uint8_t * data, uint32_t data_size, uint8_t * oob,
uint32_t oob_size)
{
@@ -656,7 +656,7 @@ static int test_iomux_settings (struct target * target, uint32_t address,
return ERROR_OK;
}
-static int initialize_nf_controller (struct nand_device_s *nand)
+static int initialize_nf_controller (struct nand_device *nand)
{
struct mx3_nf_controller *mx3_nf_info = nand->controller_priv;
struct target *target = mx3_nf_info->target;
@@ -784,7 +784,7 @@ static int poll_for_complete_op (struct target * target, const char *text)
return ERROR_OK;
}
-static int validate_target_state (struct nand_device_s *nand)
+static int validate_target_state (struct nand_device *nand)
{
struct mx3_nf_controller *mx3_nf_info = nand->controller_priv;
struct target *target = mx3_nf_info->target;
@@ -806,7 +806,7 @@ static int validate_target_state (struct nand_device_s *nand)
return ERROR_OK;
}
-static int do_data_output (struct nand_device_s *nand)
+static int do_data_output (struct nand_device *nand)
{
struct mx3_nf_controller *mx3_nf_info = nand->controller_priv;
struct target *target = mx3_nf_info->target;
diff --git a/src/flash/nand.c b/src/flash/nand.c
index 1100205a..48f65206 100644
--- a/src/flash/nand.c
+++ b/src/flash/nand.c
@@ -28,10 +28,10 @@
#include "time_support.h"
#include "fileio.h"
-static int nand_read_page(struct nand_device_s *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size);
-//static int nand_read_plain(struct nand_device_s *nand, uint32_t address, uint8_t *data, uint32_t data_size);
+static int nand_read_page(struct nand_device *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size);
+//static int nand_read_plain(struct nand_device *nand, uint32_t address, uint8_t *data, uint32_t data_size);
-static int nand_write_page(struct nand_device_s *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size);
+static int nand_write_page(struct nand_device *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size);
/* NAND flash controller
*/
@@ -61,7 +61,7 @@ static struct nand_flash_controller *nand_flash_controllers[] =
};
/* configured NAND devices and NAND Flash command handler */
-static nand_device_t *nand_devices = NULL;
+static struct nand_device *nand_devices = NULL;
static command_t *nand_cmd;
/* Chip ID list
@@ -218,7 +218,7 @@ COMMAND_HANDLER(handle_nand_device_command)
for (i = 0; nand_flash_controllers[i]; i++)
{
- nand_device_t *p, *c;
+ struct nand_device *p, *c;
if (strcmp(args[0], nand_flash_controllers[i]->name) == 0)
{
@@ -229,7 +229,7 @@ COMMAND_HANDLER(handle_nand_device_command)
return retval;
}
- c = malloc(sizeof(nand_device_t));
+ c = malloc(sizeof(struct nand_device));
c->controller = nand_flash_controllers[i];
c->controller_priv = NULL;
@@ -288,9 +288,9 @@ int nand_register_commands(struct command_context_s *cmd_ctx)
return ERROR_OK;
}
-nand_device_t *get_nand_device_by_num(int num)
+struct nand_device *get_nand_device_by_num(int num)
{
- nand_device_t *p;
+ struct nand_device *p;
int i = 0;
for (p = nand_devices; p; p = p->next)
@@ -305,7 +305,7 @@ nand_device_t *get_nand_device_by_num(int num)
}
int nand_command_get_device_by_num(struct command_context_s *cmd_ctx,
- const char *str, nand_device_t **nand)
+ const char *str, struct nand_device **nand)
{
unsigned num;
COMMAND_PARSE_NUMBER(uint, str, num);
@@ -317,7 +317,7 @@ int nand_command_get_device_by_num(struct command_context_s *cmd_ctx,
return ERROR_OK;
}
-static int nand_build_bbt(struct nand_device_s *nand, int first, int last)
+static int nand_build_bbt(struct nand_device *nand, int first, int last)
{
uint32_t page = 0x0;
int i;
@@ -351,7 +351,7 @@ static int nand_build_bbt(struct nand_device_s *nand, int first, int last)
return ERROR_OK;
}
-int nand_read_status(struct nand_device_s *nand, uint8_t *status)
+int nand_read_status(struct nand_device *nand, uint8_t *status)
{
if (!nand->device)
return ERROR_NAND_DEVICE_NOT_PROBED;
@@ -376,7 +376,7 @@ int nand_read_status(struct nand_device_s *nand, uint8_t *status)
return ERROR_OK;
}
-static int nand_poll_ready(struct nand_device_s *nand, int timeout)
+static int nand_poll_ready(struct nand_device *nand, int timeout)
{
uint8_t status;
@@ -397,7 +397,7 @@ static int nand_poll_ready(struct nand_device_s *nand, int timeout)
return (status & NAND_STATUS_READY) != 0;
}
-int nand_probe(struct nand_device_s *nand)
+int nand_probe(struct nand_device *nand)
{
uint8_t manufacturer_id, device_id;
uint8_t id_buff[6];
@@ -615,7 +615,7 @@ int nand_probe(struct nand_device_s *nand)
return ERROR_OK;
}
-static int nand_erase(struct nand_device_s *nand, int first_block, int last_block)
+static int nand_erase(struct nand_device *nand, int first_block, int last_block)
{
int i;
uint32_t page;
@@ -704,7 +704,7 @@ static int nand_erase(struct nand_device_s *nand, int first_block, int last_bloc
}
#if 0
-static int nand_read_plain(struct nand_device_s *nand, uint32_t address, uint8_t *data, uint32_t data_size)
+static int nand_read_plain(struct nand_device *nand, uint32_t address, uint8_t *data, uint32_t data_size)
{
uint8_t *page;
@@ -741,7 +741,7 @@ static int nand_read_plain(struct nand_device_s *nand, uint32_t address, uint8_t
return ERROR_OK;
}
-static int nand_write_plain(struct nand_device_s *nand, uint32_t address, uint8_t *data, uint32_t data_size)
+static int nand_write_plain(struct nand_device *nand, uint32_t address, uint8_t *data, uint32_t data_size)
{
uint8_t *page;
@@ -779,7 +779,7 @@ static int nand_write_plain(struct nand_device_s *nand, uint32_t address, uint8_
}
#endif
-int nand_write_page(struct nand_device_s *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
+int nand_write_page(struct nand_device *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
{
uint32_t block;
@@ -796,7 +796,7 @@ int nand_write_page(struct nand_device_s *nand, uint32_t page, uint8_t *data, ui
return nand->controller->write_page(nand, page, data, data_size, oob, oob_size);
}
-static int nand_read_page(struct nand_device_s *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
+static int nand_read_page(struct nand_device *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
{
if (!nand->device)
return ERROR_NAND_DEVICE_NOT_PROBED;
@@ -807,7 +807,7 @@ static int nand_read_page(struct nand_device_s *nand, uint32_t page, uint8_t *da
return nand->controller->read_page(nand, page, data, data_size, oob, oob_size);
}
-int nand_read_page_raw(struct nand_device_s *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
+int nand_read_page_raw(struct nand_device *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
{
uint32_t i;
@@ -921,7 +921,7 @@ int nand_read_page_raw(struct nand_device_s *nand, uint32_t page, uint8_t *data,
return ERROR_OK;
}
-int nand_write_page_raw(struct nand_device_s *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
+int nand_write_page_raw(struct nand_device *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
{
uint32_t i;
int retval;
@@ -1044,7 +1044,7 @@ int nand_write_page_raw(struct nand_device_s *nand, uint32_t page, uint8_t *data
COMMAND_HANDLER(handle_nand_list_command)
{
- nand_device_t *p;
+ struct nand_device *p;
int i;
if (!nand_devices)
@@ -1076,7 +1076,7 @@ COMMAND_HANDLER(handle_nand_info_command)
int first = -1;
int last = -1;
- nand_device_t *p;
+ struct nand_device *p;
int retval = nand_command_get_device_by_num(cmd_ctx, args[0], &p);
if (ERROR_OK != retval)
return retval;
@@ -1151,7 +1151,7 @@ COMMAND_HANDLER(handle_nand_probe_command)
return ERROR_COMMAND_SYNTAX_ERROR;
}
- nand_device_t *p;
+ struct nand_device *p;
int retval = nand_command_get_device_by_num(cmd_ctx, args[0], &p);
if (ERROR_OK != retval)
return retval;
@@ -1180,7 +1180,7 @@ COMMAND_HANDLER(handle_nand_erase_command)
}
- nand_device_t *p;
+ struct nand_device *p;
int retval = nand_command_get_device_by_num(cmd_ctx, args[0], &p);
if (ERROR_OK != retval)
return retval;
@@ -1239,7 +1239,7 @@ COMMAND_HANDLER(handle_nand_check_bad_blocks_command)
}
- nand_device_t *p;
+ struct nand_device *p;
int retval = nand_command_get_device_by_num(cmd_ctx, args[0], &p);
if (ERROR_OK != retval)
return retval;
@@ -1300,7 +1300,7 @@ COMMAND_HANDLER(handle_nand_write_command)
return ERROR_COMMAND_SYNTAX_ERROR;
}
- nand_device_t *p;
+ struct nand_device *p;
int retval = nand_command_get_device_by_num(cmd_ctx, args[0], &p);
if (ERROR_OK != retval)
return retval;
@@ -1458,7 +1458,7 @@ COMMAND_HANDLER(handle_nand_dump_command)
return ERROR_COMMAND_SYNTAX_ERROR;
}
- nand_device_t *p;
+ struct nand_device *p;
int retval = nand_command_get_device_by_num(cmd_ctx, args[0], &p);
if (ERROR_OK != retval)
return retval;
@@ -1575,7 +1575,7 @@ COMMAND_HANDLER(handle_nand_raw_access_command)
return ERROR_COMMAND_SYNTAX_ERROR;
}
- nand_device_t *p;
+ struct nand_device *p;
int retval = nand_command_get_device_by_num(cmd_ctx, args[0], &p);
if (ERROR_OK != retval)
return retval;
diff --git a/src/flash/nand.h b/src/flash/nand.h
index c6d40751..80963095 100644
--- a/src/flash/nand.h
+++ b/src/flash/nand.h
@@ -27,28 +27,28 @@
#include "flash.h"
-struct nand_device_s;
+struct nand_device;
#define __NAND_DEVICE_COMMAND(name) \
- COMMAND_HELPER(name, struct nand_device_s *nand)
+ COMMAND_HELPER(name, struct nand_device *nand)
struct nand_flash_controller
{
char *name;
__NAND_DEVICE_COMMAND((*nand_device_command));
int (*register_commands)(struct command_context_s *cmd_ctx);
- int (*init)(struct nand_device_s *nand);
- int (*reset)(struct nand_device_s *nand);
- int (*command)(struct nand_device_s *nand, uint8_t command);
- int (*address)(struct nand_device_s *nand, uint8_t address);
- int (*write_data)(struct nand_device_s *nand, uint16_t data);
- int (*read_data)(struct nand_device_s *nand, void *data);
- int (*write_block_data)(struct nand_device_s *nand, uint8_t *data, int size);
- int (*read_block_data)(struct nand_device_s *nand, uint8_t *data, int size);
- int (*write_page)(struct nand_device_s *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size);
- int (*read_page)(struct nand_device_s *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size);
- int (*controller_ready)(struct nand_device_s *nand, int timeout);
- int (*nand_ready)(struct nand_device_s *nand, int timeout);
+ int (*init)(struct nand_device *nand);
+ int (*reset)(struct nand_device *nand);
+ int (*command)(struct nand_device *nand, uint8_t command);
+ int (*address)(struct nand_device *nand, uint8_t address);
+ int (*write_data)(struct nand_device *nand, uint16_t data);
+ int (*read_data)(struct nand_device *nand, void *data);
+ int (*write_block_data)(struct nand_device *nand, uint8_t *data, int size);
+ int (*read_block_data)(struct nand_device *nand, uint8_t *data, int size);
+ int (*write_page)(struct nand_device *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size);
+ int (*read_page)(struct nand_device *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size);
+ int (*controller_ready)(struct nand_device *nand, int timeout);
+ int (*nand_ready)(struct nand_device *nand, int timeout);
};
#define NAND_DEVICE_COMMAND_HANDLER(name) static __NAND_DEVICE_COMMAND(name)
@@ -73,7 +73,7 @@ struct nand_ecclayout {
struct nand_oobfree oobfree[2];
};
-typedef struct nand_device_s
+struct nand_device
{
struct nand_flash_controller *controller;
void *controller_priv;
@@ -86,8 +86,8 @@ typedef struct nand_device_s
int use_raw;
int num_blocks;
struct nand_block *blocks;
- struct nand_device_s *next;
-} nand_device_t;
+ struct nand_device *next;
+};
/* NAND Flash Manufacturer ID Codes
*/
@@ -212,18 +212,18 @@ enum oob_formats
};
-nand_device_t *get_nand_device_by_num(int num);
+struct nand_device *get_nand_device_by_num(int num);
-int nand_read_page_raw(struct nand_device_s *nand, uint32_t page,
+int nand_read_page_raw(struct nand_device *nand, uint32_t page,
uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size);
-int nand_write_page_raw(struct nand_device_s *nand, uint32_t page,
+int nand_write_page_raw(struct nand_device *nand, uint32_t page,
uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size);
-int nand_read_status(struct nand_device_s *nand, uint8_t *status);
+int nand_read_status(struct nand_device *nand, uint8_t *status);
-int nand_calculate_ecc(struct nand_device_s *nand,
+int nand_calculate_ecc(struct nand_device *nand,
const uint8_t *dat, uint8_t *ecc_code);
-int nand_calculate_ecc_kw(struct nand_device_s *nand,
+int nand_calculate_ecc_kw(struct nand_device *nand,
const uint8_t *dat, uint8_t *ecc_code);
int nand_register_commands(struct command_context_s *cmd_ctx);
@@ -231,7 +231,7 @@ int nand_init(struct command_context_s *cmd_ctx);
/// helper for parsing a nand device command argument string
int nand_command_get_device_by_num(struct command_context_s *cmd_ctx,
- const char *str, nand_device_t **nand);
+ const char *str, struct nand_device **nand);
#define ERROR_NAND_DEVICE_INVALID (-1100)
diff --git a/src/flash/nand_ecc.c b/src/flash/nand_ecc.c
index 81d2bebc..7aa1519d 100644
--- a/src/flash/nand_ecc.c
+++ b/src/flash/nand_ecc.c
@@ -68,7 +68,7 @@ static const uint8_t nand_ecc_precalc_table[] = {
/*
* nand_calculate_ecc - Calculate 3-byte ECC for 256-byte block
*/
-int nand_calculate_ecc(struct nand_device_s *nand, const uint8_t *dat, uint8_t *ecc_code)
+int nand_calculate_ecc(struct nand_device *nand, const uint8_t *dat, uint8_t *ecc_code)
{
uint8_t idx, reg1, reg2, reg3, tmp1, tmp2;
int i;
diff --git a/src/flash/nand_ecc_kw.c b/src/flash/nand_ecc_kw.c
index 2f6fc4a6..a809b322 100644
--- a/src/flash/nand_ecc_kw.c
+++ b/src/flash/nand_ecc_kw.c
@@ -100,7 +100,7 @@ static void gf_build_log_exp_table(void)
* expects the ECC to be computed backward, i.e. from the last byte down
* to the first one.
*/
-int nand_calculate_ecc_kw(struct nand_device_s *nand, const uint8_t *data, uint8_t *ecc)
+int nand_calculate_ecc_kw(struct nand_device *nand, const uint8_t *data, uint8_t *ecc)
{
unsigned int r7, r6, r5, r4, r3, r2, r1, r0;
int i;
diff --git a/src/flash/orion_nand.c b/src/flash/orion_nand.c
index d6519f2f..0d4e1ea8 100644
--- a/src/flash/orion_nand.c
+++ b/src/flash/orion_nand.c
@@ -49,7 +49,7 @@ struct orion_nand_controller
} \
} while (0)
-static int orion_nand_command(struct nand_device_s *nand, uint8_t command)
+static int orion_nand_command(struct nand_device *nand, uint8_t command)
{
struct orion_nand_controller *hw = nand->controller_priv;
struct target *target = hw->target;
@@ -59,7 +59,7 @@ static int orion_nand_command(struct nand_device_s *nand, uint8_t command)
return ERROR_OK;
}
-static int orion_nand_address(struct nand_device_s *nand, uint8_t address)
+static int orion_nand_address(struct nand_device *nand, uint8_t address)
{
struct orion_nand_controller *hw = nand->controller_priv;
struct target *target = hw->target;
@@ -69,7 +69,7 @@ static int orion_nand_address(struct nand_device_s *nand, uint8_t address)
return ERROR_OK;
}
-static int orion_nand_read(struct nand_device_s *nand, void *data)
+static int orion_nand_read(struct nand_device *nand, void *data)
{
struct orion_nand_controller *hw = nand->controller_priv;
struct target *target = hw->target;
@@ -79,7 +79,7 @@ static int orion_nand_read(struct nand_device_s *nand, void *data)
return ERROR_OK;
}
-static int orion_nand_write(struct nand_device_s *nand, uint16_t data)
+static int orion_nand_write(struct nand_device *nand, uint16_t data)
{
struct orion_nand_controller *hw = nand->controller_priv;
struct target *target = hw->target;
@@ -89,14 +89,14 @@ static int orion_nand_write(struct nand_device_s *nand, uint16_t data)
return ERROR_OK;
}
-static int orion_nand_slow_block_write(struct nand_device_s *nand, uint8_t *data, int size)
+static int orion_nand_slow_block_write(struct nand_device *nand, uint8_t *data, int size)
{
while (size--)
orion_nand_write(nand, *data++);
return ERROR_OK;
}
-static int orion_nand_fast_block_write(struct nand_device_s *nand, uint8_t *data, int size)
+static int orion_nand_fast_block_write(struct nand_device *nand, uint8_t *data, int size)
{
struct orion_nand_controller *hw = nand->controller_priv;
int retval;
@@ -110,12 +110,12 @@ static int orion_nand_fast_block_write(struct nand_device_s *nand, uint8_t *data
return retval;
}
-static int orion_nand_reset(struct nand_device_s *nand)
+static int orion_nand_reset(struct nand_device *nand)
{
return orion_nand_command(nand, NAND_CMD_RESET);
}
-static int orion_nand_controller_ready(struct nand_device_s *nand, int timeout)
+static int orion_nand_controller_ready(struct nand_device *nand, int timeout)
{
return 1;
}
@@ -164,7 +164,7 @@ NAND_DEVICE_COMMAND_HANDLER(orion_nand_device_command)
return ERROR_OK;
}
-static int orion_nand_init(struct nand_device_s *nand)
+static int orion_nand_init(struct nand_device *nand)
{
return ERROR_OK;
}
diff --git a/src/flash/s3c2410_nand.c b/src/flash/s3c2410_nand.c
index 23795fbd..6fe8bae7 100644
--- a/src/flash/s3c2410_nand.c
+++ b/src/flash/s3c2410_nand.c
@@ -44,7 +44,7 @@ NAND_DEVICE_COMMAND_HANDLER(s3c2410_nand_device_command)
return ERROR_OK;
}
-static int s3c2410_init(struct nand_device_s *nand)
+static int s3c2410_init(struct nand_device *nand)
{
struct s3c24xx_nand_controller *s3c24xx_info = nand->controller_priv;
struct target *target = s3c24xx_info->target;
@@ -56,7 +56,7 @@ static int s3c2410_init(struct nand_device_s *nand)
return ERROR_OK;
}
-static int s3c2410_write_data(struct nand_device_s *nand, uint16_t data)
+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;
@@ -70,7 +70,7 @@ static int s3c2410_write_data(struct nand_device_s *nand, uint16_t data)
return ERROR_OK;
}
-static int s3c2410_read_data(struct nand_device_s *nand, void *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;
@@ -84,7 +84,7 @@ static int s3c2410_read_data(struct nand_device_s *nand, void *data)
return ERROR_OK;
}
-static int s3c2410_nand_ready(struct nand_device_s *nand, int timeout)
+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;
diff --git a/src/flash/s3c2412_nand.c b/src/flash/s3c2412_nand.c
index 85219322..2ca4cd31 100644
--- a/src/flash/s3c2412_nand.c
+++ b/src/flash/s3c2412_nand.c
@@ -44,7 +44,7 @@ NAND_DEVICE_COMMAND_HANDLER(s3c2412_nand_device_command)
return ERROR_OK;
}
-static int s3c2412_init(struct nand_device_s *nand)
+static int s3c2412_init(struct nand_device *nand)
{
struct s3c24xx_nand_controller *s3c24xx_info = nand->controller_priv;
struct target *target = s3c24xx_info->target;
diff --git a/src/flash/s3c2440_nand.c b/src/flash/s3c2440_nand.c
index 44ac3c2a..65e5a511 100644
--- a/src/flash/s3c2440_nand.c
+++ b/src/flash/s3c2440_nand.c
@@ -45,7 +45,7 @@ NAND_DEVICE_COMMAND_HANDLER(s3c2440_nand_device_command)
return ERROR_OK;
}
-static int s3c2440_init(struct nand_device_s *nand)
+static int s3c2440_init(struct nand_device *nand)
{
struct s3c24xx_nand_controller *s3c24xx_info = nand->controller_priv;
struct target *target = s3c24xx_info->target;
@@ -61,7 +61,7 @@ static int s3c2440_init(struct nand_device_s *nand)
return ERROR_OK;
}
-int s3c2440_nand_ready(struct nand_device_s *nand, int timeout)
+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;
@@ -87,7 +87,7 @@ int s3c2440_nand_ready(struct nand_device_s *nand, int timeout)
/* use the fact we can read/write 4 bytes in one go via a single 32bit op */
-int s3c2440_read_block_data(struct nand_device_s *nand, uint8_t *data, int data_size)
+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;
@@ -123,7 +123,7 @@ int s3c2440_read_block_data(struct nand_device_s *nand, uint8_t *data, int data_
return ERROR_OK;
}
-int s3c2440_write_block_data(struct nand_device_s *nand, uint8_t *data, int data_size)
+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;
diff --git a/src/flash/s3c2443_nand.c b/src/flash/s3c2443_nand.c
index c1441647..5afb26fc 100644
--- a/src/flash/s3c2443_nand.c
+++ b/src/flash/s3c2443_nand.c
@@ -45,7 +45,7 @@ NAND_DEVICE_COMMAND_HANDLER(s3c2443_nand_device_command)
return ERROR_OK;
}
-static int s3c2443_init(struct nand_device_s *nand)
+static int s3c2443_init(struct nand_device *nand)
{
struct s3c24xx_nand_controller *s3c24xx_info = nand->controller_priv;
struct target *target = s3c24xx_info->target;
diff --git a/src/flash/s3c24xx_nand.c b/src/flash/s3c24xx_nand.c
index 5125fd26..5b2d191f 100644
--- a/src/flash/s3c24xx_nand.c
+++ b/src/flash/s3c24xx_nand.c
@@ -57,7 +57,7 @@ int s3c24xx_register_commands(struct command_context_s *cmd_ctx)
return ERROR_OK;
}
-int s3c24xx_reset(struct nand_device_s *nand)
+int s3c24xx_reset(struct nand_device *nand)
{
struct s3c24xx_nand_controller *s3c24xx_info = nand->controller_priv;
struct target *target = s3c24xx_info->target;
@@ -72,7 +72,7 @@ int s3c24xx_reset(struct nand_device_s *nand)
return ERROR_OK;
}
-int s3c24xx_command(struct nand_device_s *nand, uint8_t command)
+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;
@@ -87,7 +87,7 @@ int s3c24xx_command(struct nand_device_s *nand, uint8_t command)
}
-int s3c24xx_address(struct nand_device_s *nand, uint8_t address)
+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;
@@ -101,7 +101,7 @@ int s3c24xx_address(struct nand_device_s *nand, uint8_t address)
return ERROR_OK;
}
-int s3c24xx_write_data(struct nand_device_s *nand, uint16_t data)
+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;
@@ -115,7 +115,7 @@ int s3c24xx_write_data(struct nand_device_s *nand, uint16_t data)
return ERROR_OK;
}
-int s3c24xx_read_data(struct nand_device_s *nand, void *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;
@@ -129,7 +129,7 @@ int s3c24xx_read_data(struct nand_device_s *nand, void *data)
return ERROR_OK;
}
-int s3c24xx_controller_ready(struct nand_device_s *nand, int timeout)
+int s3c24xx_controller_ready(struct nand_device *nand, int timeout)
{
return 1;
}
diff --git a/src/flash/s3c24xx_nand.h b/src/flash/s3c24xx_nand.h
index ed885916..41c95f52 100644
--- a/src/flash/s3c24xx_nand.h
+++ b/src/flash/s3c24xx_nand.h
@@ -47,7 +47,7 @@ struct s3c24xx_nand_controller
#define S3C24XX_DEVICE_COMMAND() \
COMMAND_HELPER(s3c24xx_nand_device_command, \
- struct nand_device_s *nand, \
+ struct nand_device *nand, \
struct s3c24xx_nand_controller **info)
S3C24XX_DEVICE_COMMAND();
@@ -61,26 +61,26 @@ S3C24XX_DEVICE_COMMAND();
int s3c24xx_register_commands(struct command_context_s *cmd_ctx);
-int s3c24xx_reset(struct nand_device_s *nand);
+int s3c24xx_reset(struct nand_device *nand);
-int s3c24xx_command(struct nand_device_s *nand, uint8_t command);
-int s3c24xx_address(struct nand_device_s *nand, uint8_t address);
+int s3c24xx_command(struct nand_device *nand, uint8_t command);
+int s3c24xx_address(struct nand_device *nand, uint8_t address);
-int s3c24xx_write_data(struct nand_device_s *nand, uint16_t data);
-int s3c24xx_read_data(struct nand_device_s *nand, void *data);
+int s3c24xx_write_data(struct nand_device *nand, uint16_t data);
+int s3c24xx_read_data(struct nand_device *nand, void *data);
-int s3c24xx_controller_ready(struct nand_device_s *nand, int tout);
+int s3c24xx_controller_ready(struct nand_device *nand, int tout);
#define s3c24xx_write_page NULL
#define s3c24xx_read_page NULL
/* code shared between different controllers */
-int s3c2440_nand_ready(struct nand_device_s *nand, int timeout);
+int s3c2440_nand_ready(struct nand_device *nand, int timeout);
-int s3c2440_read_block_data(struct nand_device_s *nand,
+int s3c2440_read_block_data(struct nand_device *nand,
uint8_t *data, int data_size);
-int s3c2440_write_block_data(struct nand_device_s *nand,
+int s3c2440_write_block_data(struct nand_device *nand,
uint8_t *data, int data_size);
#endif // S3C24xx_NAND_H