X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=cmd%2Fjffs2.c;h=64621f2546602af59bcf862d7628b04ae50f64f2;hb=3c1eaec012ad3105b8bf787de0672d8739b5ec54;hp=0b2eefa195436d3e5faaaa428ad2677e83a0e77c;hpb=9ef2835f26652092a61b0cb0551ef4f36be27946;p=u-boot diff --git a/cmd/jffs2.c b/cmd/jffs2.c index 0b2eefa195..64621f2546 100644 --- a/cmd/jffs2.c +++ b/cmd/jffs2.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * (C) Copyright 2002 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. @@ -17,8 +18,6 @@ * * $Id: cmdlinepart.c,v 1.17 2004/11/26 11:18:47 lavinen Exp $ * Copyright 2002 SYSGO Real-Time Solutions GmbH - * - * SPDX-License-Identifier: GPL-2.0+ */ /* @@ -80,7 +79,7 @@ #include #if defined(CONFIG_CMD_NAND) -#include +#include #include #endif @@ -166,8 +165,9 @@ static int mtd_device_validate(u8 type, u8 num, u32 *size) #endif } else if (type == MTD_DEV_TYPE_NAND) { #if defined(CONFIG_JFFS2_NAND) && defined(CONFIG_CMD_NAND) - if (num < CONFIG_SYS_MAX_NAND_DEVICE) { - *size = nand_info[num].size; + struct mtd_info *mtd = get_nand_dev_by_index(num); + if (mtd) { + *size = mtd->size; return 0; } @@ -242,11 +242,11 @@ static int mtd_id_parse(const char *id, const char **ret_id, u8 *dev_type, u8 *d static inline u32 get_part_sector_size_nand(struct mtdids *id) { #if defined(CONFIG_JFFS2_NAND) && defined(CONFIG_CMD_NAND) - nand_info_t *nand; + struct mtd_info *mtd; - nand = &nand_info[id->num]; + mtd = get_nand_dev_by_index(id->num); - return nand->erasesize; + return mtd->erasesize; #else BUG(); return 0; @@ -478,9 +478,9 @@ int do_jffs2_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) ulong offset = load_addr; /* pre-set Boot file name */ - if ((filename = getenv("bootfile")) == NULL) { + filename = env_get("bootfile"); + if (!filename) filename = "uImage"; - } if (argc == 2) { filename = argv[1]; @@ -511,7 +511,7 @@ int do_jffs2_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (size > 0) { printf("### %s load complete: %d bytes loaded to 0x%lx\n", fsname, size, offset); - setenv_hex("filesize", size); + env_set_hex("filesize", size); } else { printf("### %s LOAD ERROR<%x> for %s!\n", fsname, size, filename); } @@ -606,7 +606,7 @@ U_BOOT_CMD( " with offset 'off'" ); U_BOOT_CMD( - ls, 2, 1, do_jffs2_ls, + fsls, 2, 1, do_jffs2_ls, "list files in a directory (default /)", "[ directory ]" );