summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorGrygorii Strashko <grygorii.strashko@ti.com>2017-06-27 00:12:57 (GMT)
committerTom Rini <trini@konsulko.com>2017-07-12 02:41:47 (GMT)
commiteb6a5c3c020099bbbc41cf3509718828ec1733cc (patch)
tree149864980c596e579d634f2eb7a5ae58f623f6a4 /fs
parentedba8cc4f363112597466909e99b20a3b4469447 (diff)
downloadu-boot-fsl-qoriq-eb6a5c3c020099bbbc41cf3509718828ec1733cc.tar.xz
fs: use get_nand_dev_by_index()
As part of preparation for nand DM conversion the new API has been introduced to remove direct access to nand_info array. So, use it here instead of accessing to nand_info array directly. Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/jffs2/jffs2_1pass.c9
-rw-r--r--fs/jffs2/jffs2_nand_1pass.c6
-rw-r--r--fs/yaffs2/yaffs_uboot_glue.c8
3 files changed, 18 insertions, 5 deletions
diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
index ed60c5b..4c6dfbf 100644
--- a/fs/jffs2/jffs2_1pass.c
+++ b/fs/jffs2/jffs2_1pass.c
@@ -175,10 +175,15 @@ static u32 nand_cache_off = (u32)-1;
static int read_nand_cached(u32 off, u32 size, u_char *buf)
{
struct mtdids *id = current_part->dev->id;
+ struct mtd_info *mtd;
u32 bytes_read = 0;
size_t retlen;
int cpy_bytes;
+ mtd = get_nand_dev_by_index(id->num);
+ if (!mtd)
+ return -1;
+
while (bytes_read < size) {
if ((off + bytes_read < nand_cache_off) ||
(off + bytes_read >= nand_cache_off+NAND_CACHE_SIZE)) {
@@ -195,8 +200,8 @@ static int read_nand_cached(u32 off, u32 size, u_char *buf)
}
retlen = NAND_CACHE_SIZE;
- if (nand_read(nand_info[id->num], nand_cache_off,
- &retlen, nand_cache) != 0 ||
+ if (nand_read(mtd, nand_cache_off,
+ &retlen, nand_cache) != 0 ||
retlen != NAND_CACHE_SIZE) {
printf("read_nand_cached: error reading nand off %#x size %d bytes\n",
nand_cache_off, NAND_CACHE_SIZE);
diff --git a/fs/jffs2/jffs2_nand_1pass.c b/fs/jffs2/jffs2_nand_1pass.c
index d94c48f..1d63fc9 100644
--- a/fs/jffs2/jffs2_nand_1pass.c
+++ b/fs/jffs2/jffs2_nand_1pass.c
@@ -796,7 +796,11 @@ jffs2_1pass_build_lists(struct part_info * part)
u32 counterN = 0;
struct mtdids *id = part->dev->id;
- mtd = nand_info[id->num];
+ mtd = get_nand_dev_by_index(id->num);
+ if (!mtd) {
+ error("\nno NAND devices available\n");
+ return 0;
+ }
/* if we are building a list we need to refresh the cache. */
jffs_init_1pass_list(part);
diff --git a/fs/yaffs2/yaffs_uboot_glue.c b/fs/yaffs2/yaffs_uboot_glue.c
index f663081..bd66d31 100644
--- a/fs/yaffs2/yaffs_uboot_glue.c
+++ b/fs/yaffs2/yaffs_uboot_glue.c
@@ -166,11 +166,15 @@ void cmd_yaffs_devconfig(char *_mp, int flash_dev,
char *mp = NULL;
struct nand_chip *chip;
+ mtd = get_nand_dev_by_index(flash_dev);
+ if (!mtd) {
+ error("\nno NAND devices available\n");
+ return;
+ }
+
dev = calloc(1, sizeof(*dev));
mp = strdup(_mp);
- mtd = nand_info[flash_dev];
-
if (!dev || !mp) {
/* Alloc error */
printf("Failed to allocate memory\n");