diff options
author | Scott Wood <oss@buserror.net> | 2016-05-30 18:57:55 (GMT) |
---|---|---|
committer | Scott Wood <oss@buserror.net> | 2016-06-04 01:27:48 (GMT) |
commit | b616d9b0a708eb90eb474e1b6ec6dfe4c48a1678 (patch) | |
tree | e3710a7c0725a062e6049fe6c281575587ea6b66 /common | |
parent | 151c06ec61d74b77cf27d6d622bab6370c949c66 (diff) | |
download | u-boot-b616d9b0a708eb90eb474e1b6ec6dfe4c48a1678.tar.xz |
nand: Embed mtd_info in struct nand_chip
nand_info[] is now an array of pointers, with the actual mtd_info
instance embedded in struct nand_chip.
This is in preparation for syncing the NAND code with Linux 4.6,
which makes the same change to struct nand_chip. It's in a separate
commit due to the large amount of changes required to accommodate the
change to nand_info[].
Signed-off-by: Scott Wood <oss@buserror.net>
Diffstat (limited to 'common')
-rw-r--r-- | common/env_nand.c | 18 | ||||
-rw-r--r-- | common/fb_nand.c | 2 | ||||
-rw-r--r-- | common/splash_source.c | 4 |
3 files changed, 12 insertions, 12 deletions
diff --git a/common/env_nand.c b/common/env_nand.c index 0debc2c..fc99a5e 100644 --- a/common/env_nand.c +++ b/common/env_nand.c @@ -132,15 +132,15 @@ static int writeenv(size_t offset, u_char *buf) size_t blocksize, len; u_char *char_ptr; - blocksize = nand_info[0].erasesize; + blocksize = nand_info[0]->erasesize; len = min(blocksize, (size_t)CONFIG_ENV_SIZE); while (amount_saved < CONFIG_ENV_SIZE && offset < end) { - if (nand_block_isbad(&nand_info[0], offset)) { + if (nand_block_isbad(nand_info[0], offset)) { offset += blocksize; } else { char_ptr = &buf[amount_saved]; - if (nand_write(&nand_info[0], offset, &len, char_ptr)) + if (nand_write(nand_info[0], offset, &len, char_ptr)) return 1; offset += blocksize; @@ -164,7 +164,7 @@ static int erase_and_write_env(const struct env_location *location, int ret = 0; printf("Erasing %s...\n", location->name); - if (nand_erase_opts(&nand_info[0], &location->erase_opts)) + if (nand_erase_opts(nand_info[0], &location->erase_opts)) return 1; printf("Writing to %s... ", location->name); @@ -247,20 +247,20 @@ static int readenv(size_t offset, u_char *buf) size_t blocksize, len; u_char *char_ptr; - blocksize = nand_info[0].erasesize; + blocksize = nand_info[0]->erasesize; if (!blocksize) return 1; len = min(blocksize, (size_t)CONFIG_ENV_SIZE); while (amount_loaded < CONFIG_ENV_SIZE && offset < end) { - if (nand_block_isbad(&nand_info[0], offset)) { + if (nand_block_isbad(nand_info[0], offset)) { offset += blocksize; } else { char_ptr = &buf[amount_loaded]; - if (nand_read_skip_bad(&nand_info[0], offset, + if (nand_read_skip_bad(nand_info[0], offset, &len, NULL, - nand_info[0].size, char_ptr)) + nand_info[0]->size, char_ptr)) return 1; offset += blocksize; @@ -387,7 +387,7 @@ void env_relocate_spec(void) ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE); #if defined(CONFIG_ENV_OFFSET_OOB) - ret = get_nand_env_oob(&nand_info[0], &nand_env_oob_offset); + ret = get_nand_env_oob(nand_info[0], &nand_env_oob_offset); /* * If unable to read environment offset from NAND OOB then fall through * to the normal environment reading code below diff --git a/common/fb_nand.c b/common/fb_nand.c index c770eff..e55ea38 100644 --- a/common/fb_nand.c +++ b/common/fb_nand.c @@ -62,7 +62,7 @@ static int fb_nand_lookup(const char *partname, char *response, return -EINVAL; } - *mtd = &nand_info[dev->id->num]; + *mtd = nand_info[dev->id->num]; return 0; } diff --git a/common/splash_source.c b/common/splash_source.c index a09dd4b..f86a78a 100644 --- a/common/splash_source.c +++ b/common/splash_source.c @@ -45,9 +45,9 @@ static int splash_sf_read_raw(u32 bmp_load_addr, int offset, size_t read_size) #ifdef CONFIG_CMD_NAND static int splash_nand_read_raw(u32 bmp_load_addr, int offset, size_t read_size) { - return nand_read_skip_bad(&nand_info[nand_curr_device], offset, + return nand_read_skip_bad(nand_info[nand_curr_device], offset, &read_size, NULL, - nand_info[nand_curr_device].size, + nand_info[nand_curr_device]->size, (u_char *)bmp_load_addr); } #else |