aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/devices/doc2000.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2005-11-07 13:24:08 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-07 13:24:08 -0500
commitb3ce1debe2685383a9ad6ace9c49869c3968c013 (patch)
treedcb606fac467d6ce78a9c608a1e0d2323af44f2b /drivers/mtd/devices/doc2000.c
parent5b2f7ffcb734d3046144dfbd5ac6d76254a9e522 (diff)
parentc2965f1129ee54afcc4ef293ff0f25fa3a7e7392 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/tglx/mtd-2.6
Some manual fixups for clashing kfree() cleanups etc.
Diffstat (limited to 'drivers/mtd/devices/doc2000.c')
-rw-r--r--drivers/mtd/devices/doc2000.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/drivers/mtd/devices/doc2000.c b/drivers/mtd/devices/doc2000.c
index 5fc532895a2..be5e88b3888 100644
--- a/drivers/mtd/devices/doc2000.c
+++ b/drivers/mtd/devices/doc2000.c
@@ -4,7 +4,7 @@
4 * (c) 1999 Machine Vision Holdings, Inc. 4 * (c) 1999 Machine Vision Holdings, Inc.
5 * (c) 1999, 2000 David Woodhouse <dwmw2@infradead.org> 5 * (c) 1999, 2000 David Woodhouse <dwmw2@infradead.org>
6 * 6 *
7 * $Id: doc2000.c,v 1.66 2005/01/05 18:05:12 dwmw2 Exp $ 7 * $Id: doc2000.c,v 1.67 2005/11/07 11:14:24 gleixner Exp $
8 */ 8 */
9 9
10#include <linux/kernel.h> 10#include <linux/kernel.h>
@@ -58,7 +58,7 @@ static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len,
58 size_t *retlen, u_char *buf, u_char *eccbuf, struct nand_oobinfo *oobsel); 58 size_t *retlen, u_char *buf, u_char *eccbuf, struct nand_oobinfo *oobsel);
59static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, 59static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len,
60 size_t *retlen, const u_char *buf, u_char *eccbuf, struct nand_oobinfo *oobsel); 60 size_t *retlen, const u_char *buf, u_char *eccbuf, struct nand_oobinfo *oobsel);
61static int doc_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs, 61static int doc_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs,
62 unsigned long count, loff_t to, size_t *retlen, 62 unsigned long count, loff_t to, size_t *retlen,
63 u_char *eccbuf, struct nand_oobinfo *oobsel); 63 u_char *eccbuf, struct nand_oobinfo *oobsel);
64static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, size_t len, 64static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, size_t len,
@@ -76,14 +76,14 @@ static void DoC_Delay(struct DiskOnChip *doc, unsigned short cycles)
76{ 76{
77 volatile char dummy; 77 volatile char dummy;
78 int i; 78 int i;
79 79
80 for (i = 0; i < cycles; i++) { 80 for (i = 0; i < cycles; i++) {
81 if (DoC_is_Millennium(doc)) 81 if (DoC_is_Millennium(doc))
82 dummy = ReadDOC(doc->virtadr, NOP); 82 dummy = ReadDOC(doc->virtadr, NOP);
83 else 83 else
84 dummy = ReadDOC(doc->virtadr, DOCStatus); 84 dummy = ReadDOC(doc->virtadr, DOCStatus);
85 } 85 }
86 86
87} 87}
88 88
89/* DOC_WaitReady: Wait for RDY line to be asserted by the flash chip */ 89/* DOC_WaitReady: Wait for RDY line to be asserted by the flash chip */
@@ -220,8 +220,8 @@ static int DoC_Address(struct DiskOnChip *doc, int numbytes, unsigned long ofs,
220 WriteDOC(ofs & 0xff, docptr, WritePipeTerm); 220 WriteDOC(ofs & 0xff, docptr, WritePipeTerm);
221 221
222 DoC_Delay(doc, 2); /* Needed for some slow flash chips. mf. */ 222 DoC_Delay(doc, 2); /* Needed for some slow flash chips. mf. */
223 223
224 /* FIXME: The SlowIO's for millennium could be replaced by 224 /* FIXME: The SlowIO's for millennium could be replaced by
225 a single WritePipeTerm here. mf. */ 225 a single WritePipeTerm here. mf. */
226 226
227 /* Lower the ALE line */ 227 /* Lower the ALE line */
@@ -377,9 +377,9 @@ static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip)
377 if (mfr == 0xff || mfr == 0) 377 if (mfr == 0xff || mfr == 0)
378 return 0; 378 return 0;
379 379
380 /* Check it's the same as the first chip we identified. 380 /* Check it's the same as the first chip we identified.
381 * M-Systems say that any given DiskOnChip device should only 381 * M-Systems say that any given DiskOnChip device should only
382 * contain _one_ type of flash part, although that's not a 382 * contain _one_ type of flash part, although that's not a
383 * hardware restriction. */ 383 * hardware restriction. */
384 if (doc->mfr) { 384 if (doc->mfr) {
385 if (doc->mfr == mfr && doc->id == id) 385 if (doc->mfr == mfr && doc->id == id)
@@ -397,7 +397,7 @@ static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip)
397 for (j = 0; nand_manuf_ids[j].id != 0x0; j++) { 397 for (j = 0; nand_manuf_ids[j].id != 0x0; j++) {
398 if (nand_manuf_ids[j].id == mfr) 398 if (nand_manuf_ids[j].id == mfr)
399 break; 399 break;
400 } 400 }
401 printk(KERN_INFO 401 printk(KERN_INFO
402 "Flash chip found: Manufacturer ID: %2.2X, " 402 "Flash chip found: Manufacturer ID: %2.2X, "
403 "Chip ID: %2.2X (%s:%s)\n", mfr, id, 403 "Chip ID: %2.2X (%s:%s)\n", mfr, id,
@@ -405,7 +405,7 @@ static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip)
405 if (!doc->mfr) { 405 if (!doc->mfr) {
406 doc->mfr = mfr; 406 doc->mfr = mfr;
407 doc->id = id; 407 doc->id = id;
408 doc->chipshift = 408 doc->chipshift =
409 ffs((nand_flash_ids[i].chipsize << 20)) - 1; 409 ffs((nand_flash_ids[i].chipsize << 20)) - 1;
410 doc->page256 = (nand_flash_ids[i].pagesize == 256) ? 1 : 0; 410 doc->page256 = (nand_flash_ids[i].pagesize == 256) ? 1 : 0;
411 doc->pageadrlen = doc->chipshift > 25 ? 3 : 2; 411 doc->pageadrlen = doc->chipshift > 25 ? 3 : 2;
@@ -467,7 +467,7 @@ static void DoC_ScanChips(struct DiskOnChip *this, int maxchips)
467 467
468 ret = 0; 468 ret = 0;
469 469
470 /* Fill out the chip array with {floor, chipno} for each 470 /* Fill out the chip array with {floor, chipno} for each
471 * detected chip in the device. */ 471 * detected chip in the device. */
472 for (floor = 0; floor < MAX_FLOORS; floor++) { 472 for (floor = 0; floor < MAX_FLOORS; floor++) {
473 for (chip = 0; chip < numchips[floor]; chip++) { 473 for (chip = 0; chip < numchips[floor]; chip++) {
@@ -757,12 +757,12 @@ static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len,
757 (long)from, eccbuf[0], eccbuf[1], eccbuf[2], 757 (long)from, eccbuf[0], eccbuf[1], eccbuf[2],
758 eccbuf[3], eccbuf[4], eccbuf[5]); 758 eccbuf[3], eccbuf[4], eccbuf[5]);
759#endif 759#endif
760 760
761 /* disable the ECC engine */ 761 /* disable the ECC engine */
762 WriteDOC(DOC_ECC_DIS, docptr , ECCConf); 762 WriteDOC(DOC_ECC_DIS, docptr , ECCConf);
763 } 763 }
764 764
765 /* according to 11.4.1, we need to wait for the busy line 765 /* according to 11.4.1, we need to wait for the busy line
766 * drop if we read to the end of the page. */ 766 * drop if we read to the end of the page. */
767 if(0 == ((from + len) & 0x1ff)) 767 if(0 == ((from + len) & 0x1ff))
768 { 768 {
@@ -941,7 +941,7 @@ static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len,
941 941
942 /* Let the caller know we completed it */ 942 /* Let the caller know we completed it */
943 *retlen += len; 943 *retlen += len;
944 944
945 if (eccbuf) { 945 if (eccbuf) {
946 unsigned char x[8]; 946 unsigned char x[8];
947 size_t dummy; 947 size_t dummy;
@@ -950,10 +950,10 @@ static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len,
950 /* Write the ECC data to flash */ 950 /* Write the ECC data to flash */
951 for (di=0; di<6; di++) 951 for (di=0; di<6; di++)
952 x[di] = eccbuf[di]; 952 x[di] = eccbuf[di];
953 953
954 x[6]=0x55; 954 x[6]=0x55;
955 x[7]=0x55; 955 x[7]=0x55;
956 956
957 ret = doc_write_oob_nolock(mtd, to, 8, &dummy, x); 957 ret = doc_write_oob_nolock(mtd, to, 8, &dummy, x);
958 if (ret) { 958 if (ret) {
959 up(&this->lock); 959 up(&this->lock);
@@ -970,7 +970,7 @@ static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len,
970 return 0; 970 return 0;
971} 971}
972 972
973static int doc_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs, 973static int doc_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs,
974 unsigned long count, loff_t to, size_t *retlen, 974 unsigned long count, loff_t to, size_t *retlen,
975 u_char *eccbuf, struct nand_oobinfo *oobsel) 975 u_char *eccbuf, struct nand_oobinfo *oobsel)
976{ 976{
@@ -1022,7 +1022,7 @@ static int doc_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs,
1022 break; 1022 break;
1023 1023
1024 to += thislen; 1024 to += thislen;
1025 } 1025 }
1026 1026
1027 up(&writev_buf_sem); 1027 up(&writev_buf_sem);
1028 *retlen = totretlen; 1028 *retlen = totretlen;
@@ -1080,7 +1080,7 @@ static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, size_t len,
1080 /* Reading the full OOB data drops us off of the end of the page, 1080 /* Reading the full OOB data drops us off of the end of the page,
1081 * causing the flash device to go into busy mode, so we need 1081 * causing the flash device to go into busy mode, so we need
1082 * to wait until ready 11.4.1 and Toshiba TC58256FT docs */ 1082 * to wait until ready 11.4.1 and Toshiba TC58256FT docs */
1083 1083
1084 ret = DoC_WaitReady(this); 1084 ret = DoC_WaitReady(this);
1085 1085
1086 up(&this->lock); 1086 up(&this->lock);
@@ -1190,7 +1190,7 @@ static int doc_write_oob_nolock(struct mtd_info *mtd, loff_t ofs, size_t len,
1190 return 0; 1190 return 0;
1191 1191
1192} 1192}
1193 1193
1194static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, size_t len, 1194static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, size_t len,
1195 size_t * retlen, const u_char * buf) 1195 size_t * retlen, const u_char * buf)
1196{ 1196{
@@ -1222,7 +1222,7 @@ static int doc_erase(struct mtd_info *mtd, struct erase_info *instr)
1222 } 1222 }
1223 1223
1224 instr->state = MTD_ERASING; 1224 instr->state = MTD_ERASING;
1225 1225
1226 /* FIXME: Do this in the background. Use timers or schedule_task() */ 1226 /* FIXME: Do this in the background. Use timers or schedule_task() */
1227 while(len) { 1227 while(len) {
1228 mychip = &this->chips[ofs >> this->chipshift]; 1228 mychip = &this->chips[ofs >> this->chipshift];