2018-05-06 21:58:06 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
2005-09-14 21:53:32 +00:00
|
|
|
/*
|
2014-06-24 08:10:04 +00:00
|
|
|
* Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org> et al.
|
2005-08-17 10:55:25 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __MTD_MTD_H__
|
|
|
|
#define __MTD_MTD_H__
|
2007-10-31 12:53:06 +00:00
|
|
|
|
2014-06-24 08:10:04 +00:00
|
|
|
#ifndef __UBOOT__
|
2005-08-17 10:55:25 +00:00
|
|
|
#include <linux/types.h>
|
2014-06-24 08:10:04 +00:00
|
|
|
#include <linux/uio.h>
|
|
|
|
#include <linux/notifier.h>
|
|
|
|
#include <linux/device.h>
|
|
|
|
|
|
|
|
#include <mtd/mtd-abi.h>
|
|
|
|
|
|
|
|
#include <asm/div64.h>
|
|
|
|
#else
|
|
|
|
#include <linux/compat.h>
|
2013-01-14 03:46:50 +00:00
|
|
|
#include <mtd/mtd-abi.h>
|
2016-09-21 02:28:55 +00:00
|
|
|
#include <linux/errno.h>
|
2018-09-29 10:58:27 +00:00
|
|
|
#include <linux/list.h>
|
2014-06-24 08:10:04 +00:00
|
|
|
#include <div64.h>
|
2018-08-16 15:30:03 +00:00
|
|
|
#if IS_ENABLED(CONFIG_DM)
|
|
|
|
#include <dm/device.h>
|
|
|
|
#endif
|
2005-08-17 10:55:25 +00:00
|
|
|
|
2007-10-31 12:53:06 +00:00
|
|
|
#define MAX_MTD_DEVICES 32
|
2014-06-24 08:10:04 +00:00
|
|
|
#endif
|
2005-08-17 10:55:25 +00:00
|
|
|
|
2008-05-20 14:00:29 +00:00
|
|
|
#define MTD_ERASE_PENDING 0x01
|
2005-08-17 10:55:25 +00:00
|
|
|
#define MTD_ERASING 0x02
|
|
|
|
#define MTD_ERASE_SUSPEND 0x04
|
2014-06-24 08:10:04 +00:00
|
|
|
#define MTD_ERASE_DONE 0x08
|
|
|
|
#define MTD_ERASE_FAILED 0x10
|
2005-08-17 10:55:25 +00:00
|
|
|
|
2014-06-24 08:10:04 +00:00
|
|
|
#define MTD_FAIL_ADDR_UNKNOWN -1LL
|
2009-05-11 14:03:55 +00:00
|
|
|
|
2008-08-13 00:11:02 +00:00
|
|
|
/*
|
2014-06-24 08:10:04 +00:00
|
|
|
* If the erase fails, fail_addr might indicate exactly which block failed. If
|
|
|
|
* fail_addr = MTD_FAIL_ADDR_UNKNOWN, the failure was not at the device level
|
|
|
|
* or was not specific to any particular block.
|
2008-08-13 00:11:02 +00:00
|
|
|
*/
|
2005-08-17 10:55:25 +00:00
|
|
|
struct erase_info {
|
|
|
|
struct mtd_info *mtd;
|
2009-05-11 14:03:55 +00:00
|
|
|
uint64_t addr;
|
|
|
|
uint64_t len;
|
|
|
|
uint64_t fail_addr;
|
2005-08-17 10:55:25 +00:00
|
|
|
u_long time;
|
|
|
|
u_long retries;
|
2014-06-24 08:10:04 +00:00
|
|
|
unsigned dev;
|
|
|
|
unsigned cell;
|
2005-08-17 10:55:25 +00:00
|
|
|
void (*callback) (struct erase_info *self);
|
|
|
|
u_long priv;
|
|
|
|
u_char state;
|
|
|
|
struct erase_info *next;
|
2011-09-12 04:04:06 +00:00
|
|
|
int scrub;
|
2005-08-17 10:55:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct mtd_erase_region_info {
|
2014-06-24 08:10:04 +00:00
|
|
|
uint64_t offset; /* At which this region starts, from the beginning of the MTD */
|
|
|
|
uint32_t erasesize; /* For this region */
|
|
|
|
uint32_t numblocks; /* Number of blocks of erasesize in this region */
|
2007-10-31 12:53:06 +00:00
|
|
|
unsigned long *lockmap; /* If keeping bitmap of locks */
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct mtd_oob_ops - oob operation operands
|
|
|
|
* @mode: operation mode
|
|
|
|
*
|
|
|
|
* @len: number of data bytes to write/read
|
|
|
|
*
|
|
|
|
* @retlen: number of data bytes written/read
|
|
|
|
*
|
|
|
|
* @ooblen: number of oob bytes to write/read
|
|
|
|
* @oobretlen: number of oob bytes written/read
|
|
|
|
* @ooboffs: offset of oob data in the oob area (only relevant when
|
2013-01-14 03:46:50 +00:00
|
|
|
* mode = MTD_OPS_PLACE_OOB or MTD_OPS_RAW)
|
2007-10-31 12:53:06 +00:00
|
|
|
* @datbuf: data buffer - if NULL only oob data are read/written
|
|
|
|
* @oobbuf: oob data buffer
|
|
|
|
*/
|
|
|
|
struct mtd_oob_ops {
|
2013-01-14 03:46:50 +00:00
|
|
|
unsigned int mode;
|
2007-10-31 12:53:06 +00:00
|
|
|
size_t len;
|
|
|
|
size_t retlen;
|
|
|
|
size_t ooblen;
|
|
|
|
size_t oobretlen;
|
|
|
|
uint32_t ooboffs;
|
|
|
|
uint8_t *datbuf;
|
|
|
|
uint8_t *oobbuf;
|
2005-08-17 10:55:25 +00:00
|
|
|
};
|
|
|
|
|
mtd: move & update nand_ecclayout structure (plus board changes)
nand_ecclayout is present in mtd.h at Linux.
Move this structure to mtd.h to comply with Linux.
Also, increase the ecc placement locations to 640 to suport device having
writesize/oobsize of 8KB/640B. This means that the maximum oobsize has gone
up to 640 bytes and consequently the maximum ecc placement locations have
also gone up to 640.
Changes from Prabhabkar's version (squashed into one patch to preserve
bisectability):
- Added _LARGE to MTD_MAX_*_ENTRIES
This makes the names match current Linux source, and resolves
a conflict between
http://patchwork.ozlabs.org/patch/280488/
and
http://patchwork.ozlabs.org/patch/284513/
The former was posted first and is closer to matching Linux, but
unlike Linux it does not add _LARGE to the names. The second adds
_LARGE to one of the names, and depends on it in a subsequent patch
(http://patchwork.ozlabs.org/patch/284512/).
- Made max oobfree/eccpos configurable, and used this on tricorder,
alpr, ASH405, T4160QDS, and T4240QDS (these boards failed to build
for me without doing so, due to a size increase).
On tricorder SPL, this saves 2576 bytes (and makes the SPL build
again) versus the new default of 640 eccpos and 32 oobfree, and
saves 336 bytes versus the old default of 128 eccpos and 8 oobfree.
Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
CC: Vipin Kumar <vipin.kumar@st.com>
[scottwood@freescale.com: changes as described above]
Signed-off-by: Scott Wood <scottwood@freescale.com>
Cc: Thomas Weber <weber@corscience.de>
Cc: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
Cc: Stefan Roese <sr@denx.de>
Cc: York Sun <yorksun@freescale.com>
Cc: Tom Rini <trini@ti.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2013-10-04 08:17:58 +00:00
|
|
|
#ifdef CONFIG_SYS_NAND_MAX_OOBFREE
|
|
|
|
#define MTD_MAX_OOBFREE_ENTRIES_LARGE CONFIG_SYS_NAND_MAX_OOBFREE
|
|
|
|
#else
|
|
|
|
#define MTD_MAX_OOBFREE_ENTRIES_LARGE 32
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_SYS_NAND_MAX_ECCPOS
|
|
|
|
#define MTD_MAX_ECCPOS_ENTRIES_LARGE CONFIG_SYS_NAND_MAX_ECCPOS
|
|
|
|
#else
|
2015-04-28 12:46:03 +00:00
|
|
|
#define MTD_MAX_ECCPOS_ENTRIES_LARGE 680
|
mtd: move & update nand_ecclayout structure (plus board changes)
nand_ecclayout is present in mtd.h at Linux.
Move this structure to mtd.h to comply with Linux.
Also, increase the ecc placement locations to 640 to suport device having
writesize/oobsize of 8KB/640B. This means that the maximum oobsize has gone
up to 640 bytes and consequently the maximum ecc placement locations have
also gone up to 640.
Changes from Prabhabkar's version (squashed into one patch to preserve
bisectability):
- Added _LARGE to MTD_MAX_*_ENTRIES
This makes the names match current Linux source, and resolves
a conflict between
http://patchwork.ozlabs.org/patch/280488/
and
http://patchwork.ozlabs.org/patch/284513/
The former was posted first and is closer to matching Linux, but
unlike Linux it does not add _LARGE to the names. The second adds
_LARGE to one of the names, and depends on it in a subsequent patch
(http://patchwork.ozlabs.org/patch/284512/).
- Made max oobfree/eccpos configurable, and used this on tricorder,
alpr, ASH405, T4160QDS, and T4240QDS (these boards failed to build
for me without doing so, due to a size increase).
On tricorder SPL, this saves 2576 bytes (and makes the SPL build
again) versus the new default of 640 eccpos and 32 oobfree, and
saves 336 bytes versus the old default of 128 eccpos and 8 oobfree.
Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
CC: Vipin Kumar <vipin.kumar@st.com>
[scottwood@freescale.com: changes as described above]
Signed-off-by: Scott Wood <scottwood@freescale.com>
Cc: Thomas Weber <weber@corscience.de>
Cc: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
Cc: Stefan Roese <sr@denx.de>
Cc: York Sun <yorksun@freescale.com>
Cc: Tom Rini <trini@ti.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2013-10-04 08:17:58 +00:00
|
|
|
#endif
|
2017-11-21 17:38:23 +00:00
|
|
|
/**
|
|
|
|
* struct mtd_oob_region - oob region definition
|
|
|
|
* @offset: region offset
|
|
|
|
* @length: region length
|
|
|
|
*
|
|
|
|
* This structure describes a region of the OOB area, and is used
|
|
|
|
* to retrieve ECC or free bytes sections.
|
|
|
|
* Each section is defined by an offset within the OOB area and a
|
|
|
|
* length.
|
|
|
|
*/
|
|
|
|
struct mtd_oob_region {
|
|
|
|
u32 offset;
|
|
|
|
u32 length;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* struct mtd_ooblayout_ops - NAND OOB layout operations
|
|
|
|
* @ecc: function returning an ECC region in the OOB area.
|
|
|
|
* Should return -ERANGE if %section exceeds the total number of
|
|
|
|
* ECC sections.
|
|
|
|
* @free: function returning a free region in the OOB area.
|
|
|
|
* Should return -ERANGE if %section exceeds the total number of
|
|
|
|
* free sections.
|
|
|
|
*/
|
|
|
|
struct mtd_ooblayout_ops {
|
|
|
|
int (*ecc)(struct mtd_info *mtd, int section,
|
|
|
|
struct mtd_oob_region *oobecc);
|
|
|
|
int (*free)(struct mtd_info *mtd, int section,
|
|
|
|
struct mtd_oob_region *oobfree);
|
|
|
|
};
|
mtd: move & update nand_ecclayout structure (plus board changes)
nand_ecclayout is present in mtd.h at Linux.
Move this structure to mtd.h to comply with Linux.
Also, increase the ecc placement locations to 640 to suport device having
writesize/oobsize of 8KB/640B. This means that the maximum oobsize has gone
up to 640 bytes and consequently the maximum ecc placement locations have
also gone up to 640.
Changes from Prabhabkar's version (squashed into one patch to preserve
bisectability):
- Added _LARGE to MTD_MAX_*_ENTRIES
This makes the names match current Linux source, and resolves
a conflict between
http://patchwork.ozlabs.org/patch/280488/
and
http://patchwork.ozlabs.org/patch/284513/
The former was posted first and is closer to matching Linux, but
unlike Linux it does not add _LARGE to the names. The second adds
_LARGE to one of the names, and depends on it in a subsequent patch
(http://patchwork.ozlabs.org/patch/284512/).
- Made max oobfree/eccpos configurable, and used this on tricorder,
alpr, ASH405, T4160QDS, and T4240QDS (these boards failed to build
for me without doing so, due to a size increase).
On tricorder SPL, this saves 2576 bytes (and makes the SPL build
again) versus the new default of 640 eccpos and 32 oobfree, and
saves 336 bytes versus the old default of 128 eccpos and 8 oobfree.
Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
CC: Vipin Kumar <vipin.kumar@st.com>
[scottwood@freescale.com: changes as described above]
Signed-off-by: Scott Wood <scottwood@freescale.com>
Cc: Thomas Weber <weber@corscience.de>
Cc: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
Cc: Stefan Roese <sr@denx.de>
Cc: York Sun <yorksun@freescale.com>
Cc: Tom Rini <trini@ti.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2013-10-04 08:17:58 +00:00
|
|
|
|
|
|
|
/*
|
2014-06-24 08:10:04 +00:00
|
|
|
* Internal ECC layout control structure. For historical reasons, there is a
|
|
|
|
* similar, smaller struct nand_ecclayout_user (in mtd-abi.h) that is retained
|
|
|
|
* for export to user-space via the ECCGETLAYOUT ioctl.
|
|
|
|
* nand_ecclayout should be expandable in the future simply by the above macros.
|
mtd: move & update nand_ecclayout structure (plus board changes)
nand_ecclayout is present in mtd.h at Linux.
Move this structure to mtd.h to comply with Linux.
Also, increase the ecc placement locations to 640 to suport device having
writesize/oobsize of 8KB/640B. This means that the maximum oobsize has gone
up to 640 bytes and consequently the maximum ecc placement locations have
also gone up to 640.
Changes from Prabhabkar's version (squashed into one patch to preserve
bisectability):
- Added _LARGE to MTD_MAX_*_ENTRIES
This makes the names match current Linux source, and resolves
a conflict between
http://patchwork.ozlabs.org/patch/280488/
and
http://patchwork.ozlabs.org/patch/284513/
The former was posted first and is closer to matching Linux, but
unlike Linux it does not add _LARGE to the names. The second adds
_LARGE to one of the names, and depends on it in a subsequent patch
(http://patchwork.ozlabs.org/patch/284512/).
- Made max oobfree/eccpos configurable, and used this on tricorder,
alpr, ASH405, T4160QDS, and T4240QDS (these boards failed to build
for me without doing so, due to a size increase).
On tricorder SPL, this saves 2576 bytes (and makes the SPL build
again) versus the new default of 640 eccpos and 32 oobfree, and
saves 336 bytes versus the old default of 128 eccpos and 8 oobfree.
Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
CC: Vipin Kumar <vipin.kumar@st.com>
[scottwood@freescale.com: changes as described above]
Signed-off-by: Scott Wood <scottwood@freescale.com>
Cc: Thomas Weber <weber@corscience.de>
Cc: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
Cc: Stefan Roese <sr@denx.de>
Cc: York Sun <yorksun@freescale.com>
Cc: Tom Rini <trini@ti.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2013-10-04 08:17:58 +00:00
|
|
|
*/
|
|
|
|
struct nand_ecclayout {
|
2014-06-24 08:10:04 +00:00
|
|
|
__u32 eccbytes;
|
|
|
|
__u32 eccpos[MTD_MAX_ECCPOS_ENTRIES_LARGE];
|
|
|
|
__u32 oobavail;
|
mtd: move & update nand_ecclayout structure (plus board changes)
nand_ecclayout is present in mtd.h at Linux.
Move this structure to mtd.h to comply with Linux.
Also, increase the ecc placement locations to 640 to suport device having
writesize/oobsize of 8KB/640B. This means that the maximum oobsize has gone
up to 640 bytes and consequently the maximum ecc placement locations have
also gone up to 640.
Changes from Prabhabkar's version (squashed into one patch to preserve
bisectability):
- Added _LARGE to MTD_MAX_*_ENTRIES
This makes the names match current Linux source, and resolves
a conflict between
http://patchwork.ozlabs.org/patch/280488/
and
http://patchwork.ozlabs.org/patch/284513/
The former was posted first and is closer to matching Linux, but
unlike Linux it does not add _LARGE to the names. The second adds
_LARGE to one of the names, and depends on it in a subsequent patch
(http://patchwork.ozlabs.org/patch/284512/).
- Made max oobfree/eccpos configurable, and used this on tricorder,
alpr, ASH405, T4160QDS, and T4240QDS (these boards failed to build
for me without doing so, due to a size increase).
On tricorder SPL, this saves 2576 bytes (and makes the SPL build
again) versus the new default of 640 eccpos and 32 oobfree, and
saves 336 bytes versus the old default of 128 eccpos and 8 oobfree.
Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
CC: Vipin Kumar <vipin.kumar@st.com>
[scottwood@freescale.com: changes as described above]
Signed-off-by: Scott Wood <scottwood@freescale.com>
Cc: Thomas Weber <weber@corscience.de>
Cc: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
Cc: Stefan Roese <sr@denx.de>
Cc: York Sun <yorksun@freescale.com>
Cc: Tom Rini <trini@ti.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2013-10-04 08:17:58 +00:00
|
|
|
struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES_LARGE];
|
|
|
|
};
|
|
|
|
|
2014-06-24 08:10:04 +00:00
|
|
|
struct module; /* only needed for owner field in mtd_info */
|
|
|
|
|
2005-08-17 10:55:25 +00:00
|
|
|
struct mtd_info {
|
|
|
|
u_char type;
|
2014-06-24 08:10:04 +00:00
|
|
|
uint32_t flags;
|
|
|
|
uint64_t size; // Total size of the MTD
|
2005-08-17 10:55:25 +00:00
|
|
|
|
2011-08-04 16:45:45 +00:00
|
|
|
/* "Major" erase size for the device. Naïve users may take this
|
2005-08-17 10:55:25 +00:00
|
|
|
* to be the only erase size available, or may use the more detailed
|
|
|
|
* information below if they desire
|
|
|
|
*/
|
2014-06-24 08:10:04 +00:00
|
|
|
uint32_t erasesize;
|
2007-10-31 12:53:06 +00:00
|
|
|
/* Minimal writable flash unit size. In case of NOR flash it is 1 (even
|
|
|
|
* though individual bits can be cleared), in case of NAND flash it is
|
|
|
|
* one NAND page (or half, or one-fourths of it), in case of ECC-ed NOR
|
|
|
|
* it is of ECC block size, etc. It is illegal to have writesize = 0.
|
|
|
|
* Any driver registering a struct mtd_info must ensure a writesize of
|
|
|
|
* 1 or larger.
|
|
|
|
*/
|
2014-06-24 08:10:04 +00:00
|
|
|
uint32_t writesize;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Size of the write buffer used by the MTD. MTD devices having a write
|
|
|
|
* buffer can write multiple writesize chunks at a time. E.g. while
|
|
|
|
* writing 4 * writesize bytes to a device with 2 * writesize bytes
|
|
|
|
* buffer the MTD driver can (but doesn't have to) do 2 writesize
|
|
|
|
* operations, but not 4. Currently, all NANDs have writebufsize
|
|
|
|
* equivalent to writesize (NAND page size). Some NOR flashes do have
|
|
|
|
* writebufsize greater than writesize.
|
|
|
|
*/
|
|
|
|
uint32_t writebufsize;
|
2005-08-17 10:55:25 +00:00
|
|
|
|
2014-06-24 08:10:04 +00:00
|
|
|
uint32_t oobsize; // Amount of OOB data per block (e.g. 16)
|
|
|
|
uint32_t oobavail; // Available OOB bytes per block
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If erasesize is a power of 2 then the shift is stored in
|
|
|
|
* erasesize_shift otherwise erasesize_shift is zero. Ditto writesize.
|
|
|
|
*/
|
|
|
|
unsigned int erasesize_shift;
|
|
|
|
unsigned int writesize_shift;
|
|
|
|
/* Masks based on erasesize_shift and writesize_shift */
|
|
|
|
unsigned int erasesize_mask;
|
|
|
|
unsigned int writesize_mask;
|
2005-09-14 21:53:32 +00:00
|
|
|
|
2013-01-14 03:46:50 +00:00
|
|
|
/*
|
|
|
|
* read ops return -EUCLEAN if max number of bitflips corrected on any
|
|
|
|
* one region comprising an ecc step equals or exceeds this value.
|
|
|
|
* Settable by driver, else defaults to ecc_strength. User can override
|
|
|
|
* in sysfs. N.B. The meaning of the -EUCLEAN return code has changed;
|
|
|
|
* see Documentation/ABI/testing/sysfs-class-mtd for more detail.
|
|
|
|
*/
|
|
|
|
unsigned int bitflip_threshold;
|
|
|
|
|
2014-06-24 08:10:04 +00:00
|
|
|
// Kernel-only stuff starts here.
|
|
|
|
#ifndef __UBOOT__
|
2008-10-24 21:20:43 +00:00
|
|
|
const char *name;
|
2014-06-24 08:10:04 +00:00
|
|
|
#else
|
|
|
|
char *name;
|
|
|
|
#endif
|
2005-08-17 10:55:25 +00:00
|
|
|
int index;
|
|
|
|
|
2017-11-21 17:38:23 +00:00
|
|
|
/* OOB layout description */
|
|
|
|
const struct mtd_ooblayout_ops *ooblayout;
|
|
|
|
|
2013-01-14 03:46:50 +00:00
|
|
|
/* ECC layout structure pointer - read only! */
|
2007-10-31 12:53:06 +00:00
|
|
|
struct nand_ecclayout *ecclayout;
|
2005-08-17 10:55:25 +00:00
|
|
|
|
2014-06-24 08:10:04 +00:00
|
|
|
/* the ecc step size. */
|
|
|
|
unsigned int ecc_step_size;
|
|
|
|
|
2013-01-14 03:46:50 +00:00
|
|
|
/* max number of correctible bit errors per ecc step */
|
|
|
|
unsigned int ecc_strength;
|
|
|
|
|
2005-08-17 10:55:25 +00:00
|
|
|
/* Data for variable erase regions. If numeraseregions is zero,
|
2005-09-14 21:53:32 +00:00
|
|
|
* it means that the whole device has erasesize as given above.
|
2005-08-17 10:55:25 +00:00
|
|
|
*/
|
|
|
|
int numeraseregions;
|
2005-09-14 21:53:32 +00:00
|
|
|
struct mtd_erase_region_info *eraseregions;
|
2005-08-17 10:55:25 +00:00
|
|
|
|
2008-10-24 21:20:43 +00:00
|
|
|
/*
|
2013-01-14 03:46:50 +00:00
|
|
|
* Do not call via these pointers, use corresponding mtd_*()
|
|
|
|
* wrappers instead.
|
2008-10-24 21:20:43 +00:00
|
|
|
*/
|
2013-01-14 03:46:50 +00:00
|
|
|
int (*_erase) (struct mtd_info *mtd, struct erase_info *instr);
|
2014-06-24 08:10:04 +00:00
|
|
|
#ifndef __UBOOT__
|
2013-01-14 03:46:50 +00:00
|
|
|
int (*_point) (struct mtd_info *mtd, loff_t from, size_t len,
|
2014-06-24 08:10:04 +00:00
|
|
|
size_t *retlen, void **virt, resource_size_t *phys);
|
|
|
|
int (*_unpoint) (struct mtd_info *mtd, loff_t from, size_t len);
|
|
|
|
#endif
|
|
|
|
unsigned long (*_get_unmapped_area) (struct mtd_info *mtd,
|
|
|
|
unsigned long len,
|
|
|
|
unsigned long offset,
|
|
|
|
unsigned long flags);
|
2013-01-14 03:46:50 +00:00
|
|
|
int (*_read) (struct mtd_info *mtd, loff_t from, size_t len,
|
2014-06-24 08:10:04 +00:00
|
|
|
size_t *retlen, u_char *buf);
|
2013-01-14 03:46:50 +00:00
|
|
|
int (*_write) (struct mtd_info *mtd, loff_t to, size_t len,
|
2014-06-24 08:10:04 +00:00
|
|
|
size_t *retlen, const u_char *buf);
|
|
|
|
int (*_panic_write) (struct mtd_info *mtd, loff_t to, size_t len,
|
|
|
|
size_t *retlen, const u_char *buf);
|
2013-01-14 03:46:50 +00:00
|
|
|
int (*_read_oob) (struct mtd_info *mtd, loff_t from,
|
2014-06-24 08:10:04 +00:00
|
|
|
struct mtd_oob_ops *ops);
|
2013-01-14 03:46:50 +00:00
|
|
|
int (*_write_oob) (struct mtd_info *mtd, loff_t to,
|
2014-06-24 08:10:04 +00:00
|
|
|
struct mtd_oob_ops *ops);
|
2014-07-15 14:08:43 +00:00
|
|
|
int (*_get_fact_prot_info) (struct mtd_info *mtd, size_t len,
|
|
|
|
size_t *retlen, struct otp_info *buf);
|
2013-01-14 03:46:50 +00:00
|
|
|
int (*_read_fact_prot_reg) (struct mtd_info *mtd, loff_t from,
|
2014-06-24 08:10:04 +00:00
|
|
|
size_t len, size_t *retlen, u_char *buf);
|
2014-07-15 14:08:43 +00:00
|
|
|
int (*_get_user_prot_info) (struct mtd_info *mtd, size_t len,
|
|
|
|
size_t *retlen, struct otp_info *buf);
|
2013-01-14 03:46:50 +00:00
|
|
|
int (*_read_user_prot_reg) (struct mtd_info *mtd, loff_t from,
|
2014-06-24 08:10:04 +00:00
|
|
|
size_t len, size_t *retlen, u_char *buf);
|
|
|
|
int (*_write_user_prot_reg) (struct mtd_info *mtd, loff_t to,
|
|
|
|
size_t len, size_t *retlen, u_char *buf);
|
2013-01-14 03:46:50 +00:00
|
|
|
int (*_lock_user_prot_reg) (struct mtd_info *mtd, loff_t from,
|
2014-06-24 08:10:04 +00:00
|
|
|
size_t len);
|
|
|
|
#ifndef __UBOOT__
|
|
|
|
int (*_writev) (struct mtd_info *mtd, const struct kvec *vecs,
|
|
|
|
unsigned long count, loff_t to, size_t *retlen);
|
|
|
|
#endif
|
2013-01-14 03:46:50 +00:00
|
|
|
void (*_sync) (struct mtd_info *mtd);
|
|
|
|
int (*_lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
|
|
|
|
int (*_unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
|
2014-06-24 08:10:04 +00:00
|
|
|
int (*_is_locked) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
|
2014-05-21 22:06:12 +00:00
|
|
|
int (*_block_isreserved) (struct mtd_info *mtd, loff_t ofs);
|
2013-01-14 03:46:50 +00:00
|
|
|
int (*_block_isbad) (struct mtd_info *mtd, loff_t ofs);
|
|
|
|
int (*_block_markbad) (struct mtd_info *mtd, loff_t ofs);
|
2014-06-24 08:10:04 +00:00
|
|
|
#ifndef __UBOOT__
|
|
|
|
int (*_suspend) (struct mtd_info *mtd);
|
|
|
|
void (*_resume) (struct mtd_info *mtd);
|
2015-10-22 04:19:21 +00:00
|
|
|
void (*_reboot) (struct mtd_info *mtd);
|
2014-06-24 08:10:04 +00:00
|
|
|
#endif
|
2005-09-14 21:53:32 +00:00
|
|
|
/*
|
2013-01-14 03:46:50 +00:00
|
|
|
* If the driver is something smart, like UBI, it may need to maintain
|
|
|
|
* its own reference counting. The below functions are only for driver.
|
2005-08-17 10:55:25 +00:00
|
|
|
*/
|
2013-01-14 03:46:50 +00:00
|
|
|
int (*_get_device) (struct mtd_info *mtd);
|
|
|
|
void (*_put_device) (struct mtd_info *mtd);
|
2007-10-31 12:53:06 +00:00
|
|
|
|
2014-06-24 08:10:04 +00:00
|
|
|
#ifndef __UBOOT__
|
|
|
|
/* Backing device capabilities for this device
|
|
|
|
* - provides mmap capabilities
|
|
|
|
*/
|
|
|
|
struct backing_dev_info *backing_dev_info;
|
|
|
|
|
2007-10-31 12:53:06 +00:00
|
|
|
struct notifier_block reboot_notifier; /* default mode before reboot */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* ECC status information */
|
|
|
|
struct mtd_ecc_stats ecc_stats;
|
|
|
|
/* Subpage shift (NAND) */
|
|
|
|
int subpage_sft;
|
|
|
|
|
2005-08-17 10:55:25 +00:00
|
|
|
void *priv;
|
|
|
|
|
|
|
|
struct module *owner;
|
2014-06-24 08:10:04 +00:00
|
|
|
#ifndef __UBOOT__
|
|
|
|
struct device dev;
|
2015-11-07 06:20:31 +00:00
|
|
|
#else
|
|
|
|
struct udevice *dev;
|
2014-06-24 08:10:04 +00:00
|
|
|
#endif
|
2005-08-17 10:55:25 +00:00
|
|
|
int usecount;
|
2018-09-29 10:58:27 +00:00
|
|
|
|
|
|
|
/* MTD devices do not have any parent. MTD partitions do. */
|
|
|
|
struct mtd_info *parent;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Offset of the partition relatively to the parent offset.
|
|
|
|
* Is 0 for real MTD devices (ie. not partitions).
|
|
|
|
*/
|
|
|
|
u64 offset;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* List node used to add an MTD partition to the parent
|
|
|
|
* partition list.
|
|
|
|
*/
|
|
|
|
struct list_head node;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* List of partitions attached to this MTD device (the parent
|
|
|
|
* MTD device can itself be a partition).
|
|
|
|
*/
|
|
|
|
struct list_head partitions;
|
2005-08-17 10:55:25 +00:00
|
|
|
};
|
|
|
|
|
2018-08-16 15:30:03 +00:00
|
|
|
#if IS_ENABLED(CONFIG_DM)
|
|
|
|
static inline void mtd_set_of_node(struct mtd_info *mtd,
|
|
|
|
const struct device_node *np)
|
|
|
|
{
|
|
|
|
mtd->dev->node.np = np;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline const struct device_node *mtd_get_of_node(struct mtd_info *mtd)
|
|
|
|
{
|
|
|
|
return mtd->dev->node.np;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
struct device_node;
|
|
|
|
|
|
|
|
static inline void mtd_set_of_node(struct mtd_info *mtd,
|
|
|
|
const struct device_node *np)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline const struct device_node *mtd_get_of_node(struct mtd_info *mtd)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-09-29 10:58:27 +00:00
|
|
|
static inline bool mtd_is_partition(const struct mtd_info *mtd)
|
|
|
|
{
|
|
|
|
return mtd->parent;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline bool mtd_has_partitions(const struct mtd_info *mtd)
|
|
|
|
{
|
|
|
|
return !list_empty(&mtd->partitions);
|
|
|
|
}
|
|
|
|
|
2018-12-02 09:54:30 +00:00
|
|
|
bool mtd_partitions_used(struct mtd_info *master);
|
|
|
|
|
2017-11-21 17:38:23 +00:00
|
|
|
int mtd_ooblayout_ecc(struct mtd_info *mtd, int section,
|
|
|
|
struct mtd_oob_region *oobecc);
|
|
|
|
int mtd_ooblayout_find_eccregion(struct mtd_info *mtd, int eccbyte,
|
|
|
|
int *section,
|
|
|
|
struct mtd_oob_region *oobregion);
|
|
|
|
int mtd_ooblayout_get_eccbytes(struct mtd_info *mtd, u8 *eccbuf,
|
|
|
|
const u8 *oobbuf, int start, int nbytes);
|
|
|
|
int mtd_ooblayout_set_eccbytes(struct mtd_info *mtd, const u8 *eccbuf,
|
|
|
|
u8 *oobbuf, int start, int nbytes);
|
|
|
|
int mtd_ooblayout_free(struct mtd_info *mtd, int section,
|
|
|
|
struct mtd_oob_region *oobfree);
|
|
|
|
int mtd_ooblayout_get_databytes(struct mtd_info *mtd, u8 *databuf,
|
|
|
|
const u8 *oobbuf, int start, int nbytes);
|
|
|
|
int mtd_ooblayout_set_databytes(struct mtd_info *mtd, const u8 *databuf,
|
|
|
|
u8 *oobbuf, int start, int nbytes);
|
|
|
|
int mtd_ooblayout_count_freebytes(struct mtd_info *mtd);
|
|
|
|
int mtd_ooblayout_count_eccbytes(struct mtd_info *mtd);
|
|
|
|
|
|
|
|
static inline void mtd_set_ooblayout(struct mtd_info *mtd,
|
|
|
|
const struct mtd_ooblayout_ops *ooblayout)
|
|
|
|
{
|
|
|
|
mtd->ooblayout = ooblayout;
|
|
|
|
}
|
|
|
|
|
2018-11-18 20:11:46 +00:00
|
|
|
static inline u32 mtd_oobavail(struct mtd_info *mtd, struct mtd_oob_ops *ops)
|
2016-05-30 18:57:58 +00:00
|
|
|
{
|
|
|
|
return ops->mode == MTD_OPS_AUTO_OOB ? mtd->oobavail : mtd->oobsize;
|
|
|
|
}
|
|
|
|
|
2013-01-14 03:46:50 +00:00
|
|
|
int mtd_erase(struct mtd_info *mtd, struct erase_info *instr);
|
2014-06-24 08:10:04 +00:00
|
|
|
#ifndef __UBOOT__
|
|
|
|
int mtd_point(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen,
|
|
|
|
void **virt, resource_size_t *phys);
|
|
|
|
int mtd_unpoint(struct mtd_info *mtd, loff_t from, size_t len);
|
|
|
|
#endif
|
|
|
|
unsigned long mtd_get_unmapped_area(struct mtd_info *mtd, unsigned long len,
|
|
|
|
unsigned long offset, unsigned long flags);
|
2013-01-14 03:46:50 +00:00
|
|
|
int mtd_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen,
|
|
|
|
u_char *buf);
|
|
|
|
int mtd_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen,
|
|
|
|
const u_char *buf);
|
|
|
|
int mtd_panic_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen,
|
|
|
|
const u_char *buf);
|
|
|
|
|
|
|
|
int mtd_read_oob(struct mtd_info *mtd, loff_t from, struct mtd_oob_ops *ops);
|
2018-08-16 15:30:00 +00:00
|
|
|
int mtd_write_oob(struct mtd_info *mtd, loff_t to, struct mtd_oob_ops *ops);
|
2013-01-14 03:46:50 +00:00
|
|
|
|
2014-07-15 14:08:43 +00:00
|
|
|
int mtd_get_fact_prot_info(struct mtd_info *mtd, size_t len, size_t *retlen,
|
|
|
|
struct otp_info *buf);
|
2013-01-14 03:46:50 +00:00
|
|
|
int mtd_read_fact_prot_reg(struct mtd_info *mtd, loff_t from, size_t len,
|
|
|
|
size_t *retlen, u_char *buf);
|
2014-07-15 14:08:43 +00:00
|
|
|
int mtd_get_user_prot_info(struct mtd_info *mtd, size_t len, size_t *retlen,
|
|
|
|
struct otp_info *buf);
|
2013-01-14 03:46:50 +00:00
|
|
|
int mtd_read_user_prot_reg(struct mtd_info *mtd, loff_t from, size_t len,
|
|
|
|
size_t *retlen, u_char *buf);
|
|
|
|
int mtd_write_user_prot_reg(struct mtd_info *mtd, loff_t to, size_t len,
|
|
|
|
size_t *retlen, u_char *buf);
|
|
|
|
int mtd_lock_user_prot_reg(struct mtd_info *mtd, loff_t from, size_t len);
|
|
|
|
|
2014-06-24 08:10:04 +00:00
|
|
|
#ifndef __UBOOT__
|
2013-01-14 03:46:50 +00:00
|
|
|
int mtd_writev(struct mtd_info *mtd, const struct kvec *vecs,
|
|
|
|
unsigned long count, loff_t to, size_t *retlen);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static inline void mtd_sync(struct mtd_info *mtd)
|
|
|
|
{
|
|
|
|
if (mtd->_sync)
|
|
|
|
mtd->_sync(mtd);
|
|
|
|
}
|
|
|
|
|
|
|
|
int mtd_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
|
|
|
|
int mtd_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
|
|
|
|
int mtd_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len);
|
2014-05-21 22:06:12 +00:00
|
|
|
int mtd_block_isreserved(struct mtd_info *mtd, loff_t ofs);
|
2013-01-14 03:46:50 +00:00
|
|
|
int mtd_block_isbad(struct mtd_info *mtd, loff_t ofs);
|
|
|
|
int mtd_block_markbad(struct mtd_info *mtd, loff_t ofs);
|
|
|
|
|
2014-06-24 08:10:04 +00:00
|
|
|
#ifndef __UBOOT__
|
|
|
|
static inline int mtd_suspend(struct mtd_info *mtd)
|
|
|
|
{
|
|
|
|
return mtd->_suspend ? mtd->_suspend(mtd) : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void mtd_resume(struct mtd_info *mtd)
|
|
|
|
{
|
|
|
|
if (mtd->_resume)
|
|
|
|
mtd->_resume(mtd);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2009-05-11 14:03:55 +00:00
|
|
|
static inline uint32_t mtd_div_by_eb(uint64_t sz, struct mtd_info *mtd)
|
|
|
|
{
|
2014-06-24 08:10:04 +00:00
|
|
|
if (mtd->erasesize_shift)
|
|
|
|
return sz >> mtd->erasesize_shift;
|
2009-05-11 14:03:55 +00:00
|
|
|
do_div(sz, mtd->erasesize);
|
|
|
|
return sz;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline uint32_t mtd_mod_by_eb(uint64_t sz, struct mtd_info *mtd)
|
|
|
|
{
|
2014-06-24 08:10:04 +00:00
|
|
|
if (mtd->erasesize_shift)
|
|
|
|
return sz & mtd->erasesize_mask;
|
2009-05-11 14:03:55 +00:00
|
|
|
return do_div(sz, mtd->erasesize);
|
|
|
|
}
|
2005-08-17 10:55:25 +00:00
|
|
|
|
2014-06-24 08:10:04 +00:00
|
|
|
static inline uint32_t mtd_div_by_ws(uint64_t sz, struct mtd_info *mtd)
|
|
|
|
{
|
|
|
|
if (mtd->writesize_shift)
|
|
|
|
return sz >> mtd->writesize_shift;
|
|
|
|
do_div(sz, mtd->writesize);
|
|
|
|
return sz;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline uint32_t mtd_mod_by_ws(uint64_t sz, struct mtd_info *mtd)
|
|
|
|
{
|
|
|
|
if (mtd->writesize_shift)
|
|
|
|
return sz & mtd->writesize_mask;
|
|
|
|
return do_div(sz, mtd->writesize);
|
|
|
|
}
|
|
|
|
|
2013-01-14 03:46:50 +00:00
|
|
|
static inline int mtd_has_oob(const struct mtd_info *mtd)
|
|
|
|
{
|
|
|
|
return mtd->_read_oob && mtd->_write_oob;
|
|
|
|
}
|
|
|
|
|
2014-06-24 08:10:04 +00:00
|
|
|
static inline int mtd_type_is_nand(const struct mtd_info *mtd)
|
|
|
|
{
|
|
|
|
return mtd->type == MTD_NANDFLASH || mtd->type == MTD_MLCNANDFLASH;
|
|
|
|
}
|
|
|
|
|
2013-01-14 03:46:50 +00:00
|
|
|
static inline int mtd_can_have_bb(const struct mtd_info *mtd)
|
|
|
|
{
|
|
|
|
return !!mtd->_block_isbad;
|
|
|
|
}
|
|
|
|
|
2005-08-17 10:55:25 +00:00
|
|
|
/* Kernel-side ioctl definitions */
|
|
|
|
|
2014-06-24 08:10:04 +00:00
|
|
|
struct mtd_partition;
|
|
|
|
struct mtd_part_parser_data;
|
|
|
|
|
|
|
|
extern int mtd_device_parse_register(struct mtd_info *mtd,
|
|
|
|
const char * const *part_probe_types,
|
|
|
|
struct mtd_part_parser_data *parser_data,
|
|
|
|
const struct mtd_partition *defparts,
|
|
|
|
int defnr_parts);
|
|
|
|
#define mtd_device_register(master, parts, nr_parts) \
|
|
|
|
mtd_device_parse_register(master, NULL, NULL, parts, nr_parts)
|
|
|
|
extern int mtd_device_unregister(struct mtd_info *master);
|
2005-08-17 10:55:25 +00:00
|
|
|
extern struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num);
|
2014-06-24 08:10:04 +00:00
|
|
|
extern int __get_mtd_device(struct mtd_info *mtd);
|
|
|
|
extern void __put_mtd_device(struct mtd_info *mtd);
|
2007-10-31 12:53:06 +00:00
|
|
|
extern struct mtd_info *get_mtd_device_nm(const char *name);
|
2005-08-17 10:55:25 +00:00
|
|
|
extern void put_mtd_device(struct mtd_info *mtd);
|
2014-06-24 08:10:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
#ifndef __UBOOT__
|
2005-08-17 10:55:25 +00:00
|
|
|
struct mtd_notifier {
|
|
|
|
void (*add)(struct mtd_info *mtd);
|
|
|
|
void (*remove)(struct mtd_info *mtd);
|
|
|
|
struct list_head list;
|
|
|
|
};
|
|
|
|
|
2014-06-24 08:10:04 +00:00
|
|
|
|
2005-08-17 10:55:25 +00:00
|
|
|
extern void register_mtd_user (struct mtd_notifier *new);
|
|
|
|
extern int unregister_mtd_user (struct mtd_notifier *old);
|
|
|
|
#endif
|
2014-06-24 08:10:04 +00:00
|
|
|
void *mtd_kmalloc_up_to(const struct mtd_info *mtd, size_t *size);
|
2005-08-17 10:55:25 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_MTD_PARTITIONS
|
|
|
|
void mtd_erase_callback(struct erase_info *instr);
|
|
|
|
#else
|
|
|
|
static inline void mtd_erase_callback(struct erase_info *instr)
|
|
|
|
{
|
|
|
|
if (instr->callback)
|
|
|
|
instr->callback(instr);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-01-14 03:46:50 +00:00
|
|
|
static inline int mtd_is_bitflip(int err) {
|
|
|
|
return err == -EUCLEAN;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int mtd_is_eccerr(int err) {
|
|
|
|
return err == -EBADMSG;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int mtd_is_bitflip_or_eccerr(int err) {
|
|
|
|
return mtd_is_bitflip(err) || mtd_is_eccerr(err);
|
|
|
|
}
|
2005-08-17 10:55:25 +00:00
|
|
|
|
2015-10-22 04:19:21 +00:00
|
|
|
unsigned mtd_mmap_capabilities(struct mtd_info *mtd);
|
|
|
|
|
2014-06-24 08:10:04 +00:00
|
|
|
#ifdef __UBOOT__
|
|
|
|
/* drivers/mtd/mtdcore.h */
|
|
|
|
int add_mtd_device(struct mtd_info *mtd);
|
2014-07-15 14:08:42 +00:00
|
|
|
int del_mtd_device(struct mtd_info *mtd);
|
2018-12-02 09:54:24 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_MTD_PARTITIONS
|
2014-06-24 08:10:04 +00:00
|
|
|
int add_mtd_partitions(struct mtd_info *, const struct mtd_partition *, int);
|
|
|
|
int del_mtd_partitions(struct mtd_info *);
|
2018-12-02 09:54:24 +00:00
|
|
|
#else
|
|
|
|
static inline int add_mtd_partitions(struct mtd_info *mtd,
|
|
|
|
const struct mtd_partition *parts,
|
|
|
|
int nparts)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int del_mtd_partitions(struct mtd_info *mtd)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
2015-04-27 05:42:05 +00:00
|
|
|
|
2018-08-16 15:30:05 +00:00
|
|
|
struct mtd_info *__mtd_next_device(int i);
|
|
|
|
#define mtd_for_each_device(mtd) \
|
|
|
|
for ((mtd) = __mtd_next_device(0); \
|
|
|
|
(mtd) != NULL; \
|
|
|
|
(mtd) = __mtd_next_device(mtd->index + 1))
|
|
|
|
|
2015-04-27 05:42:05 +00:00
|
|
|
int mtd_arg_off(const char *arg, int *idx, loff_t *off, loff_t *size,
|
2015-07-01 12:35:49 +00:00
|
|
|
loff_t *maxsize, int devtype, uint64_t chipsize);
|
2015-04-27 05:42:05 +00:00
|
|
|
int mtd_arg_off_size(int argc, char *const argv[], int *idx, loff_t *off,
|
2015-07-01 12:35:49 +00:00
|
|
|
loff_t *size, loff_t *maxsize, int devtype,
|
|
|
|
uint64_t chipsize);
|
2016-06-29 20:50:59 +00:00
|
|
|
|
|
|
|
/* drivers/mtd/mtdcore.c */
|
|
|
|
void mtd_get_len_incl_bad(struct mtd_info *mtd, uint64_t offset,
|
|
|
|
const uint64_t length, uint64_t *len_incl_bad,
|
|
|
|
int *truncated);
|
2018-12-02 09:54:22 +00:00
|
|
|
bool mtd_dev_list_updated(void);
|
2018-09-29 10:58:26 +00:00
|
|
|
|
|
|
|
/* drivers/mtd/mtd_uboot.c */
|
|
|
|
int mtd_search_alternate_name(const char *mtdname, char *altname,
|
|
|
|
unsigned int max_len);
|
|
|
|
|
2014-06-24 08:10:04 +00:00
|
|
|
#endif
|
2005-08-17 10:55:25 +00:00
|
|
|
#endif /* __MTD_MTD_H__ */
|