Blame view
include/nand.h
4.42 KB
83d290c56 SPDX: Convert all... |
1 |
/* SPDX-License-Identifier: GPL-2.0 */ |
932394ac4 Rewrite of NAND c... |
2 3 4 5 |
/* * (C) Copyright 2005 * 2N Telekomunikace, a.s. <www.2n.cz> * Ladislav Michl <michl@2n.cz> |
932394ac4 Rewrite of NAND c... |
6 7 8 9 |
*/ #ifndef _NAND_H_ #define _NAND_H_ |
c17834749 nand/fsl_elbc: Co... |
10 11 12 13 14 15 16 |
#include <config.h> /* * All boards using a given driver must convert to self-init * at the same time, so do it here. When all drivers are * converted, this will go away. */ |
0b0b4f598 mtd: nand: atmel:... |
17 18 19 20 21 |
#ifdef CONFIG_SPL_BUILD #if defined(CONFIG_NAND_FSL_ELBC) || defined(CONFIG_NAND_FSL_IFC) #define CONFIG_SYS_NAND_SELF_INIT #endif #else |
a1b81ab26 nand/fsl_ifc: Con... |
22 23 |
#if defined(CONFIG_NAND_FSL_ELBC) || defined(CONFIG_NAND_ATMEL)\ || defined(CONFIG_NAND_FSL_IFC) |
c17834749 nand/fsl_elbc: Co... |
24 25 |
#define CONFIG_SYS_NAND_SELF_INIT #endif |
0b0b4f598 mtd: nand: atmel:... |
26 |
#endif |
c17834749 nand/fsl_elbc: Co... |
27 |
|
9d2e3947b NAND: ifdef-prote... |
28 |
extern void nand_init(void); |
203db38a9 mtd: nand: remove... |
29 |
unsigned long nand_size(void); |
9d2e3947b NAND: ifdef-prote... |
30 |
|
7b15e2bb9 linux/compat.h: r... |
31 |
#include <linux/compat.h> |
932394ac4 Rewrite of NAND c... |
32 |
#include <linux/mtd/mtd.h> |
6ae3900a8 mtd: nand: Rename... |
33 |
#include <linux/mtd/rawnand.h> |
932394ac4 Rewrite of NAND c... |
34 |
|
b616d9b0a nand: Embed mtd_i... |
35 |
int nand_mtd_to_devnum(struct mtd_info *mtd); |
578931b34 nand: Introduce C... |
36 37 |
#ifdef CONFIG_SYS_NAND_SELF_INIT void board_nand_init(void); |
b616d9b0a nand: Embed mtd_i... |
38 |
int nand_register(int devnum, struct mtd_info *mtd); |
578931b34 nand: Introduce C... |
39 |
#else |
69fb8be4f NAND: move board_... |
40 |
extern int board_nand_init(struct nand_chip *nand); |
578931b34 nand: Introduce C... |
41 |
#endif |
69fb8be4f NAND: move board_... |
42 |
|
932394ac4 Rewrite of NAND c... |
43 |
extern int nand_curr_device; |
932394ac4 Rewrite of NAND c... |
44 |
|
151c06ec6 mtd: nand: Remove... |
45 46 |
static inline int nand_read(struct mtd_info *info, loff_t ofs, size_t *len, u_char *buf) |
932394ac4 Rewrite of NAND c... |
47 |
{ |
dfe64e2c8 mtd: resync with ... |
48 |
return mtd_read(info, ofs, *len, (size_t *)len, buf); |
932394ac4 Rewrite of NAND c... |
49 |
} |
151c06ec6 mtd: nand: Remove... |
50 51 |
static inline int nand_write(struct mtd_info *info, loff_t ofs, size_t *len, u_char *buf) |
932394ac4 Rewrite of NAND c... |
52 |
{ |
dfe64e2c8 mtd: resync with ... |
53 |
return mtd_write(info, ofs, *len, (size_t *)len, buf); |
932394ac4 Rewrite of NAND c... |
54 |
} |
151c06ec6 mtd: nand: Remove... |
55 |
static inline int nand_block_isbad(struct mtd_info *info, loff_t ofs) |
932394ac4 Rewrite of NAND c... |
56 |
{ |
dfe64e2c8 mtd: resync with ... |
57 |
return mtd_block_isbad(info, ofs); |
932394ac4 Rewrite of NAND c... |
58 |
} |
151c06ec6 mtd: nand: Remove... |
59 |
static inline int nand_erase(struct mtd_info *info, loff_t off, size_t size) |
932394ac4 Rewrite of NAND c... |
60 |
{ |
8e9655f86 * Add hook to NAN... |
61 62 63 64 65 66 |
struct erase_info instr; instr.mtd = info; instr.addr = off; instr.len = size; instr.callback = 0; |
dfe64e2c8 mtd: resync with ... |
67 |
return mtd_erase(info, &instr); |
932394ac4 Rewrite of NAND c... |
68 |
} |
2255b2d20 * Several improve... |
69 70 71 72 |
/***************************************************************************** * declarations from nand_util.c ****************************************************************************/ |
cfa460adf Update MTD to tha... |
73 |
typedef struct mtd_oob_ops mtd_oob_ops_t; |
2255b2d20 * Several improve... |
74 |
|
2255b2d20 * Several improve... |
75 |
struct nand_erase_options { |
304863225 nand erase: .spre... |
76 77 |
loff_t length; /* number of bytes to erase */ loff_t offset; /* first address in NAND to erase */ |
2255b2d20 * Several improve... |
78 79 80 81 82 |
int quiet; /* don't display progress messages */ int jffs2; /* if true: format for jffs2 usage * (write appropriate cleanmarker blocks) */ int scrub; /* if true, really clean NAND by erasing * bad blocks (UNSAFE) */ |
304863225 nand erase: .spre... |
83 84 85 |
/* Don't include skipped bad blocks in size to be erased */ int spread; |
a67cc37e6 dfu, nand: before... |
86 87 |
/* maximum size that actual may be in order to not exceed the buf */ loff_t lim; |
2255b2d20 * Several improve... |
88 89 90 |
}; typedef struct nand_erase_options nand_erase_options_t; |
151c06ec6 mtd: nand: Remove... |
91 |
int nand_read_skip_bad(struct mtd_info *mtd, loff_t offset, size_t *length, |
c39d6a0ea nand: Extend nand... |
92 |
size_t *actual, loff_t lim, u_char *buffer); |
a6c9aa1f9 nand_util: conver... |
93 |
|
004a1fdb4 nand: yaffs: Remo... |
94 95 |
#define WITH_DROP_FFS (1 << 0) /* drop trailing all-0xff pages */ #define WITH_WR_VERIFY (1 << 1) /* verify data was written correctly */ |
a6c9aa1f9 nand_util: conver... |
96 |
|
151c06ec6 mtd: nand: Remove... |
97 |
int nand_write_skip_bad(struct mtd_info *mtd, loff_t offset, size_t *length, |
c39d6a0ea nand: Extend nand... |
98 |
size_t *actual, loff_t lim, u_char *buffer, int flags); |
151c06ec6 mtd: nand: Remove... |
99 100 101 102 103 104 |
int nand_erase_opts(struct mtd_info *mtd, const nand_erase_options_t *opts); int nand_torture(struct mtd_info *mtd, loff_t offset); int nand_verify_page_oob(struct mtd_info *mtd, struct mtd_oob_ops *ops, loff_t ofs); int nand_verify(struct mtd_info *mtd, loff_t ofs, size_t len, u_char *buf); |
2255b2d20 * Several improve... |
105 106 |
#define NAND_LOCK_STATUS_TIGHT 0x01 |
2255b2d20 * Several improve... |
107 |
#define NAND_LOCK_STATUS_UNLOCK 0x04 |
151c06ec6 mtd: nand: Remove... |
108 109 110 111 |
int nand_lock(struct mtd_info *mtd, int tight); int nand_unlock(struct mtd_info *mtd, loff_t start, size_t length, int allexcept); int nand_get_lock_status(struct mtd_info *mtd, loff_t offset); |
2255b2d20 * Several improve... |
112 |
|
12c2f1ee3 spl: add NAND Lib... |
113 |
int nand_spl_load_image(uint32_t offs, unsigned int size, void *dst); |
e1a89e935 nand_spl_simple: ... |
114 |
int nand_spl_read_block(int block, int offset, int len, void *dst); |
bb085b87e omap-common: add ... |
115 |
void nand_deselect(void); |
6d0f6bcf3 rename CFG_ macro... |
116 |
#ifdef CONFIG_SYS_NAND_SELECT_DEVICE |
43a2b0e76 Add board/cpu spe... |
117 118 |
void board_nand_select_device(struct nand_chip *nand, int chip); #endif |
e4c095085 NAND boot: MPC831... |
119 |
__attribute__((noreturn)) void nand_boot(void); |
c9f7351b5 NAND: environment... |
120 121 122 123 124 125 |
#ifdef CONFIG_ENV_OFFSET_OOB #define ENV_OOB_MARKER 0x30425645 /*"EVB0" in little-endian -- offset is stored as block number*/ #define ENV_OOB_MARKER_OLD 0x30564e45 /*"ENV0" in little-endian -- offset is stored as byte number */ #define ENV_OFFSET_SIZE 8 |
151c06ec6 mtd: nand: Remove... |
126 |
int get_nand_env_oob(struct mtd_info *mtd, unsigned long *result); |
c9f7351b5 NAND: environment... |
127 |
#endif |
4dfd36058 spl, nand, atmel_... |
128 |
int spl_nand_erase_one(int block, int page); |
4ccae81cd mtd: nand: Add th... |
129 130 131 |
/* platform specific init functions */ void sunxi_nand_init(void); |
2afc741a2 include: nand: mo... |
132 |
|
ad92dff28 cmd: nand: abstra... |
133 134 135 136 137 138 139 140 |
/* * get_nand_dev_by_index - Get the nand info based in index. * * @dev - index to the nand device. * * returns pointer to the nand device info structure or NULL on failure. */ struct mtd_info *get_nand_dev_by_index(int dev); |
2afc741a2 include: nand: mo... |
141 |
#endif /* _NAND_H_ */ |