@@ -118,20 +118,25 @@ enum nand_ecc_algo {
118118#define NAND_ECC_GENERIC_ERASED_CHECK BIT(0)
119119#define NAND_ECC_MAXIMIZE BIT(1)
120120
121- /*
122- * When using software implementation of Hamming, we can specify which byte
123- * ordering should be used.
124- */
125- #define NAND_ECC_SOFT_HAMMING_SM_ORDER BIT(2)
126-
127121/*
128122 * Option constants for bizarre disfunctionality and real
129123 * features.
130124 */
125+
131126/* Buswidth is 16 bit */
132127#define NAND_BUSWIDTH_16 BIT(1)
128+
129+ /*
130+ * When using software implementation of Hamming, we can specify which byte
131+ * ordering should be used.
132+ */
133+ #define NAND_ECC_SOFT_HAMMING_SM_ORDER BIT(2)
134+
133135/* Chip has cache program function */
134136#define NAND_CACHEPRG BIT(3)
137+ /* Options valid for Samsung large page devices */
138+ #define NAND_SAMSUNG_LP_OPTIONS NAND_CACHEPRG
139+
135140/*
136141 * Chip requires ready check on read (for auto-incremented sequential read).
137142 * True only for small page devices; large page devices do not support
@@ -150,6 +155,8 @@ enum nand_ecc_algo {
150155
151156/* Device supports subpage reads */
152157#define NAND_SUBPAGE_READ BIT(12)
158+ /* Macros to identify the above */
159+ #define NAND_HAS_SUBPAGE_READ (chip ) ((chip->options & NAND_SUBPAGE_READ))
153160
154161/*
155162 * Some MLC NANDs need data scrambling to limit bitflips caused by repeated
@@ -160,39 +167,20 @@ enum nand_ecc_algo {
160167/* Device needs 3rd row address cycle */
161168#define NAND_ROW_ADDR_3 BIT(14)
162169
163- /* Options valid for Samsung large page devices */
164- #define NAND_SAMSUNG_LP_OPTIONS NAND_CACHEPRG
165-
166- /* Macros to identify the above */
167- #define NAND_HAS_SUBPAGE_READ (chip ) ((chip->options & NAND_SUBPAGE_READ))
168-
169- /*
170- * There are different places where the manufacturer stores the factory bad
171- * block markers.
172- *
173- * Position within the block: Each of these pages needs to be checked for a
174- * bad block marking pattern.
175- */
176- #define NAND_BBM_FIRSTPAGE BIT(24)
177- #define NAND_BBM_SECONDPAGE BIT(25)
178- #define NAND_BBM_LASTPAGE BIT(26)
179-
180- /* Position within the OOB data of the page */
181- #define NAND_BBM_POS_SMALL 5
182- #define NAND_BBM_POS_LARGE 0
183-
184170/* Non chip related options */
185171/* This option skips the bbt scan during initialization. */
186172#define NAND_SKIP_BBTSCAN BIT(16)
187173/* Chip may not exist, so silence any errors in scan */
188174#define NAND_SCAN_SILENT_NODEV BIT(18)
175+
189176/*
190177 * Autodetect nand buswidth with readid/onfi.
191178 * This suppose the driver will configure the hardware in 8 bits mode
192179 * when calling nand_scan_ident, and update its configuration
193180 * before calling nand_scan_tail.
194181 */
195182#define NAND_BUSWIDTH_AUTO BIT(19)
183+
196184/*
197185 * This option could be defined by controller drivers to protect against
198186 * kmap'ed, vmalloc'ed highmem buffers being passed from upper layers
@@ -222,11 +210,26 @@ enum nand_ecc_algo {
222210 */
223211#define NAND_KEEP_TIMINGS BIT(23)
224212
213+ /*
214+ * There are different places where the manufacturer stores the factory bad
215+ * block markers.
216+ *
217+ * Position within the block: Each of these pages needs to be checked for a
218+ * bad block marking pattern.
219+ */
220+ #define NAND_BBM_FIRSTPAGE BIT(24)
221+ #define NAND_BBM_SECONDPAGE BIT(25)
222+ #define NAND_BBM_LASTPAGE BIT(26)
223+
225224/* Cell info constants */
226225#define NAND_CI_CHIPNR_MSK 0x03
227226#define NAND_CI_CELLTYPE_MSK 0x0C
228227#define NAND_CI_CELLTYPE_SHIFT 2
229228
229+ /* Position within the OOB data of the page */
230+ #define NAND_BBM_POS_SMALL 5
231+ #define NAND_BBM_POS_LARGE 0
232+
230233/**
231234 * struct nand_parameters - NAND generic parameters from the parameter page
232235 * @model: Model name
0 commit comments