summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2016-06-04 12:49:47 (GMT)
committerTom Rini <trini@konsulko.com>2016-06-04 12:49:47 (GMT)
commit715b3a9b2486e8d7a32365d817c77209b35ee796 (patch)
tree5daa126a15d2e0d60156664d19adbf451324d098 /common
parentc41c649c2fdec7bf6ef84173597cc3feabdb7828 (diff)
parent667067faa18334f1e28c01b47530b5cce1b6182f (diff)
downloadu-boot-715b3a9b2486e8d7a32365d817c77209b35ee796.tar.xz
Merge git://git.denx.de/u-boot-nand-flash
Diffstat (limited to 'common')
-rw-r--r--common/env_nand.c24
-rw-r--r--common/fb_nand.c32
-rw-r--r--common/splash_source.c4
3 files changed, 30 insertions, 30 deletions
diff --git a/common/env_nand.c b/common/env_nand.c
index b32eeac..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;
@@ -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 {
@@ -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 9ca8602..e55ea38 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;
}
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