* muti-page-rw.diff follow-up
@ 2000-07-26 0:14 Rogelio M. Serrano Jr.
2000-07-26 0:51 ` Ollie Lho
0 siblings, 1 reply; 4+ messages in thread
From: Rogelio M. Serrano Jr. @ 2000-07-26 0:14 UTC (permalink / raw)
To: mtd@infradead.org
[-- Attachment #1: Type: text/plain, Size: 345 bytes --]
I hope my modifications doesnt break nftl. I needed modifications to
make jffs work on the DOC. I am going to do the same to the DOCmil
driver when I have read through the docs. I have broken the ecc
functions in the doc2000 driver im afraid. I am fixing it now and I will
send patches when I am done. The diff is against mtd-snapshot-20000725.
[-- Attachment #2: multi-page-rw.diff --]
[-- Type: text/plain, Size: 4054 bytes --]
diff -r -u mtd/kernel/doc2000.c mtd-snapshot-20000725/kernel/doc2000.c
--- mtd/kernel/doc2000.c Wed Jul 26 06:00:03 2000
+++ mtd-snapshot-20000725/kernel/doc2000.c Wed Jul 26 07:27:47 2000
@@ -496,18 +496,37 @@
unsigned long docptr;
struct Nand *mychip;
+ loff_t subfrom;
+ size_t sublen;
+ u_char *pos;
+ int multipage = 0;
+ loff_t end = from + len;
+
docptr = this->virtadr;
+ *retlen = 0;
+ sublen = len;
+ subfrom = from;
+ pos = buf;
+
/* Don't allow read past end of device */
if (from >= this->totlen)
return -EINVAL;
-
- /* Don't allow a single read to cross a 512-byte block boundary */
- if (from + len > ( (from | 0x1ff) + 1))
- len = ((from | 0x1ff) + 1) - from;
+ if ((subfrom + sublen) > ((subfrom | 0x1ff) + 1)) {
+ multipage = 1;
+ sublen = ((subfrom | 0x1ff) + 1) - subfrom;
+ }
+do {
+ if ((subfrom + 512) > end) {
+ multipage = 0;
+ sublen = end - subfrom;
+ if (!sublen) break;
+ }
+
+
/* Find the chip which is to be used and select it */
- mychip = &this->chips[from >> (this->chipshift)];
+ mychip = &this->chips[subfrom >> (this->chipshift)];
if (this->curfloor != mychip->floor) {
DoC_SelectFloor(docptr, mychip->floor);
@@ -527,15 +546,15 @@
WriteDOC ( DOC_ECC_EN, docptr, ECCConf);
}
- DoC_Command(docptr, (from >> 8) & 1, CDSN_CTRL_WP);
- DoC_Address(docptr, 3, from, CDSN_CTRL_WP , CDSN_CTRL_ECC_IO);
+ DoC_Command(docptr, (subfrom >> 8) & 1, CDSN_CTRL_WP);
+ DoC_Address(docptr, 3, subfrom, CDSN_CTRL_WP , CDSN_CTRL_ECC_IO);
- for (di=0; di < len ; di++) {
- buf[di] = ReadDOC(docptr, 2k_CDSN_IO);
+ for (di=0; di < sublen ; di++) {
+ pos[di] = ReadDOC(docptr, 2k_CDSN_IO);
}
/* Let the caller know we completed it */
- *retlen = len;
+ *retlen += sublen;
if (eccbuf) {
/* Read the ECC data through the DiskOnChip ECC logic */
@@ -571,6 +590,14 @@
}
+ if (multipage){
+ subfrom += sublen;
+ pos += sublen;
+ sublen = 512;
+ }
+
+} while (multipage);
+
return 0;
}
@@ -587,24 +614,36 @@
unsigned long docptr;
struct Nand *mychip;
+ loff_t subto;
+ size_t sublen;
+ u_char *pos;
+ int multipage = 0;
+ loff_t end = to + len;
+
docptr = this->virtadr;
+ *retlen = 0;
+ sublen = len;
+ subto = to;
+ pos = buf;
+
/* Don't allow write past end of device */
if (to >= this->totlen)
return -EINVAL;
-#if 0
- /* Don't allow a single write to cross a 512-byte block boundary */
- if (to + len > ( (to | 0x1ff) + 1))
- len = ((to | 0x1ff) + 1) - to;
-
-#else
- /* Don't allow writes which aren't exactly one block */
- if (to & 0x1ff || len != 0x200)
- return -EINVAL;
-#endif
+ if ((subto + sublen) > ((subto | 0x1ff) + 1)) {
+ multipage = 1;
+ sublen = ((subto | 0x1ff) + 1) - subto;
+ }
+do {
+ if ((subto + 512) > end) {
+ multipage = 0;
+ sublen = end - subto;
+ if (!sublen) break;
+ }
+
/* Find the chip which is to be used and select it */
- mychip = &this->chips[to >> (this->chipshift)];
+ mychip = &this->chips[subto >> (this->chipshift)];
if (this->curfloor != mychip->floor) {
DoC_SelectFloor(docptr, mychip->floor);
@@ -628,10 +667,10 @@
}
DoC_Command(docptr, NAND_CMD_SEQIN, 0);
- DoC_Address(docptr, 3, to, 0, CDSN_CTRL_ECC_IO);
+ DoC_Address(docptr, 3, subto, 0, CDSN_CTRL_ECC_IO);
- for (di=0; di < len ; di++) {
- WriteDOC(buf[di], docptr, 2k_CDSN_IO);
+ for (di=0; di < sublen ; di++) {
+ WriteDOC(pos[di], docptr, 2k_CDSN_IO);
}
@@ -675,8 +714,14 @@
}
/* Let the caller know we completed it */
- *retlen = len;
+ *retlen += sublen;
+ if (multipage){
+ subto += sublen;
+ pos += sublen;
+ sublen = 512;
+ }
+} while (multipage);
return 0;
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: muti-page-rw.diff follow-up
2000-07-26 0:14 muti-page-rw.diff follow-up Rogelio M. Serrano Jr.
@ 2000-07-26 0:51 ` Ollie Lho
2000-07-26 8:22 ` David Woodhouse
0 siblings, 1 reply; 4+ messages in thread
From: Ollie Lho @ 2000-07-26 0:51 UTC (permalink / raw)
To: Rogelio M. Serrano Jr.; +Cc: mtd@infradead.org
"Rogelio M. Serrano Jr." wrote:
>
> I hope my modifications doesnt break nftl. I needed modifications to
> make jffs work on the DOC. I am going to do the same to the DOCmil
> driver when I have read through the docs. I have broken the ecc
> functions in the doc2000 driver im afraid. I am fixing it now and I will
> send patches when I am done. The diff is against mtd-snapshot-20000725.
>
I will try the DoC Mil part. Rogelio, please be careful that the ECC logic
and CDSNIO register should be programmed "as is" in the source I sent to you.
Or it will not work at all.
P.S. there seems to be some small bugs in the DoC Mil driver and I think
I have found the solution. I will send you a patch soon.
P.S. 2. David, did you commit the patch to CVS ??
Ollie
To unsubscribe, send "unsubscribe mtd" to majordomo@infradead.org
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: muti-page-rw.diff follow-up
2000-07-26 0:51 ` Ollie Lho
@ 2000-07-26 8:22 ` David Woodhouse
2000-07-26 9:52 ` Ollie Lho
0 siblings, 1 reply; 4+ messages in thread
From: David Woodhouse @ 2000-07-26 8:22 UTC (permalink / raw)
To: Ollie Lho; +Cc: Rogelio M. Serrano Jr., mtd@infradead.org
ollie@sis.com.tw said:
> P.S. there seems to be some small bugs in the DoC Mil driver and I
> think I have found the solution. I will send you a patch soon.
> P.S. 2. David, did you commit the patch to CVS ??
I didn't - sorry, I got back from OLS on Monday, spent most of Monday
sleeping and haven't caught up yet. Should I wait for your new patch.
Anyone else who sent me patches which I haven't yet applied - please could
you resend your latest version, made against the most recent snapshot?
Rogelio - could you test NFTL or find someone to do so and let me know when
it's safe to merge your new patch?
--
dwmw2
To unsubscribe, send "unsubscribe mtd" to majordomo@infradead.org
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: muti-page-rw.diff follow-up
2000-07-26 8:22 ` David Woodhouse
@ 2000-07-26 9:52 ` Ollie Lho
0 siblings, 0 replies; 4+ messages in thread
From: Ollie Lho @ 2000-07-26 9:52 UTC (permalink / raw)
To: David Woodhouse; +Cc: Rogelio M. Serrano Jr., mtd@infradead.org
[-- Attachment #1: Type: text/plain, Size: 617 bytes --]
David Woodhouse wrote:
>
> ollie@sis.com.tw said:
> > P.S. there seems to be some small bugs in the DoC Mil driver and I
> > think I have found the solution. I will send you a patch soon.
>
> > P.S. 2. David, did you commit the patch to CVS ??
>
> I didn't - sorry, I got back from OLS on Monday, spent most of Monday
> sleeping and haven't caught up yet. Should I wait for your new patch.
>
> Anyone else who sent me patches which I haven't yet applied - please could
> you resend your latest version, made against the most recent snapshot?
>
Attached. The ECC logic should be really correct this time.
Ollie
[-- Attachment #2: doc_mil.patch.gz --]
[-- Type: application/x-gzip, Size: 11295 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2000-07-26 9:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-07-26 0:14 muti-page-rw.diff follow-up Rogelio M. Serrano Jr.
2000-07-26 0:51 ` Ollie Lho
2000-07-26 8:22 ` David Woodhouse
2000-07-26 9:52 ` Ollie Lho
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox