diff options
author | Scott Wood <oss@buserror.net> | 2016-05-30 13:57:54 -0500 |
---|---|---|
committer | Scott Wood <oss@buserror.net> | 2016-06-03 20:27:48 -0500 |
commit | 151c06ec61d74b77cf27d6d622bab6370c949c66 (patch) | |
tree | fc50effb6cd876bf28ba3e6f3f143f0f51fd6db1 /common | |
parent | ea7d1eec66898b233ac49f8a60391b96afa25477 (diff) | |
download | u-boot-151c06ec61d74b77cf27d6d622bab6370c949c66.zip u-boot-151c06ec61d74b77cf27d6d622bab6370c949c66.tar.gz u-boot-151c06ec61d74b77cf27d6d622bab6370c949c66.tar.bz2 |
mtd: nand: Remove nand_info_t typedef
This typedef serves no purpose other than causing confusion with
struct nand_chip.
Signed-off-by: Scott Wood <oss@buserror.net>
Diffstat (limited to 'common')
-rw-r--r-- | common/env_nand.c | 6 | ||||
-rw-r--r-- | common/fb_nand.c | 32 |
2 files changed, 19 insertions, 19 deletions
diff --git a/common/env_nand.c b/common/env_nand.c index b32eeac..0debc2c 100644 --- a/common/env_nand.c +++ b/common/env_nand.c @@ -276,7 +276,7 @@ static int readenv(size_t offset, u_char *buf) #endif /* #if defined(CONFIG_SPL_BUILD) */ #ifdef CONFIG_ENV_OFFSET_OOB -int get_nand_env_oob(nand_info_t *nand, unsigned long *result) +int get_nand_env_oob(struct mtd_info *mtd, unsigned long *result) { struct mtd_oob_ops ops; uint32_t oob_buf[ENV_OFFSET_SIZE / sizeof(uint32_t)]; @@ -288,14 +288,14 @@ int get_nand_env_oob(nand_info_t *nand, unsigned long *result) ops.ooblen = ENV_OFFSET_SIZE; ops.oobbuf = (void *)oob_buf; - ret = nand->read_oob(nand, ENV_OFFSET_SIZE, &ops); + ret = mtd->read_oob(mtd, ENV_OFFSET_SIZE, &ops); if (ret) { printf("error reading OOB block 0\n"); return ret; } if (oob_buf[0] == ENV_OOB_MARKER) { - *result = oob_buf[1] * nand->erasesize; + *result = oob_buf[1] * mtd->erasesize; } else if (oob_buf[0] == ENV_OOB_MARKER_OLD) { *result = oob_buf[1]; } else { diff --git a/common/fb_nand.c b/common/fb_nand.c index 9ca8602..c770eff 100644 --- a/common/fb_nand.c +++ b/common/fb_nand.c @@ -19,7 +19,7 @@ static char *response_str; struct fb_nand_sparse { - nand_info_t *nand; + struct mtd_info *nand; struct part_info *part; }; @@ -34,7 +34,7 @@ __weak int board_fastboot_write_partition_setup(char *name) } static int fb_nand_lookup(const char *partname, char *response, - nand_info_t **nand, + struct mtd_info **nand, struct part_info **part) { struct mtd_device *dev; @@ -62,12 +62,12 @@ static int fb_nand_lookup(const char *partname, char *response, return -EINVAL; } - *nand = &nand_info[dev->id->num]; + *mtd = &nand_info[dev->id->num]; return 0; } -static int _fb_nand_erase(nand_info_t *nand, struct part_info *part) +static int _fb_nand_erase(struct mtd_info *mtd, struct part_info *part) { nand_erase_options_t opts; int ret; @@ -80,7 +80,7 @@ static int _fb_nand_erase(nand_info_t *nand, struct part_info *part) printf("Erasing blocks 0x%llx to 0x%llx\n", part->offset, part->offset + part->size); - ret = nand_erase_opts(nand, &opts); + ret = nand_erase_opts(mtd, &opts); if (ret) return ret; @@ -90,7 +90,7 @@ static int _fb_nand_erase(nand_info_t *nand, struct part_info *part) return 0; } -static int _fb_nand_write(nand_info_t *nand, struct part_info *part, +static int _fb_nand_write(struct mtd_info *mtd, struct part_info *part, void *buffer, unsigned int offset, unsigned int length, size_t *written) { @@ -100,7 +100,7 @@ static int _fb_nand_write(nand_info_t *nand, struct part_info *part, flags |= WITH_DROP_FFS; #endif - return nand_write_skip_bad(nand, offset, &length, written, + return nand_write_skip_bad(mtd, offset, &length, written, part->size - (offset - part->offset), buffer, flags); } @@ -131,13 +131,13 @@ void fb_nand_flash_write(const char *partname, unsigned int session_id, char *response) { struct part_info *part; - nand_info_t *nand = NULL; + struct mtd_info *mtd = NULL; int ret; /* initialize the response buffer */ response_str = response; - ret = fb_nand_lookup(partname, response, &nand, &part); + ret = fb_nand_lookup(partname, response, &mtd, &part); if (ret) { error("invalid NAND device"); fastboot_fail(response_str, "invalid NAND device"); @@ -152,10 +152,10 @@ void fb_nand_flash_write(const char *partname, unsigned int session_id, struct fb_nand_sparse sparse_priv; sparse_storage_t sparse; - sparse_priv.nand = nand; + sparse_priv.nand = mtd; sparse_priv.part = part; - sparse.block_sz = nand->writesize; + sparse.block_sz = mtd->writesize; sparse.start = part->offset / sparse.block_sz; sparse.size = part->size / sparse.block_sz; sparse.name = part->name; @@ -167,7 +167,7 @@ void fb_nand_flash_write(const char *partname, unsigned int session_id, printf("Flashing raw image at offset 0x%llx\n", part->offset); - ret = _fb_nand_write(nand, part, download_buffer, part->offset, + ret = _fb_nand_write(mtd, part, download_buffer, part->offset, download_bytes, NULL); printf("........ wrote %u bytes to '%s'\n", @@ -185,13 +185,13 @@ void fb_nand_flash_write(const char *partname, unsigned int session_id, void fb_nand_erase(const char *partname, char *response) { struct part_info *part; - nand_info_t *nand = NULL; + struct mtd_info *mtd = NULL; int ret; /* initialize the response buffer */ response_str = response; - ret = fb_nand_lookup(partname, response, &nand, &part); + ret = fb_nand_lookup(partname, response, &mtd, &part); if (ret) { error("invalid NAND device"); fastboot_fail(response_str, "invalid NAND device"); @@ -202,9 +202,9 @@ void fb_nand_erase(const char *partname, char *response) if (ret) return; - ret = _fb_nand_erase(nand, part); + ret = _fb_nand_erase(mtd, part); if (ret) { - error("failed erasing from device %s", nand->name); + error("failed erasing from device %s", mtd->name); fastboot_fail(response_str, "failed erasing from device"); return; } |