Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 360339
b: refs/heads/master
c: b23b746
h: refs/heads/master
i:
  360337: 3742c70
  360335: c543b2c
v: v3
  • Loading branch information
Zach Sadecki authored and Artem Bityutskiy committed Feb 4, 2013
1 parent a342529 commit 4839141
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e830342ef389b46160f223e6882b1e85bd7de708
refs/heads/master: b23b746cdcb0792b1268bc338acf29ec27739527
27 changes: 8 additions & 19 deletions trunk/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
Original file line number Diff line number Diff line change
Expand Up @@ -920,8 +920,7 @@ static int gpmi_ecc_read_page(struct mtd_info *mtd, struct nand_chip *chip,
dma_addr_t auxiliary_phys;
unsigned int i;
unsigned char *status;
unsigned int failed;
unsigned int corrected;
unsigned int max_bitflips = 0;
int ret;

pr_debug("page number is : %d\n", page);
Expand All @@ -945,35 +944,25 @@ static int gpmi_ecc_read_page(struct mtd_info *mtd, struct nand_chip *chip,
payload_virt, payload_phys);
if (ret) {
pr_err("Error in ECC-based read: %d\n", ret);
goto exit_nfc;
return ret;
}

/* handle the block mark swapping */
block_mark_swapping(this, payload_virt, auxiliary_virt);

/* Loop over status bytes, accumulating ECC status. */
failed = 0;
corrected = 0;
status = auxiliary_virt + nfc_geo->auxiliary_status_offset;
status = auxiliary_virt + nfc_geo->auxiliary_status_offset;

for (i = 0; i < nfc_geo->ecc_chunk_count; i++, status++) {
if ((*status == STATUS_GOOD) || (*status == STATUS_ERASED))
continue;

if (*status == STATUS_UNCORRECTABLE) {
failed++;
mtd->ecc_stats.failed++;
continue;
}
corrected += *status;
}

/*
* Propagate ECC status to the owning MTD only when failed or
* corrected times nearly reaches our ECC correction threshold.
*/
if (failed || corrected >= (nfc_geo->ecc_strength - 1)) {
mtd->ecc_stats.failed += failed;
mtd->ecc_stats.corrected += corrected;
mtd->ecc_stats.corrected += *status;
max_bitflips = max_t(unsigned int, max_bitflips, *status);
}

if (oob_required) {
Expand All @@ -995,8 +984,8 @@ static int gpmi_ecc_read_page(struct mtd_info *mtd, struct nand_chip *chip,
this->payload_virt, this->payload_phys,
nfc_geo->payload_size,
payload_virt, payload_phys);
exit_nfc:
return ret;

return max_bitflips;
}

static int gpmi_ecc_write_page(struct mtd_info *mtd, struct nand_chip *chip,
Expand Down

0 comments on commit 4839141

Please sign in to comment.