1e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
24a8e43feSDavid Howells /*
34a8e43feSDavid Howells * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org> et al.
44a8e43feSDavid Howells *
54a8e43feSDavid Howells * This program is free software; you can redistribute it and/or modify
64a8e43feSDavid Howells * it under the terms of the GNU General Public License as published by
74a8e43feSDavid Howells * the Free Software Foundation; either version 2 of the License, or
84a8e43feSDavid Howells * (at your option) any later version.
94a8e43feSDavid Howells *
104a8e43feSDavid Howells * This program is distributed in the hope that it will be useful,
114a8e43feSDavid Howells * but WITHOUT ANY WARRANTY; without even the implied warranty of
124a8e43feSDavid Howells * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
134a8e43feSDavid Howells * GNU General Public License for more details.
144a8e43feSDavid Howells *
154a8e43feSDavid Howells * You should have received a copy of the GNU General Public License
164a8e43feSDavid Howells * along with this program; if not, write to the Free Software
174a8e43feSDavid Howells * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
184a8e43feSDavid Howells *
194a8e43feSDavid Howells */
204a8e43feSDavid Howells
214a8e43feSDavid Howells #ifndef __MTD_ABI_H__
224a8e43feSDavid Howells #define __MTD_ABI_H__
234a8e43feSDavid Howells
244a8e43feSDavid Howells #include <linux/types.h>
254a8e43feSDavid Howells
264a8e43feSDavid Howells struct erase_info_user {
274a8e43feSDavid Howells __u32 start;
284a8e43feSDavid Howells __u32 length;
294a8e43feSDavid Howells };
304a8e43feSDavid Howells
314a8e43feSDavid Howells struct erase_info_user64 {
324a8e43feSDavid Howells __u64 start;
334a8e43feSDavid Howells __u64 length;
344a8e43feSDavid Howells };
354a8e43feSDavid Howells
364a8e43feSDavid Howells struct mtd_oob_buf {
374a8e43feSDavid Howells __u32 start;
384a8e43feSDavid Howells __u32 length;
394a8e43feSDavid Howells unsigned char __user *ptr;
404a8e43feSDavid Howells };
414a8e43feSDavid Howells
424a8e43feSDavid Howells struct mtd_oob_buf64 {
434a8e43feSDavid Howells __u64 start;
444a8e43feSDavid Howells __u32 pad;
454a8e43feSDavid Howells __u32 length;
464a8e43feSDavid Howells __u64 usr_ptr;
474a8e43feSDavid Howells };
484a8e43feSDavid Howells
494a8e43feSDavid Howells /**
504a8e43feSDavid Howells * MTD operation modes
514a8e43feSDavid Howells *
524a8e43feSDavid Howells * @MTD_OPS_PLACE_OOB: OOB data are placed at the given offset (default)
534a8e43feSDavid Howells * @MTD_OPS_AUTO_OOB: OOB data are automatically placed at the free areas
544a8e43feSDavid Howells * which are defined by the internal ecclayout
554a8e43feSDavid Howells * @MTD_OPS_RAW: data are transferred as-is, with no error correction;
564a8e43feSDavid Howells * this mode implies %MTD_OPS_PLACE_OOB
574a8e43feSDavid Howells *
58*095bb6e4SMichał Kępień * These modes can be passed to ioctl(MEMWRITE) and ioctl(MEMREAD); they are
59*095bb6e4SMichał Kępień * also used internally. See notes on "MTD file modes" for discussion on
60*095bb6e4SMichał Kępień * %MTD_OPS_RAW vs. %MTD_FILE_MODE_RAW.
614a8e43feSDavid Howells */
624a8e43feSDavid Howells enum {
634a8e43feSDavid Howells MTD_OPS_PLACE_OOB = 0,
644a8e43feSDavid Howells MTD_OPS_AUTO_OOB = 1,
654a8e43feSDavid Howells MTD_OPS_RAW = 2,
664a8e43feSDavid Howells };
674a8e43feSDavid Howells
684a8e43feSDavid Howells /**
694a8e43feSDavid Howells * struct mtd_write_req - data structure for requesting a write operation
704a8e43feSDavid Howells *
714a8e43feSDavid Howells * @start: start address
72a1eda864SMichał Kępień * @len: length of data buffer (only lower 32 bits are used)
73a1eda864SMichał Kępień * @ooblen: length of OOB buffer (only lower 32 bits are used)
744a8e43feSDavid Howells * @usr_data: user-provided data buffer
754a8e43feSDavid Howells * @usr_oob: user-provided OOB buffer
764a8e43feSDavid Howells * @mode: MTD mode (see "MTD operation modes")
774a8e43feSDavid Howells * @padding: reserved, must be set to 0
784a8e43feSDavid Howells *
794a8e43feSDavid Howells * This structure supports ioctl(MEMWRITE) operations, allowing data and/or OOB
804a8e43feSDavid Howells * writes in various modes. To write to OOB-only, set @usr_data == NULL, and to
814a8e43feSDavid Howells * write data-only, set @usr_oob == NULL. However, setting both @usr_data and
824a8e43feSDavid Howells * @usr_oob to NULL is not allowed.
834a8e43feSDavid Howells */
844a8e43feSDavid Howells struct mtd_write_req {
854a8e43feSDavid Howells __u64 start;
864a8e43feSDavid Howells __u64 len;
874a8e43feSDavid Howells __u64 ooblen;
884a8e43feSDavid Howells __u64 usr_data;
894a8e43feSDavid Howells __u64 usr_oob;
904a8e43feSDavid Howells __u8 mode;
914a8e43feSDavid Howells __u8 padding[7];
924a8e43feSDavid Howells };
934a8e43feSDavid Howells
94*095bb6e4SMichał Kępień /**
95*095bb6e4SMichał Kępień * struct mtd_read_req_ecc_stats - ECC statistics for a read operation
96*095bb6e4SMichał Kępień *
97*095bb6e4SMichał Kępień * @uncorrectable_errors: the number of uncorrectable errors that happened
98*095bb6e4SMichał Kępień * during the read operation
99*095bb6e4SMichał Kępień * @corrected_bitflips: the number of bitflips corrected during the read
100*095bb6e4SMichał Kępień * operation
101*095bb6e4SMichał Kępień * @max_bitflips: the maximum number of bitflips detected in any single ECC
102*095bb6e4SMichał Kępień * step for the data read during the operation; this information
103*095bb6e4SMichał Kępień * can be used to decide whether the data stored in a specific
104*095bb6e4SMichał Kępień * region of the MTD device should be moved somewhere else to
105*095bb6e4SMichał Kępień * avoid data loss.
106*095bb6e4SMichał Kępień */
107*095bb6e4SMichał Kępień struct mtd_read_req_ecc_stats {
108*095bb6e4SMichał Kępień __u32 uncorrectable_errors;
109*095bb6e4SMichał Kępień __u32 corrected_bitflips;
110*095bb6e4SMichał Kępień __u32 max_bitflips;
111*095bb6e4SMichał Kępień };
112*095bb6e4SMichał Kępień
113*095bb6e4SMichał Kępień /**
114*095bb6e4SMichał Kępień * struct mtd_read_req - data structure for requesting a read operation
115*095bb6e4SMichał Kępień *
116*095bb6e4SMichał Kępień * @start: start address
117*095bb6e4SMichał Kępień * @len: length of data buffer (only lower 32 bits are used)
118*095bb6e4SMichał Kępień * @ooblen: length of OOB buffer (only lower 32 bits are used)
119*095bb6e4SMichał Kępień * @usr_data: user-provided data buffer
120*095bb6e4SMichał Kępień * @usr_oob: user-provided OOB buffer
121*095bb6e4SMichał Kępień * @mode: MTD mode (see "MTD operation modes")
122*095bb6e4SMichał Kępień * @padding: reserved, must be set to 0
123*095bb6e4SMichał Kępień * @ecc_stats: ECC statistics for the read operation
124*095bb6e4SMichał Kępień *
125*095bb6e4SMichał Kępień * This structure supports ioctl(MEMREAD) operations, allowing data and/or OOB
126*095bb6e4SMichał Kępień * reads in various modes. To read from OOB-only, set @usr_data == NULL, and to
127*095bb6e4SMichał Kępień * read data-only, set @usr_oob == NULL. However, setting both @usr_data and
128*095bb6e4SMichał Kępień * @usr_oob to NULL is not allowed.
129*095bb6e4SMichał Kępień */
130*095bb6e4SMichał Kępień struct mtd_read_req {
131*095bb6e4SMichał Kępień __u64 start;
132*095bb6e4SMichał Kępień __u64 len;
133*095bb6e4SMichał Kępień __u64 ooblen;
134*095bb6e4SMichał Kępień __u64 usr_data;
135*095bb6e4SMichał Kępień __u64 usr_oob;
136*095bb6e4SMichał Kępień __u8 mode;
137*095bb6e4SMichał Kępień __u8 padding[7];
138*095bb6e4SMichał Kępień struct mtd_read_req_ecc_stats ecc_stats;
139*095bb6e4SMichał Kępień };
140*095bb6e4SMichał Kępień
1414a8e43feSDavid Howells #define MTD_ABSENT 0
1424a8e43feSDavid Howells #define MTD_RAM 1
1434a8e43feSDavid Howells #define MTD_ROM 2
1444a8e43feSDavid Howells #define MTD_NORFLASH 3
145fda5b0e2SHuang Shijie #define MTD_NANDFLASH 4 /* SLC NAND */
1464a8e43feSDavid Howells #define MTD_DATAFLASH 6
1474a8e43feSDavid Howells #define MTD_UBIVOLUME 7
148fda5b0e2SHuang Shijie #define MTD_MLCNANDFLASH 8 /* MLC NAND (including TLC) */
1494a8e43feSDavid Howells
1504a8e43feSDavid Howells #define MTD_WRITEABLE 0x400 /* Device is writeable */
1514a8e43feSDavid Howells #define MTD_BIT_WRITEABLE 0x800 /* Single bits can be flipped */
1524a8e43feSDavid Howells #define MTD_NO_ERASE 0x1000 /* No erase necessary */
1534a8e43feSDavid Howells #define MTD_POWERUP_LOCK 0x2000 /* Always locked after reset */
1549e3307a1SBoris Brezillon #define MTD_SLC_ON_MLC_EMULATION 0x4000 /* Emulate SLC behavior on MLC NANDs */
1554a8e43feSDavid Howells
1564a8e43feSDavid Howells /* Some common devices / combinations of capabilities */
1574a8e43feSDavid Howells #define MTD_CAP_ROM 0
1584a8e43feSDavid Howells #define MTD_CAP_RAM (MTD_WRITEABLE | MTD_BIT_WRITEABLE | MTD_NO_ERASE)
1594a8e43feSDavid Howells #define MTD_CAP_NORFLASH (MTD_WRITEABLE | MTD_BIT_WRITEABLE)
1604a8e43feSDavid Howells #define MTD_CAP_NANDFLASH (MTD_WRITEABLE)
16196ba9dd6SVincenzo Aliberti #define MTD_CAP_NVRAM (MTD_WRITEABLE | MTD_BIT_WRITEABLE | MTD_NO_ERASE)
1624a8e43feSDavid Howells
1634a8e43feSDavid Howells /* Obsolete ECC byte placement modes (used with obsolete MEMGETOOBSEL) */
164df616d7aSMasahiro Yamada #define MTD_NANDECC_OFF 0 /* Switch off ECC (Not recommended) */
165df616d7aSMasahiro Yamada #define MTD_NANDECC_PLACE 1 /* Use the given placement in the structure (YAFFS1 legacy mode) */
166df616d7aSMasahiro Yamada #define MTD_NANDECC_AUTOPLACE 2 /* Use the default placement scheme */
167df616d7aSMasahiro Yamada #define MTD_NANDECC_PLACEONLY 3 /* Use the given placement in the structure (Do not store ecc result on read) */
168df616d7aSMasahiro Yamada #define MTD_NANDECC_AUTOPL_USR 4 /* Use the given autoplacement scheme rather than using the default */
1694a8e43feSDavid Howells
1704a8e43feSDavid Howells /* OTP mode selection */
1714a8e43feSDavid Howells #define MTD_OTP_OFF 0
1724a8e43feSDavid Howells #define MTD_OTP_FACTORY 1
1734a8e43feSDavid Howells #define MTD_OTP_USER 2
1744a8e43feSDavid Howells
1754a8e43feSDavid Howells struct mtd_info_user {
1764a8e43feSDavid Howells __u8 type;
1774a8e43feSDavid Howells __u32 flags;
1784a8e43feSDavid Howells __u32 size; /* Total size of the MTD */
1794a8e43feSDavid Howells __u32 erasesize;
1804a8e43feSDavid Howells __u32 writesize;
1814a8e43feSDavid Howells __u32 oobsize; /* Amount of OOB data per block (e.g. 16) */
1824a8e43feSDavid Howells __u64 padding; /* Old obsolete field; do not use */
1834a8e43feSDavid Howells };
1844a8e43feSDavid Howells
1854a8e43feSDavid Howells struct region_info_user {
1864a8e43feSDavid Howells __u32 offset; /* At which this region starts,
1874a8e43feSDavid Howells * from the beginning of the MTD */
1884a8e43feSDavid Howells __u32 erasesize; /* For this region */
1894a8e43feSDavid Howells __u32 numblocks; /* Number of blocks in this region */
1904a8e43feSDavid Howells __u32 regionindex;
1914a8e43feSDavid Howells };
1924a8e43feSDavid Howells
1934a8e43feSDavid Howells struct otp_info {
1944a8e43feSDavid Howells __u32 start;
1954a8e43feSDavid Howells __u32 length;
1964a8e43feSDavid Howells __u32 locked;
1974a8e43feSDavid Howells };
1984a8e43feSDavid Howells
1994a8e43feSDavid Howells /*
2004a8e43feSDavid Howells * Note, the following ioctl existed in the past and was removed:
2014a8e43feSDavid Howells * #define MEMSETOOBSEL _IOW('M', 9, struct nand_oobinfo)
2024a8e43feSDavid Howells * Try to avoid adding a new ioctl with the same ioctl number.
2034a8e43feSDavid Howells */
2044a8e43feSDavid Howells
2054a8e43feSDavid Howells /* Get basic MTD characteristics info (better to use sysfs) */
2064a8e43feSDavid Howells #define MEMGETINFO _IOR('M', 1, struct mtd_info_user)
2074a8e43feSDavid Howells /* Erase segment of MTD */
2084a8e43feSDavid Howells #define MEMERASE _IOW('M', 2, struct erase_info_user)
2094a8e43feSDavid Howells /* Write out-of-band data from MTD */
2104a8e43feSDavid Howells #define MEMWRITEOOB _IOWR('M', 3, struct mtd_oob_buf)
2114a8e43feSDavid Howells /* Read out-of-band data from MTD */
2124a8e43feSDavid Howells #define MEMREADOOB _IOWR('M', 4, struct mtd_oob_buf)
2134a8e43feSDavid Howells /* Lock a chip (for MTD that supports it) */
2144a8e43feSDavid Howells #define MEMLOCK _IOW('M', 5, struct erase_info_user)
2154a8e43feSDavid Howells /* Unlock a chip (for MTD that supports it) */
2164a8e43feSDavid Howells #define MEMUNLOCK _IOW('M', 6, struct erase_info_user)
2174a8e43feSDavid Howells /* Get the number of different erase regions */
2184a8e43feSDavid Howells #define MEMGETREGIONCOUNT _IOR('M', 7, int)
2194a8e43feSDavid Howells /* Get information about the erase region for a specific index */
2204a8e43feSDavid Howells #define MEMGETREGIONINFO _IOWR('M', 8, struct region_info_user)
2214a8e43feSDavid Howells /* Get info about OOB modes (e.g., RAW, PLACE, AUTO) - legacy interface */
2224a8e43feSDavid Howells #define MEMGETOOBSEL _IOR('M', 10, struct nand_oobinfo)
2234a8e43feSDavid Howells /* Check if an eraseblock is bad */
2244a8e43feSDavid Howells #define MEMGETBADBLOCK _IOW('M', 11, __kernel_loff_t)
2254a8e43feSDavid Howells /* Mark an eraseblock as bad */
2264a8e43feSDavid Howells #define MEMSETBADBLOCK _IOW('M', 12, __kernel_loff_t)
2274a8e43feSDavid Howells /* Set OTP (One-Time Programmable) mode (factory vs. user) */
2284a8e43feSDavid Howells #define OTPSELECT _IOR('M', 13, int)
2294a8e43feSDavid Howells /* Get number of OTP (One-Time Programmable) regions */
2304a8e43feSDavid Howells #define OTPGETREGIONCOUNT _IOW('M', 14, int)
2314a8e43feSDavid Howells /* Get all OTP (One-Time Programmable) info about MTD */
2324a8e43feSDavid Howells #define OTPGETREGIONINFO _IOW('M', 15, struct otp_info)
2334a8e43feSDavid Howells /* Lock a given range of user data (must be in mode %MTD_FILE_MODE_OTP_USER) */
2344a8e43feSDavid Howells #define OTPLOCK _IOR('M', 16, struct otp_info)
2354a8e43feSDavid Howells /* Get ECC layout (deprecated) */
2364a8e43feSDavid Howells #define ECCGETLAYOUT _IOR('M', 17, struct nand_ecclayout_user)
2374a8e43feSDavid Howells /* Get statistics about corrected/uncorrected errors */
2384a8e43feSDavid Howells #define ECCGETSTATS _IOR('M', 18, struct mtd_ecc_stats)
2394a8e43feSDavid Howells /* Set MTD mode on a per-file-descriptor basis (see "MTD file modes") */
2404a8e43feSDavid Howells #define MTDFILEMODE _IO('M', 19)
2414a8e43feSDavid Howells /* Erase segment of MTD (supports 64-bit address) */
2424a8e43feSDavid Howells #define MEMERASE64 _IOW('M', 20, struct erase_info_user64)
2434a8e43feSDavid Howells /* Write data to OOB (64-bit version) */
2444a8e43feSDavid Howells #define MEMWRITEOOB64 _IOWR('M', 21, struct mtd_oob_buf64)
2454a8e43feSDavid Howells /* Read data from OOB (64-bit version) */
2464a8e43feSDavid Howells #define MEMREADOOB64 _IOWR('M', 22, struct mtd_oob_buf64)
2474a8e43feSDavid Howells /* Check if chip is locked (for MTD that supports it) */
2484a8e43feSDavid Howells #define MEMISLOCKED _IOR('M', 23, struct erase_info_user)
2494a8e43feSDavid Howells /*
2504a8e43feSDavid Howells * Most generic write interface; can write in-band and/or out-of-band in various
2514a8e43feSDavid Howells * modes (see "struct mtd_write_req"). This ioctl is not supported for flashes
2524a8e43feSDavid Howells * without OOB, e.g., NOR flash.
2534a8e43feSDavid Howells */
2544a8e43feSDavid Howells #define MEMWRITE _IOWR('M', 24, struct mtd_write_req)
255e3c1f1c9SMichael Walle /* Erase a given range of user data (must be in mode %MTD_FILE_MODE_OTP_USER) */
256e3c1f1c9SMichael Walle #define OTPERASE _IOW('M', 25, struct otp_info)
257*095bb6e4SMichał Kępień /*
258*095bb6e4SMichał Kępień * Most generic read interface; can read in-band and/or out-of-band in various
259*095bb6e4SMichał Kępień * modes (see "struct mtd_read_req"). This ioctl is not supported for flashes
260*095bb6e4SMichał Kępień * without OOB, e.g., NOR flash.
261*095bb6e4SMichał Kępień */
262*095bb6e4SMichał Kępień #define MEMREAD _IOWR('M', 26, struct mtd_read_req)
2634a8e43feSDavid Howells
2644a8e43feSDavid Howells /*
2654a8e43feSDavid Howells * Obsolete legacy interface. Keep it in order not to break userspace
2664a8e43feSDavid Howells * interfaces
2674a8e43feSDavid Howells */
2684a8e43feSDavid Howells struct nand_oobinfo {
2694a8e43feSDavid Howells __u32 useecc;
2704a8e43feSDavid Howells __u32 eccbytes;
2714a8e43feSDavid Howells __u32 oobfree[8][2];
2724a8e43feSDavid Howells __u32 eccpos[32];
2734a8e43feSDavid Howells };
2744a8e43feSDavid Howells
2754a8e43feSDavid Howells struct nand_oobfree {
2764a8e43feSDavid Howells __u32 offset;
2774a8e43feSDavid Howells __u32 length;
2784a8e43feSDavid Howells };
2794a8e43feSDavid Howells
2804a8e43feSDavid Howells #define MTD_MAX_OOBFREE_ENTRIES 8
2814a8e43feSDavid Howells #define MTD_MAX_ECCPOS_ENTRIES 64
2824a8e43feSDavid Howells /*
2834a8e43feSDavid Howells * OBSOLETE: ECC layout control structure. Exported to user-space via ioctl
2844a8e43feSDavid Howells * ECCGETLAYOUT for backwards compatbility and should not be mistaken as a
2854a8e43feSDavid Howells * complete set of ECC information. The ioctl truncates the larger internal
2864a8e43feSDavid Howells * structure to retain binary compatibility with the static declaration of the
2874a8e43feSDavid Howells * ioctl. Note that the "MTD_MAX_..._ENTRIES" macros represent the max size of
288aab616e3SBoris Brezillon * the user struct, not the MAX size of the internal OOB layout representation.
2894a8e43feSDavid Howells */
2904a8e43feSDavid Howells struct nand_ecclayout_user {
2914a8e43feSDavid Howells __u32 eccbytes;
2924a8e43feSDavid Howells __u32 eccpos[MTD_MAX_ECCPOS_ENTRIES];
2934a8e43feSDavid Howells __u32 oobavail;
2944a8e43feSDavid Howells struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES];
2954a8e43feSDavid Howells };
2964a8e43feSDavid Howells
2974a8e43feSDavid Howells /**
2984a8e43feSDavid Howells * struct mtd_ecc_stats - error correction stats
2994a8e43feSDavid Howells *
3004a8e43feSDavid Howells * @corrected: number of corrected bits
3014a8e43feSDavid Howells * @failed: number of uncorrectable errors
3024a8e43feSDavid Howells * @badblocks: number of bad blocks in this partition
3034a8e43feSDavid Howells * @bbtblocks: number of blocks reserved for bad block tables
3044a8e43feSDavid Howells */
3054a8e43feSDavid Howells struct mtd_ecc_stats {
3064a8e43feSDavid Howells __u32 corrected;
3074a8e43feSDavid Howells __u32 failed;
3084a8e43feSDavid Howells __u32 badblocks;
3094a8e43feSDavid Howells __u32 bbtblocks;
3104a8e43feSDavid Howells };
3114a8e43feSDavid Howells
3124a8e43feSDavid Howells /*
3134a8e43feSDavid Howells * MTD file modes - for read/write access to MTD
3144a8e43feSDavid Howells *
3154a8e43feSDavid Howells * @MTD_FILE_MODE_NORMAL: OTP disabled, ECC enabled
3164a8e43feSDavid Howells * @MTD_FILE_MODE_OTP_FACTORY: OTP enabled in factory mode
3174a8e43feSDavid Howells * @MTD_FILE_MODE_OTP_USER: OTP enabled in user mode
3184a8e43feSDavid Howells * @MTD_FILE_MODE_RAW: OTP disabled, ECC disabled
3194a8e43feSDavid Howells *
320f8951902SRandy Dunlap * These modes can be set via ioctl(MTDFILEMODE). The mode will be retained
3214a8e43feSDavid Howells * separately for each open file descriptor.
3224a8e43feSDavid Howells *
3234a8e43feSDavid Howells * Note: %MTD_FILE_MODE_RAW provides the same functionality as %MTD_OPS_RAW -
3244a8e43feSDavid Howells * raw access to the flash, without error correction or autoplacement schemes.
3254a8e43feSDavid Howells * Wherever possible, the MTD_OPS_* mode will override the MTD_FILE_MODE_* mode
326*095bb6e4SMichał Kępień * (e.g., when using ioctl(MEMWRITE) or ioctl(MEMREAD)), but in some cases, the
327*095bb6e4SMichał Kępień * MTD_FILE_MODE is used out of necessity (e.g., `write()',
328*095bb6e4SMichał Kępień * ioctl(MEMWRITEOOB64)).
3294a8e43feSDavid Howells */
3304a8e43feSDavid Howells enum mtd_file_modes {
3314a8e43feSDavid Howells MTD_FILE_MODE_NORMAL = MTD_OTP_OFF,
3324a8e43feSDavid Howells MTD_FILE_MODE_OTP_FACTORY = MTD_OTP_FACTORY,
3334a8e43feSDavid Howells MTD_FILE_MODE_OTP_USER = MTD_OTP_USER,
3344a8e43feSDavid Howells MTD_FILE_MODE_RAW,
3354a8e43feSDavid Howells };
3364a8e43feSDavid Howells
mtd_type_is_nand_user(const struct mtd_info_user * mtd)3374f8a3ba7SHuang Shijie static inline int mtd_type_is_nand_user(const struct mtd_info_user *mtd)
3384f8a3ba7SHuang Shijie {
3394f8a3ba7SHuang Shijie return mtd->type == MTD_NANDFLASH || mtd->type == MTD_MLCNANDFLASH;
3404f8a3ba7SHuang Shijie }
3414f8a3ba7SHuang Shijie
3424a8e43feSDavid Howells #endif /* __MTD_ABI_H__ */
343