doc2000.c 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202
  1. /*
  2. * Linux driver for Disk-On-Chip 2000 and Millennium
  3. * (c) 1999 Machine Vision Holdings, Inc.
  4. * (c) 1999, 2000 David Woodhouse <dwmw2@infradead.org>
  5. */
  6. #include <linux/kernel.h>
  7. #include <linux/module.h>
  8. #include <asm/errno.h>
  9. #include <asm/io.h>
  10. #include <asm/uaccess.h>
  11. #include <linux/miscdevice.h>
  12. #include <linux/delay.h>
  13. #include <linux/slab.h>
  14. #include <linux/sched.h>
  15. #include <linux/init.h>
  16. #include <linux/types.h>
  17. #include <linux/bitops.h>
  18. #include <linux/mutex.h>
  19. #include <linux/mtd/mtd.h>
  20. #include <linux/mtd/nand.h>
  21. #include <linux/mtd/doc2000.h>
  22. #define DOC_SUPPORT_2000
  23. #define DOC_SUPPORT_2000TSOP
  24. #define DOC_SUPPORT_MILLENNIUM
  25. #ifdef DOC_SUPPORT_2000
  26. #define DoC_is_2000(doc) (doc->ChipID == DOC_ChipID_Doc2k)
  27. #else
  28. #define DoC_is_2000(doc) (0)
  29. #endif
  30. #if defined(DOC_SUPPORT_2000TSOP) || defined(DOC_SUPPORT_MILLENNIUM)
  31. #define DoC_is_Millennium(doc) (doc->ChipID == DOC_ChipID_DocMil)
  32. #else
  33. #define DoC_is_Millennium(doc) (0)
  34. #endif
  35. /* #define ECC_DEBUG */
  36. /* I have no idea why some DoC chips can not use memcpy_from|to_io().
  37. * This may be due to the different revisions of the ASIC controller built-in or
  38. * simplily a QA/Bug issue. Who knows ?? If you have trouble, please uncomment
  39. * this:
  40. #undef USE_MEMCPY
  41. */
  42. static int doc_read(struct mtd_info *mtd, loff_t from, size_t len,
  43. size_t *retlen, u_char *buf);
  44. static int doc_write(struct mtd_info *mtd, loff_t to, size_t len,
  45. size_t *retlen, const u_char *buf);
  46. static int doc_read_oob(struct mtd_info *mtd, loff_t ofs,
  47. struct mtd_oob_ops *ops);
  48. static int doc_write_oob(struct mtd_info *mtd, loff_t ofs,
  49. struct mtd_oob_ops *ops);
  50. static int doc_write_oob_nolock(struct mtd_info *mtd, loff_t ofs, size_t len,
  51. size_t *retlen, const u_char *buf);
  52. static int doc_erase (struct mtd_info *mtd, struct erase_info *instr);
  53. static struct mtd_info *doc2klist = NULL;
  54. /* Perform the required delay cycles by reading from the appropriate register */
  55. static void DoC_Delay(struct DiskOnChip *doc, unsigned short cycles)
  56. {
  57. volatile char dummy;
  58. int i;
  59. for (i = 0; i < cycles; i++) {
  60. if (DoC_is_Millennium(doc))
  61. dummy = ReadDOC(doc->virtadr, NOP);
  62. else
  63. dummy = ReadDOC(doc->virtadr, DOCStatus);
  64. }
  65. }
  66. /* DOC_WaitReady: Wait for RDY line to be asserted by the flash chip */
  67. static int _DoC_WaitReady(struct DiskOnChip *doc)
  68. {
  69. void __iomem *docptr = doc->virtadr;
  70. unsigned long timeo = jiffies + (HZ * 10);
  71. DEBUG(MTD_DEBUG_LEVEL3,
  72. "_DoC_WaitReady called for out-of-line wait\n");
  73. /* Out-of-line routine to wait for chip response */
  74. while (!(ReadDOC(docptr, CDSNControl) & CDSN_CTRL_FR_B)) {
  75. /* issue 2 read from NOP register after reading from CDSNControl register
  76. see Software Requirement 11.4 item 2. */
  77. DoC_Delay(doc, 2);
  78. if (time_after(jiffies, timeo)) {
  79. DEBUG(MTD_DEBUG_LEVEL2, "_DoC_WaitReady timed out.\n");
  80. return -EIO;
  81. }
  82. udelay(1);
  83. cond_resched();
  84. }
  85. return 0;
  86. }
  87. static inline int DoC_WaitReady(struct DiskOnChip *doc)
  88. {
  89. void __iomem *docptr = doc->virtadr;
  90. /* This is inline, to optimise the common case, where it's ready instantly */
  91. int ret = 0;
  92. /* 4 read form NOP register should be issued in prior to the read from CDSNControl
  93. see Software Requirement 11.4 item 2. */
  94. DoC_Delay(doc, 4);
  95. if (!(ReadDOC(docptr, CDSNControl) & CDSN_CTRL_FR_B))
  96. /* Call the out-of-line routine to wait */
  97. ret = _DoC_WaitReady(doc);
  98. /* issue 2 read from NOP register after reading from CDSNControl register
  99. see Software Requirement 11.4 item 2. */
  100. DoC_Delay(doc, 2);
  101. return ret;
  102. }
  103. /* DoC_Command: Send a flash command to the flash chip through the CDSN Slow IO register to
  104. bypass the internal pipeline. Each of 4 delay cycles (read from the NOP register) is
  105. required after writing to CDSN Control register, see Software Requirement 11.4 item 3. */
  106. static int DoC_Command(struct DiskOnChip *doc, unsigned char command,
  107. unsigned char xtraflags)
  108. {
  109. void __iomem *docptr = doc->virtadr;
  110. if (DoC_is_2000(doc))
  111. xtraflags |= CDSN_CTRL_FLASH_IO;
  112. /* Assert the CLE (Command Latch Enable) line to the flash chip */
  113. WriteDOC(xtraflags | CDSN_CTRL_CLE | CDSN_CTRL_CE, docptr, CDSNControl);
  114. DoC_Delay(doc, 4); /* Software requirement 11.4.3 for Millennium */
  115. if (DoC_is_Millennium(doc))
  116. WriteDOC(command, docptr, CDSNSlowIO);
  117. /* Send the command */
  118. WriteDOC_(command, docptr, doc->ioreg);
  119. if (DoC_is_Millennium(doc))
  120. WriteDOC(command, docptr, WritePipeTerm);
  121. /* Lower the CLE line */
  122. WriteDOC(xtraflags | CDSN_CTRL_CE, docptr, CDSNControl);
  123. DoC_Delay(doc, 4); /* Software requirement 11.4.3 for Millennium */
  124. /* Wait for the chip to respond - Software requirement 11.4.1 (extended for any command) */
  125. return DoC_WaitReady(doc);
  126. }
  127. /* DoC_Address: Set the current address for the flash chip through the CDSN Slow IO register to
  128. bypass the internal pipeline. Each of 4 delay cycles (read from the NOP register) is
  129. required after writing to CDSN Control register, see Software Requirement 11.4 item 3. */
  130. static int DoC_Address(struct DiskOnChip *doc, int numbytes, unsigned long ofs,
  131. unsigned char xtraflags1, unsigned char xtraflags2)
  132. {
  133. int i;
  134. void __iomem *docptr = doc->virtadr;
  135. if (DoC_is_2000(doc))
  136. xtraflags1 |= CDSN_CTRL_FLASH_IO;
  137. /* Assert the ALE (Address Latch Enable) line to the flash chip */
  138. WriteDOC(xtraflags1 | CDSN_CTRL_ALE | CDSN_CTRL_CE, docptr, CDSNControl);
  139. DoC_Delay(doc, 4); /* Software requirement 11.4.3 for Millennium */
  140. /* Send the address */
  141. /* Devices with 256-byte page are addressed as:
  142. Column (bits 0-7), Page (bits 8-15, 16-23, 24-31)
  143. * there is no device on the market with page256
  144. and more than 24 bits.
  145. Devices with 512-byte page are addressed as:
  146. Column (bits 0-7), Page (bits 9-16, 17-24, 25-31)
  147. * 25-31 is sent only if the chip support it.
  148. * bit 8 changes the read command to be sent
  149. (NAND_CMD_READ0 or NAND_CMD_READ1).
  150. */
  151. if (numbytes == ADDR_COLUMN || numbytes == ADDR_COLUMN_PAGE) {
  152. if (DoC_is_Millennium(doc))
  153. WriteDOC(ofs & 0xff, docptr, CDSNSlowIO);
  154. WriteDOC_(ofs & 0xff, docptr, doc->ioreg);
  155. }
  156. if (doc->page256) {
  157. ofs = ofs >> 8;
  158. } else {
  159. ofs = ofs >> 9;
  160. }
  161. if (numbytes == ADDR_PAGE || numbytes == ADDR_COLUMN_PAGE) {
  162. for (i = 0; i < doc->pageadrlen; i++, ofs = ofs >> 8) {
  163. if (DoC_is_Millennium(doc))
  164. WriteDOC(ofs & 0xff, docptr, CDSNSlowIO);
  165. WriteDOC_(ofs & 0xff, docptr, doc->ioreg);
  166. }
  167. }
  168. if (DoC_is_Millennium(doc))
  169. WriteDOC(ofs & 0xff, docptr, WritePipeTerm);
  170. DoC_Delay(doc, 2); /* Needed for some slow flash chips. mf. */
  171. /* FIXME: The SlowIO's for millennium could be replaced by
  172. a single WritePipeTerm here. mf. */
  173. /* Lower the ALE line */
  174. WriteDOC(xtraflags1 | xtraflags2 | CDSN_CTRL_CE, docptr,
  175. CDSNControl);
  176. DoC_Delay(doc, 4); /* Software requirement 11.4.3 for Millennium */
  177. /* Wait for the chip to respond - Software requirement 11.4.1 */
  178. return DoC_WaitReady(doc);
  179. }
  180. /* Read a buffer from DoC, taking care of Millennium odditys */
  181. static void DoC_ReadBuf(struct DiskOnChip *doc, u_char * buf, int len)
  182. {
  183. volatile int dummy;
  184. int modulus = 0xffff;
  185. void __iomem *docptr = doc->virtadr;
  186. int i;
  187. if (len <= 0)
  188. return;
  189. if (DoC_is_Millennium(doc)) {
  190. /* Read the data via the internal pipeline through CDSN IO register,
  191. see Pipelined Read Operations 11.3 */
  192. dummy = ReadDOC(docptr, ReadPipeInit);
  193. /* Millennium should use the LastDataRead register - Pipeline Reads */
  194. len--;
  195. /* This is needed for correctly ECC calculation */
  196. modulus = 0xff;
  197. }
  198. for (i = 0; i < len; i++)
  199. buf[i] = ReadDOC_(docptr, doc->ioreg + (i & modulus));
  200. if (DoC_is_Millennium(doc)) {
  201. buf[i] = ReadDOC(docptr, LastDataRead);
  202. }
  203. }
  204. /* Write a buffer to DoC, taking care of Millennium odditys */
  205. static void DoC_WriteBuf(struct DiskOnChip *doc, const u_char * buf, int len)
  206. {
  207. void __iomem *docptr = doc->virtadr;
  208. int i;
  209. if (len <= 0)
  210. return;
  211. for (i = 0; i < len; i++)
  212. WriteDOC_(buf[i], docptr, doc->ioreg + i);
  213. if (DoC_is_Millennium(doc)) {
  214. WriteDOC(0x00, docptr, WritePipeTerm);
  215. }
  216. }
  217. /* DoC_SelectChip: Select a given flash chip within the current floor */
  218. static inline int DoC_SelectChip(struct DiskOnChip *doc, int chip)
  219. {
  220. void __iomem *docptr = doc->virtadr;
  221. /* Software requirement 11.4.4 before writing DeviceSelect */
  222. /* Deassert the CE line to eliminate glitches on the FCE# outputs */
  223. WriteDOC(CDSN_CTRL_WP, docptr, CDSNControl);
  224. DoC_Delay(doc, 4); /* Software requirement 11.4.3 for Millennium */
  225. /* Select the individual flash chip requested */
  226. WriteDOC(chip, docptr, CDSNDeviceSelect);
  227. DoC_Delay(doc, 4);
  228. /* Reassert the CE line */
  229. WriteDOC(CDSN_CTRL_CE | CDSN_CTRL_FLASH_IO | CDSN_CTRL_WP, docptr,
  230. CDSNControl);
  231. DoC_Delay(doc, 4); /* Software requirement 11.4.3 for Millennium */
  232. /* Wait for it to be ready */
  233. return DoC_WaitReady(doc);
  234. }
  235. /* DoC_SelectFloor: Select a given floor (bank of flash chips) */
  236. static inline int DoC_SelectFloor(struct DiskOnChip *doc, int floor)
  237. {
  238. void __iomem *docptr = doc->virtadr;
  239. /* Select the floor (bank) of chips required */
  240. WriteDOC(floor, docptr, FloorSelect);
  241. /* Wait for the chip to be ready */
  242. return DoC_WaitReady(doc);
  243. }
  244. /* DoC_IdentChip: Identify a given NAND chip given {floor,chip} */
  245. static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip)
  246. {
  247. int mfr, id, i, j;
  248. volatile char dummy;
  249. /* Page in the required floor/chip */
  250. DoC_SelectFloor(doc, floor);
  251. DoC_SelectChip(doc, chip);
  252. /* Reset the chip */
  253. if (DoC_Command(doc, NAND_CMD_RESET, CDSN_CTRL_WP)) {
  254. DEBUG(MTD_DEBUG_LEVEL2,
  255. "DoC_Command (reset) for %d,%d returned true\n",
  256. floor, chip);
  257. return 0;
  258. }
  259. /* Read the NAND chip ID: 1. Send ReadID command */
  260. if (DoC_Command(doc, NAND_CMD_READID, CDSN_CTRL_WP)) {
  261. DEBUG(MTD_DEBUG_LEVEL2,
  262. "DoC_Command (ReadID) for %d,%d returned true\n",
  263. floor, chip);
  264. return 0;
  265. }
  266. /* Read the NAND chip ID: 2. Send address byte zero */
  267. DoC_Address(doc, ADDR_COLUMN, 0, CDSN_CTRL_WP, 0);
  268. /* Read the manufacturer and device id codes from the device */
  269. if (DoC_is_Millennium(doc)) {
  270. DoC_Delay(doc, 2);
  271. dummy = ReadDOC(doc->virtadr, ReadPipeInit);
  272. mfr = ReadDOC(doc->virtadr, LastDataRead);
  273. DoC_Delay(doc, 2);
  274. dummy = ReadDOC(doc->virtadr, ReadPipeInit);
  275. id = ReadDOC(doc->virtadr, LastDataRead);
  276. } else {
  277. /* CDSN Slow IO register see Software Req 11.4 item 5. */
  278. dummy = ReadDOC(doc->virtadr, CDSNSlowIO);
  279. DoC_Delay(doc, 2);
  280. mfr = ReadDOC_(doc->virtadr, doc->ioreg);
  281. /* CDSN Slow IO register see Software Req 11.4 item 5. */
  282. dummy = ReadDOC(doc->virtadr, CDSNSlowIO);
  283. DoC_Delay(doc, 2);
  284. id = ReadDOC_(doc->virtadr, doc->ioreg);
  285. }
  286. /* No response - return failure */
  287. if (mfr == 0xff || mfr == 0)
  288. return 0;
  289. /* Check it's the same as the first chip we identified.
  290. * M-Systems say that any given DiskOnChip device should only
  291. * contain _one_ type of flash part, although that's not a
  292. * hardware restriction. */
  293. if (doc->mfr) {
  294. if (doc->mfr == mfr && doc->id == id)
  295. return 1; /* This is the same as the first */
  296. else
  297. printk(KERN_WARNING
  298. "Flash chip at floor %d, chip %d is different:\n",
  299. floor, chip);
  300. }
  301. /* Print and store the manufacturer and ID codes. */
  302. for (i = 0; nand_flash_ids[i].name != NULL; i++) {
  303. if (id == nand_flash_ids[i].id) {
  304. /* Try to identify manufacturer */
  305. for (j = 0; nand_manuf_ids[j].id != 0x0; j++) {
  306. if (nand_manuf_ids[j].id == mfr)
  307. break;
  308. }
  309. printk(KERN_INFO
  310. "Flash chip found: Manufacturer ID: %2.2X, "
  311. "Chip ID: %2.2X (%s:%s)\n", mfr, id,
  312. nand_manuf_ids[j].name, nand_flash_ids[i].name);
  313. if (!doc->mfr) {
  314. doc->mfr = mfr;
  315. doc->id = id;
  316. doc->chipshift =
  317. ffs((nand_flash_ids[i].chipsize << 20)) - 1;
  318. doc->page256 = (nand_flash_ids[i].pagesize == 256) ? 1 : 0;
  319. doc->pageadrlen = doc->chipshift > 25 ? 3 : 2;
  320. doc->erasesize =
  321. nand_flash_ids[i].erasesize;
  322. return 1;
  323. }
  324. return 0;
  325. }
  326. }
  327. /* We haven't fully identified the chip. Print as much as we know. */
  328. printk(KERN_WARNING "Unknown flash chip found: %2.2X %2.2X\n",
  329. id, mfr);
  330. printk(KERN_WARNING "Please report to dwmw2@infradead.org\n");
  331. return 0;
  332. }
  333. /* DoC_ScanChips: Find all NAND chips present in a DiskOnChip, and identify them */
  334. static void DoC_ScanChips(struct DiskOnChip *this, int maxchips)
  335. {
  336. int floor, chip;
  337. int numchips[MAX_FLOORS];
  338. int ret = 1;
  339. this->numchips = 0;
  340. this->mfr = 0;
  341. this->id = 0;
  342. /* For each floor, find the number of valid chips it contains */
  343. for (floor = 0; floor < MAX_FLOORS; floor++) {
  344. ret = 1;
  345. numchips[floor] = 0;
  346. for (chip = 0; chip < maxchips && ret != 0; chip++) {
  347. ret = DoC_IdentChip(this, floor, chip);
  348. if (ret) {
  349. numchips[floor]++;
  350. this->numchips++;
  351. }
  352. }
  353. }
  354. /* If there are none at all that we recognise, bail */
  355. if (!this->numchips) {
  356. printk(KERN_NOTICE "No flash chips recognised.\n");
  357. return;
  358. }
  359. /* Allocate an array to hold the information for each chip */
  360. this->chips = kmalloc(sizeof(struct Nand) * this->numchips, GFP_KERNEL);
  361. if (!this->chips) {
  362. printk(KERN_NOTICE "No memory for allocating chip info structures\n");
  363. return;
  364. }
  365. ret = 0;
  366. /* Fill out the chip array with {floor, chipno} for each
  367. * detected chip in the device. */
  368. for (floor = 0; floor < MAX_FLOORS; floor++) {
  369. for (chip = 0; chip < numchips[floor]; chip++) {
  370. this->chips[ret].floor = floor;
  371. this->chips[ret].chip = chip;
  372. this->chips[ret].curadr = 0;
  373. this->chips[ret].curmode = 0x50;
  374. ret++;
  375. }
  376. }
  377. /* Calculate and print the total size of the device */
  378. this->totlen = this->numchips * (1 << this->chipshift);
  379. printk(KERN_INFO "%d flash chips found. Total DiskOnChip size: %ld MiB\n",
  380. this->numchips, this->totlen >> 20);
  381. }
  382. static int DoC2k_is_alias(struct DiskOnChip *doc1, struct DiskOnChip *doc2)
  383. {
  384. int tmp1, tmp2, retval;
  385. if (doc1->physadr == doc2->physadr)
  386. return 1;
  387. /* Use the alias resolution register which was set aside for this
  388. * purpose. If it's value is the same on both chips, they might
  389. * be the same chip, and we write to one and check for a change in
  390. * the other. It's unclear if this register is usuable in the
  391. * DoC 2000 (it's in the Millennium docs), but it seems to work. */
  392. tmp1 = ReadDOC(doc1->virtadr, AliasResolution);
  393. tmp2 = ReadDOC(doc2->virtadr, AliasResolution);
  394. if (tmp1 != tmp2)
  395. return 0;
  396. WriteDOC((tmp1 + 1) % 0xff, doc1->virtadr, AliasResolution);
  397. tmp2 = ReadDOC(doc2->virtadr, AliasResolution);
  398. if (tmp2 == (tmp1 + 1) % 0xff)
  399. retval = 1;
  400. else
  401. retval = 0;
  402. /* Restore register contents. May not be necessary, but do it just to
  403. * be safe. */
  404. WriteDOC(tmp1, doc1->virtadr, AliasResolution);
  405. return retval;
  406. }
  407. /* This routine is found from the docprobe code by symbol_get(),
  408. * which will bump the use count of this module. */
  409. void DoC2k_init(struct mtd_info *mtd)
  410. {
  411. struct DiskOnChip *this = mtd->priv;
  412. struct DiskOnChip *old = NULL;
  413. int maxchips;
  414. /* We must avoid being called twice for the same device. */
  415. if (doc2klist)
  416. old = doc2klist->priv;
  417. while (old) {
  418. if (DoC2k_is_alias(old, this)) {
  419. printk(KERN_NOTICE
  420. "Ignoring DiskOnChip 2000 at 0x%lX - already configured\n",
  421. this->physadr);
  422. iounmap(this->virtadr);
  423. kfree(mtd);
  424. return;
  425. }
  426. if (old->nextdoc)
  427. old = old->nextdoc->priv;
  428. else
  429. old = NULL;
  430. }
  431. switch (this->ChipID) {
  432. case DOC_ChipID_Doc2kTSOP:
  433. mtd->name = "DiskOnChip 2000 TSOP";
  434. this->ioreg = DoC_Mil_CDSN_IO;
  435. /* Pretend it's a Millennium */
  436. this->ChipID = DOC_ChipID_DocMil;
  437. maxchips = MAX_CHIPS;
  438. break;
  439. case DOC_ChipID_Doc2k:
  440. mtd->name = "DiskOnChip 2000";
  441. this->ioreg = DoC_2k_CDSN_IO;
  442. maxchips = MAX_CHIPS;
  443. break;
  444. case DOC_ChipID_DocMil:
  445. mtd->name = "DiskOnChip Millennium";
  446. this->ioreg = DoC_Mil_CDSN_IO;
  447. maxchips = MAX_CHIPS_MIL;
  448. break;
  449. default:
  450. printk("Unknown ChipID 0x%02x\n", this->ChipID);
  451. kfree(mtd);
  452. iounmap(this->virtadr);
  453. return;
  454. }
  455. printk(KERN_NOTICE "%s found at address 0x%lX\n", mtd->name,
  456. this->physadr);
  457. mtd->type = MTD_NANDFLASH;
  458. mtd->flags = MTD_CAP_NANDFLASH;
  459. mtd->size = 0;
  460. mtd->erasesize = 0;
  461. mtd->writesize = 512;
  462. mtd->oobsize = 16;
  463. mtd->owner = THIS_MODULE;
  464. mtd->erase = doc_erase;
  465. mtd->point = NULL;
  466. mtd->unpoint = NULL;
  467. mtd->read = doc_read;
  468. mtd->write = doc_write;
  469. mtd->read_oob = doc_read_oob;
  470. mtd->write_oob = doc_write_oob;
  471. mtd->sync = NULL;
  472. this->totlen = 0;
  473. this->numchips = 0;
  474. this->curfloor = -1;
  475. this->curchip = -1;
  476. mutex_init(&this->lock);
  477. /* Ident all the chips present. */
  478. DoC_ScanChips(this, maxchips);
  479. if (!this->totlen) {
  480. kfree(mtd);
  481. iounmap(this->virtadr);
  482. } else {
  483. this->nextdoc = doc2klist;
  484. doc2klist = mtd;
  485. mtd->size = this->totlen;
  486. mtd->erasesize = this->erasesize;
  487. add_mtd_device(mtd);
  488. return;
  489. }
  490. }
  491. EXPORT_SYMBOL_GPL(DoC2k_init);
  492. static int doc_read(struct mtd_info *mtd, loff_t from, size_t len,
  493. size_t * retlen, u_char * buf)
  494. {
  495. struct DiskOnChip *this = mtd->priv;
  496. void __iomem *docptr = this->virtadr;
  497. struct Nand *mychip;
  498. unsigned char syndrome[6], eccbuf[6];
  499. volatile char dummy;
  500. int i, len256 = 0, ret=0;
  501. size_t left = len;
  502. /* Don't allow read past end of device */
  503. if (from >= this->totlen)
  504. return -EINVAL;
  505. mutex_lock(&this->lock);
  506. *retlen = 0;
  507. while (left) {
  508. len = left;
  509. /* Don't allow a single read to cross a 512-byte block boundary */
  510. if (from + len > ((from | 0x1ff) + 1))
  511. len = ((from | 0x1ff) + 1) - from;
  512. /* The ECC will not be calculated correctly if less than 512 is read */
  513. if (len != 0x200)
  514. printk(KERN_WARNING
  515. "ECC needs a full sector read (adr: %lx size %lx)\n",
  516. (long) from, (long) len);
  517. /* printk("DoC_Read (adr: %lx size %lx)\n", (long) from, (long) len); */
  518. /* Find the chip which is to be used and select it */
  519. mychip = &this->chips[from >> (this->chipshift)];
  520. if (this->curfloor != mychip->floor) {
  521. DoC_SelectFloor(this, mychip->floor);
  522. DoC_SelectChip(this, mychip->chip);
  523. } else if (this->curchip != mychip->chip) {
  524. DoC_SelectChip(this, mychip->chip);
  525. }
  526. this->curfloor = mychip->floor;
  527. this->curchip = mychip->chip;
  528. DoC_Command(this,
  529. (!this->page256
  530. && (from & 0x100)) ? NAND_CMD_READ1 : NAND_CMD_READ0,
  531. CDSN_CTRL_WP);
  532. DoC_Address(this, ADDR_COLUMN_PAGE, from, CDSN_CTRL_WP,
  533. CDSN_CTRL_ECC_IO);
  534. /* Prime the ECC engine */
  535. WriteDOC(DOC_ECC_RESET, docptr, ECCConf);
  536. WriteDOC(DOC_ECC_EN, docptr, ECCConf);
  537. /* treat crossing 256-byte sector for 2M x 8bits devices */
  538. if (this->page256 && from + len > (from | 0xff) + 1) {
  539. len256 = (from | 0xff) + 1 - from;
  540. DoC_ReadBuf(this, buf, len256);
  541. DoC_Command(this, NAND_CMD_READ0, CDSN_CTRL_WP);
  542. DoC_Address(this, ADDR_COLUMN_PAGE, from + len256,
  543. CDSN_CTRL_WP, CDSN_CTRL_ECC_IO);
  544. }
  545. DoC_ReadBuf(this, &buf[len256], len - len256);
  546. /* Let the caller know we completed it */
  547. *retlen += len;
  548. /* Read the ECC data through the DiskOnChip ECC logic */
  549. /* Note: this will work even with 2M x 8bit devices as */
  550. /* they have 8 bytes of OOB per 256 page. mf. */
  551. DoC_ReadBuf(this, eccbuf, 6);
  552. /* Flush the pipeline */
  553. if (DoC_is_Millennium(this)) {
  554. dummy = ReadDOC(docptr, ECCConf);
  555. dummy = ReadDOC(docptr, ECCConf);
  556. i = ReadDOC(docptr, ECCConf);
  557. } else {
  558. dummy = ReadDOC(docptr, 2k_ECCStatus);
  559. dummy = ReadDOC(docptr, 2k_ECCStatus);
  560. i = ReadDOC(docptr, 2k_ECCStatus);
  561. }
  562. /* Check the ECC Status */
  563. if (i & 0x80) {
  564. int nb_errors;
  565. /* There was an ECC error */
  566. #ifdef ECC_DEBUG
  567. printk(KERN_ERR "DiskOnChip ECC Error: Read at %lx\n", (long)from);
  568. #endif
  569. /* Read the ECC syndrom through the DiskOnChip ECC
  570. logic. These syndrome will be all ZERO when there
  571. is no error */
  572. for (i = 0; i < 6; i++) {
  573. syndrome[i] =
  574. ReadDOC(docptr, ECCSyndrome0 + i);
  575. }
  576. nb_errors = doc_decode_ecc(buf, syndrome);
  577. #ifdef ECC_DEBUG
  578. printk(KERN_ERR "Errors corrected: %x\n", nb_errors);
  579. #endif
  580. if (nb_errors < 0) {
  581. /* We return error, but have actually done the
  582. read. Not that this can be told to
  583. user-space, via sys_read(), but at least
  584. MTD-aware stuff can know about it by
  585. checking *retlen */
  586. ret = -EIO;
  587. }
  588. }
  589. #ifdef PSYCHO_DEBUG
  590. printk(KERN_DEBUG "ECC DATA at %lxB: %2.2X %2.2X %2.2X %2.2X %2.2X %2.2X\n",
  591. (long)from, eccbuf[0], eccbuf[1], eccbuf[2],
  592. eccbuf[3], eccbuf[4], eccbuf[5]);
  593. #endif
  594. /* disable the ECC engine */
  595. WriteDOC(DOC_ECC_DIS, docptr , ECCConf);
  596. /* according to 11.4.1, we need to wait for the busy line
  597. * drop if we read to the end of the page. */
  598. if(0 == ((from + len) & 0x1ff))
  599. {
  600. DoC_WaitReady(this);
  601. }
  602. from += len;
  603. left -= len;
  604. buf += len;
  605. }
  606. mutex_unlock(&this->lock);
  607. return ret;
  608. }
  609. static int doc_write(struct mtd_info *mtd, loff_t to, size_t len,
  610. size_t * retlen, const u_char * buf)
  611. {
  612. struct DiskOnChip *this = mtd->priv;
  613. int di; /* Yes, DI is a hangover from when I was disassembling the binary driver */
  614. void __iomem *docptr = this->virtadr;
  615. unsigned char eccbuf[6];
  616. volatile char dummy;
  617. int len256 = 0;
  618. struct Nand *mychip;
  619. size_t left = len;
  620. int status;
  621. /* Don't allow write past end of device */
  622. if (to >= this->totlen)
  623. return -EINVAL;
  624. mutex_lock(&this->lock);
  625. *retlen = 0;
  626. while (left) {
  627. len = left;
  628. /* Don't allow a single write to cross a 512-byte block boundary */
  629. if (to + len > ((to | 0x1ff) + 1))
  630. len = ((to | 0x1ff) + 1) - to;
  631. /* The ECC will not be calculated correctly if less than 512 is written */
  632. /* DBB-
  633. if (len != 0x200 && eccbuf)
  634. printk(KERN_WARNING
  635. "ECC needs a full sector write (adr: %lx size %lx)\n",
  636. (long) to, (long) len);
  637. -DBB */
  638. /* printk("DoC_Write (adr: %lx size %lx)\n", (long) to, (long) len); */
  639. /* Find the chip which is to be used and select it */
  640. mychip = &this->chips[to >> (this->chipshift)];
  641. if (this->curfloor != mychip->floor) {
  642. DoC_SelectFloor(this, mychip->floor);
  643. DoC_SelectChip(this, mychip->chip);
  644. } else if (this->curchip != mychip->chip) {
  645. DoC_SelectChip(this, mychip->chip);
  646. }
  647. this->curfloor = mychip->floor;
  648. this->curchip = mychip->chip;
  649. /* Set device to main plane of flash */
  650. DoC_Command(this, NAND_CMD_RESET, CDSN_CTRL_WP);
  651. DoC_Command(this,
  652. (!this->page256
  653. && (to & 0x100)) ? NAND_CMD_READ1 : NAND_CMD_READ0,
  654. CDSN_CTRL_WP);
  655. DoC_Command(this, NAND_CMD_SEQIN, 0);
  656. DoC_Address(this, ADDR_COLUMN_PAGE, to, 0, CDSN_CTRL_ECC_IO);
  657. /* Prime the ECC engine */
  658. WriteDOC(DOC_ECC_RESET, docptr, ECCConf);
  659. WriteDOC(DOC_ECC_EN | DOC_ECC_RW, docptr, ECCConf);
  660. /* treat crossing 256-byte sector for 2M x 8bits devices */
  661. if (this->page256 && to + len > (to | 0xff) + 1) {
  662. len256 = (to | 0xff) + 1 - to;
  663. DoC_WriteBuf(this, buf, len256);
  664. DoC_Command(this, NAND_CMD_PAGEPROG, 0);
  665. DoC_Command(this, NAND_CMD_STATUS, CDSN_CTRL_WP);
  666. /* There's an implicit DoC_WaitReady() in DoC_Command */
  667. dummy = ReadDOC(docptr, CDSNSlowIO);
  668. DoC_Delay(this, 2);
  669. if (ReadDOC_(docptr, this->ioreg) & 1) {
  670. printk(KERN_ERR "Error programming flash\n");
  671. /* Error in programming */
  672. *retlen = 0;
  673. mutex_unlock(&this->lock);
  674. return -EIO;
  675. }
  676. DoC_Command(this, NAND_CMD_SEQIN, 0);
  677. DoC_Address(this, ADDR_COLUMN_PAGE, to + len256, 0,
  678. CDSN_CTRL_ECC_IO);
  679. }
  680. DoC_WriteBuf(this, &buf[len256], len - len256);
  681. WriteDOC(CDSN_CTRL_ECC_IO | CDSN_CTRL_CE, docptr, CDSNControl);
  682. if (DoC_is_Millennium(this)) {
  683. WriteDOC(0, docptr, NOP);
  684. WriteDOC(0, docptr, NOP);
  685. WriteDOC(0, docptr, NOP);
  686. } else {
  687. WriteDOC_(0, docptr, this->ioreg);
  688. WriteDOC_(0, docptr, this->ioreg);
  689. WriteDOC_(0, docptr, this->ioreg);
  690. }
  691. WriteDOC(CDSN_CTRL_ECC_IO | CDSN_CTRL_FLASH_IO | CDSN_CTRL_CE, docptr,
  692. CDSNControl);
  693. /* Read the ECC data through the DiskOnChip ECC logic */
  694. for (di = 0; di < 6; di++) {
  695. eccbuf[di] = ReadDOC(docptr, ECCSyndrome0 + di);
  696. }
  697. /* Reset the ECC engine */
  698. WriteDOC(DOC_ECC_DIS, docptr, ECCConf);
  699. #ifdef PSYCHO_DEBUG
  700. printk
  701. ("OOB data at %lx is %2.2X %2.2X %2.2X %2.2X %2.2X %2.2X\n",
  702. (long) to, eccbuf[0], eccbuf[1], eccbuf[2], eccbuf[3],
  703. eccbuf[4], eccbuf[5]);
  704. #endif
  705. DoC_Command(this, NAND_CMD_PAGEPROG, 0);
  706. DoC_Command(this, NAND_CMD_STATUS, CDSN_CTRL_WP);
  707. /* There's an implicit DoC_WaitReady() in DoC_Command */
  708. if (DoC_is_Millennium(this)) {
  709. ReadDOC(docptr, ReadPipeInit);
  710. status = ReadDOC(docptr, LastDataRead);
  711. } else {
  712. dummy = ReadDOC(docptr, CDSNSlowIO);
  713. DoC_Delay(this, 2);
  714. status = ReadDOC_(docptr, this->ioreg);
  715. }
  716. if (status & 1) {
  717. printk(KERN_ERR "Error programming flash\n");
  718. /* Error in programming */
  719. *retlen = 0;
  720. mutex_unlock(&this->lock);
  721. return -EIO;
  722. }
  723. /* Let the caller know we completed it */
  724. *retlen += len;
  725. {
  726. unsigned char x[8];
  727. size_t dummy;
  728. int ret;
  729. /* Write the ECC data to flash */
  730. for (di=0; di<6; di++)
  731. x[di] = eccbuf[di];
  732. x[6]=0x55;
  733. x[7]=0x55;
  734. ret = doc_write_oob_nolock(mtd, to, 8, &dummy, x);
  735. if (ret) {
  736. mutex_unlock(&this->lock);
  737. return ret;
  738. }
  739. }
  740. to += len;
  741. left -= len;
  742. buf += len;
  743. }
  744. mutex_unlock(&this->lock);
  745. return 0;
  746. }
  747. static int doc_read_oob(struct mtd_info *mtd, loff_t ofs,
  748. struct mtd_oob_ops *ops)
  749. {
  750. struct DiskOnChip *this = mtd->priv;
  751. int len256 = 0, ret;
  752. struct Nand *mychip;
  753. uint8_t *buf = ops->oobbuf;
  754. size_t len = ops->len;
  755. BUG_ON(ops->mode != MTD_OOB_PLACE);
  756. ofs += ops->ooboffs;
  757. mutex_lock(&this->lock);
  758. mychip = &this->chips[ofs >> this->chipshift];
  759. if (this->curfloor != mychip->floor) {
  760. DoC_SelectFloor(this, mychip->floor);
  761. DoC_SelectChip(this, mychip->chip);
  762. } else if (this->curchip != mychip->chip) {
  763. DoC_SelectChip(this, mychip->chip);
  764. }
  765. this->curfloor = mychip->floor;
  766. this->curchip = mychip->chip;
  767. /* update address for 2M x 8bit devices. OOB starts on the second */
  768. /* page to maintain compatibility with doc_read_ecc. */
  769. if (this->page256) {
  770. if (!(ofs & 0x8))
  771. ofs += 0x100;
  772. else
  773. ofs -= 0x8;
  774. }
  775. DoC_Command(this, NAND_CMD_READOOB, CDSN_CTRL_WP);
  776. DoC_Address(this, ADDR_COLUMN_PAGE, ofs, CDSN_CTRL_WP, 0);
  777. /* treat crossing 8-byte OOB data for 2M x 8bit devices */
  778. /* Note: datasheet says it should automaticaly wrap to the */
  779. /* next OOB block, but it didn't work here. mf. */
  780. if (this->page256 && ofs + len > (ofs | 0x7) + 1) {
  781. len256 = (ofs | 0x7) + 1 - ofs;
  782. DoC_ReadBuf(this, buf, len256);
  783. DoC_Command(this, NAND_CMD_READOOB, CDSN_CTRL_WP);
  784. DoC_Address(this, ADDR_COLUMN_PAGE, ofs & (~0x1ff),
  785. CDSN_CTRL_WP, 0);
  786. }
  787. DoC_ReadBuf(this, &buf[len256], len - len256);
  788. ops->retlen = len;
  789. /* Reading the full OOB data drops us off of the end of the page,
  790. * causing the flash device to go into busy mode, so we need
  791. * to wait until ready 11.4.1 and Toshiba TC58256FT docs */
  792. ret = DoC_WaitReady(this);
  793. mutex_unlock(&this->lock);
  794. return ret;
  795. }
  796. static int doc_write_oob_nolock(struct mtd_info *mtd, loff_t ofs, size_t len,
  797. size_t * retlen, const u_char * buf)
  798. {
  799. struct DiskOnChip *this = mtd->priv;
  800. int len256 = 0;
  801. void __iomem *docptr = this->virtadr;
  802. struct Nand *mychip = &this->chips[ofs >> this->chipshift];
  803. volatile int dummy;
  804. int status;
  805. // printk("doc_write_oob(%lx, %d): %2.2X %2.2X %2.2X %2.2X ... %2.2X %2.2X .. %2.2X %2.2X\n",(long)ofs, len,
  806. // buf[0], buf[1], buf[2], buf[3], buf[8], buf[9], buf[14],buf[15]);
  807. /* Find the chip which is to be used and select it */
  808. if (this->curfloor != mychip->floor) {
  809. DoC_SelectFloor(this, mychip->floor);
  810. DoC_SelectChip(this, mychip->chip);
  811. } else if (this->curchip != mychip->chip) {
  812. DoC_SelectChip(this, mychip->chip);
  813. }
  814. this->curfloor = mychip->floor;
  815. this->curchip = mychip->chip;
  816. /* disable the ECC engine */
  817. WriteDOC (DOC_ECC_RESET, docptr, ECCConf);
  818. WriteDOC (DOC_ECC_DIS, docptr, ECCConf);
  819. /* Reset the chip, see Software Requirement 11.4 item 1. */
  820. DoC_Command(this, NAND_CMD_RESET, CDSN_CTRL_WP);
  821. /* issue the Read2 command to set the pointer to the Spare Data Area. */
  822. DoC_Command(this, NAND_CMD_READOOB, CDSN_CTRL_WP);
  823. /* update address for 2M x 8bit devices. OOB starts on the second */
  824. /* page to maintain compatibility with doc_read_ecc. */
  825. if (this->page256) {
  826. if (!(ofs & 0x8))
  827. ofs += 0x100;
  828. else
  829. ofs -= 0x8;
  830. }
  831. /* issue the Serial Data In command to initial the Page Program process */
  832. DoC_Command(this, NAND_CMD_SEQIN, 0);
  833. DoC_Address(this, ADDR_COLUMN_PAGE, ofs, 0, 0);
  834. /* treat crossing 8-byte OOB data for 2M x 8bit devices */
  835. /* Note: datasheet says it should automaticaly wrap to the */
  836. /* next OOB block, but it didn't work here. mf. */
  837. if (this->page256 && ofs + len > (ofs | 0x7) + 1) {
  838. len256 = (ofs | 0x7) + 1 - ofs;
  839. DoC_WriteBuf(this, buf, len256);
  840. DoC_Command(this, NAND_CMD_PAGEPROG, 0);
  841. DoC_Command(this, NAND_CMD_STATUS, 0);
  842. /* DoC_WaitReady() is implicit in DoC_Command */
  843. if (DoC_is_Millennium(this)) {
  844. ReadDOC(docptr, ReadPipeInit);
  845. status = ReadDOC(docptr, LastDataRead);
  846. } else {
  847. dummy = ReadDOC(docptr, CDSNSlowIO);
  848. DoC_Delay(this, 2);
  849. status = ReadDOC_(docptr, this->ioreg);
  850. }
  851. if (status & 1) {
  852. printk(KERN_ERR "Error programming oob data\n");
  853. /* There was an error */
  854. *retlen = 0;
  855. return -EIO;
  856. }
  857. DoC_Command(this, NAND_CMD_SEQIN, 0);
  858. DoC_Address(this, ADDR_COLUMN_PAGE, ofs & (~0x1ff), 0, 0);
  859. }
  860. DoC_WriteBuf(this, &buf[len256], len - len256);
  861. DoC_Command(this, NAND_CMD_PAGEPROG, 0);
  862. DoC_Command(this, NAND_CMD_STATUS, 0);
  863. /* DoC_WaitReady() is implicit in DoC_Command */
  864. if (DoC_is_Millennium(this)) {
  865. ReadDOC(docptr, ReadPipeInit);
  866. status = ReadDOC(docptr, LastDataRead);
  867. } else {
  868. dummy = ReadDOC(docptr, CDSNSlowIO);
  869. DoC_Delay(this, 2);
  870. status = ReadDOC_(docptr, this->ioreg);
  871. }
  872. if (status & 1) {
  873. printk(KERN_ERR "Error programming oob data\n");
  874. /* There was an error */
  875. *retlen = 0;
  876. return -EIO;
  877. }
  878. *retlen = len;
  879. return 0;
  880. }
  881. static int doc_write_oob(struct mtd_info *mtd, loff_t ofs,
  882. struct mtd_oob_ops *ops)
  883. {
  884. struct DiskOnChip *this = mtd->priv;
  885. int ret;
  886. BUG_ON(ops->mode != MTD_OOB_PLACE);
  887. mutex_lock(&this->lock);
  888. ret = doc_write_oob_nolock(mtd, ofs + ops->ooboffs, ops->len,
  889. &ops->retlen, ops->oobbuf);
  890. mutex_unlock(&this->lock);
  891. return ret;
  892. }
  893. static int doc_erase(struct mtd_info *mtd, struct erase_info *instr)
  894. {
  895. struct DiskOnChip *this = mtd->priv;
  896. __u32 ofs = instr->addr;
  897. __u32 len = instr->len;
  898. volatile int dummy;
  899. void __iomem *docptr = this->virtadr;
  900. struct Nand *mychip;
  901. int status;
  902. mutex_lock(&this->lock);
  903. if (ofs & (mtd->erasesize-1) || len & (mtd->erasesize-1)) {
  904. mutex_unlock(&this->lock);
  905. return -EINVAL;
  906. }
  907. instr->state = MTD_ERASING;
  908. /* FIXME: Do this in the background. Use timers or schedule_task() */
  909. while(len) {
  910. mychip = &this->chips[ofs >> this->chipshift];
  911. if (this->curfloor != mychip->floor) {
  912. DoC_SelectFloor(this, mychip->floor);
  913. DoC_SelectChip(this, mychip->chip);
  914. } else if (this->curchip != mychip->chip) {
  915. DoC_SelectChip(this, mychip->chip);
  916. }
  917. this->curfloor = mychip->floor;
  918. this->curchip = mychip->chip;
  919. DoC_Command(this, NAND_CMD_ERASE1, 0);
  920. DoC_Address(this, ADDR_PAGE, ofs, 0, 0);
  921. DoC_Command(this, NAND_CMD_ERASE2, 0);
  922. DoC_Command(this, NAND_CMD_STATUS, CDSN_CTRL_WP);
  923. if (DoC_is_Millennium(this)) {
  924. ReadDOC(docptr, ReadPipeInit);
  925. status = ReadDOC(docptr, LastDataRead);
  926. } else {
  927. dummy = ReadDOC(docptr, CDSNSlowIO);
  928. DoC_Delay(this, 2);
  929. status = ReadDOC_(docptr, this->ioreg);
  930. }
  931. if (status & 1) {
  932. printk(KERN_ERR "Error erasing at 0x%x\n", ofs);
  933. /* There was an error */
  934. instr->state = MTD_ERASE_FAILED;
  935. goto callback;
  936. }
  937. ofs += mtd->erasesize;
  938. len -= mtd->erasesize;
  939. }
  940. instr->state = MTD_ERASE_DONE;
  941. callback:
  942. mtd_erase_callback(instr);
  943. mutex_unlock(&this->lock);
  944. return 0;
  945. }
  946. /****************************************************************************
  947. *
  948. * Module stuff
  949. *
  950. ****************************************************************************/
  951. static void __exit cleanup_doc2000(void)
  952. {
  953. struct mtd_info *mtd;
  954. struct DiskOnChip *this;
  955. while ((mtd = doc2klist)) {
  956. this = mtd->priv;
  957. doc2klist = this->nextdoc;
  958. del_mtd_device(mtd);
  959. iounmap(this->virtadr);
  960. kfree(this->chips);
  961. kfree(mtd);
  962. }
  963. }
  964. module_exit(cleanup_doc2000);
  965. MODULE_LICENSE("GPL");
  966. MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org> et al.");
  967. MODULE_DESCRIPTION("MTD driver for DiskOnChip 2000 and Millennium");