aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/devices/docg3.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/devices/docg3.c')
-rw-r--r--drivers/mtd/devices/docg3.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c
index f7490a014e78..2a32072c7908 100644
--- a/drivers/mtd/devices/docg3.c
+++ b/drivers/mtd/devices/docg3.c
@@ -61,7 +61,7 @@
61 * 61 *
62 */ 62 */
63 63
64static unsigned int reliable_mode = 0; 64static unsigned int reliable_mode;
65module_param(reliable_mode, uint, 0); 65module_param(reliable_mode, uint, 0);
66MODULE_PARM_DESC(reliable_mode, "Set the docg3 mode (0=normal MLC, 1=fast, " 66MODULE_PARM_DESC(reliable_mode, "Set the docg3 mode (0=normal MLC, 1=fast, "
67 "2=reliable) : MLC normal operations are in normal mode"); 67 "2=reliable) : MLC normal operations are in normal mode");
@@ -546,7 +546,7 @@ out:
546 * @len: the number of bytes covered by the ECC (BCH covered) 546 * @len: the number of bytes covered by the ECC (BCH covered)
547 * 547 *
548 * The function does initialize the hardware ECC engine to compute the Hamming 548 * The function does initialize the hardware ECC engine to compute the Hamming
549 * ECC (on 1 byte) and the BCH Syndroms (on 7 bytes). 549 * ECC (on 1 byte) and the BCH hardware ECC (on 7 bytes).
550 * 550 *
551 * Return 0 if succeeded, -EIO on error 551 * Return 0 if succeeded, -EIO on error
552 */ 552 */
@@ -567,13 +567,13 @@ static int doc_read_page_ecc_init(struct docg3 *docg3, int len)
567 * @len: the number of bytes covered by the ECC (BCH covered) 567 * @len: the number of bytes covered by the ECC (BCH covered)
568 * 568 *
569 * The function does initialize the hardware ECC engine to compute the Hamming 569 * The function does initialize the hardware ECC engine to compute the Hamming
570 * ECC (on 1 byte) and the BCH Syndroms (on 7 bytes). 570 * ECC (on 1 byte) and the BCH hardware ECC (on 7 bytes).
571 * 571 *
572 * Return 0 if succeeded, -EIO on error 572 * Return 0 if succeeded, -EIO on error
573 */ 573 */
574static int doc_write_page_ecc_init(struct docg3 *docg3, int len) 574static int doc_write_page_ecc_init(struct docg3 *docg3, int len)
575{ 575{
576 doc_writew(docg3, !DOC_ECCCONF0_READ_MODE 576 doc_writew(docg3, DOC_ECCCONF0_WRITE_MODE
577 | DOC_ECCCONF0_BCH_ENABLE | DOC_ECCCONF0_HAMMING_ENABLE 577 | DOC_ECCCONF0_BCH_ENABLE | DOC_ECCCONF0_HAMMING_ENABLE
578 | (len & DOC_ECCCONF0_DATA_BYTES_MASK), 578 | (len & DOC_ECCCONF0_DATA_BYTES_MASK),
579 DOC_ECCCONF0); 579 DOC_ECCCONF0);
@@ -614,7 +614,7 @@ static void doc_hamming_ecc_init(struct docg3 *docg3, int nb_bytes)
614} 614}
615 615
616/** 616/**
617 * doc_correct_data - Fix if need be read data from flash 617 * doc_ecc_bch_fix_data - Fix if need be read data from flash
618 * @docg3: the device 618 * @docg3: the device
619 * @buf: the buffer of read data (512 + 7 + 1 bytes) 619 * @buf: the buffer of read data (512 + 7 + 1 bytes)
620 * @hwecc: the hardware calculated ECC. 620 * @hwecc: the hardware calculated ECC.
@@ -761,16 +761,16 @@ static void doc_write_page_putbytes(struct docg3 *docg3, int len,
761} 761}
762 762
763/** 763/**
764 * doc_get_hw_bch_syndroms - Get hardware calculated BCH syndroms 764 * doc_get_bch_hw_ecc - Get hardware calculated BCH ECC
765 * @docg3: the device 765 * @docg3: the device
766 * @syns: the array of 7 integers where the syndroms will be stored 766 * @hwecc: the array of 7 integers where the hardware ecc will be stored
767 */ 767 */
768static void doc_get_hw_bch_syndroms(struct docg3 *docg3, u8 *syns) 768static void doc_get_bch_hw_ecc(struct docg3 *docg3, u8 *hwecc)
769{ 769{
770 int i; 770 int i;
771 771
772 for (i = 0; i < DOC_ECC_BCH_SIZE; i++) 772 for (i = 0; i < DOC_ECC_BCH_SIZE; i++)
773 syns[i] = doc_register_readb(docg3, DOC_BCH_SYNDROM(i)); 773 hwecc[i] = doc_register_readb(docg3, DOC_BCH_HW_ECC(i));
774} 774}
775 775
776/** 776/**
@@ -904,7 +904,7 @@ static int doc_read_oob(struct mtd_info *mtd, loff_t from,
904 doc_read_page_getbytes(docg3, DOC_LAYOUT_OOB_SIZE - nboob, 904 doc_read_page_getbytes(docg3, DOC_LAYOUT_OOB_SIZE - nboob,
905 NULL, 0); 905 NULL, 0);
906 906
907 doc_get_hw_bch_syndroms(docg3, hwecc); 907 doc_get_bch_hw_ecc(docg3, hwecc);
908 eccconf1 = doc_register_readb(docg3, DOC_ECCCONF1); 908 eccconf1 = doc_register_readb(docg3, DOC_ECCCONF1);
909 909
910 if (nboob >= DOC_LAYOUT_OOB_SIZE) { 910 if (nboob >= DOC_LAYOUT_OOB_SIZE) {
@@ -1248,7 +1248,7 @@ static int doc_write_page(struct docg3 *docg3, loff_t to, const u_char *buf,
1248 const u_char *oob, int autoecc) 1248 const u_char *oob, int autoecc)
1249{ 1249{
1250 int block0, block1, page, ret, ofs = 0; 1250 int block0, block1, page, ret, ofs = 0;
1251 u8 syn[DOC_ECC_BCH_SIZE], hamming; 1251 u8 hwecc[DOC_ECC_BCH_SIZE], hamming;
1252 1252
1253 doc_dbg("doc_write_page(to=%lld)\n", to); 1253 doc_dbg("doc_write_page(to=%lld)\n", to);
1254 calc_block_sector(to, &block0, &block1, &page, &ofs, docg3->reliable); 1254 calc_block_sector(to, &block0, &block1, &page, &ofs, docg3->reliable);
@@ -1278,8 +1278,8 @@ static int doc_write_page(struct docg3 *docg3, loff_t to, const u_char *buf,
1278 &hamming); 1278 &hamming);
1279 doc_delay(docg3, 2); 1279 doc_delay(docg3, 2);
1280 1280
1281 doc_get_hw_bch_syndroms(docg3, syn); 1281 doc_get_bch_hw_ecc(docg3, hwecc);
1282 doc_write_page_putbytes(docg3, DOC_LAYOUT_OOB_BCH_SZ, syn); 1282 doc_write_page_putbytes(docg3, DOC_LAYOUT_OOB_BCH_SZ, hwecc);
1283 doc_delay(docg3, 2); 1283 doc_delay(docg3, 2);
1284 1284
1285 doc_write_page_putbytes(docg3, DOC_LAYOUT_OOB_UNUSED_SZ, oob); 1285 doc_write_page_putbytes(docg3, DOC_LAYOUT_OOB_UNUSED_SZ, oob);