Remove misleading typedef and redundant suffix from struct nand_device.
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);
};
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;
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;
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;
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;
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;
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;
/* 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;
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;
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;
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;
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;
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;
/*
* 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;
* 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[] = {
* 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;
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);
#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>
*/
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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]);
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)
{
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;
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;
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);
}
return ERROR_OK;
}
-static int imx31_reset (struct nand_device_s *nand)
+static int imx31_reset (struct nand_device *nand)
{
/*
* validate target state
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;
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;
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;
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)
{
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)
{
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;
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;
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;
#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
*/
};
/* 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
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)
{
return retval;
}
- c = malloc(sizeof(nand_device_t));
+ c = malloc(sizeof(struct nand_device));
c->controller = nand_flash_controllers[i];
c->controller_priv = NULL;
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)
}
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);
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;
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;
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;
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];
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;
}
#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;
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;
}
#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;
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;
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;
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;
COMMAND_HANDLER(handle_nand_list_command)
{
- nand_device_t *p;
+ struct nand_device *p;
int i;
if (!nand_devices)
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;
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;
}
- 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;
}
- 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;
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;
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;
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;
#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)
struct nand_oobfree oobfree[2];
};
-typedef struct nand_device_s
+struct nand_device
{
struct nand_flash_controller *controller;
void *controller_priv;
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
*/
};
-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);
/// 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)
/*
* 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;
* 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;
} \
} 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;
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;
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;
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;
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;
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;
}
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;
}
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;
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;
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;
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;
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;
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;
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;
/* 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;
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;
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;
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;
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;
}
-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;
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;
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;
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;
}
#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();
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