mxc_nand.c 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191
  1. /*
  2. * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
  3. * Copyright 2008 Sascha Hauer, kernel@pengutronix.de
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License
  7. * as published by the Free Software Foundation; either version 2
  8. * of the License, or (at your option) any later version.
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  17. * MA 02110-1301, USA.
  18. */
  19. #include <linux/delay.h>
  20. #include <linux/slab.h>
  21. #include <linux/init.h>
  22. #include <linux/module.h>
  23. #include <linux/mtd/mtd.h>
  24. #include <linux/mtd/nand.h>
  25. #include <linux/mtd/partitions.h>
  26. #include <linux/interrupt.h>
  27. #include <linux/device.h>
  28. #include <linux/platform_device.h>
  29. #include <linux/clk.h>
  30. #include <linux/err.h>
  31. #include <linux/io.h>
  32. #include <asm/mach/flash.h>
  33. #include <mach/mxc_nand.h>
  34. #include <mach/hardware.h>
  35. #define DRIVER_NAME "mxc_nand"
  36. #define nfc_is_v21() (cpu_is_mx25() || cpu_is_mx35())
  37. #define nfc_is_v1() (cpu_is_mx31() || cpu_is_mx27() || cpu_is_mx21())
  38. #define nfc_is_v3_2() cpu_is_mx51()
  39. #define nfc_is_v3() nfc_is_v3_2()
  40. /* Addresses for NFC registers */
  41. #define NFC_V1_V2_BUF_SIZE (host->regs + 0x00)
  42. #define NFC_V1_V2_BUF_ADDR (host->regs + 0x04)
  43. #define NFC_V1_V2_FLASH_ADDR (host->regs + 0x06)
  44. #define NFC_V1_V2_FLASH_CMD (host->regs + 0x08)
  45. #define NFC_V1_V2_CONFIG (host->regs + 0x0a)
  46. #define NFC_V1_V2_ECC_STATUS_RESULT (host->regs + 0x0c)
  47. #define NFC_V1_V2_RSLTMAIN_AREA (host->regs + 0x0e)
  48. #define NFC_V1_V2_RSLTSPARE_AREA (host->regs + 0x10)
  49. #define NFC_V1_V2_WRPROT (host->regs + 0x12)
  50. #define NFC_V1_UNLOCKSTART_BLKADDR (host->regs + 0x14)
  51. #define NFC_V1_UNLOCKEND_BLKADDR (host->regs + 0x16)
  52. #define NFC_V21_UNLOCKSTART_BLKADDR (host->regs + 0x20)
  53. #define NFC_V21_UNLOCKEND_BLKADDR (host->regs + 0x22)
  54. #define NFC_V1_V2_NF_WRPRST (host->regs + 0x18)
  55. #define NFC_V1_V2_CONFIG1 (host->regs + 0x1a)
  56. #define NFC_V1_V2_CONFIG2 (host->regs + 0x1c)
  57. #define NFC_V2_CONFIG1_ECC_MODE_4 (1 << 0)
  58. #define NFC_V1_V2_CONFIG1_SP_EN (1 << 2)
  59. #define NFC_V1_V2_CONFIG1_ECC_EN (1 << 3)
  60. #define NFC_V1_V2_CONFIG1_INT_MSK (1 << 4)
  61. #define NFC_V1_V2_CONFIG1_BIG (1 << 5)
  62. #define NFC_V1_V2_CONFIG1_RST (1 << 6)
  63. #define NFC_V1_V2_CONFIG1_CE (1 << 7)
  64. #define NFC_V1_V2_CONFIG1_ONE_CYCLE (1 << 8)
  65. #define NFC_V1_V2_CONFIG2_INT (1 << 15)
  66. /*
  67. * Operation modes for the NFC. Valid for v1, v2 and v3
  68. * type controllers.
  69. */
  70. #define NFC_CMD (1 << 0)
  71. #define NFC_ADDR (1 << 1)
  72. #define NFC_INPUT (1 << 2)
  73. #define NFC_OUTPUT (1 << 3)
  74. #define NFC_ID (1 << 4)
  75. #define NFC_STATUS (1 << 5)
  76. #define NFC_V3_FLASH_CMD (host->regs_axi + 0x00)
  77. #define NFC_V3_FLASH_ADDR0 (host->regs_axi + 0x04)
  78. #define NFC_V3_CONFIG1 (host->regs_axi + 0x34)
  79. #define NFC_V3_CONFIG1_SP_EN (1 << 0)
  80. #define NFC_V3_CONFIG1_RBA(x) (((x) & 0x7 ) << 4)
  81. #define NFC_V3_ECC_STATUS_RESULT (host->regs_axi + 0x38)
  82. #define NFC_V3_LAUNCH (host->regs_axi + 0x40)
  83. #define NFC_V3_WRPROT (host->regs_ip + 0x0)
  84. #define NFC_V3_WRPROT_LOCK_TIGHT (1 << 0)
  85. #define NFC_V3_WRPROT_LOCK (1 << 1)
  86. #define NFC_V3_WRPROT_UNLOCK (1 << 2)
  87. #define NFC_V3_WRPROT_BLS_UNLOCK (2 << 6)
  88. #define NFC_V3_WRPROT_UNLOCK_BLK_ADD0 (host->regs_ip + 0x04)
  89. #define NFC_V3_CONFIG2 (host->regs_ip + 0x24)
  90. #define NFC_V3_CONFIG2_PS_512 (0 << 0)
  91. #define NFC_V3_CONFIG2_PS_2048 (1 << 0)
  92. #define NFC_V3_CONFIG2_PS_4096 (2 << 0)
  93. #define NFC_V3_CONFIG2_ONE_CYCLE (1 << 2)
  94. #define NFC_V3_CONFIG2_ECC_EN (1 << 3)
  95. #define NFC_V3_CONFIG2_2CMD_PHASES (1 << 4)
  96. #define NFC_V3_CONFIG2_NUM_ADDR_PHASE0 (1 << 5)
  97. #define NFC_V3_CONFIG2_ECC_MODE_8 (1 << 6)
  98. #define NFC_V3_CONFIG2_PPB(x) (((x) & 0x3) << 7)
  99. #define NFC_V3_CONFIG2_NUM_ADDR_PHASE1(x) (((x) & 0x3) << 12)
  100. #define NFC_V3_CONFIG2_INT_MSK (1 << 15)
  101. #define NFC_V3_CONFIG2_ST_CMD(x) (((x) & 0xff) << 24)
  102. #define NFC_V3_CONFIG2_SPAS(x) (((x) & 0xff) << 16)
  103. #define NFC_V3_CONFIG3 (host->regs_ip + 0x28)
  104. #define NFC_V3_CONFIG3_ADD_OP(x) (((x) & 0x3) << 0)
  105. #define NFC_V3_CONFIG3_FW8 (1 << 3)
  106. #define NFC_V3_CONFIG3_SBB(x) (((x) & 0x7) << 8)
  107. #define NFC_V3_CONFIG3_NUM_OF_DEVICES(x) (((x) & 0x7) << 12)
  108. #define NFC_V3_CONFIG3_RBB_MODE (1 << 15)
  109. #define NFC_V3_CONFIG3_NO_SDMA (1 << 20)
  110. #define NFC_V3_IPC (host->regs_ip + 0x2C)
  111. #define NFC_V3_IPC_CREQ (1 << 0)
  112. #define NFC_V3_IPC_INT (1 << 31)
  113. #define NFC_V3_DELAY_LINE (host->regs_ip + 0x34)
  114. struct mxc_nand_host {
  115. struct mtd_info mtd;
  116. struct nand_chip nand;
  117. struct mtd_partition *parts;
  118. struct device *dev;
  119. void *spare0;
  120. void *main_area0;
  121. void __iomem *base;
  122. void __iomem *regs;
  123. void __iomem *regs_axi;
  124. void __iomem *regs_ip;
  125. int status_request;
  126. struct clk *clk;
  127. int clk_act;
  128. int irq;
  129. int eccsize;
  130. wait_queue_head_t irq_waitq;
  131. uint8_t *data_buf;
  132. unsigned int buf_start;
  133. int spare_len;
  134. void (*preset)(struct mtd_info *);
  135. void (*send_cmd)(struct mxc_nand_host *, uint16_t, int);
  136. void (*send_addr)(struct mxc_nand_host *, uint16_t, int);
  137. void (*send_page)(struct mtd_info *, unsigned int);
  138. void (*send_read_id)(struct mxc_nand_host *);
  139. uint16_t (*get_dev_status)(struct mxc_nand_host *);
  140. int (*check_int)(struct mxc_nand_host *);
  141. };
  142. /* OOB placement block for use with hardware ecc generation */
  143. static struct nand_ecclayout nandv1_hw_eccoob_smallpage = {
  144. .eccbytes = 5,
  145. .eccpos = {6, 7, 8, 9, 10},
  146. .oobfree = {{0, 5}, {12, 4}, }
  147. };
  148. static struct nand_ecclayout nandv1_hw_eccoob_largepage = {
  149. .eccbytes = 20,
  150. .eccpos = {6, 7, 8, 9, 10, 22, 23, 24, 25, 26,
  151. 38, 39, 40, 41, 42, 54, 55, 56, 57, 58},
  152. .oobfree = {{2, 4}, {11, 10}, {27, 10}, {43, 10}, {59, 5}, }
  153. };
  154. /* OOB description for 512 byte pages with 16 byte OOB */
  155. static struct nand_ecclayout nandv2_hw_eccoob_smallpage = {
  156. .eccbytes = 1 * 9,
  157. .eccpos = {
  158. 7, 8, 9, 10, 11, 12, 13, 14, 15
  159. },
  160. .oobfree = {
  161. {.offset = 0, .length = 5}
  162. }
  163. };
  164. /* OOB description for 2048 byte pages with 64 byte OOB */
  165. static struct nand_ecclayout nandv2_hw_eccoob_largepage = {
  166. .eccbytes = 4 * 9,
  167. .eccpos = {
  168. 7, 8, 9, 10, 11, 12, 13, 14, 15,
  169. 23, 24, 25, 26, 27, 28, 29, 30, 31,
  170. 39, 40, 41, 42, 43, 44, 45, 46, 47,
  171. 55, 56, 57, 58, 59, 60, 61, 62, 63
  172. },
  173. .oobfree = {
  174. {.offset = 2, .length = 4},
  175. {.offset = 16, .length = 7},
  176. {.offset = 32, .length = 7},
  177. {.offset = 48, .length = 7}
  178. }
  179. };
  180. #ifdef CONFIG_MTD_PARTITIONS
  181. static const char *part_probes[] = { "RedBoot", "cmdlinepart", NULL };
  182. #endif
  183. static irqreturn_t mxc_nfc_irq(int irq, void *dev_id)
  184. {
  185. struct mxc_nand_host *host = dev_id;
  186. disable_irq_nosync(irq);
  187. wake_up(&host->irq_waitq);
  188. return IRQ_HANDLED;
  189. }
  190. static int check_int_v3(struct mxc_nand_host *host)
  191. {
  192. uint32_t tmp;
  193. tmp = readl(NFC_V3_IPC);
  194. if (!(tmp & NFC_V3_IPC_INT))
  195. return 0;
  196. tmp &= ~NFC_V3_IPC_INT;
  197. writel(tmp, NFC_V3_IPC);
  198. return 1;
  199. }
  200. static int check_int_v1_v2(struct mxc_nand_host *host)
  201. {
  202. uint32_t tmp;
  203. tmp = readw(NFC_V1_V2_CONFIG2);
  204. if (!(tmp & NFC_V1_V2_CONFIG2_INT))
  205. return 0;
  206. writew(tmp & ~NFC_V1_V2_CONFIG2_INT, NFC_V1_V2_CONFIG2);
  207. return 1;
  208. }
  209. /* This function polls the NANDFC to wait for the basic operation to
  210. * complete by checking the INT bit of config2 register.
  211. */
  212. static void wait_op_done(struct mxc_nand_host *host, int useirq)
  213. {
  214. int max_retries = 8000;
  215. if (useirq) {
  216. if (!host->check_int(host)) {
  217. enable_irq(host->irq);
  218. wait_event(host->irq_waitq, host->check_int(host));
  219. }
  220. } else {
  221. while (max_retries-- > 0) {
  222. if (host->check_int(host))
  223. break;
  224. udelay(1);
  225. }
  226. if (max_retries < 0)
  227. DEBUG(MTD_DEBUG_LEVEL0, "%s: INT not set\n",
  228. __func__);
  229. }
  230. }
  231. static void send_cmd_v3(struct mxc_nand_host *host, uint16_t cmd, int useirq)
  232. {
  233. /* fill command */
  234. writel(cmd, NFC_V3_FLASH_CMD);
  235. /* send out command */
  236. writel(NFC_CMD, NFC_V3_LAUNCH);
  237. /* Wait for operation to complete */
  238. wait_op_done(host, useirq);
  239. }
  240. /* This function issues the specified command to the NAND device and
  241. * waits for completion. */
  242. static void send_cmd_v1_v2(struct mxc_nand_host *host, uint16_t cmd, int useirq)
  243. {
  244. DEBUG(MTD_DEBUG_LEVEL3, "send_cmd(host, 0x%x, %d)\n", cmd, useirq);
  245. writew(cmd, NFC_V1_V2_FLASH_CMD);
  246. writew(NFC_CMD, NFC_V1_V2_CONFIG2);
  247. if (cpu_is_mx21() && (cmd == NAND_CMD_RESET)) {
  248. int max_retries = 100;
  249. /* Reset completion is indicated by NFC_CONFIG2 */
  250. /* being set to 0 */
  251. while (max_retries-- > 0) {
  252. if (readw(NFC_V1_V2_CONFIG2) == 0) {
  253. break;
  254. }
  255. udelay(1);
  256. }
  257. if (max_retries < 0)
  258. DEBUG(MTD_DEBUG_LEVEL0, "%s: RESET failed\n",
  259. __func__);
  260. } else {
  261. /* Wait for operation to complete */
  262. wait_op_done(host, useirq);
  263. }
  264. }
  265. static void send_addr_v3(struct mxc_nand_host *host, uint16_t addr, int islast)
  266. {
  267. /* fill address */
  268. writel(addr, NFC_V3_FLASH_ADDR0);
  269. /* send out address */
  270. writel(NFC_ADDR, NFC_V3_LAUNCH);
  271. wait_op_done(host, 0);
  272. }
  273. /* This function sends an address (or partial address) to the
  274. * NAND device. The address is used to select the source/destination for
  275. * a NAND command. */
  276. static void send_addr_v1_v2(struct mxc_nand_host *host, uint16_t addr, int islast)
  277. {
  278. DEBUG(MTD_DEBUG_LEVEL3, "send_addr(host, 0x%x %d)\n", addr, islast);
  279. writew(addr, NFC_V1_V2_FLASH_ADDR);
  280. writew(NFC_ADDR, NFC_V1_V2_CONFIG2);
  281. /* Wait for operation to complete */
  282. wait_op_done(host, islast);
  283. }
  284. static void send_page_v3(struct mtd_info *mtd, unsigned int ops)
  285. {
  286. struct nand_chip *nand_chip = mtd->priv;
  287. struct mxc_nand_host *host = nand_chip->priv;
  288. uint32_t tmp;
  289. tmp = readl(NFC_V3_CONFIG1);
  290. tmp &= ~(7 << 4);
  291. writel(tmp, NFC_V3_CONFIG1);
  292. /* transfer data from NFC ram to nand */
  293. writel(ops, NFC_V3_LAUNCH);
  294. wait_op_done(host, false);
  295. }
  296. static void send_page_v1_v2(struct mtd_info *mtd, unsigned int ops)
  297. {
  298. struct nand_chip *nand_chip = mtd->priv;
  299. struct mxc_nand_host *host = nand_chip->priv;
  300. int bufs, i;
  301. if (nfc_is_v1() && mtd->writesize > 512)
  302. bufs = 4;
  303. else
  304. bufs = 1;
  305. for (i = 0; i < bufs; i++) {
  306. /* NANDFC buffer 0 is used for page read/write */
  307. writew(i, NFC_V1_V2_BUF_ADDR);
  308. writew(ops, NFC_V1_V2_CONFIG2);
  309. /* Wait for operation to complete */
  310. wait_op_done(host, true);
  311. }
  312. }
  313. static void send_read_id_v3(struct mxc_nand_host *host)
  314. {
  315. /* Read ID into main buffer */
  316. writel(NFC_ID, NFC_V3_LAUNCH);
  317. wait_op_done(host, true);
  318. memcpy(host->data_buf, host->main_area0, 16);
  319. }
  320. /* Request the NANDFC to perform a read of the NAND device ID. */
  321. static void send_read_id_v1_v2(struct mxc_nand_host *host)
  322. {
  323. struct nand_chip *this = &host->nand;
  324. /* NANDFC buffer 0 is used for device ID output */
  325. writew(0x0, NFC_V1_V2_BUF_ADDR);
  326. writew(NFC_ID, NFC_V1_V2_CONFIG2);
  327. /* Wait for operation to complete */
  328. wait_op_done(host, true);
  329. if (this->options & NAND_BUSWIDTH_16) {
  330. void __iomem *main_buf = host->main_area0;
  331. /* compress the ID info */
  332. writeb(readb(main_buf + 2), main_buf + 1);
  333. writeb(readb(main_buf + 4), main_buf + 2);
  334. writeb(readb(main_buf + 6), main_buf + 3);
  335. writeb(readb(main_buf + 8), main_buf + 4);
  336. writeb(readb(main_buf + 10), main_buf + 5);
  337. }
  338. memcpy(host->data_buf, host->main_area0, 16);
  339. }
  340. static uint16_t get_dev_status_v3(struct mxc_nand_host *host)
  341. {
  342. writew(NFC_STATUS, NFC_V3_LAUNCH);
  343. wait_op_done(host, true);
  344. return readl(NFC_V3_CONFIG1) >> 16;
  345. }
  346. /* This function requests the NANDFC to perform a read of the
  347. * NAND device status and returns the current status. */
  348. static uint16_t get_dev_status_v1_v2(struct mxc_nand_host *host)
  349. {
  350. void __iomem *main_buf = host->main_area0;
  351. uint32_t store;
  352. uint16_t ret;
  353. writew(0x0, NFC_V1_V2_BUF_ADDR);
  354. /*
  355. * The device status is stored in main_area0. To
  356. * prevent corruption of the buffer save the value
  357. * and restore it afterwards.
  358. */
  359. store = readl(main_buf);
  360. writew(NFC_STATUS, NFC_V1_V2_CONFIG2);
  361. wait_op_done(host, true);
  362. ret = readw(main_buf);
  363. writel(store, main_buf);
  364. return ret;
  365. }
  366. /* This functions is used by upper layer to checks if device is ready */
  367. static int mxc_nand_dev_ready(struct mtd_info *mtd)
  368. {
  369. /*
  370. * NFC handles R/B internally. Therefore, this function
  371. * always returns status as ready.
  372. */
  373. return 1;
  374. }
  375. static void mxc_nand_enable_hwecc(struct mtd_info *mtd, int mode)
  376. {
  377. /*
  378. * If HW ECC is enabled, we turn it on during init. There is
  379. * no need to enable again here.
  380. */
  381. }
  382. static int mxc_nand_correct_data_v1(struct mtd_info *mtd, u_char *dat,
  383. u_char *read_ecc, u_char *calc_ecc)
  384. {
  385. struct nand_chip *nand_chip = mtd->priv;
  386. struct mxc_nand_host *host = nand_chip->priv;
  387. /*
  388. * 1-Bit errors are automatically corrected in HW. No need for
  389. * additional correction. 2-Bit errors cannot be corrected by
  390. * HW ECC, so we need to return failure
  391. */
  392. uint16_t ecc_status = readw(NFC_V1_V2_ECC_STATUS_RESULT);
  393. if (((ecc_status & 0x3) == 2) || ((ecc_status >> 2) == 2)) {
  394. DEBUG(MTD_DEBUG_LEVEL0,
  395. "MXC_NAND: HWECC uncorrectable 2-bit ECC error\n");
  396. return -1;
  397. }
  398. return 0;
  399. }
  400. static int mxc_nand_correct_data_v2_v3(struct mtd_info *mtd, u_char *dat,
  401. u_char *read_ecc, u_char *calc_ecc)
  402. {
  403. struct nand_chip *nand_chip = mtd->priv;
  404. struct mxc_nand_host *host = nand_chip->priv;
  405. u32 ecc_stat, err;
  406. int no_subpages = 1;
  407. int ret = 0;
  408. u8 ecc_bit_mask, err_limit;
  409. ecc_bit_mask = (host->eccsize == 4) ? 0x7 : 0xf;
  410. err_limit = (host->eccsize == 4) ? 0x4 : 0x8;
  411. no_subpages = mtd->writesize >> 9;
  412. if (nfc_is_v21())
  413. ecc_stat = readl(NFC_V1_V2_ECC_STATUS_RESULT);
  414. else
  415. ecc_stat = readl(NFC_V3_ECC_STATUS_RESULT);
  416. do {
  417. err = ecc_stat & ecc_bit_mask;
  418. if (err > err_limit) {
  419. printk(KERN_WARNING "UnCorrectable RS-ECC Error\n");
  420. return -1;
  421. } else {
  422. ret += err;
  423. }
  424. ecc_stat >>= 4;
  425. } while (--no_subpages);
  426. mtd->ecc_stats.corrected += ret;
  427. pr_debug("%d Symbol Correctable RS-ECC Error\n", ret);
  428. return ret;
  429. }
  430. static int mxc_nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat,
  431. u_char *ecc_code)
  432. {
  433. return 0;
  434. }
  435. static u_char mxc_nand_read_byte(struct mtd_info *mtd)
  436. {
  437. struct nand_chip *nand_chip = mtd->priv;
  438. struct mxc_nand_host *host = nand_chip->priv;
  439. uint8_t ret;
  440. /* Check for status request */
  441. if (host->status_request)
  442. return host->get_dev_status(host) & 0xFF;
  443. ret = *(uint8_t *)(host->data_buf + host->buf_start);
  444. host->buf_start++;
  445. return ret;
  446. }
  447. static uint16_t mxc_nand_read_word(struct mtd_info *mtd)
  448. {
  449. struct nand_chip *nand_chip = mtd->priv;
  450. struct mxc_nand_host *host = nand_chip->priv;
  451. uint16_t ret;
  452. ret = *(uint16_t *)(host->data_buf + host->buf_start);
  453. host->buf_start += 2;
  454. return ret;
  455. }
  456. /* Write data of length len to buffer buf. The data to be
  457. * written on NAND Flash is first copied to RAMbuffer. After the Data Input
  458. * Operation by the NFC, the data is written to NAND Flash */
  459. static void mxc_nand_write_buf(struct mtd_info *mtd,
  460. const u_char *buf, int len)
  461. {
  462. struct nand_chip *nand_chip = mtd->priv;
  463. struct mxc_nand_host *host = nand_chip->priv;
  464. u16 col = host->buf_start;
  465. int n = mtd->oobsize + mtd->writesize - col;
  466. n = min(n, len);
  467. memcpy(host->data_buf + col, buf, n);
  468. host->buf_start += n;
  469. }
  470. /* Read the data buffer from the NAND Flash. To read the data from NAND
  471. * Flash first the data output cycle is initiated by the NFC, which copies
  472. * the data to RAMbuffer. This data of length len is then copied to buffer buf.
  473. */
  474. static void mxc_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
  475. {
  476. struct nand_chip *nand_chip = mtd->priv;
  477. struct mxc_nand_host *host = nand_chip->priv;
  478. u16 col = host->buf_start;
  479. int n = mtd->oobsize + mtd->writesize - col;
  480. n = min(n, len);
  481. memcpy(buf, host->data_buf + col, len);
  482. host->buf_start += len;
  483. }
  484. /* Used by the upper layer to verify the data in NAND Flash
  485. * with the data in the buf. */
  486. static int mxc_nand_verify_buf(struct mtd_info *mtd,
  487. const u_char *buf, int len)
  488. {
  489. return -EFAULT;
  490. }
  491. /* This function is used by upper layer for select and
  492. * deselect of the NAND chip */
  493. static void mxc_nand_select_chip(struct mtd_info *mtd, int chip)
  494. {
  495. struct nand_chip *nand_chip = mtd->priv;
  496. struct mxc_nand_host *host = nand_chip->priv;
  497. switch (chip) {
  498. case -1:
  499. /* Disable the NFC clock */
  500. if (host->clk_act) {
  501. clk_disable(host->clk);
  502. host->clk_act = 0;
  503. }
  504. break;
  505. case 0:
  506. /* Enable the NFC clock */
  507. if (!host->clk_act) {
  508. clk_enable(host->clk);
  509. host->clk_act = 1;
  510. }
  511. break;
  512. default:
  513. break;
  514. }
  515. }
  516. /*
  517. * Function to transfer data to/from spare area.
  518. */
  519. static void copy_spare(struct mtd_info *mtd, bool bfrom)
  520. {
  521. struct nand_chip *this = mtd->priv;
  522. struct mxc_nand_host *host = this->priv;
  523. u16 i, j;
  524. u16 n = mtd->writesize >> 9;
  525. u8 *d = host->data_buf + mtd->writesize;
  526. u8 *s = host->spare0;
  527. u16 t = host->spare_len;
  528. j = (mtd->oobsize / n >> 1) << 1;
  529. if (bfrom) {
  530. for (i = 0; i < n - 1; i++)
  531. memcpy(d + i * j, s + i * t, j);
  532. /* the last section */
  533. memcpy(d + i * j, s + i * t, mtd->oobsize - i * j);
  534. } else {
  535. for (i = 0; i < n - 1; i++)
  536. memcpy(&s[i * t], &d[i * j], j);
  537. /* the last section */
  538. memcpy(&s[i * t], &d[i * j], mtd->oobsize - i * j);
  539. }
  540. }
  541. static void mxc_do_addr_cycle(struct mtd_info *mtd, int column, int page_addr)
  542. {
  543. struct nand_chip *nand_chip = mtd->priv;
  544. struct mxc_nand_host *host = nand_chip->priv;
  545. /* Write out column address, if necessary */
  546. if (column != -1) {
  547. /*
  548. * MXC NANDFC can only perform full page+spare or
  549. * spare-only read/write. When the upper layers
  550. * layers perform a read/write buf operation,
  551. * we will used the saved column address to index into
  552. * the full page.
  553. */
  554. host->send_addr(host, 0, page_addr == -1);
  555. if (mtd->writesize > 512)
  556. /* another col addr cycle for 2k page */
  557. host->send_addr(host, 0, false);
  558. }
  559. /* Write out page address, if necessary */
  560. if (page_addr != -1) {
  561. /* paddr_0 - p_addr_7 */
  562. host->send_addr(host, (page_addr & 0xff), false);
  563. if (mtd->writesize > 512) {
  564. if (mtd->size >= 0x10000000) {
  565. /* paddr_8 - paddr_15 */
  566. host->send_addr(host, (page_addr >> 8) & 0xff, false);
  567. host->send_addr(host, (page_addr >> 16) & 0xff, true);
  568. } else
  569. /* paddr_8 - paddr_15 */
  570. host->send_addr(host, (page_addr >> 8) & 0xff, true);
  571. } else {
  572. /* One more address cycle for higher density devices */
  573. if (mtd->size >= 0x4000000) {
  574. /* paddr_8 - paddr_15 */
  575. host->send_addr(host, (page_addr >> 8) & 0xff, false);
  576. host->send_addr(host, (page_addr >> 16) & 0xff, true);
  577. } else
  578. /* paddr_8 - paddr_15 */
  579. host->send_addr(host, (page_addr >> 8) & 0xff, true);
  580. }
  581. }
  582. }
  583. /*
  584. * v2 and v3 type controllers can do 4bit or 8bit ecc depending
  585. * on how much oob the nand chip has. For 8bit ecc we need at least
  586. * 26 bytes of oob data per 512 byte block.
  587. */
  588. static int get_eccsize(struct mtd_info *mtd)
  589. {
  590. int oobbytes_per_512 = 0;
  591. oobbytes_per_512 = mtd->oobsize * 512 / mtd->writesize;
  592. if (oobbytes_per_512 < 26)
  593. return 4;
  594. else
  595. return 8;
  596. }
  597. static void preset_v1_v2(struct mtd_info *mtd)
  598. {
  599. struct nand_chip *nand_chip = mtd->priv;
  600. struct mxc_nand_host *host = nand_chip->priv;
  601. uint16_t tmp;
  602. /* enable interrupt, disable spare enable */
  603. tmp = readw(NFC_V1_V2_CONFIG1);
  604. tmp &= ~NFC_V1_V2_CONFIG1_INT_MSK;
  605. tmp &= ~NFC_V1_V2_CONFIG1_SP_EN;
  606. if (nand_chip->ecc.mode == NAND_ECC_HW) {
  607. tmp |= NFC_V1_V2_CONFIG1_ECC_EN;
  608. } else {
  609. tmp &= ~NFC_V1_V2_CONFIG1_ECC_EN;
  610. }
  611. if (nfc_is_v21() && mtd->writesize) {
  612. host->eccsize = get_eccsize(mtd);
  613. if (host->eccsize == 4)
  614. tmp |= NFC_V2_CONFIG1_ECC_MODE_4;
  615. } else {
  616. host->eccsize = 1;
  617. }
  618. writew(tmp, NFC_V1_V2_CONFIG1);
  619. /* preset operation */
  620. /* Unlock the internal RAM Buffer */
  621. writew(0x2, NFC_V1_V2_CONFIG);
  622. /* Blocks to be unlocked */
  623. if (nfc_is_v21()) {
  624. writew(0x0, NFC_V21_UNLOCKSTART_BLKADDR);
  625. writew(0xffff, NFC_V21_UNLOCKEND_BLKADDR);
  626. } else if (nfc_is_v1()) {
  627. writew(0x0, NFC_V1_UNLOCKSTART_BLKADDR);
  628. writew(0x4000, NFC_V1_UNLOCKEND_BLKADDR);
  629. } else
  630. BUG();
  631. /* Unlock Block Command for given address range */
  632. writew(0x4, NFC_V1_V2_WRPROT);
  633. }
  634. static void preset_v3(struct mtd_info *mtd)
  635. {
  636. struct nand_chip *chip = mtd->priv;
  637. struct mxc_nand_host *host = chip->priv;
  638. uint32_t config2, config3;
  639. int i, addr_phases;
  640. writel(NFC_V3_CONFIG1_RBA(0), NFC_V3_CONFIG1);
  641. writel(NFC_V3_IPC_CREQ, NFC_V3_IPC);
  642. /* Unlock the internal RAM Buffer */
  643. writel(NFC_V3_WRPROT_BLS_UNLOCK | NFC_V3_WRPROT_UNLOCK,
  644. NFC_V3_WRPROT);
  645. /* Blocks to be unlocked */
  646. for (i = 0; i < NAND_MAX_CHIPS; i++)
  647. writel(0x0 | (0xffff << 16),
  648. NFC_V3_WRPROT_UNLOCK_BLK_ADD0 + (i << 2));
  649. writel(0, NFC_V3_IPC);
  650. config2 = NFC_V3_CONFIG2_ONE_CYCLE |
  651. NFC_V3_CONFIG2_2CMD_PHASES |
  652. NFC_V3_CONFIG2_SPAS(mtd->oobsize >> 1) |
  653. NFC_V3_CONFIG2_ST_CMD(0x70) |
  654. NFC_V3_CONFIG2_NUM_ADDR_PHASE0;
  655. if (chip->ecc.mode == NAND_ECC_HW)
  656. config2 |= NFC_V3_CONFIG2_ECC_EN;
  657. addr_phases = fls(chip->pagemask) >> 3;
  658. if (mtd->writesize == 2048) {
  659. config2 |= NFC_V3_CONFIG2_PS_2048;
  660. config2 |= NFC_V3_CONFIG2_NUM_ADDR_PHASE1(addr_phases);
  661. } else if (mtd->writesize == 4096) {
  662. config2 |= NFC_V3_CONFIG2_PS_4096;
  663. config2 |= NFC_V3_CONFIG2_NUM_ADDR_PHASE1(addr_phases);
  664. } else {
  665. config2 |= NFC_V3_CONFIG2_PS_512;
  666. config2 |= NFC_V3_CONFIG2_NUM_ADDR_PHASE1(addr_phases - 1);
  667. }
  668. if (mtd->writesize) {
  669. config2 |= NFC_V3_CONFIG2_PPB(ffs(mtd->erasesize / mtd->writesize) - 6);
  670. host->eccsize = get_eccsize(mtd);
  671. if (host->eccsize == 8)
  672. config2 |= NFC_V3_CONFIG2_ECC_MODE_8;
  673. }
  674. writel(config2, NFC_V3_CONFIG2);
  675. config3 = NFC_V3_CONFIG3_NUM_OF_DEVICES(0) |
  676. NFC_V3_CONFIG3_NO_SDMA |
  677. NFC_V3_CONFIG3_RBB_MODE |
  678. NFC_V3_CONFIG3_SBB(6) | /* Reset default */
  679. NFC_V3_CONFIG3_ADD_OP(0);
  680. if (!(chip->options & NAND_BUSWIDTH_16))
  681. config3 |= NFC_V3_CONFIG3_FW8;
  682. writel(config3, NFC_V3_CONFIG3);
  683. writel(0, NFC_V3_DELAY_LINE);
  684. }
  685. /* Used by the upper layer to write command to NAND Flash for
  686. * different operations to be carried out on NAND Flash */
  687. static void mxc_nand_command(struct mtd_info *mtd, unsigned command,
  688. int column, int page_addr)
  689. {
  690. struct nand_chip *nand_chip = mtd->priv;
  691. struct mxc_nand_host *host = nand_chip->priv;
  692. DEBUG(MTD_DEBUG_LEVEL3,
  693. "mxc_nand_command (cmd = 0x%x, col = 0x%x, page = 0x%x)\n",
  694. command, column, page_addr);
  695. /* Reset command state information */
  696. host->status_request = false;
  697. /* Command pre-processing step */
  698. switch (command) {
  699. case NAND_CMD_RESET:
  700. host->preset(mtd);
  701. host->send_cmd(host, command, false);
  702. break;
  703. case NAND_CMD_STATUS:
  704. host->buf_start = 0;
  705. host->status_request = true;
  706. host->send_cmd(host, command, true);
  707. mxc_do_addr_cycle(mtd, column, page_addr);
  708. break;
  709. case NAND_CMD_READ0:
  710. case NAND_CMD_READOOB:
  711. if (command == NAND_CMD_READ0)
  712. host->buf_start = column;
  713. else
  714. host->buf_start = column + mtd->writesize;
  715. command = NAND_CMD_READ0; /* only READ0 is valid */
  716. host->send_cmd(host, command, false);
  717. mxc_do_addr_cycle(mtd, column, page_addr);
  718. if (mtd->writesize > 512)
  719. host->send_cmd(host, NAND_CMD_READSTART, true);
  720. host->send_page(mtd, NFC_OUTPUT);
  721. memcpy(host->data_buf, host->main_area0, mtd->writesize);
  722. copy_spare(mtd, true);
  723. break;
  724. case NAND_CMD_SEQIN:
  725. if (column >= mtd->writesize)
  726. /* call ourself to read a page */
  727. mxc_nand_command(mtd, NAND_CMD_READ0, 0, page_addr);
  728. host->buf_start = column;
  729. host->send_cmd(host, command, false);
  730. mxc_do_addr_cycle(mtd, column, page_addr);
  731. break;
  732. case NAND_CMD_PAGEPROG:
  733. memcpy(host->main_area0, host->data_buf, mtd->writesize);
  734. copy_spare(mtd, false);
  735. host->send_page(mtd, NFC_INPUT);
  736. host->send_cmd(host, command, true);
  737. mxc_do_addr_cycle(mtd, column, page_addr);
  738. break;
  739. case NAND_CMD_READID:
  740. host->send_cmd(host, command, true);
  741. mxc_do_addr_cycle(mtd, column, page_addr);
  742. host->send_read_id(host);
  743. host->buf_start = column;
  744. break;
  745. case NAND_CMD_ERASE1:
  746. case NAND_CMD_ERASE2:
  747. host->send_cmd(host, command, false);
  748. mxc_do_addr_cycle(mtd, column, page_addr);
  749. break;
  750. }
  751. }
  752. /*
  753. * The generic flash bbt decriptors overlap with our ecc
  754. * hardware, so define some i.MX specific ones.
  755. */
  756. static uint8_t bbt_pattern[] = { 'B', 'b', 't', '0' };
  757. static uint8_t mirror_pattern[] = { '1', 't', 'b', 'B' };
  758. static struct nand_bbt_descr bbt_main_descr = {
  759. .options = NAND_BBT_LASTBLOCK | NAND_BBT_CREATE | NAND_BBT_WRITE
  760. | NAND_BBT_2BIT | NAND_BBT_VERSION | NAND_BBT_PERCHIP,
  761. .offs = 0,
  762. .len = 4,
  763. .veroffs = 4,
  764. .maxblocks = 4,
  765. .pattern = bbt_pattern,
  766. };
  767. static struct nand_bbt_descr bbt_mirror_descr = {
  768. .options = NAND_BBT_LASTBLOCK | NAND_BBT_CREATE | NAND_BBT_WRITE
  769. | NAND_BBT_2BIT | NAND_BBT_VERSION | NAND_BBT_PERCHIP,
  770. .offs = 0,
  771. .len = 4,
  772. .veroffs = 4,
  773. .maxblocks = 4,
  774. .pattern = mirror_pattern,
  775. };
  776. static int __init mxcnd_probe(struct platform_device *pdev)
  777. {
  778. struct nand_chip *this;
  779. struct mtd_info *mtd;
  780. struct mxc_nand_platform_data *pdata = pdev->dev.platform_data;
  781. struct mxc_nand_host *host;
  782. struct resource *res;
  783. int err = 0, nr_parts = 0;
  784. struct nand_ecclayout *oob_smallpage, *oob_largepage;
  785. /* Allocate memory for MTD device structure and private data */
  786. host = kzalloc(sizeof(struct mxc_nand_host) + NAND_MAX_PAGESIZE +
  787. NAND_MAX_OOBSIZE, GFP_KERNEL);
  788. if (!host)
  789. return -ENOMEM;
  790. host->data_buf = (uint8_t *)(host + 1);
  791. host->dev = &pdev->dev;
  792. /* structures must be linked */
  793. this = &host->nand;
  794. mtd = &host->mtd;
  795. mtd->priv = this;
  796. mtd->owner = THIS_MODULE;
  797. mtd->dev.parent = &pdev->dev;
  798. mtd->name = DRIVER_NAME;
  799. /* 50 us command delay time */
  800. this->chip_delay = 5;
  801. this->priv = host;
  802. this->dev_ready = mxc_nand_dev_ready;
  803. this->cmdfunc = mxc_nand_command;
  804. this->select_chip = mxc_nand_select_chip;
  805. this->read_byte = mxc_nand_read_byte;
  806. this->read_word = mxc_nand_read_word;
  807. this->write_buf = mxc_nand_write_buf;
  808. this->read_buf = mxc_nand_read_buf;
  809. this->verify_buf = mxc_nand_verify_buf;
  810. host->clk = clk_get(&pdev->dev, "nfc");
  811. if (IS_ERR(host->clk)) {
  812. err = PTR_ERR(host->clk);
  813. goto eclk;
  814. }
  815. clk_enable(host->clk);
  816. host->clk_act = 1;
  817. res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  818. if (!res) {
  819. err = -ENODEV;
  820. goto eres;
  821. }
  822. host->base = ioremap(res->start, resource_size(res));
  823. if (!host->base) {
  824. err = -ENOMEM;
  825. goto eres;
  826. }
  827. host->main_area0 = host->base;
  828. if (nfc_is_v1() || nfc_is_v21()) {
  829. host->preset = preset_v1_v2;
  830. host->send_cmd = send_cmd_v1_v2;
  831. host->send_addr = send_addr_v1_v2;
  832. host->send_page = send_page_v1_v2;
  833. host->send_read_id = send_read_id_v1_v2;
  834. host->get_dev_status = get_dev_status_v1_v2;
  835. host->check_int = check_int_v1_v2;
  836. }
  837. if (nfc_is_v21()) {
  838. host->regs = host->base + 0x1e00;
  839. host->spare0 = host->base + 0x1000;
  840. host->spare_len = 64;
  841. oob_smallpage = &nandv2_hw_eccoob_smallpage;
  842. oob_largepage = &nandv2_hw_eccoob_largepage;
  843. this->ecc.bytes = 9;
  844. } else if (nfc_is_v1()) {
  845. host->regs = host->base + 0xe00;
  846. host->spare0 = host->base + 0x800;
  847. host->spare_len = 16;
  848. oob_smallpage = &nandv1_hw_eccoob_smallpage;
  849. oob_largepage = &nandv1_hw_eccoob_largepage;
  850. this->ecc.bytes = 3;
  851. host->eccsize = 1;
  852. } else if (nfc_is_v3_2()) {
  853. res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
  854. if (!res) {
  855. err = -ENODEV;
  856. goto eirq;
  857. }
  858. host->regs_ip = ioremap(res->start, resource_size(res));
  859. if (!host->regs_ip) {
  860. err = -ENOMEM;
  861. goto eirq;
  862. }
  863. host->regs_axi = host->base + 0x1e00;
  864. host->spare0 = host->base + 0x1000;
  865. host->spare_len = 64;
  866. host->preset = preset_v3;
  867. host->send_cmd = send_cmd_v3;
  868. host->send_addr = send_addr_v3;
  869. host->send_page = send_page_v3;
  870. host->send_read_id = send_read_id_v3;
  871. host->check_int = check_int_v3;
  872. host->get_dev_status = get_dev_status_v3;
  873. oob_smallpage = &nandv2_hw_eccoob_smallpage;
  874. oob_largepage = &nandv2_hw_eccoob_largepage;
  875. } else
  876. BUG();
  877. this->ecc.size = 512;
  878. this->ecc.layout = oob_smallpage;
  879. if (pdata->hw_ecc) {
  880. this->ecc.calculate = mxc_nand_calculate_ecc;
  881. this->ecc.hwctl = mxc_nand_enable_hwecc;
  882. if (nfc_is_v1())
  883. this->ecc.correct = mxc_nand_correct_data_v1;
  884. else
  885. this->ecc.correct = mxc_nand_correct_data_v2_v3;
  886. this->ecc.mode = NAND_ECC_HW;
  887. } else {
  888. this->ecc.mode = NAND_ECC_SOFT;
  889. }
  890. /* NAND bus width determines access funtions used by upper layer */
  891. if (pdata->width == 2)
  892. this->options |= NAND_BUSWIDTH_16;
  893. if (pdata->flash_bbt) {
  894. this->bbt_td = &bbt_main_descr;
  895. this->bbt_md = &bbt_mirror_descr;
  896. /* update flash based bbt */
  897. this->options |= NAND_USE_FLASH_BBT;
  898. }
  899. init_waitqueue_head(&host->irq_waitq);
  900. host->irq = platform_get_irq(pdev, 0);
  901. err = request_irq(host->irq, mxc_nfc_irq, IRQF_DISABLED, DRIVER_NAME, host);
  902. if (err)
  903. goto eirq;
  904. /* first scan to find the device and get the page size */
  905. if (nand_scan_ident(mtd, 1, NULL)) {
  906. err = -ENXIO;
  907. goto escan;
  908. }
  909. /* Call preset again, with correct writesize this time */
  910. host->preset(mtd);
  911. if (mtd->writesize == 2048)
  912. this->ecc.layout = oob_largepage;
  913. /* second phase scan */
  914. if (nand_scan_tail(mtd)) {
  915. err = -ENXIO;
  916. goto escan;
  917. }
  918. /* Register the partitions */
  919. #ifdef CONFIG_MTD_PARTITIONS
  920. nr_parts =
  921. parse_mtd_partitions(mtd, part_probes, &host->parts, 0);
  922. if (nr_parts > 0)
  923. add_mtd_partitions(mtd, host->parts, nr_parts);
  924. else if (pdata->parts)
  925. add_mtd_partitions(mtd, pdata->parts, pdata->nr_parts);
  926. else
  927. #endif
  928. {
  929. pr_info("Registering %s as whole device\n", mtd->name);
  930. add_mtd_device(mtd);
  931. }
  932. platform_set_drvdata(pdev, host);
  933. return 0;
  934. escan:
  935. free_irq(host->irq, host);
  936. eirq:
  937. if (host->regs_ip)
  938. iounmap(host->regs_ip);
  939. iounmap(host->base);
  940. eres:
  941. clk_put(host->clk);
  942. eclk:
  943. kfree(host);
  944. return err;
  945. }
  946. static int __devexit mxcnd_remove(struct platform_device *pdev)
  947. {
  948. struct mxc_nand_host *host = platform_get_drvdata(pdev);
  949. clk_put(host->clk);
  950. platform_set_drvdata(pdev, NULL);
  951. nand_release(&host->mtd);
  952. free_irq(host->irq, host);
  953. if (host->regs_ip)
  954. iounmap(host->regs_ip);
  955. iounmap(host->base);
  956. kfree(host);
  957. return 0;
  958. }
  959. static struct platform_driver mxcnd_driver = {
  960. .driver = {
  961. .name = DRIVER_NAME,
  962. },
  963. .remove = __devexit_p(mxcnd_remove),
  964. };
  965. static int __init mxc_nd_init(void)
  966. {
  967. return platform_driver_probe(&mxcnd_driver, mxcnd_probe);
  968. }
  969. static void __exit mxc_nd_cleanup(void)
  970. {
  971. /* Unregister the device structure */
  972. platform_driver_unregister(&mxcnd_driver);
  973. }
  974. module_init(mxc_nd_init);
  975. module_exit(mxc_nd_cleanup);
  976. MODULE_AUTHOR("Freescale Semiconductor, Inc.");
  977. MODULE_DESCRIPTION("MXC NAND MTD driver");
  978. MODULE_LICENSE("GPL");