X-Git-Url: https://git.kernelconcepts.de/?a=blobdiff_plain;f=common%2Fcmd_jffs2.c;h=bce098315e386cf9348f8a24495fc7f361b6f418;hb=a3b5e1ec3e52bd7624e832a612a23fc2dd432abb;hp=3bb6c3cb158cce08515b99204b6ffba3244c5c7e;hpb=5520ab1f7685721314dcfb7cdcc7c15e6571473f;p=karo-tx-uboot.git diff --git a/common/cmd_jffs2.c b/common/cmd_jffs2.c index 3bb6c3cb15..bce098315e 100644 --- a/common/cmd_jffs2.c +++ b/common/cmd_jffs2.c @@ -18,23 +18,7 @@ * $Id: cmdlinepart.c,v 1.17 2004/11/26 11:18:47 lavinen Exp $ * Copyright 2002 SYSGO Real-Time Solutions GmbH * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA + * SPDX-License-Identifier: GPL-2.0+ */ /* @@ -96,12 +80,8 @@ #include #if defined(CONFIG_CMD_NAND) -#ifdef CONFIG_NAND_LEGACY -#include -#else /* !CONFIG_NAND_LEGACY */ #include #include -#endif /* !CONFIG_NAND_LEGACY */ #endif #if defined(CONFIG_CMD_ONENAND) @@ -187,12 +167,7 @@ static int mtd_device_validate(u8 type, u8 num, u32 *size) } else if (type == MTD_DEV_TYPE_NAND) { #if defined(CONFIG_JFFS2_NAND) && defined(CONFIG_CMD_NAND) if (num < CONFIG_SYS_MAX_NAND_DEVICE) { -#ifndef CONFIG_NAND_LEGACY *size = nand_info[num].size; -#else - extern struct nand_chip nand_dev_desc[CONFIG_SYS_MAX_NAND_DEVICE]; - *size = nand_dev_desc[num].totlen; -#endif return 0; } @@ -267,17 +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) -#if defined(CONFIG_NAND_LEGACY) - extern struct nand_chip nand_dev_desc[CONFIG_SYS_MAX_NAND_DEVICE]; - - return nand_dev_desc[id->num].erasesize; -#else nand_info_t *nand; nand = &nand_info[id->num]; return nand->erasesize; -#endif #else BUG(); return 0; @@ -296,7 +265,7 @@ static inline u32 get_part_sector_size_nor(struct mtdids *id, struct part_info * flash = &flash_info[id->num]; start_phys = flash->start[0] + part->offset; - end_phys = start_phys + part->size; + end_phys = start_phys + part->size - 1; for (i = 0; i < flash->sector_count; i++) { if (flash->start[i] >= end_phys) @@ -421,8 +390,6 @@ int mtdparts_init(void) part->offset = 0x00000000; #endif - part->sector_size = get_part_sector_size(id, part); - part->dev = current_mtd_dev; INIT_LIST_HEAD(&part->link); @@ -430,6 +397,8 @@ int mtdparts_init(void) if (part->size == SIZE_REMAINING) part->size = id->size - part->offset; + part->sector_size = get_part_sector_size(id, part); + DEBUGF("part : name = %s, size = 0x%08lx, offset = 0x%08lx\n", part->name, part->size, part->offset); @@ -500,7 +469,7 @@ static struct part_info* jffs2_part_info(struct mtd_device *dev, unsigned int pa * @param argv arguments list * @return 0 on success, 1 otherwise */ -int do_jffs2_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_jffs2_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *fsname; char *filename; @@ -540,11 +509,9 @@ int do_jffs2_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) } if (size > 0) { - char buf[10]; printf("### %s load complete: %d bytes loaded to 0x%lx\n", fsname, size, offset); - sprintf(buf, "%x", size); - setenv("filesize", buf); + setenv_hex("filesize", size); } else { printf("### %s LOAD ERROR<%x> for %s!\n", fsname, size, filename); } @@ -564,7 +531,7 @@ int do_jffs2_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) * @param argv arguments list * @return 0 on success, 1 otherwise */ -int do_jffs2_ls(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_jffs2_ls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *filename = "/"; int ret; @@ -602,7 +569,7 @@ int do_jffs2_ls(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) * @param argv arguments list * @return 0 on success, 1 otherwise */ -int do_jffs2_fsinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_jffs2_fsinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { struct part_info *part; char *fsname; @@ -636,18 +603,17 @@ U_BOOT_CMD( "load binary file from a filesystem image", "[ off ] [ filename ]\n" " - load binary file from flash bank\n" - " with offset 'off'\n" + " with offset 'off'" ); U_BOOT_CMD( ls, 2, 1, do_jffs2_ls, "list files in a directory (default /)", - "[ directory ]\n" - " - list files in a directory.\n" + "[ directory ]" ); U_BOOT_CMD( fsinfo, 1, 1, do_jffs2_fsinfo, "print information about filesystems", - " - print information about filesystems\n" + "" ); /***************************************************/