blob: 2e8b7e9314a39bcd6184e5f8d263552ab1dfe27b [file] [log] [blame]
Stefan Agner456930d2015-09-02 18:06:33 -07001/*
2 * Copyright 2009-2015 Freescale Semiconductor, Inc. and others
3 *
4 * Description: MPC5125, VF610, MCF54418 and Kinetis K70 Nand driver.
5 * Jason ported to M54418TWR and MVFA5 (VF610).
6 * Authors: Stefan Agner <stefan.agner@toradex.com>
7 * Bill Pringlemeir <bpringlemeir@nbsps.com>
8 * Shaohui Xie <b21989@freescale.com>
9 * Jason Jin <Jason.jin@freescale.com>
10 *
11 * Based on original driver mpc5121_nfc.c.
12 *
13 * This is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * Limitations:
19 * - Untested on MPC5125 and M54418.
20 * - DMA and pipelining not used.
21 * - 2K pages or less.
Stefan Agner049f4252015-09-02 18:06:34 -070022 * - HW ECC: Only 2K page with 64+ OOB.
23 * - HW ECC: Only 24 and 32-bit error correction implemented.
Stefan Agner456930d2015-09-02 18:06:33 -070024 */
25
26#include <linux/module.h>
27#include <linux/bitops.h>
28#include <linux/clk.h>
29#include <linux/delay.h>
30#include <linux/init.h>
31#include <linux/interrupt.h>
32#include <linux/io.h>
33#include <linux/mtd/mtd.h>
Boris Brezillond4092d72017-08-04 17:29:10 +020034#include <linux/mtd/rawnand.h>
Stefan Agner456930d2015-09-02 18:06:33 -070035#include <linux/mtd/partitions.h>
Stefan Agner456930d2015-09-02 18:06:33 -070036#include <linux/of_device.h>
37#include <linux/platform_device.h>
38#include <linux/slab.h>
Stefan Agner1cbe30b2018-03-09 15:50:36 +010039#include <linux/swab.h>
Stefan Agner456930d2015-09-02 18:06:33 -070040
41#define DRV_NAME "vf610_nfc"
42
43/* Register Offsets */
44#define NFC_FLASH_CMD1 0x3F00
45#define NFC_FLASH_CMD2 0x3F04
46#define NFC_COL_ADDR 0x3F08
47#define NFC_ROW_ADDR 0x3F0c
48#define NFC_ROW_ADDR_INC 0x3F14
49#define NFC_FLASH_STATUS1 0x3F18
50#define NFC_FLASH_STATUS2 0x3F1c
51#define NFC_CACHE_SWAP 0x3F28
52#define NFC_SECTOR_SIZE 0x3F2c
53#define NFC_FLASH_CONFIG 0x3F30
54#define NFC_IRQ_STATUS 0x3F38
55
56/* Addresses for NFC MAIN RAM BUFFER areas */
57#define NFC_MAIN_AREA(n) ((n) * 0x1000)
58
59#define PAGE_2K 0x0800
60#define OOB_64 0x0040
61#define OOB_MAX 0x0100
62
Stefan Agner1cbe30b2018-03-09 15:50:36 +010063/* NFC_CMD2[CODE] controller cycle bit masks */
64#define COMMAND_CMD_BYTE1 BIT(14)
65#define COMMAND_CAR_BYTE1 BIT(13)
66#define COMMAND_CAR_BYTE2 BIT(12)
67#define COMMAND_RAR_BYTE1 BIT(11)
68#define COMMAND_RAR_BYTE2 BIT(10)
69#define COMMAND_RAR_BYTE3 BIT(9)
70#define COMMAND_NADDR_BYTES(x) GENMASK(13, 13 - (x) + 1)
71#define COMMAND_WRITE_DATA BIT(8)
72#define COMMAND_CMD_BYTE2 BIT(7)
73#define COMMAND_RB_HANDSHAKE BIT(6)
74#define COMMAND_READ_DATA BIT(5)
75#define COMMAND_CMD_BYTE3 BIT(4)
76#define COMMAND_READ_STATUS BIT(3)
77#define COMMAND_READ_ID BIT(2)
78
Stefan Agner456930d2015-09-02 18:06:33 -070079/* NFC ECC mode define */
80#define ECC_BYPASS 0
Stefan Agner049f4252015-09-02 18:06:34 -070081#define ECC_45_BYTE 6
82#define ECC_60_BYTE 7
Stefan Agner456930d2015-09-02 18:06:33 -070083
84/*** Register Mask and bit definitions */
85
86/* NFC_FLASH_CMD1 Field */
87#define CMD_BYTE2_MASK 0xFF000000
88#define CMD_BYTE2_SHIFT 24
89
90/* NFC_FLASH_CM2 Field */
91#define CMD_BYTE1_MASK 0xFF000000
92#define CMD_BYTE1_SHIFT 24
93#define CMD_CODE_MASK 0x00FFFF00
94#define CMD_CODE_SHIFT 8
95#define BUFNO_MASK 0x00000006
96#define BUFNO_SHIFT 1
97#define START_BIT BIT(0)
98
99/* NFC_COL_ADDR Field */
100#define COL_ADDR_MASK 0x0000FFFF
101#define COL_ADDR_SHIFT 0
Stefan Agner1cbe30b2018-03-09 15:50:36 +0100102#define COL_ADDR(pos, val) (((val) & 0xFF) << (8 * (pos)))
Stefan Agner456930d2015-09-02 18:06:33 -0700103
104/* NFC_ROW_ADDR Field */
105#define ROW_ADDR_MASK 0x00FFFFFF
106#define ROW_ADDR_SHIFT 0
Stefan Agner1cbe30b2018-03-09 15:50:36 +0100107#define ROW_ADDR(pos, val) (((val) & 0xFF) << (8 * (pos)))
108
Stefan Agner456930d2015-09-02 18:06:33 -0700109#define ROW_ADDR_CHIP_SEL_RB_MASK 0xF0000000
110#define ROW_ADDR_CHIP_SEL_RB_SHIFT 28
111#define ROW_ADDR_CHIP_SEL_MASK 0x0F000000
112#define ROW_ADDR_CHIP_SEL_SHIFT 24
113
114/* NFC_FLASH_STATUS2 Field */
115#define STATUS_BYTE1_MASK 0x000000FF
116
117/* NFC_FLASH_CONFIG Field */
118#define CONFIG_ECC_SRAM_ADDR_MASK 0x7FC00000
119#define CONFIG_ECC_SRAM_ADDR_SHIFT 22
120#define CONFIG_ECC_SRAM_REQ_BIT BIT(21)
121#define CONFIG_DMA_REQ_BIT BIT(20)
122#define CONFIG_ECC_MODE_MASK 0x000E0000
123#define CONFIG_ECC_MODE_SHIFT 17
124#define CONFIG_FAST_FLASH_BIT BIT(16)
125#define CONFIG_16BIT BIT(7)
126#define CONFIG_BOOT_MODE_BIT BIT(6)
127#define CONFIG_ADDR_AUTO_INCR_BIT BIT(5)
128#define CONFIG_BUFNO_AUTO_INCR_BIT BIT(4)
129#define CONFIG_PAGE_CNT_MASK 0xF
130#define CONFIG_PAGE_CNT_SHIFT 0
131
132/* NFC_IRQ_STATUS Field */
133#define IDLE_IRQ_BIT BIT(29)
134#define IDLE_EN_BIT BIT(20)
135#define CMD_DONE_CLEAR_BIT BIT(18)
136#define IDLE_CLEAR_BIT BIT(17)
137
Stefan Agner049f4252015-09-02 18:06:34 -0700138/*
139 * ECC status - seems to consume 8 bytes (double word). The documented
140 * status byte is located in the lowest byte of the second word (which is
141 * the 4th or 7th byte depending on endianness).
142 * Calculate an offset to store the ECC status at the end of the buffer.
143 */
144#define ECC_SRAM_ADDR (PAGE_2K + OOB_MAX - 8)
145
146#define ECC_STATUS 0x4
147#define ECC_STATUS_MASK 0x80
148#define ECC_STATUS_ERR_COUNT 0x3F
149
Stefan Agner456930d2015-09-02 18:06:33 -0700150enum vf610_nfc_variant {
151 NFC_VFC610 = 1,
152};
153
154struct vf610_nfc {
Boris Brezillonda59b452018-11-20 10:02:37 +0100155 struct nand_controller base;
Stefan Agner456930d2015-09-02 18:06:33 -0700156 struct nand_chip chip;
157 struct device *dev;
158 void __iomem *regs;
159 struct completion cmd_done;
Stefan Agner456930d2015-09-02 18:06:33 -0700160 /* Status and ID are in alternate locations. */
Stefan Agner456930d2015-09-02 18:06:33 -0700161 enum vf610_nfc_variant variant;
162 struct clk *clk;
Stefan Agner1cbe30b2018-03-09 15:50:36 +0100163 /*
164 * Indicate that user data is accessed (full page/oob). This is
165 * useful to indicate the driver whether to swap byte endianness.
166 * See comments in vf610_nfc_rd_from_sram/vf610_nfc_wr_to_sram.
167 */
168 bool data_access;
Stefan Agner049f4252015-09-02 18:06:34 -0700169 u32 ecc_mode;
Stefan Agner456930d2015-09-02 18:06:33 -0700170};
171
Stefan Agner1cbe30b2018-03-09 15:50:36 +0100172static inline struct vf610_nfc *chip_to_nfc(struct nand_chip *chip)
173{
174 return container_of(chip, struct vf610_nfc, chip);
175}
176
Stefan Agner456930d2015-09-02 18:06:33 -0700177static inline u32 vf610_nfc_read(struct vf610_nfc *nfc, uint reg)
178{
179 return readl(nfc->regs + reg);
180}
181
182static inline void vf610_nfc_write(struct vf610_nfc *nfc, uint reg, u32 val)
183{
184 writel(val, nfc->regs + reg);
185}
186
187static inline void vf610_nfc_set(struct vf610_nfc *nfc, uint reg, u32 bits)
188{
189 vf610_nfc_write(nfc, reg, vf610_nfc_read(nfc, reg) | bits);
190}
191
192static inline void vf610_nfc_clear(struct vf610_nfc *nfc, uint reg, u32 bits)
193{
194 vf610_nfc_write(nfc, reg, vf610_nfc_read(nfc, reg) & ~bits);
195}
196
197static inline void vf610_nfc_set_field(struct vf610_nfc *nfc, u32 reg,
198 u32 mask, u32 shift, u32 val)
199{
200 vf610_nfc_write(nfc, reg,
201 (vf610_nfc_read(nfc, reg) & (~mask)) | val << shift);
202}
203
Stefan Agner1cbe30b2018-03-09 15:50:36 +0100204static inline bool vf610_nfc_kernel_is_little_endian(void)
205{
206#ifdef __LITTLE_ENDIAN
207 return true;
208#else
209 return false;
210#endif
211}
212
213/**
214 * Read accessor for internal SRAM buffer
215 * @dst: destination address in regular memory
216 * @src: source address in SRAM buffer
217 * @len: bytes to copy
218 * @fix_endian: Fix endianness if required
219 *
220 * Use this accessor for the internal SRAM buffers. On the ARM
221 * Freescale Vybrid SoC it's known that the driver can treat
222 * the SRAM buffer as if it's memory. Other platform might need
223 * to treat the buffers differently.
224 *
225 * The controller stores bytes from the NAND chip internally in big
226 * endianness. On little endian platforms such as Vybrid this leads
227 * to reversed byte order.
228 * For performance reason (and earlier probably due to unawareness)
229 * the driver avoids correcting endianness where it has control over
230 * write and read side (e.g. page wise data access).
231 */
232static inline void vf610_nfc_rd_from_sram(void *dst, const void __iomem *src,
233 size_t len, bool fix_endian)
234{
235 if (vf610_nfc_kernel_is_little_endian() && fix_endian) {
236 unsigned int i;
237
238 for (i = 0; i < len; i += 4) {
239 u32 val = swab32(__raw_readl(src + i));
240
241 memcpy(dst + i, &val, min(sizeof(val), len - i));
242 }
243 } else {
244 memcpy_fromio(dst, src, len);
245 }
246}
247
248/**
249 * Write accessor for internal SRAM buffer
250 * @dst: destination address in SRAM buffer
251 * @src: source address in regular memory
252 * @len: bytes to copy
253 * @fix_endian: Fix endianness if required
254 *
255 * Use this accessor for the internal SRAM buffers. On the ARM
256 * Freescale Vybrid SoC it's known that the driver can treat
257 * the SRAM buffer as if it's memory. Other platform might need
258 * to treat the buffers differently.
259 *
260 * The controller stores bytes from the NAND chip internally in big
261 * endianness. On little endian platforms such as Vybrid this leads
262 * to reversed byte order.
263 * For performance reason (and earlier probably due to unawareness)
264 * the driver avoids correcting endianness where it has control over
265 * write and read side (e.g. page wise data access).
266 */
267static inline void vf610_nfc_wr_to_sram(void __iomem *dst, const void *src,
268 size_t len, bool fix_endian)
269{
270 if (vf610_nfc_kernel_is_little_endian() && fix_endian) {
271 unsigned int i;
272
273 for (i = 0; i < len; i += 4) {
274 u32 val;
275
276 memcpy(&val, src + i, min(sizeof(val), len - i));
277 __raw_writel(swab32(val), dst + i);
278 }
279 } else {
280 memcpy_toio(dst, src, len);
281 }
282}
283
Stefan Agner456930d2015-09-02 18:06:33 -0700284/* Clear flags for upcoming command */
285static inline void vf610_nfc_clear_status(struct vf610_nfc *nfc)
286{
287 u32 tmp = vf610_nfc_read(nfc, NFC_IRQ_STATUS);
288
289 tmp |= CMD_DONE_CLEAR_BIT | IDLE_CLEAR_BIT;
290 vf610_nfc_write(nfc, NFC_IRQ_STATUS, tmp);
291}
292
293static void vf610_nfc_done(struct vf610_nfc *nfc)
294{
295 unsigned long timeout = msecs_to_jiffies(100);
296
297 /*
298 * Barrier is needed after this write. This write need
299 * to be done before reading the next register the first
300 * time.
301 * vf610_nfc_set implicates such a barrier by using writel
302 * to write to the register.
303 */
304 vf610_nfc_set(nfc, NFC_IRQ_STATUS, IDLE_EN_BIT);
305 vf610_nfc_set(nfc, NFC_FLASH_CMD2, START_BIT);
306
307 if (!wait_for_completion_timeout(&nfc->cmd_done, timeout))
308 dev_warn(nfc->dev, "Timeout while waiting for BUSY.\n");
309
310 vf610_nfc_clear_status(nfc);
311}
312
Stefan Agner456930d2015-09-02 18:06:33 -0700313static irqreturn_t vf610_nfc_irq(int irq, void *data)
314{
Boris Brezillon4440f782018-11-20 10:02:36 +0100315 struct vf610_nfc *nfc = data;
Stefan Agner456930d2015-09-02 18:06:33 -0700316
317 vf610_nfc_clear(nfc, NFC_IRQ_STATUS, IDLE_EN_BIT);
318 complete(&nfc->cmd_done);
319
320 return IRQ_HANDLED;
321}
322
Stefan Agner049f4252015-09-02 18:06:34 -0700323static inline void vf610_nfc_ecc_mode(struct vf610_nfc *nfc, int ecc_mode)
324{
325 vf610_nfc_set_field(nfc, NFC_FLASH_CONFIG,
326 CONFIG_ECC_MODE_MASK,
327 CONFIG_ECC_MODE_SHIFT, ecc_mode);
328}
329
Stefan Agner456930d2015-09-02 18:06:33 -0700330static inline void vf610_nfc_transfer_size(struct vf610_nfc *nfc, int size)
331{
332 vf610_nfc_write(nfc, NFC_SECTOR_SIZE, size);
333}
334
Stefan Agner1cbe30b2018-03-09 15:50:36 +0100335static inline void vf610_nfc_run(struct vf610_nfc *nfc, u32 col, u32 row,
336 u32 cmd1, u32 cmd2, u32 trfr_sz)
337{
338 vf610_nfc_set_field(nfc, NFC_COL_ADDR, COL_ADDR_MASK,
339 COL_ADDR_SHIFT, col);
340
341 vf610_nfc_set_field(nfc, NFC_ROW_ADDR, ROW_ADDR_MASK,
342 ROW_ADDR_SHIFT, row);
343
344 vf610_nfc_write(nfc, NFC_SECTOR_SIZE, trfr_sz);
345 vf610_nfc_write(nfc, NFC_FLASH_CMD1, cmd1);
346 vf610_nfc_write(nfc, NFC_FLASH_CMD2, cmd2);
347
348 dev_dbg(nfc->dev,
349 "col 0x%04x, row 0x%08x, cmd1 0x%08x, cmd2 0x%08x, len %d\n",
350 col, row, cmd1, cmd2, trfr_sz);
351
352 vf610_nfc_done(nfc);
353}
354
355static inline const struct nand_op_instr *
356vf610_get_next_instr(const struct nand_subop *subop, int *op_id)
357{
358 if (*op_id + 1 >= subop->ninstrs)
359 return NULL;
360
361 (*op_id)++;
362
363 return &subop->instrs[*op_id];
364}
365
366static int vf610_nfc_cmd(struct nand_chip *chip,
367 const struct nand_subop *subop)
368{
369 const struct nand_op_instr *instr;
370 struct vf610_nfc *nfc = chip_to_nfc(chip);
371 int op_id = -1, trfr_sz = 0, offset;
372 u32 col = 0, row = 0, cmd1 = 0, cmd2 = 0, code = 0;
373 bool force8bit = false;
374
375 /*
376 * Some ops are optional, but the hardware requires the operations
377 * to be in this exact order.
378 * The op parser enforces the order and makes sure that there isn't
379 * a read and write element in a single operation.
380 */
381 instr = vf610_get_next_instr(subop, &op_id);
382 if (!instr)
383 return -EINVAL;
384
385 if (instr && instr->type == NAND_OP_CMD_INSTR) {
386 cmd2 |= instr->ctx.cmd.opcode << CMD_BYTE1_SHIFT;
387 code |= COMMAND_CMD_BYTE1;
388
389 instr = vf610_get_next_instr(subop, &op_id);
390 }
391
392 if (instr && instr->type == NAND_OP_ADDR_INSTR) {
393 int naddrs = nand_subop_get_num_addr_cyc(subop, op_id);
394 int i = nand_subop_get_addr_start_off(subop, op_id);
395
396 for (; i < naddrs; i++) {
397 u8 val = instr->ctx.addr.addrs[i];
398
399 if (i < 2)
400 col |= COL_ADDR(i, val);
401 else
402 row |= ROW_ADDR(i - 2, val);
403 }
404 code |= COMMAND_NADDR_BYTES(naddrs);
405
406 instr = vf610_get_next_instr(subop, &op_id);
407 }
408
409 if (instr && instr->type == NAND_OP_DATA_OUT_INSTR) {
410 trfr_sz = nand_subop_get_data_len(subop, op_id);
411 offset = nand_subop_get_data_start_off(subop, op_id);
412 force8bit = instr->ctx.data.force_8bit;
413
414 /*
415 * Don't fix endianness on page access for historical reasons.
416 * See comment in vf610_nfc_wr_to_sram
417 */
418 vf610_nfc_wr_to_sram(nfc->regs + NFC_MAIN_AREA(0) + offset,
419 instr->ctx.data.buf.out + offset,
420 trfr_sz, !nfc->data_access);
421 code |= COMMAND_WRITE_DATA;
422
423 instr = vf610_get_next_instr(subop, &op_id);
424 }
425
426 if (instr && instr->type == NAND_OP_CMD_INSTR) {
427 cmd1 |= instr->ctx.cmd.opcode << CMD_BYTE2_SHIFT;
428 code |= COMMAND_CMD_BYTE2;
429
430 instr = vf610_get_next_instr(subop, &op_id);
431 }
432
433 if (instr && instr->type == NAND_OP_WAITRDY_INSTR) {
434 code |= COMMAND_RB_HANDSHAKE;
435
436 instr = vf610_get_next_instr(subop, &op_id);
437 }
438
439 if (instr && instr->type == NAND_OP_DATA_IN_INSTR) {
440 trfr_sz = nand_subop_get_data_len(subop, op_id);
441 offset = nand_subop_get_data_start_off(subop, op_id);
442 force8bit = instr->ctx.data.force_8bit;
443
444 code |= COMMAND_READ_DATA;
445 }
446
447 if (force8bit && (chip->options & NAND_BUSWIDTH_16))
448 vf610_nfc_clear(nfc, NFC_FLASH_CONFIG, CONFIG_16BIT);
449
450 cmd2 |= code << CMD_CODE_SHIFT;
451
452 vf610_nfc_run(nfc, col, row, cmd1, cmd2, trfr_sz);
453
454 if (instr && instr->type == NAND_OP_DATA_IN_INSTR) {
455 /*
456 * Don't fix endianness on page access for historical reasons.
457 * See comment in vf610_nfc_rd_from_sram
458 */
459 vf610_nfc_rd_from_sram(instr->ctx.data.buf.in + offset,
460 nfc->regs + NFC_MAIN_AREA(0) + offset,
461 trfr_sz, !nfc->data_access);
462 }
463
464 if (force8bit && (chip->options & NAND_BUSWIDTH_16))
465 vf610_nfc_set(nfc, NFC_FLASH_CONFIG, CONFIG_16BIT);
466
467 return 0;
468}
469
470static const struct nand_op_parser vf610_nfc_op_parser = NAND_OP_PARSER(
471 NAND_OP_PARSER_PATTERN(vf610_nfc_cmd,
472 NAND_OP_PARSER_PAT_CMD_ELEM(true),
473 NAND_OP_PARSER_PAT_ADDR_ELEM(true, 5),
474 NAND_OP_PARSER_PAT_DATA_OUT_ELEM(true, PAGE_2K + OOB_MAX),
475 NAND_OP_PARSER_PAT_CMD_ELEM(true),
476 NAND_OP_PARSER_PAT_WAITRDY_ELEM(true)),
477 NAND_OP_PARSER_PATTERN(vf610_nfc_cmd,
478 NAND_OP_PARSER_PAT_CMD_ELEM(true),
479 NAND_OP_PARSER_PAT_ADDR_ELEM(true, 5),
480 NAND_OP_PARSER_PAT_CMD_ELEM(true),
481 NAND_OP_PARSER_PAT_WAITRDY_ELEM(true),
482 NAND_OP_PARSER_PAT_DATA_IN_ELEM(true, PAGE_2K + OOB_MAX)),
483 );
484
Stefan Agner456930d2015-09-02 18:06:33 -0700485/*
486 * This function supports Vybrid only (MPC5125 would have full RB and four CS)
487 */
Boris Brezillon653c57c2018-11-11 08:55:20 +0100488static void vf610_nfc_select_target(struct nand_chip *chip, unsigned int cs)
Stefan Agner456930d2015-09-02 18:06:33 -0700489{
Boris Brezillon4440f782018-11-20 10:02:36 +0100490 struct vf610_nfc *nfc = chip_to_nfc(chip);
Boris Brezillon653c57c2018-11-11 08:55:20 +0100491 u32 tmp;
Stefan Agner456930d2015-09-02 18:06:33 -0700492
493 /* Vybrid only (MPC5125 would have full RB and four CS) */
494 if (nfc->variant != NFC_VFC610)
495 return;
496
Boris Brezillon653c57c2018-11-11 08:55:20 +0100497 tmp = vf610_nfc_read(nfc, NFC_ROW_ADDR);
Stefan Agner456930d2015-09-02 18:06:33 -0700498 tmp &= ~(ROW_ADDR_CHIP_SEL_RB_MASK | ROW_ADDR_CHIP_SEL_MASK);
Boris Brezillon653c57c2018-11-11 08:55:20 +0100499 tmp |= 1 << ROW_ADDR_CHIP_SEL_RB_SHIFT;
500 tmp |= BIT(cs) << ROW_ADDR_CHIP_SEL_SHIFT;
Stefan Agner456930d2015-09-02 18:06:33 -0700501
502 vf610_nfc_write(nfc, NFC_ROW_ADDR, tmp);
503}
504
Boris Brezillon653c57c2018-11-11 08:55:20 +0100505static int vf610_nfc_exec_op(struct nand_chip *chip,
506 const struct nand_operation *op,
507 bool check_only)
508{
509 vf610_nfc_select_target(chip, op->cs);
510 return nand_op_parser_exec_op(chip, &vf610_nfc_op_parser, op,
511 check_only);
512}
513
Boris Brezillon4440f782018-11-20 10:02:36 +0100514static inline int vf610_nfc_correct_data(struct nand_chip *chip, uint8_t *dat,
Stefan Agner049f4252015-09-02 18:06:34 -0700515 uint8_t *oob, int page)
516{
Boris Brezillon4440f782018-11-20 10:02:36 +0100517 struct vf610_nfc *nfc = chip_to_nfc(chip);
518 struct mtd_info *mtd = nand_to_mtd(chip);
Stefan Agner049f4252015-09-02 18:06:34 -0700519 u32 ecc_status_off = NFC_MAIN_AREA(0) + ECC_SRAM_ADDR + ECC_STATUS;
520 u8 ecc_status;
521 u8 ecc_count;
Stefan Agner049f4252015-09-02 18:06:34 -0700522 int flips_threshold = nfc->chip.ecc.strength / 2;
523
524 ecc_status = vf610_nfc_read(nfc, ecc_status_off) & 0xff;
525 ecc_count = ecc_status & ECC_STATUS_ERR_COUNT;
526
527 if (!(ecc_status & ECC_STATUS_MASK))
528 return ecc_count;
529
Stefan Agner1cbe30b2018-03-09 15:50:36 +0100530 nfc->data_access = true;
531 nand_read_oob_op(&nfc->chip, page, 0, oob, mtd->oobsize);
532 nfc->data_access = false;
Stefan Agner049f4252015-09-02 18:06:34 -0700533
534 /*
535 * On an erased page, bit count (including OOB) should be zero or
536 * at least less then half of the ECC strength.
537 */
Brian Norris48c25cf2015-09-29 14:11:56 -0700538 return nand_check_erased_ecc_chunk(dat, nfc->chip.ecc.size, oob,
539 mtd->oobsize, NULL, 0,
540 flips_threshold);
Stefan Agner049f4252015-09-02 18:06:34 -0700541}
542
Stefan Agner1cbe30b2018-03-09 15:50:36 +0100543static void vf610_nfc_fill_row(struct nand_chip *chip, int page, u32 *code,
544 u32 *row)
545{
546 *row = ROW_ADDR(0, page & 0xff) | ROW_ADDR(1, page >> 8);
547 *code |= COMMAND_RAR_BYTE1 | COMMAND_RAR_BYTE2;
548
549 if (chip->options & NAND_ROW_ADDR_3) {
550 *row |= ROW_ADDR(2, page >> 16);
551 *code |= COMMAND_RAR_BYTE3;
552 }
553}
554
Boris Brezillonb9761682018-09-06 14:05:20 +0200555static int vf610_nfc_read_page(struct nand_chip *chip, uint8_t *buf,
556 int oob_required, int page)
Stefan Agner049f4252015-09-02 18:06:34 -0700557{
Boris Brezillon4440f782018-11-20 10:02:36 +0100558 struct vf610_nfc *nfc = chip_to_nfc(chip);
Boris Brezillonb9761682018-09-06 14:05:20 +0200559 struct mtd_info *mtd = nand_to_mtd(chip);
Stefan Agner1cbe30b2018-03-09 15:50:36 +0100560 int trfr_sz = mtd->writesize + mtd->oobsize;
561 u32 row = 0, cmd1 = 0, cmd2 = 0, code = 0;
Stefan Agner049f4252015-09-02 18:06:34 -0700562 int stat;
563
Boris Brezillon653c57c2018-11-11 08:55:20 +0100564 vf610_nfc_select_target(chip, chip->cur_cs);
565
Stefan Agner1cbe30b2018-03-09 15:50:36 +0100566 cmd2 |= NAND_CMD_READ0 << CMD_BYTE1_SHIFT;
567 code |= COMMAND_CMD_BYTE1 | COMMAND_CAR_BYTE1 | COMMAND_CAR_BYTE2;
568
569 vf610_nfc_fill_row(chip, page, &code, &row);
570
571 cmd1 |= NAND_CMD_READSTART << CMD_BYTE2_SHIFT;
572 code |= COMMAND_CMD_BYTE2 | COMMAND_RB_HANDSHAKE | COMMAND_READ_DATA;
573
574 cmd2 |= code << CMD_CODE_SHIFT;
575
576 vf610_nfc_ecc_mode(nfc, nfc->ecc_mode);
577 vf610_nfc_run(nfc, 0, row, cmd1, cmd2, trfr_sz);
578 vf610_nfc_ecc_mode(nfc, ECC_BYPASS);
579
580 /*
581 * Don't fix endianness on page access for historical reasons.
582 * See comment in vf610_nfc_rd_from_sram
583 */
584 vf610_nfc_rd_from_sram(buf, nfc->regs + NFC_MAIN_AREA(0),
585 mtd->writesize, false);
Stefan Agner049f4252015-09-02 18:06:34 -0700586 if (oob_required)
Stefan Agner1cbe30b2018-03-09 15:50:36 +0100587 vf610_nfc_rd_from_sram(chip->oob_poi,
588 nfc->regs + NFC_MAIN_AREA(0) +
589 mtd->writesize,
590 mtd->oobsize, false);
Stefan Agner049f4252015-09-02 18:06:34 -0700591
Boris Brezillon4440f782018-11-20 10:02:36 +0100592 stat = vf610_nfc_correct_data(chip, buf, chip->oob_poi, page);
Stefan Agner049f4252015-09-02 18:06:34 -0700593
594 if (stat < 0) {
595 mtd->ecc_stats.failed++;
596 return 0;
597 } else {
598 mtd->ecc_stats.corrected += stat;
599 return stat;
600 }
601}
602
Boris Brezillon767eb6f2018-09-06 14:05:21 +0200603static int vf610_nfc_write_page(struct nand_chip *chip, const uint8_t *buf,
604 int oob_required, int page)
Stefan Agner049f4252015-09-02 18:06:34 -0700605{
Boris Brezillon4440f782018-11-20 10:02:36 +0100606 struct vf610_nfc *nfc = chip_to_nfc(chip);
Boris Brezillon767eb6f2018-09-06 14:05:21 +0200607 struct mtd_info *mtd = nand_to_mtd(chip);
Stefan Agner1cbe30b2018-03-09 15:50:36 +0100608 int trfr_sz = mtd->writesize + mtd->oobsize;
609 u32 row = 0, cmd1 = 0, cmd2 = 0, code = 0;
610 u8 status;
611 int ret;
Stefan Agner049f4252015-09-02 18:06:34 -0700612
Boris Brezillon653c57c2018-11-11 08:55:20 +0100613 vf610_nfc_select_target(chip, chip->cur_cs);
614
Stefan Agner1cbe30b2018-03-09 15:50:36 +0100615 cmd2 |= NAND_CMD_SEQIN << CMD_BYTE1_SHIFT;
616 code |= COMMAND_CMD_BYTE1 | COMMAND_CAR_BYTE1 | COMMAND_CAR_BYTE2;
Stefan Agner049f4252015-09-02 18:06:34 -0700617
Stefan Agner1cbe30b2018-03-09 15:50:36 +0100618 vf610_nfc_fill_row(chip, page, &code, &row);
619
620 cmd1 |= NAND_CMD_PAGEPROG << CMD_BYTE2_SHIFT;
621 code |= COMMAND_CMD_BYTE2 | COMMAND_WRITE_DATA;
622
623 /*
624 * Don't fix endianness on page access for historical reasons.
625 * See comment in vf610_nfc_wr_to_sram
626 */
627 vf610_nfc_wr_to_sram(nfc->regs + NFC_MAIN_AREA(0), buf,
628 mtd->writesize, false);
629
630 code |= COMMAND_RB_HANDSHAKE;
631 cmd2 |= code << CMD_CODE_SHIFT;
632
633 vf610_nfc_ecc_mode(nfc, nfc->ecc_mode);
634 vf610_nfc_run(nfc, 0, row, cmd1, cmd2, trfr_sz);
635 vf610_nfc_ecc_mode(nfc, ECC_BYPASS);
636
637 ret = nand_status_op(chip, &status);
638 if (ret)
639 return ret;
640
641 if (status & NAND_STATUS_FAIL)
642 return -EIO;
643
644 return 0;
645}
646
Boris Brezillonb9761682018-09-06 14:05:20 +0200647static int vf610_nfc_read_page_raw(struct nand_chip *chip, u8 *buf,
Stefan Agner1cbe30b2018-03-09 15:50:36 +0100648 int oob_required, int page)
649{
Boris Brezillon4440f782018-11-20 10:02:36 +0100650 struct vf610_nfc *nfc = chip_to_nfc(chip);
Stefan Agner1cbe30b2018-03-09 15:50:36 +0100651 int ret;
652
653 nfc->data_access = true;
Boris Brezillonb9761682018-09-06 14:05:20 +0200654 ret = nand_read_page_raw(chip, buf, oob_required, page);
Stefan Agner1cbe30b2018-03-09 15:50:36 +0100655 nfc->data_access = false;
656
657 return ret;
658}
659
Boris Brezillon767eb6f2018-09-06 14:05:21 +0200660static int vf610_nfc_write_page_raw(struct nand_chip *chip, const u8 *buf,
Stefan Agner1cbe30b2018-03-09 15:50:36 +0100661 int oob_required, int page)
662{
Boris Brezillon4440f782018-11-20 10:02:36 +0100663 struct vf610_nfc *nfc = chip_to_nfc(chip);
Boris Brezillon767eb6f2018-09-06 14:05:21 +0200664 struct mtd_info *mtd = nand_to_mtd(chip);
Stefan Agner1cbe30b2018-03-09 15:50:36 +0100665 int ret;
666
667 nfc->data_access = true;
668 ret = nand_prog_page_begin_op(chip, page, 0, buf, mtd->writesize);
669 if (!ret && oob_required)
670 ret = nand_write_data_op(chip, chip->oob_poi, mtd->oobsize,
671 false);
672 nfc->data_access = false;
673
674 if (ret)
675 return ret;
676
677 return nand_prog_page_end_op(chip);
678}
679
Boris Brezillonb9761682018-09-06 14:05:20 +0200680static int vf610_nfc_read_oob(struct nand_chip *chip, int page)
Stefan Agner1cbe30b2018-03-09 15:50:36 +0100681{
Boris Brezillon4440f782018-11-20 10:02:36 +0100682 struct vf610_nfc *nfc = chip_to_nfc(chip);
Stefan Agner1cbe30b2018-03-09 15:50:36 +0100683 int ret;
684
685 nfc->data_access = true;
Boris Brezillonb9761682018-09-06 14:05:20 +0200686 ret = nand_read_oob_std(chip, page);
Stefan Agner1cbe30b2018-03-09 15:50:36 +0100687 nfc->data_access = false;
688
689 return ret;
690}
691
Boris Brezillon767eb6f2018-09-06 14:05:21 +0200692static int vf610_nfc_write_oob(struct nand_chip *chip, int page)
Stefan Agner1cbe30b2018-03-09 15:50:36 +0100693{
Boris Brezillon767eb6f2018-09-06 14:05:21 +0200694 struct mtd_info *mtd = nand_to_mtd(chip);
Boris Brezillon4440f782018-11-20 10:02:36 +0100695 struct vf610_nfc *nfc = chip_to_nfc(chip);
Stefan Agner1cbe30b2018-03-09 15:50:36 +0100696 int ret;
697
698 nfc->data_access = true;
699 ret = nand_prog_page_begin_op(chip, page, mtd->writesize,
700 chip->oob_poi, mtd->oobsize);
701 nfc->data_access = false;
702
703 if (ret)
704 return ret;
Stefan Agner049f4252015-09-02 18:06:34 -0700705
Boris Brezillon25f815f2017-11-30 18:01:30 +0100706 return nand_prog_page_end_op(chip);
Stefan Agner049f4252015-09-02 18:06:34 -0700707}
708
Stefan Agner456930d2015-09-02 18:06:33 -0700709static const struct of_device_id vf610_nfc_dt_ids[] = {
710 { .compatible = "fsl,vf610-nfc", .data = (void *)NFC_VFC610 },
711 { /* sentinel */ }
712};
713MODULE_DEVICE_TABLE(of, vf610_nfc_dt_ids);
714
715static void vf610_nfc_preinit_controller(struct vf610_nfc *nfc)
716{
717 vf610_nfc_clear(nfc, NFC_FLASH_CONFIG, CONFIG_16BIT);
718 vf610_nfc_clear(nfc, NFC_FLASH_CONFIG, CONFIG_ADDR_AUTO_INCR_BIT);
719 vf610_nfc_clear(nfc, NFC_FLASH_CONFIG, CONFIG_BUFNO_AUTO_INCR_BIT);
720 vf610_nfc_clear(nfc, NFC_FLASH_CONFIG, CONFIG_BOOT_MODE_BIT);
721 vf610_nfc_clear(nfc, NFC_FLASH_CONFIG, CONFIG_DMA_REQ_BIT);
722 vf610_nfc_set(nfc, NFC_FLASH_CONFIG, CONFIG_FAST_FLASH_BIT);
Stefan Agner1cbe30b2018-03-09 15:50:36 +0100723 vf610_nfc_ecc_mode(nfc, ECC_BYPASS);
Stefan Agner456930d2015-09-02 18:06:33 -0700724
725 /* Disable virtual pages, only one elementary transfer unit */
726 vf610_nfc_set_field(nfc, NFC_FLASH_CONFIG, CONFIG_PAGE_CNT_MASK,
727 CONFIG_PAGE_CNT_SHIFT, 1);
728}
729
730static void vf610_nfc_init_controller(struct vf610_nfc *nfc)
731{
732 if (nfc->chip.options & NAND_BUSWIDTH_16)
733 vf610_nfc_set(nfc, NFC_FLASH_CONFIG, CONFIG_16BIT);
734 else
735 vf610_nfc_clear(nfc, NFC_FLASH_CONFIG, CONFIG_16BIT);
Stefan Agner049f4252015-09-02 18:06:34 -0700736
737 if (nfc->chip.ecc.mode == NAND_ECC_HW) {
738 /* Set ECC status offset in SRAM */
739 vf610_nfc_set_field(nfc, NFC_FLASH_CONFIG,
740 CONFIG_ECC_SRAM_ADDR_MASK,
741 CONFIG_ECC_SRAM_ADDR_SHIFT,
742 ECC_SRAM_ADDR >> 3);
743
744 /* Enable ECC status in SRAM */
745 vf610_nfc_set(nfc, NFC_FLASH_CONFIG, CONFIG_ECC_SRAM_REQ_BIT);
746 }
Stefan Agner456930d2015-09-02 18:06:33 -0700747}
748
Miquel Raynal962c35e2018-07-20 17:15:17 +0200749static int vf610_nfc_attach_chip(struct nand_chip *chip)
750{
751 struct mtd_info *mtd = nand_to_mtd(chip);
Boris Brezillon4440f782018-11-20 10:02:36 +0100752 struct vf610_nfc *nfc = chip_to_nfc(chip);
Miquel Raynal962c35e2018-07-20 17:15:17 +0200753
754 vf610_nfc_init_controller(nfc);
755
756 /* Bad block options. */
757 if (chip->bbt_options & NAND_BBT_USE_FLASH)
758 chip->bbt_options |= NAND_BBT_NO_OOB;
759
760 /* Single buffer only, max 256 OOB minus ECC status */
761 if (mtd->writesize + mtd->oobsize > PAGE_2K + OOB_MAX - 8) {
762 dev_err(nfc->dev, "Unsupported flash page size\n");
763 return -ENXIO;
764 }
765
766 if (chip->ecc.mode != NAND_ECC_HW)
767 return 0;
768
769 if (mtd->writesize != PAGE_2K && mtd->oobsize < 64) {
770 dev_err(nfc->dev, "Unsupported flash with hwecc\n");
771 return -ENXIO;
772 }
773
774 if (chip->ecc.size != mtd->writesize) {
775 dev_err(nfc->dev, "Step size needs to be page size\n");
776 return -ENXIO;
777 }
778
779 /* Only 64 byte ECC layouts known */
780 if (mtd->oobsize > 64)
781 mtd->oobsize = 64;
782
783 /* Use default large page ECC layout defined in NAND core */
784 mtd_set_ooblayout(mtd, &nand_ooblayout_lp_ops);
785 if (chip->ecc.strength == 32) {
786 nfc->ecc_mode = ECC_60_BYTE;
787 chip->ecc.bytes = 60;
788 } else if (chip->ecc.strength == 24) {
789 nfc->ecc_mode = ECC_45_BYTE;
790 chip->ecc.bytes = 45;
791 } else {
792 dev_err(nfc->dev, "Unsupported ECC strength\n");
793 return -ENXIO;
794 }
795
796 chip->ecc.read_page = vf610_nfc_read_page;
797 chip->ecc.write_page = vf610_nfc_write_page;
798 chip->ecc.read_page_raw = vf610_nfc_read_page_raw;
799 chip->ecc.write_page_raw = vf610_nfc_write_page_raw;
800 chip->ecc.read_oob = vf610_nfc_read_oob;
801 chip->ecc.write_oob = vf610_nfc_write_oob;
802
803 chip->ecc.size = PAGE_2K;
804
805 return 0;
806}
807
808static const struct nand_controller_ops vf610_nfc_controller_ops = {
809 .attach_chip = vf610_nfc_attach_chip,
Boris Brezillonf2abfeb2018-11-11 08:55:23 +0100810 .exec_op = vf610_nfc_exec_op,
811
Miquel Raynal962c35e2018-07-20 17:15:17 +0200812};
813
Stefan Agner456930d2015-09-02 18:06:33 -0700814static int vf610_nfc_probe(struct platform_device *pdev)
815{
816 struct vf610_nfc *nfc;
817 struct resource *res;
818 struct mtd_info *mtd;
819 struct nand_chip *chip;
820 struct device_node *child;
821 const struct of_device_id *of_id;
822 int err;
823 int irq;
824
825 nfc = devm_kzalloc(&pdev->dev, sizeof(*nfc), GFP_KERNEL);
826 if (!nfc)
827 return -ENOMEM;
828
829 nfc->dev = &pdev->dev;
Stefan Agner456930d2015-09-02 18:06:33 -0700830 chip = &nfc->chip;
Boris BREZILLON960823a2015-12-10 09:00:29 +0100831 mtd = nand_to_mtd(chip);
Stefan Agner456930d2015-09-02 18:06:33 -0700832
Stefan Agner456930d2015-09-02 18:06:33 -0700833 mtd->owner = THIS_MODULE;
834 mtd->dev.parent = nfc->dev;
835 mtd->name = DRV_NAME;
836
837 irq = platform_get_irq(pdev, 0);
838 if (irq <= 0)
839 return -EINVAL;
840
841 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
842 nfc->regs = devm_ioremap_resource(nfc->dev, res);
843 if (IS_ERR(nfc->regs))
844 return PTR_ERR(nfc->regs);
845
846 nfc->clk = devm_clk_get(&pdev->dev, NULL);
847 if (IS_ERR(nfc->clk))
848 return PTR_ERR(nfc->clk);
849
850 err = clk_prepare_enable(nfc->clk);
851 if (err) {
852 dev_err(nfc->dev, "Unable to enable clock!\n");
853 return err;
854 }
855
856 of_id = of_match_device(vf610_nfc_dt_ids, &pdev->dev);
857 nfc->variant = (enum vf610_nfc_variant)of_id->data;
858
859 for_each_available_child_of_node(nfc->dev->of_node, child) {
860 if (of_device_is_compatible(child, "fsl,vf610-nfc-nandcs")) {
861
Boris BREZILLON44ec23c2015-11-02 00:03:38 +0100862 if (nand_get_flash_node(chip)) {
Stefan Agner456930d2015-09-02 18:06:33 -0700863 dev_err(nfc->dev,
864 "Only one NAND chip supported!\n");
865 err = -EINVAL;
Alexey Khoroshilov196644f2018-02-10 01:28:35 +0300866 goto err_disable_clk;
Stefan Agner456930d2015-09-02 18:06:33 -0700867 }
868
Brian Norris63752192015-10-30 20:33:23 -0700869 nand_set_flash_node(chip, child);
Stefan Agner456930d2015-09-02 18:06:33 -0700870 }
871 }
872
Boris BREZILLON44ec23c2015-11-02 00:03:38 +0100873 if (!nand_get_flash_node(chip)) {
Stefan Agner456930d2015-09-02 18:06:33 -0700874 dev_err(nfc->dev, "NAND chip sub-node missing!\n");
875 err = -ENODEV;
Alexey Khoroshilov196644f2018-02-10 01:28:35 +0300876 goto err_disable_clk;
Stefan Agner456930d2015-09-02 18:06:33 -0700877 }
878
Stefan Agner456930d2015-09-02 18:06:33 -0700879 chip->options |= NAND_NO_SUBPAGE_WRITE;
880
881 init_completion(&nfc->cmd_done);
882
Boris Brezillon4440f782018-11-20 10:02:36 +0100883 err = devm_request_irq(nfc->dev, irq, vf610_nfc_irq, 0, DRV_NAME, nfc);
Stefan Agner456930d2015-09-02 18:06:33 -0700884 if (err) {
885 dev_err(nfc->dev, "Error requesting IRQ!\n");
Alexey Khoroshilov196644f2018-02-10 01:28:35 +0300886 goto err_disable_clk;
Stefan Agner456930d2015-09-02 18:06:33 -0700887 }
888
889 vf610_nfc_preinit_controller(nfc);
890
Boris Brezillonda59b452018-11-20 10:02:37 +0100891 nand_controller_init(&nfc->base);
892 nfc->base.ops = &vf610_nfc_controller_ops;
893 chip->controller = &nfc->base;
894
Miquel Raynal962c35e2018-07-20 17:15:17 +0200895 /* Scan the NAND chip */
Boris Brezillon00ad3782018-09-06 14:05:14 +0200896 err = nand_scan(chip, 1);
Masahiro Yamadae9d354b2016-11-04 19:43:05 +0900897 if (err)
Alexey Khoroshilov196644f2018-02-10 01:28:35 +0300898 goto err_disable_clk;
Stefan Agner456930d2015-09-02 18:06:33 -0700899
Boris Brezillon4440f782018-11-20 10:02:36 +0100900 platform_set_drvdata(pdev, nfc);
Stefan Agner456930d2015-09-02 18:06:33 -0700901
902 /* Register device in MTD */
Alexey Khoroshilov1b8c9092018-02-10 01:28:36 +0300903 err = mtd_device_register(mtd, NULL, 0);
904 if (err)
905 goto err_cleanup_nand;
906 return 0;
Stefan Agner456930d2015-09-02 18:06:33 -0700907
Alexey Khoroshilov1b8c9092018-02-10 01:28:36 +0300908err_cleanup_nand:
909 nand_cleanup(chip);
Alexey Khoroshilov196644f2018-02-10 01:28:35 +0300910err_disable_clk:
Stefan Agner456930d2015-09-02 18:06:33 -0700911 clk_disable_unprepare(nfc->clk);
912 return err;
913}
914
915static int vf610_nfc_remove(struct platform_device *pdev)
916{
Boris Brezillon4440f782018-11-20 10:02:36 +0100917 struct vf610_nfc *nfc = platform_get_drvdata(pdev);
Stefan Agner456930d2015-09-02 18:06:33 -0700918
Boris Brezillon4440f782018-11-20 10:02:36 +0100919 nand_release(&nfc->chip);
Stefan Agner456930d2015-09-02 18:06:33 -0700920 clk_disable_unprepare(nfc->clk);
921 return 0;
922}
923
924#ifdef CONFIG_PM_SLEEP
925static int vf610_nfc_suspend(struct device *dev)
926{
Boris Brezillon4440f782018-11-20 10:02:36 +0100927 struct vf610_nfc *nfc = dev_get_drvdata(dev);
Stefan Agner456930d2015-09-02 18:06:33 -0700928
929 clk_disable_unprepare(nfc->clk);
930 return 0;
931}
932
933static int vf610_nfc_resume(struct device *dev)
934{
Boris Brezillon4440f782018-11-20 10:02:36 +0100935 struct vf610_nfc *nfc = dev_get_drvdata(dev);
Fabio Estevam03fba862017-07-17 21:54:07 -0300936 int err;
937
Fabio Estevam03fba862017-07-17 21:54:07 -0300938 err = clk_prepare_enable(nfc->clk);
939 if (err)
940 return err;
Stefan Agner456930d2015-09-02 18:06:33 -0700941
942 vf610_nfc_preinit_controller(nfc);
943 vf610_nfc_init_controller(nfc);
944 return 0;
945}
946#endif
947
948static SIMPLE_DEV_PM_OPS(vf610_nfc_pm_ops, vf610_nfc_suspend, vf610_nfc_resume);
949
950static struct platform_driver vf610_nfc_driver = {
951 .driver = {
952 .name = DRV_NAME,
953 .of_match_table = vf610_nfc_dt_ids,
954 .pm = &vf610_nfc_pm_ops,
955 },
956 .probe = vf610_nfc_probe,
957 .remove = vf610_nfc_remove,
958};
959
960module_platform_driver(vf610_nfc_driver);
961
962MODULE_AUTHOR("Stefan Agner <stefan.agner@toradex.com>");
963MODULE_DESCRIPTION("Freescale VF610/MPC5125 NFC MTD NAND driver");
964MODULE_LICENSE("GPL");