dfu: unify mmc/nand read/write ops enum

MMC and NAND independently defines same enumerators for read/write.
Unify them by defining enum in dfu header. RAM support that is being
added newly also can make use of it.

Signed-off-by: Afzal Mohammed <afzal.mohd.ma@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
Acked-by: Lukasz Majewski <l.majewski@samsung.com>
Acked-by: Marek Vasut <marex@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>
This commit is contained in:
Afzal Mohammed 2013-09-18 01:14:50 +05:30 committed by Marek Vasut
parent 765c5ae5bc
commit 5a127c8433
3 changed files with 8 additions and 13 deletions

View file

@ -13,16 +13,11 @@
#include <div64.h> #include <div64.h>
#include <dfu.h> #include <dfu.h>
enum dfu_mmc_op {
DFU_OP_READ = 1,
DFU_OP_WRITE,
};
static unsigned char __aligned(CONFIG_SYS_CACHELINE_SIZE) static unsigned char __aligned(CONFIG_SYS_CACHELINE_SIZE)
dfu_file_buf[CONFIG_SYS_DFU_MAX_FILE_SIZE]; dfu_file_buf[CONFIG_SYS_DFU_MAX_FILE_SIZE];
static long dfu_file_buf_len; static long dfu_file_buf_len;
static int mmc_block_op(enum dfu_mmc_op op, struct dfu_entity *dfu, static int mmc_block_op(enum dfu_op op, struct dfu_entity *dfu,
u64 offset, void *buf, long *len) u64 offset, void *buf, long *len)
{ {
char cmd_buf[DFU_CMD_BUF_SIZE]; char cmd_buf[DFU_CMD_BUF_SIZE];
@ -65,7 +60,7 @@ static int mmc_file_buffer(struct dfu_entity *dfu, void *buf, long *len)
return 0; return 0;
} }
static int mmc_file_op(enum dfu_mmc_op op, struct dfu_entity *dfu, static int mmc_file_op(enum dfu_op op, struct dfu_entity *dfu,
void *buf, long *len) void *buf, long *len)
{ {
char cmd_buf[DFU_CMD_BUF_SIZE]; char cmd_buf[DFU_CMD_BUF_SIZE];

View file

@ -19,12 +19,7 @@
#include <jffs2/load_kernel.h> #include <jffs2/load_kernel.h>
#include <nand.h> #include <nand.h>
enum dfu_nand_op { static int nand_block_op(enum dfu_op op, struct dfu_entity *dfu,
DFU_OP_READ = 1,
DFU_OP_WRITE,
};
static int nand_block_op(enum dfu_nand_op op, struct dfu_entity *dfu,
u64 offset, void *buf, long *len) u64 offset, void *buf, long *len)
{ {
loff_t start, lim; loff_t start, lim;

View file

@ -29,6 +29,11 @@ enum dfu_layout {
DFU_FS_EXT4, DFU_FS_EXT4,
}; };
enum dfu_op {
DFU_OP_READ = 1,
DFU_OP_WRITE,
};
struct mmc_internal_data { struct mmc_internal_data {
/* RAW programming */ /* RAW programming */
unsigned int lba_start; unsigned int lba_start;