···11# drivers/mtd/maps/Kconfig22-# $Id: Kconfig,v 1.15 2004/12/22 17:51:15 joern Exp $22+# $Id: Kconfig,v 1.18 2005/11/07 11:14:24 gleixner Exp $3344menu "Self-contained MTD device drivers"55 depends on MTD!=n···110110 If you have system RAM accessible by the CPU but not used by Linux111111 in normal operation, you can give the physical address at which the112112 available RAM starts, and the MTDRAM driver will use it instead of113113- allocating space from Linux's available memory. Otherwise, leave 113113+ allocating space from Linux's available memory. Otherwise, leave114114 this set to zero. Most people will want to leave this as zero.115115116116config MTD_BLKMTD···165165 select MTD_DOCPROBE166166 select MTD_NAND_IDS167167 ---help---168168- This provides an alternative MTD device driver for the M-Systems 168168+ This provides an alternative MTD device driver for the M-Systems169169 DiskOnChip Millennium devices. Use this if you have problems with170170 the combined DiskOnChip 2000 and Millennium driver above. To get171171 the DiskOnChip probe code to load and use this driver instead of···192192193193 If you use this device, you probably also want to enable the INFTL194194 'Inverse NAND Flash Translation Layer' option below, which is used195195- to emulate a block device by using a kind of file system on the 195195+ to emulate a block device by using a kind of file system on the196196 flash chips.197197198198 NOTE: This driver will soon be replaced by the new DiskOnChip driver
+5-5
drivers/mtd/devices/blkmtd.c
···11/*22- * $Id: blkmtd.c,v 1.24 2004/11/16 18:29:01 dwmw2 Exp $22+ * $Id: blkmtd.c,v 1.27 2005/11/07 11:14:24 gleixner Exp $33 *44 * blkmtd.c - use a block device as a fake MTD55 *···39394040/* Default erase size in K, always make it a multiple of PAGE_SIZE */4141#define CONFIG_MTD_BLKDEV_ERASESIZE (128 << 10) /* 128KiB */4242-#define VERSION "$Revision: 1.24 $"4242+#define VERSION "$Revision: 1.27 $"43434444/* Info for the block device */4545struct blkmtd_dev {···117117 unlock_page(page);118118 page_cache_release(page);119119 } while (bvec >= bio->bi_io_vec);120120-120120+121121 complete((struct completion*)bio->bi_private);122122 return 0;123123}···135135 unlock_page(page);136136 return 0;137137 }138138-138138+139139 ClearPageUptodate(page);140140 ClearPageError(page);141141···710710 dev->mtd_info.erasesize >> 10,711711 readonly ? "(read-only)" : "");712712 }713713-713713+714714 return dev;715715716716 devinit_err:
+4-4
drivers/mtd/devices/block2mtd.c
···11/*22- * $Id: block2mtd.c,v 1.28 2005/03/19 22:40:44 gleixner Exp $22+ * $Id: block2mtd.c,v 1.29 2005/11/07 11:14:24 gleixner Exp $33 *44 * block2mtd.c - create an mtd from a block device55 *···1919#include <linux/mtd/mtd.h>2020#include <linux/buffer_head.h>21212222-#define VERSION "$Revision: 1.28 $"2222+#define VERSION "$Revision: 1.29 $"232324242525#define ERROR(fmt, args...) printk(KERN_ERR "block2mtd: " fmt "\n" , ## args)···111111 return PTR_ERR(page);112112113113 max = (u_long*)page_address(page) + PAGE_SIZE;114114- for (p=(u_long*)page_address(page); p<max; p++) 114114+ for (p=(u_long*)page_address(page); p<max; p++)115115 if (*p != -1UL) {116116 lock_page(page);117117 memset(page_address(page), 0xff, PAGE_SIZE);···206206 if (retlen)207207 *retlen = 0;208208 while (len) {209209- if ((offset+len) > PAGE_SIZE) 209209+ if ((offset+len) > PAGE_SIZE)210210 cpylen = PAGE_SIZE - offset; // multiple pages211211 else212212 cpylen = len; // this page
+21-21
drivers/mtd/devices/doc2000.c
···44 * (c) 1999 Machine Vision Holdings, Inc.55 * (c) 1999, 2000 David Woodhouse <dwmw2@infradead.org>66 *77- * $Id: doc2000.c,v 1.66 2005/01/05 18:05:12 dwmw2 Exp $77+ * $Id: doc2000.c,v 1.67 2005/11/07 11:14:24 gleixner Exp $88 */991010#include <linux/kernel.h>···5858 size_t *retlen, u_char *buf, u_char *eccbuf, struct nand_oobinfo *oobsel);5959static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len,6060 size_t *retlen, const u_char *buf, u_char *eccbuf, struct nand_oobinfo *oobsel);6161-static int doc_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs, 6161+static int doc_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs,6262 unsigned long count, loff_t to, size_t *retlen,6363 u_char *eccbuf, struct nand_oobinfo *oobsel);6464static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, size_t len,···7676{7777 volatile char dummy;7878 int i;7979-7979+8080 for (i = 0; i < cycles; i++) {8181 if (DoC_is_Millennium(doc))8282 dummy = ReadDOC(doc->virtadr, NOP);8383 else8484 dummy = ReadDOC(doc->virtadr, DOCStatus);8585 }8686-8686+8787}88888989/* DOC_WaitReady: Wait for RDY line to be asserted by the flash chip */···220220 WriteDOC(ofs & 0xff, docptr, WritePipeTerm);221221222222 DoC_Delay(doc, 2); /* Needed for some slow flash chips. mf. */223223-224224- /* FIXME: The SlowIO's for millennium could be replaced by 223223+224224+ /* FIXME: The SlowIO's for millennium could be replaced by225225 a single WritePipeTerm here. mf. */226226227227 /* Lower the ALE line */···377377 if (mfr == 0xff || mfr == 0)378378 return 0;379379380380- /* Check it's the same as the first chip we identified. 380380+ /* Check it's the same as the first chip we identified.381381 * M-Systems say that any given DiskOnChip device should only382382- * contain _one_ type of flash part, although that's not a 382382+ * contain _one_ type of flash part, although that's not a383383 * hardware restriction. */384384 if (doc->mfr) {385385 if (doc->mfr == mfr && doc->id == id)···397397 for (j = 0; nand_manuf_ids[j].id != 0x0; j++) {398398 if (nand_manuf_ids[j].id == mfr)399399 break;400400- } 400400+ }401401 printk(KERN_INFO402402 "Flash chip found: Manufacturer ID: %2.2X, "403403 "Chip ID: %2.2X (%s:%s)\n", mfr, id,···405405 if (!doc->mfr) {406406 doc->mfr = mfr;407407 doc->id = id;408408- doc->chipshift = 408408+ doc->chipshift =409409 ffs((nand_flash_ids[i].chipsize << 20)) - 1;410410 doc->page256 = (nand_flash_ids[i].pagesize == 256) ? 1 : 0;411411 doc->pageadrlen = doc->chipshift > 25 ? 3 : 2;···467467468468 ret = 0;469469470470- /* Fill out the chip array with {floor, chipno} for each 470470+ /* Fill out the chip array with {floor, chipno} for each471471 * detected chip in the device. */472472 for (floor = 0; floor < MAX_FLOORS; floor++) {473473 for (chip = 0; chip < numchips[floor]; chip++) {···757757 (long)from, eccbuf[0], eccbuf[1], eccbuf[2],758758 eccbuf[3], eccbuf[4], eccbuf[5]);759759#endif760760-760760+761761 /* disable the ECC engine */762762 WriteDOC(DOC_ECC_DIS, docptr , ECCConf);763763 }764764765765- /* according to 11.4.1, we need to wait for the busy line 765765+ /* according to 11.4.1, we need to wait for the busy line766766 * drop if we read to the end of the page. */767767 if(0 == ((from + len) & 0x1ff))768768 {···941941942942 /* Let the caller know we completed it */943943 *retlen += len;944944-944944+945945 if (eccbuf) {946946 unsigned char x[8];947947 size_t dummy;···950950 /* Write the ECC data to flash */951951 for (di=0; di<6; di++)952952 x[di] = eccbuf[di];953953-953953+954954 x[6]=0x55;955955 x[7]=0x55;956956-956956+957957 ret = doc_write_oob_nolock(mtd, to, 8, &dummy, x);958958 if (ret) {959959 up(&this->lock);···970970 return 0;971971}972972973973-static int doc_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs, 973973+static int doc_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs,974974 unsigned long count, loff_t to, size_t *retlen,975975 u_char *eccbuf, struct nand_oobinfo *oobsel)976976{···10221022 break;1023102310241024 to += thislen;10251025- } 10251025+ }1026102610271027 up(&writev_buf_sem);10281028 *retlen = totretlen;···10801080 /* Reading the full OOB data drops us off of the end of the page,10811081 * causing the flash device to go into busy mode, so we need10821082 * to wait until ready 11.4.1 and Toshiba TC58256FT docs */10831083-10831083+10841084 ret = DoC_WaitReady(this);1085108510861086 up(&this->lock);···11901190 return 0;1191119111921192}11931193-11931193+11941194static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, size_t len,11951195 size_t * retlen, const u_char * buf)11961196{···12221222 }1223122312241224 instr->state = MTD_ERASING;12251225-12251225+12261226 /* FIXME: Do this in the background. Use timers or schedule_task() */12271227 while(len) {12281228 mychip = &this->chips[ofs >> this->chipshift];
+12-12
drivers/mtd/devices/doc2001.c
···44 * (c) 1999 Machine Vision Holdings, Inc.55 * (c) 1999, 2000 David Woodhouse <dwmw2@infradead.org>66 *77- * $Id: doc2001.c,v 1.48 2005/01/05 18:05:12 dwmw2 Exp $77+ * $Id: doc2001.c,v 1.49 2005/11/07 11:14:24 gleixner Exp $88 */991010#include <linux/kernel.h>···196196 DoC_Command(doc->virtadr, NAND_CMD_RESET, CDSN_CTRL_WP);197197 DoC_WaitReady(doc->virtadr);198198199199- /* Read the NAND chip ID: 1. Send ReadID command */ 199199+ /* Read the NAND chip ID: 1. Send ReadID command */200200 DoC_Command(doc->virtadr, NAND_CMD_READID, CDSN_CTRL_WP);201201202202- /* Read the NAND chip ID: 2. Send address byte zero */ 202202+ /* Read the NAND chip ID: 2. Send address byte zero */203203 DoC_Address(doc->virtadr, 1, 0x00, CDSN_CTRL_WP, 0x00);204204205205 /* Read the manufacturer and device id codes of the flash device through···223223 for (j = 0; nand_manuf_ids[j].id != 0x0; j++) {224224 if (nand_manuf_ids[j].id == mfr)225225 break;226226- } 226226+ }227227 printk(KERN_INFO "Flash chip found: Manufacturer ID: %2.2X, "228228 "Chip ID: %2.2X (%s:%s)\n",229229 mfr, id, nand_manuf_ids[j].name, nand_flash_ids[i].name);···275275 return;276276 }277277278278- /* Fill out the chip array with {floor, chipno} for each 278278+ /* Fill out the chip array with {floor, chipno} for each279279 * detected chip in the device. */280280 for (floor = 0, ret = 0; floor < MAX_FLOORS_MIL; floor++) {281281 for (chip = 0 ; chip < numchips[floor] ; chip++) {···309309 tmp2 = ReadDOC(doc2->virtadr, AliasResolution);310310 if (tmp1 != tmp2)311311 return 0;312312-312312+313313 WriteDOC((tmp1+1) % 0xff, doc1->virtadr, AliasResolution);314314 tmp2 = ReadDOC(doc2->virtadr, AliasResolution);315315 if (tmp2 == (tmp1+1) % 0xff)···425425 return -EINVAL;426426427427 /* Don't allow a single read to cross a 512-byte block boundary */428428- if (from + len > ((from | 0x1ff) + 1)) 428428+ if (from + len > ((from | 0x1ff) + 1))429429 len = ((from | 0x1ff) + 1) - from;430430431431 /* Find the chip which is to be used and select it */···552552553553#if 0554554 /* Don't allow a single write to cross a 512-byte block boundary */555555- if (to + len > ( (to | 0x1ff) + 1)) 555555+ if (to + len > ( (to | 0x1ff) + 1))556556 len = ((to | 0x1ff) + 1) - to;557557#else558558 /* Don't allow writes which aren't exactly one block */···632632633633 /* write the block status BLOCK_USED (0x5555) at the end of ECC data634634 FIXME: this is only a hack for programming the IPL area for LinuxBIOS635635- and should be replace with proper codes in user space utilities */ 635635+ and should be replace with proper codes in user space utilities */636636 WriteDOC(0x55, docptr, Mil_CDSN_IO);637637 WriteDOC(0x55, docptr, Mil_CDSN_IO + 1);638638···802802 void __iomem *docptr = this->virtadr;803803 struct Nand *mychip = &this->chips[ofs >> this->chipshift];804804805805- if (len != mtd->erasesize) 805805+ if (len != mtd->erasesize)806806 printk(KERN_WARNING "Erase not right size (%x != %x)n",807807 len, mtd->erasesize);808808···870870 while ((mtd=docmillist)) {871871 this = mtd->priv;872872 docmillist = this->nextdoc;873873-873873+874874 del_mtd_device(mtd);875875-875875+876876 iounmap(this->virtadr);877877 kfree(this->chips);878878 kfree(mtd);
+10-10
drivers/mtd/devices/doc2001plus.c
···66 * (c) 1999 Machine Vision Holdings, Inc.77 * (c) 1999, 2000 David Woodhouse <dwmw2@infradead.org>88 *99- * $Id: doc2001plus.c,v 1.13 2005/01/05 18:05:12 dwmw2 Exp $99+ * $Id: doc2001plus.c,v 1.14 2005/11/07 11:14:24 gleixner Exp $1010 *1111 * Released under GPL1212 */···293293 DoC_Command(docptr, NAND_CMD_RESET, 0);294294 DoC_WaitReady(docptr);295295296296- /* Read the NAND chip ID: 1. Send ReadID command */ 296296+ /* Read the NAND chip ID: 1. Send ReadID command */297297 DoC_Command(docptr, NAND_CMD_READID, 0);298298299299- /* Read the NAND chip ID: 2. Send address byte zero */ 299299+ /* Read the NAND chip ID: 2. Send address byte zero */300300 DoC_Address(doc, 1, 0x00, 0, 0x00);301301302302 WriteDOC(0, docptr, Mplus_FlashControl);···365365 this->interleave = 1;366366367367 /* Check the ASIC agrees */368368- if ( (this->interleave << 2) != 368368+ if ( (this->interleave << 2) !=369369 (ReadDOC(this->virtadr, Mplus_Configuration) & 4)) {370370 u_char conf = ReadDOC(this->virtadr, Mplus_Configuration);371371 printk(KERN_NOTICE "Setting DiskOnChip Millennium Plus interleave to %s\n",···398398 return;399399 }400400401401- /* Fill out the chip array with {floor, chipno} for each 401401+ /* Fill out the chip array with {floor, chipno} for each402402 * detected chip in the device. */403403 for (floor = 0, ret = 0; floor < MAX_FLOORS_MPLUS; floor++) {404404 for (chip = 0 ; chip < numchips[floor] ; chip++) {···432432 tmp2 = ReadDOC(doc2->virtadr, Mplus_AliasResolution);433433 if (tmp1 != tmp2)434434 return 0;435435-435435+436436 WriteDOC((tmp1+1) % 0xff, doc1->virtadr, Mplus_AliasResolution);437437 tmp2 = ReadDOC(doc2->virtadr, Mplus_AliasResolution);438438 if (tmp2 == (tmp1+1) % 0xff)···624624 return -EINVAL;625625626626 /* Don't allow a single read to cross a 512-byte block boundary */627627- if (from + len > ((from | 0x1ff) + 1)) 627627+ if (from + len > ((from | 0x1ff) + 1))628628 len = ((from | 0x1ff) + 1) - from;629629630630 DoC_CheckASIC(docptr);···1066106610671067 DoC_CheckASIC(docptr);1068106810691069- if (len != mtd->erasesize) 10691069+ if (len != mtd->erasesize)10701070 printk(KERN_WARNING "MTD: Erase not right size (%x != %x)n",10711071 len, mtd->erasesize);10721072···11361136 while ((mtd=docmilpluslist)) {11371137 this = mtd->priv;11381138 docmilpluslist = this->nextdoc;11391139-11391139+11401140 del_mtd_device(mtd);11411141-11411141+11421142 iounmap(this->virtadr);11431143 kfree(this->chips);11441144 kfree(mtd);
+20-20
drivers/mtd/devices/docecc.c
···44 * GNU GPL License. The rest is simply to convert the disk on chip55 * syndrom into a standard syndom.66 *77- * Author: Fabrice Bellard (fabrice.bellard@netgem.com) 77+ * Author: Fabrice Bellard (fabrice.bellard@netgem.com)88 * Copyright (C) 2000 Netgem S.A.99 *1010- * $Id: docecc.c,v 1.5 2003/05/21 15:15:06 dwmw2 Exp $1010+ * $Id: docecc.c,v 1.7 2005/11/07 11:14:25 gleixner Exp $1111 *1212 * This program is free software; you can redistribute it and/or modify1313 * it under the terms of the GNU General Public License as published by···122122 a(0) + a(1) @ + a(2) @^2 + ... + a(m-1) @^(m-1)123123 we consider the integer "i" whose binary representation with a(0) being LSB124124 and a(m-1) MSB is (a(0),a(1),...,a(m-1)) and locate the entry125125- "index_of[i]". Now, @^index_of[i] is that element whose polynomial 125125+ "index_of[i]". Now, @^index_of[i] is that element whose polynomial126126 representation is (a(0),a(1),a(2),...,a(m-1)).127127 NOTE:128128 The element alpha_to[2^m-1] = 0 always signifying that the···130130 Similarily, the element index_of[0] = A0 always signifying131131 that the power of alpha which has the polynomial representation132132 (0,0,...,0) is "infinity".133133-133133+134134*/135135136136static void···176176 * are written back. NOTE! This array must be at least NN-KK elements long.177177 * The corrected data are written in eras_val[]. They must be xor with the data178178 * to retrieve the correct data : data[erase_pos[i]] ^= erase_val[i] .179179- * 179179+ *180180 * First "no_eras" erasures are declared by the calling program. Then, the181181 * maximum # of errors correctable is t_after_eras = floor((NN-KK-no_eras)/2).182182 * If the number of channel errors is not greater than "t_after_eras" the···189189 * */190190static int191191eras_dec_rs(dtype Alpha_to[NN + 1], dtype Index_of[NN + 1],192192- gf bb[NN - KK + 1], gf eras_val[NN-KK], int eras_pos[NN-KK], 192192+ gf bb[NN - KK + 1], gf eras_val[NN-KK], int eras_pos[NN-KK],193193 int no_eras)194194{195195 int deg_lambda, el, deg_omega;···212212 count = 0;213213 goto finish;214214 }215215-215215+216216 for(i=1;i<=NN-KK;i++){217217 s[i] = bb[0];218218 }···220220 if(bb[j] == 0)221221 continue;222222 tmp = Index_of[bb[j]];223223-223223+224224 for(i=1;i<=NN-KK;i++)225225 s[i] ^= Alpha_to[modnn(tmp + (B0+i-1)*PRIM*j)];226226 }···234234 tmp = modnn(tmp + 2 * KK * (B0+i-1)*PRIM);235235 s[i] = tmp;236236 }237237-237237+238238 CLEAR(&lambda[1],NN-KK);239239 lambda[0] = 1;240240···252252#if DEBUG_ECC >= 1253253 /* Test code that verifies the erasure locator polynomial just constructed254254 Needed only for decoder debugging. */255255-255255+256256 /* find roots of the erasure location polynomial */257257 for(i=1;i<=no_eras;i++)258258 reg[i] = Index_of[lambda[i]];···286286 }287287 for(i=0;i<NN-KK+1;i++)288288 b[i] = Index_of[lambda[i]];289289-289289+290290 /*291291 * Begin Berlekamp-Massey algorithm to determine error+erasure292292 * locator polynomial···389389 omega[i] = Index_of[tmp];390390 }391391 omega[NN-KK] = A0;392392-392392+393393 /*394394 * Compute error values in poly-form. num1 = omega(inv(X(l))), num2 =395395 * inv(X(l))**(B0-1) and den = lambda_pr(inv(X(l))) all in poly-form···402402 }403403 num2 = Alpha_to[modnn(root[j] * (B0 - 1) + NN)];404404 den = 0;405405-405405+406406 /* lambda[i+1] for i even is the formal derivative lambda_pr of lambda[i] */407407 for (i = min(deg_lambda,NN-KK-1) & ~1; i >= 0; i -=2) {408408 if(lambda[i+1] != A0)···436436/* The sector bytes are packed into NB_DATA MM bits words */437437#define NB_DATA (((SECTOR_SIZE + 1) * 8 + 6) / MM)438438439439-/* 439439+/*440440 * Correct the errors in 'sector[]' by using 'ecc1[]' which is the441441 * content of the feedback shift register applyied to the sector and442442 * the ECC. Return the number of errors corrected (and correct them in443443- * sector), or -1 if error 443443+ * sector), or -1 if error444444 */445445int doc_decode_ecc(unsigned char sector[SECTOR_SIZE], unsigned char ecc1[6])446446{···454454 Alpha_to = kmalloc((NN + 1) * sizeof(dtype), GFP_KERNEL);455455 if (!Alpha_to)456456 return -1;457457-457457+458458 Index_of = kmalloc((NN + 1) * sizeof(dtype), GFP_KERNEL);459459 if (!Index_of) {460460 kfree(Alpha_to);···470470 bb[2] = ((ecc1[2] & 0xf0) >> 4) | ((ecc1[3] & 0x3f) << 4);471471 bb[3] = ((ecc1[3] & 0xc0) >> 6) | ((ecc1[0] & 0xff) << 2);472472473473- nb_errors = eras_dec_rs(Alpha_to, Index_of, bb, 473473+ nb_errors = eras_dec_rs(Alpha_to, Index_of, bb,474474 error_val, error_pos, 0);475475 if (nb_errors <= 0)476476 goto the_end;···489489 can be modified since pos is even */490490 index = (pos >> 3) ^ 1;491491 bitpos = pos & 7;492492- if ((index >= 0 && index < SECTOR_SIZE) || 492492+ if ((index >= 0 && index < SECTOR_SIZE) ||493493 index == (SECTOR_SIZE + 1)) {494494 val = error_val[i] >> (2 + bitpos);495495 parity ^= val;···500500 bitpos = (bitpos + 10) & 7;501501 if (bitpos == 0)502502 bitpos = 8;503503- if ((index >= 0 && index < SECTOR_SIZE) || 503503+ if ((index >= 0 && index < SECTOR_SIZE) ||504504 index == (SECTOR_SIZE + 1)) {505505 val = error_val[i] << (8 - bitpos);506506 parity ^= val;···509509 }510510 }511511 }512512-512512+513513 /* use parity to test extra errors */514514 if ((parity & 0xff) != 0)515515 nb_errors = -1;
+41-41
drivers/mtd/devices/docprobe.c
···44/* (C) 1999 Machine Vision Holdings, Inc. */55/* (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> */6677-/* $Id: docprobe.c,v 1.44 2005/01/05 12:40:36 dwmw2 Exp $ */77+/* $Id: docprobe.c,v 1.46 2005/11/07 11:14:25 gleixner Exp $ */889910101111/* DOC_PASSIVE_PROBE:1212- In order to ensure that the BIOS checksum is correct at boot time, and 1313- hence that the onboard BIOS extension gets executed, the DiskOnChip 1414- goes into reset mode when it is read sequentially: all registers 1515- return 0xff until the chip is woken up again by writing to the 1616- DOCControl register. 1212+ In order to ensure that the BIOS checksum is correct at boot time, and1313+ hence that the onboard BIOS extension gets executed, the DiskOnChip1414+ goes into reset mode when it is read sequentially: all registers1515+ return 0xff until the chip is woken up again by writing to the1616+ DOCControl register.17171818- Unfortunately, this means that the probe for the DiskOnChip is unsafe, 1919- because one of the first things it does is write to where it thinks 2020- the DOCControl register should be - which may well be shared memory 2121- for another device. I've had machines which lock up when this is 2222- attempted. Hence the possibility to do a passive probe, which will fail 1818+ Unfortunately, this means that the probe for the DiskOnChip is unsafe,1919+ because one of the first things it does is write to where it thinks2020+ the DOCControl register should be - which may well be shared memory2121+ for another device. I've had machines which lock up when this is2222+ attempted. Hence the possibility to do a passive probe, which will fail2323 to detect a chip in reset mode, but is at least guaranteed not to lock2424 the machine.2525···33333434 The old Millennium-only driver has been retained just in case there3535 are problems with the new code. If the combined driver doesn't work3636- for you, you can try the old one by undefining DOC_SINGLE_DRIVER 3636+ for you, you can try the old one by undefining DOC_SINGLE_DRIVER3737 below and also enabling it in your configuration. If this fixes the3838- problems, please send a report to the MTD mailing list at 3838+ problems, please send a report to the MTD mailing list at3939 <linux-mtd@lists.infradead.org>.4040*/4141#define DOC_SINGLE_DRIVER···6868static unsigned long __initdata doc_locations[] = {6969#if defined (__alpha__) || defined(__i386__) || defined(__x86_64__)7070#ifdef CONFIG_MTD_DOCPROBE_HIGH7171- 0xfffc8000, 0xfffca000, 0xfffcc000, 0xfffce000, 7171+ 0xfffc8000, 0xfffca000, 0xfffcc000, 0xfffce000,7272 0xfffd0000, 0xfffd2000, 0xfffd4000, 0xfffd6000,7373- 0xfffd8000, 0xfffda000, 0xfffdc000, 0xfffde000, 7474- 0xfffe0000, 0xfffe2000, 0xfffe4000, 0xfffe6000, 7373+ 0xfffd8000, 0xfffda000, 0xfffdc000, 0xfffde000,7474+ 0xfffe0000, 0xfffe2000, 0xfffe4000, 0xfffe6000,7575 0xfffe8000, 0xfffea000, 0xfffec000, 0xfffee000,7676#else /* CONFIG_MTD_DOCPROBE_HIGH */7777- 0xc8000, 0xca000, 0xcc000, 0xce000, 7777+ 0xc8000, 0xca000, 0xcc000, 0xce000,7878 0xd0000, 0xd2000, 0xd4000, 0xd6000,7979- 0xd8000, 0xda000, 0xdc000, 0xde000, 8080- 0xe0000, 0xe2000, 0xe4000, 0xe6000, 7979+ 0xd8000, 0xda000, 0xdc000, 0xde000,8080+ 0xe0000, 0xe2000, 0xe4000, 0xe6000,8181 0xe8000, 0xea000, 0xec000, 0xee000,8282#endif /* CONFIG_MTD_DOCPROBE_HIGH */8383#elif defined(__PPC__)···111111 return 0;112112#endif /* CONFIG_MTD_DOCPROBE_55AA */113113114114-#ifndef DOC_PASSIVE_PROBE 114114+#ifndef DOC_PASSIVE_PROBE115115 /* It's not possible to cleanly detect the DiskOnChip - the116116 * bootup procedure will put the device into reset mode, and117117 * it's not possible to talk to it without actually writing118118 * to the DOCControl register. So we store the current contents119119 * of the DOCControl register's location, in case we later decide120120 * that it's not a DiskOnChip, and want to put it back how we121121- * found it. 121121+ * found it.122122 */123123 tmp2 = ReadDOC(window, DOCControl);124124-124124+125125 /* Reset the DiskOnChip ASIC */126126- WriteDOC(DOC_MODE_CLR_ERR | DOC_MODE_MDWREN | DOC_MODE_RESET, 126126+ WriteDOC(DOC_MODE_CLR_ERR | DOC_MODE_MDWREN | DOC_MODE_RESET,127127 window, DOCControl);128128- WriteDOC(DOC_MODE_CLR_ERR | DOC_MODE_MDWREN | DOC_MODE_RESET, 128128+ WriteDOC(DOC_MODE_CLR_ERR | DOC_MODE_MDWREN | DOC_MODE_RESET,129129 window, DOCControl);130130-130130+131131 /* Enable the DiskOnChip ASIC */132132- WriteDOC(DOC_MODE_CLR_ERR | DOC_MODE_MDWREN | DOC_MODE_NORMAL, 132132+ WriteDOC(DOC_MODE_CLR_ERR | DOC_MODE_MDWREN | DOC_MODE_NORMAL,133133 window, DOCControl);134134- WriteDOC(DOC_MODE_CLR_ERR | DOC_MODE_MDWREN | DOC_MODE_NORMAL, 134134+ WriteDOC(DOC_MODE_CLR_ERR | DOC_MODE_MDWREN | DOC_MODE_NORMAL,135135 window, DOCControl);136136-#endif /* !DOC_PASSIVE_PROBE */ 136136+#endif /* !DOC_PASSIVE_PROBE */137137138138 /* We need to read the ChipID register four times. For some139139 newer DiskOnChip 2000 units, the first three reads will140140 return the DiskOnChip Millennium ident. Don't ask. */141141 ChipID = ReadDOC(window, ChipID);142142-142142+143143 switch (ChipID) {144144 case DOC_ChipID_Doc2k:145145 /* Check the TOGGLE bit in the ECC register */···149149 if (tmp != tmpb && tmp == tmpc)150150 return ChipID;151151 break;152152-152152+153153 case DOC_ChipID_DocMil:154154 /* Check for the new 2000 with Millennium ASIC */155155 ReadDOC(window, ChipID);···164164 if (tmp != tmpb && tmp == tmpc)165165 return ChipID;166166 break;167167-167167+168168 case DOC_ChipID_DocMilPlus16:169169 case DOC_ChipID_DocMilPlus32:170170 case 0:···179179 DOC_MODE_BDECT;180180 WriteDOC(tmp, window, Mplus_DOCControl);181181 WriteDOC(~tmp, window, Mplus_CtrlConfirm);182182-182182+183183 mdelay(1);184184 /* Enable the DiskOnChip ASIC */185185 tmp = DOC_MODE_NORMAL | DOC_MODE_MDWREN | DOC_MODE_RST_LAT |···187187 WriteDOC(tmp, window, Mplus_DOCControl);188188 WriteDOC(~tmp, window, Mplus_CtrlConfirm);189189 mdelay(1);190190-#endif /* !DOC_PASSIVE_PROBE */ 190190+#endif /* !DOC_PASSIVE_PROBE */191191192192 ChipID = ReadDOC(window, ChipID);193193···227227 WriteDOC(tmp2, window, DOCControl);228228#endif229229 return 0;230230-} 230230+}231231232232static int docfound;233233···244244 void (*initroutine)(struct mtd_info *) = NULL;245245246246 docptr = ioremap(physadr, DOC_IOREMAP_LEN);247247-247247+248248 if (!docptr)249249 return;250250-250250+251251 if ((ChipID = doccheck(docptr, physadr))) {252252 if (ChipID == DOC_ChipID_Doc2kTSOP) {253253 /* Remove this at your own peril. The hardware driver works but nothing prevents you from erasing bad blocks */···263263 iounmap(docptr);264264 return;265265 }266266-266266+267267 this = (struct DiskOnChip *)(&mtd[1]);268268-268268+269269 memset((char *)mtd,0, sizeof(struct mtd_info));270270 memset((char *)this, 0, sizeof(struct DiskOnChip));271271···281281 im_funcname = "DoC2k_init";282282 im_modname = "doc2000";283283 break;284284-284284+285285 case DOC_ChipID_Doc2k:286286 name="2000";287287 im_funcname = "DoC2k_init";288288 im_modname = "doc2000";289289 break;290290-290290+291291 case DOC_ChipID_DocMil:292292 name="Millennium";293293#ifdef DOC_SINGLE_DRIVER···331331static int __init init_doc(void)332332{333333 int i;334334-334334+335335 if (doc_config_location) {336336 printk(KERN_INFO "Using configured DiskOnChip probe address 0x%lx\n", doc_config_location);337337 DoC_Probe(doc_config_location);
+4-4
drivers/mtd/devices/lart.c
···22/*33 * MTD driver for the 28F160F3 Flash Memory (non-CFI) on LART.44 *55- * $Id: lart.c,v 1.7 2004/08/09 13:19:44 dwmw2 Exp $55+ * $Id: lart.c,v 1.9 2005/11/07 11:14:25 gleixner Exp $66 *77 * Author: Abraham vd Merwe <abraham@2d3d.co.za>88 *···122122123123/*124124 * The data line mapping on LART is as follows:125125- * 125125+ *126126 * U2 CPU | U3 CPU127127 * -------------------128128 * 0 20 | 0 12···181181 (((x) & 0x00004000) >> 13) \182182 )183183184184-/* 184184+/*185185 * The address line mapping on LART is as follows:186186 *187187 * U3 CPU | U2 CPU···204204 * 12 15 | 12 15205205 * 13 14 | 13 14206206 * 14 16 | 14 16207207- * 207207+ *208208 * MAIN BLOCK BOUNDARY209209 *210210 * 15 17 | 15 18
+7-7
drivers/mtd/devices/phram.c
···11/**22- * $Id: phram.c,v 1.14 2005/03/07 21:43:38 joern Exp $22+ * $Id: phram.c,v 1.16 2005/11/07 11:14:25 gleixner Exp $33 *44 * Copyright (c) ???? Jochen Sch�uble <psionic@psionic.de>55 * Copyright (c) 2003-2004 J�rn Engel <joern@wh.fh-wedel.de>···41414242 if (instr->addr + instr->len > mtd->size)4343 return -EINVAL;4444-4444+4545 memset(start + instr->addr, 0xff, instr->len);46464747- /* This'll catch a few races. Free the thing before returning :) 4747+ /* This'll catch a few races. Free the thing before returning :)4848 * I don't feel at all ashamed. This kind of thing is possible anyway4949 * with flash, but unlikely.5050 */···63636464 if (from + len > mtd->size)6565 return -EINVAL;6666-6666+6767 *mtdbuf = start + from;6868 *retlen = len;6969 return 0;···84848585 if (len > mtd->size - from)8686 len = mtd->size - from;8787-8787+8888 memcpy(buf, start + from, len);89899090 *retlen = len;···101101102102 if (len > mtd->size - to)103103 len = mtd->size - to;104104-104104+105105 memcpy(start + to, buf, len);106106107107 *retlen = len;···159159 }160160161161 list_add_tail(&new->list, &phram_list);162162- return 0; 162162+ return 0;163163164164out2:165165 iounmap(new->mtd.priv);
+12-12
drivers/mtd/devices/pmc551.c
···11/*22- * $Id: pmc551.c,v 1.30 2005/01/05 18:05:13 dwmw2 Exp $22+ * $Id: pmc551.c,v 1.32 2005/11/07 11:14:25 gleixner Exp $33 *44 * PMC551 PCI Mezzanine Ram Device55 *···2727 * it as high speed swap or for a high speed disk device of some2828 * sort. Which becomes very useful on diskless systems in the2929 * embedded market I might add.3030- * 3030+ *3131 * Notes:3232 * Due to what I assume is more buggy SROM, the 64M PMC551 I3333 * have available claims that all 4 of it's DRAM banks have 64M···6363 * Minyard set up the card to utilize a 1M sliding apature.6464 *6565 * Corey Minyard <minyard@nortelnetworks.com>6666- * * Modified driver to utilize a sliding aperture instead of 6666+ * * Modified driver to utilize a sliding aperture instead of6767 * mapping all memory into kernel space which turned out to6868 * be very wasteful.6969- * * Located a bug in the SROM's initialization sequence that 6969+ * * Located a bug in the SROM's initialization sequence that7070 * made the memory unusable, added a fix to code to touch up7171 * the DRAM some.7272 *···390390 bcmd |= (0x40|0x20);391391 pci_write_config_byte(dev, PMC551_SYS_CTRL_REG, bcmd);392392393393- /* 393393+ /*394394 * Take care and turn off the memory on the device while we395395 * tweak the configurations396396 */···408408 * Grab old BAR0 config so that we can figure out memory size409409 * This is another bit of kludge going on. The reason for the410410 * redundancy is I am hoping to retain the original configuration411411- * previously assigned to the card by the BIOS or some previous 411411+ * previously assigned to the card by the BIOS or some previous412412 * fixup routine in the kernel. So we read the old config into cfg,413413 * then write all 1's to the memory space, read back the result into414414 * "size", and then write back all the old config.···480480 } while ( (PCI_COMMAND_IO) & cmd );481481482482 /*483483- * Turn on auto refresh 483483+ * Turn on auto refresh484484 * The loop is taken directly from Ramix's example code. I assume that485485 * this must be held high for some duration of time, but I can find no486486 * documentation refrencing the reasons why.···615615 pci_read_config_byte(dev, PMC551_SYS_CTRL_REG, &bcmd );616616 printk( KERN_DEBUG "pmc551: EEPROM is under %s control\n"617617 "pmc551: System Control Register is %slocked to PCI access\n"618618- "pmc551: System Control Register is %slocked to EEPROM access\n", 618618+ "pmc551: System Control Register is %slocked to EEPROM access\n",619619 (bcmd&0x1)?"software":"hardware",620620 (bcmd&0x20)?"":"un", (bcmd&0x40)?"":"un");621621#endif···744744 priv->start = ioremap(((PCI_Device->resource[0].start)745745 & PCI_BASE_ADDRESS_MEM_MASK),746746 priv->asize);747747-747747+748748 if (!priv->start) {749749 printk(KERN_NOTICE "pmc551: Unable to map IO space\n");750750 kfree(mtd->priv);···765765 priv->curr_map0 );766766767767#ifdef CONFIG_MTD_PMC551_DEBUG768768- printk( KERN_DEBUG "pmc551: aperture set to %d\n", 768768+ printk( KERN_DEBUG "pmc551: aperture set to %d\n",769769 (priv->base_map0 & 0xF0)>>4 );770770#endif771771···823823 while((mtd=pmc551list)) {824824 priv = mtd->priv;825825 pmc551list = priv->nextpmc551;826826-826826+827827 if(priv->start) {828828 printk (KERN_DEBUG "pmc551: unmapping %dM starting at 0x%p\n",829829 priv->asize>>20, priv->start);830830 iounmap (priv->start);831831 }832832-832832+833833 kfree (mtd->priv);834834 del_mtd_device (mtd);835835 kfree (mtd);
+15-15
drivers/mtd/devices/slram.c
···11/*======================================================================2233- $Id: slram.c,v 1.34 2005/01/06 21:16:42 jwboyer Exp $33+ $Id: slram.c,v 1.36 2005/11/07 11:14:25 gleixner Exp $4455 This driver provides a method to access memory not used by the kernel66 itself (i.e. if the kernel commandline mem=xxx is used). To actually···1818 <start>: start of the memory region, decimal or hex (0xabcdef)1919 <end/offset>: end of the memory region. It's possible to use +0x12342020 to specify the offset instead of the absolute address2121-2121+2222 NOTE:2323 With slram it's only possible to map a contigous memory region. Therfore2424 if there's a device mapped somewhere in the region specified slram will2525 fail to load (see kernel log if modprobe fails).26262727 -2828-2828+2929 Jochen Schaeuble <psionic@psionic.de>30303131======================================================================*/···8989 if (instr->addr + instr->len > mtd->size) {9090 return(-EINVAL);9191 }9292-9292+9393 memset(priv->start + instr->addr, 0xff, instr->len);94949595- /* This'll catch a few races. Free the thing before returning :) 9595+ /* This'll catch a few races. Free the thing before returning :)9696 * I don't feel at all ashamed. This kind of thing is possible anyway9797 * with flash, but unlikely.9898 */···170170 }171171 (*curmtd)->mtdinfo = kmalloc(sizeof(struct mtd_info), GFP_KERNEL);172172 (*curmtd)->next = NULL;173173-173173+174174 if ((*curmtd)->mtdinfo) {175175 memset((char *)(*curmtd)->mtdinfo, 0, sizeof(struct mtd_info));176176 (*curmtd)->mtdinfo->priv =177177 kmalloc(sizeof(slram_priv_t), GFP_KERNEL);178178-178178+179179 if (!(*curmtd)->mtdinfo->priv) {180180 kfree((*curmtd)->mtdinfo);181181 (*curmtd)->mtdinfo = NULL;···188188 E("slram: Cannot allocate new MTD device.\n");189189 return(-ENOMEM);190190 }191191-191191+192192 if (!(((slram_priv_t *)(*curmtd)->mtdinfo->priv)->start =193193 ioremap(start, length))) {194194 E("slram: ioremap failed\n");···223223 T("slram: Mapped from 0x%p to 0x%p\n",224224 ((slram_priv_t *)(*curmtd)->mtdinfo->priv)->start,225225 ((slram_priv_t *)(*curmtd)->mtdinfo->priv)->end);226226- return(0); 226226+ return(0);227227}228228229229static void unregister_devices(void)···256256 char *buffer;257257 unsigned long devstart;258258 unsigned long devlength;259259-259259+260260 if ((!devname) || (!szstart) || (!szlength)) {261261 unregister_devices();262262 return(-EINVAL);···264264265265 devstart = simple_strtoul(szstart, &buffer, 0);266266 devstart = handle_unit(devstart, buffer);267267-267267+268268 if (*(szlength) != '+') {269269 devlength = simple_strtoul(szlength, &buffer, 0);270270 devlength = handle_unit(devlength, buffer) - devstart;···278278 E("slram: Illegal start / length parameter.\n");279279 return(-EINVAL);280280 }281281-281281+282282 if ((devstart = register_device(devname, devstart, devlength))){283283 unregister_devices();284284 return((int)devstart);···335335 }336336#else337337 int count;338338-338338+339339 for (count = 0; (map[count]) && (count < SLRAM_MAX_DEVICES_PARAMS);340340 count++) {341341 }···350350 if (parse_cmdline(devname, map[i * 3 + 1], map[i * 3 + 2])!=0) {351351 return(-EINVAL);352352 }353353-353353+354354 }355355#endif /* !MODULE */356356-356356+357357 return(0);358358}359359