Skip to content
Snippets Groups Projects
Select Git revision
  • 71edc271816ec82cf0550dd6980be2da3cc2ad9e
  • master default protected
  • stable
  • extraversion
  • early-display
  • variant-emmc-nvme-boot
  • 2024-07-19
  • 2024-06-30
  • 2023-10-18
  • 2023-10-10
  • 2023-07-04
  • 2023-01-25
  • v3
  • variant-emmc-nvme-boot
  • 2020-06-01
15 results

cmd_misc.c

Blame
  • nand_util.c 21.74 KiB
    /*
     * drivers/mtd/nand/nand_util.c
     *
     * Copyright (C) 2006 by Weiss-Electronic GmbH.
     * All rights reserved.
     *
     * @author:	Guido Classen <clagix@gmail.com>
     * @descr:	NAND Flash support
     * @references: borrowed heavily from Linux mtd-utils code:
     *		flash_eraseall.c by Arcom Control System Ltd
     *		nandwrite.c by Steven J. Hill (sjhill@realitydiluted.com)
     *			       and Thomas Gleixner (tglx@linutronix.de)
     *
     * 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 version
     * 2 as published by the Free Software Foundation.
     *
     * 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
     *
     */
    
    #include <common.h>
    
    #if defined(CONFIG_CMD_NAND) && !defined(CFG_NAND_LEGACY)
    
    #include <command.h>
    #include <watchdog.h>
    #include <malloc.h>
    #include <div64.h>
    
    #include <nand.h>
    #include <jffs2/jffs2.h>
    
    typedef struct erase_info erase_info_t;
    typedef struct mtd_info	  mtd_info_t;
    
    /* support only for native endian JFFS2 */
    #define cpu_to_je16(x) (x)
    #define cpu_to_je32(x) (x)
    
    /*****************************************************************************/
    static int nand_block_bad_scrub(struct mtd_info *mtd, loff_t ofs, int getchip)
    {
    	return 0;
    }
    
    /**
     * nand_erase_opts: - erase NAND flash with support for various options
     *		      (jffs2 formating)
     *
     * @param meminfo	NAND device to erase
     * @param opts		options,  @see struct nand_erase_options
     * @return		0 in case of success
     *
     * This code is ported from flash_eraseall.c from Linux mtd utils by
     * Arcom Control System Ltd.
     */
    int nand_erase_opts(nand_info_t *meminfo, const nand_erase_options_t *opts)
    {