mtd/drivers/mtd/nand Kconfig, 1.21, 1.22 diskonchip.c, 1.37,
1.38 rtc_from4.c, 1.5, 1.6
gleixner at infradead.org
gleixner at infradead.org
Tue Oct 5 18:11:49 EDT 2004
Update of /home/cvs/mtd/drivers/mtd/nand
In directory phoenix.infradead.org:/tmp/cvs-serv24281
Modified Files:
Kconfig diskonchip.c rtc_from4.c
Log Message:
Make it work with the modified rs lib code
Index: Kconfig
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/Kconfig,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- Kconfig 28 Sep 2004 22:07:39 -0000 1.21
+++ Kconfig 5 Oct 2004 22:11:46 -0000 1.22
@@ -83,6 +83,8 @@
config MTD_NAND_RTC_FROM4
tristate "Renesas Flash ROM 4-slot interface board (FROM_BOARD4)"
depends on MTD_NAND && SH_SOLUTION_ENGINE
+ select REED_SOLOMON
+ select REED_SOLOMON_DEC8
help
This enables the driver for the Renesas Technology AG-AND
flash interface board (FROM_BOARD4)
@@ -125,6 +127,7 @@
tristate "DiskOnChip 2000, Millennium and Millennium Plus (NAND reimplementation) (EXPERIMENTAL)"
depends on MTD_NAND && EXPERIMENTAL
select REED_SOLOMON
+ select REED_SOLOMON_DEC16
help
This is a reimplementation of M-Systems DiskOnChip 2000,
Millennium and Millennium Plus as a standard NAND device driver,
Index: diskonchip.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/diskonchip.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- diskonchip.c 5 Oct 2004 13:50:19 -0000 1.37
+++ diskonchip.c 5 Oct 2004 22:11:46 -0000 1.38
@@ -131,6 +131,13 @@
#define SECTOR_SIZE 512
/* The sector bytes are packed into NB_DATA 10 bit words */
#define NB_DATA (((SECTOR_SIZE + 1) * 8 + 6) / 10)
+/* Number of roots */
+#define NROOTS 4
+/* First consective root */
+#define FCR 510
+/* Number of symbols */
+#define NN 1023
+
/* the Reed Solomon control structure */
static struct rs_control *rs_decoder;
@@ -167,18 +174,18 @@
for(j = 1; j < NROOTS; j++) {
if(ds[j] == 0)
continue;
- tmp = INDEX_OF[ds[j]];
+ tmp = rs->index_of[ds[j]];
for(i = 0; i < NROOTS; i++)
- s[i] ^= ALPHA_TO[MODNN(tmp + (FCR + i) * j)];
+ s[i] ^= rs->alpha_to[rs_modnn(rs, tmp + (FCR + i) * j)];
}
/* Calc s[i] = s[i] / alpha^(v + i) */
for (i = 0; i < NROOTS; i++) {
if (syn[i])
- syn[i] = MODNN(INDEX_OF[s[i]] + (NN - FCR - i));
+ syn[i] = rs_modnn(rs, rs->index_of[s[i]] + (NN - FCR - i));
}
/* Call the decoder library */
- nerr = decode_rs16 (rs, NULL, NULL, 1019, syn, 0, errpos, 0, errval);
+ nerr = decode_rs16(rs, NULL, NULL, 1019, syn, 0, errpos, 0, errval);
/* Incorrectable errors ? */
if (nerr < 0)
@@ -1741,7 +1748,7 @@
* primitve element to generate roots = 1
* generator polinomial degree = 4
*/
- rs_decoder = init_rs (10, 0x409, 510, 1, 4);
+ rs_decoder = init_rs(10, 0x409, FCR, 1, NROOTS);
if (!rs_decoder) {
printk (KERN_ERR "DiskOnChip: Could not create a RS decoder\n");
release_nanddoc();
Index: rtc_from4.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/rtc_from4.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- rtc_from4.c 1 Oct 2004 21:45:30 -0000 1.5
+++ rtc_from4.c 5 Oct 2004 22:11:46 -0000 1.6
@@ -358,9 +358,6 @@
ecc_code[7] |= 0x0f; /* set the last four bits (not used) */
}
-/* Make the rslib macros work */
-#define rs rs_decoder
-
/*
* rtc_from4_correct_data - hardware specific code to correct data using ECC code
* @mtd: MTD device structure
@@ -397,26 +394,31 @@
}
/* convert into 6 10bit syndrome fields */
- par[5] = INDEX_OF[(((uint16_t)ecc[0] >> 0) & 0x0ff) | (((uint16_t)ecc[1] << 8) & 0x300)];
- par[4] = INDEX_OF[(((uint16_t)ecc[1] >> 2) & 0x03f) | (((uint16_t)ecc[2] << 6) & 0x3c0)];
- par[3] = INDEX_OF[(((uint16_t)ecc[2] >> 4) & 0x00f) | (((uint16_t)ecc[3] << 4) & 0x3f0)];
- par[2] = INDEX_OF[(((uint16_t)ecc[3] >> 6) & 0x003) | (((uint16_t)ecc[4] << 2) & 0x3fc)];
- par[1] = INDEX_OF[(((uint16_t)ecc[5] >> 0) & 0x0ff) | (((uint16_t)ecc[6] << 8) & 0x300)];
+ par[5] = rs_decoder->index_of[(((uint16_t)ecc[0] >> 0) & 0x0ff) |
+ (((uint16_t)ecc[1] << 8) & 0x300)];
+ par[4] = rs_decoder->index_of[(((uint16_t)ecc[1] >> 2) & 0x03f) |
+ (((uint16_t)ecc[2] << 6) & 0x3c0)];
+ par[3] = rs_decoder->index_of[(((uint16_t)ecc[2] >> 4) & 0x00f) |
+ (((uint16_t)ecc[3] << 4) & 0x3f0)];
+ par[2] = rs_decoder->index_of[(((uint16_t)ecc[3] >> 6) & 0x003) |
+ (((uint16_t)ecc[4] << 2) & 0x3fc)];
+ par[1] = rs_decoder->index_of[(((uint16_t)ecc[5] >> 0) & 0x0ff) |
+ (((uint16_t)ecc[6] << 8) & 0x300)];
par[0] = (((uint16_t)ecc[6] >> 2) & 0x03f) | (((uint16_t)ecc[7] << 6) & 0x3c0);
/* Convert to computable syndrome */
for (i = 0; i < 6; i++) {
syn[i] = par[0];
for (j = 1; j < 6; j++)
- if (par[j] != A0)
- syn[i] ^= ALPHA_TO[MODNN(par[j] + i * j)];
+ if (par[j] != rs_decoder->nn)
+ syn[i] ^= rs_decoder->alpha_to[rs_modnn(rs_decoder, par[j] + i * j)];
/* Convert to index form */
- syn[i] = INDEX_OF[syn[i]];
+ syn[i] = rs_decoder->index_of[syn[i]];
}
/* Let the library code do its magic.*/
- res = decode_rs8 (rs_decoder, buf, par, 512, syn, 0, NULL, 0xff, NULL);
+ res = decode_rs8(rs_decoder, buf, par, 512, syn, 0, NULL, 0xff, NULL);
if (res > 0) {
DEBUG (MTD_DEBUG_LEVEL0, "rtc_from4_correct_data: "
"ECC corrected %d errors on read\n", res);
@@ -434,7 +436,7 @@
unsigned short bcr1, bcr2, wcr2;
/* Allocate memory for MTD device structure and private data */
- rtc_from4_mtd = kmalloc (sizeof(struct mtd_info) + sizeof (struct nand_chip),
+ rtc_from4_mtd = kmalloc(sizeof(struct mtd_info) + sizeof (struct nand_chip),
GFP_KERNEL);
if (!rtc_from4_mtd) {
printk ("Unable to allocate Renesas NAND MTD device structure.\n");
@@ -499,8 +501,8 @@
this->bbt_md = &rtc_from4_bbt_mirror_descr;
/* Scan to find existence of the device */
- if (nand_scan (rtc_from4_mtd, RTC_FROM4_MAX_CHIPS)) {
- kfree (rtc_from4_mtd);
+ if (nand_scan(rtc_from4_mtd, RTC_FROM4_MAX_CHIPS)) {
+ kfree(rtc_from4_mtd);
return -ENXIO;
}
@@ -517,11 +519,11 @@
* primitve element to generate roots = 1
* generator polinomial degree = 6
*/
- rs_decoder = init_rs (10, 0x409, 0, 1, 6);
+ rs_decoder = init_rs(10, 0x409, 0, 1, 6);
if (!rs_decoder) {
printk (KERN_ERR "Could not create a RS decoder\n");
nand_release(rtc_from4_mtd);
- kfree (rtc_from4_mtd);
+ kfree(rtc_from4_mtd);
return -ENOMEM;
}
#endif
More information about the linux-mtd-cvs
mailing list