summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Ziswiler <marcel.ziswiler@toradex.com>2015-04-28 02:05:32 +0200
committerMarcel Ziswiler <marcel.ziswiler@toradex.com>2015-04-28 02:05:32 +0200
commitdcca76ea36fc778fa750473aee09fa0297dc5e2b (patch)
tree59ddcf49cc4158b63e2f08404567566fbf63f2c4
parenta1bddaecd525096d51fba69331c924b2d314bf2f (diff)
tegra: nand: 16-bit bch ecc integration
Integrate 16-bit BCH ECC handling required e.g. for the latest NAND parts assembled on Colibri T20.
-rw-r--r--drivers/mtd/nand/tegra_nand.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/mtd/nand/tegra_nand.c b/drivers/mtd/nand/tegra_nand.c
index 9c906341914..b02d27abc35 100644
--- a/drivers/mtd/nand/tegra_nand.c
+++ b/drivers/mtd/nand/tegra_nand.c
@@ -567,17 +567,12 @@ static int nand_rw_page(struct mtd_info *mtd, struct nand_chip *chip,
if (with_ecc) {
tag_size = chip->ecc.layout->oobavail + TAG_ECC_BYTES;
reg_val |= (CFG_SKIP_SPARE_SEL_4
- | CFG_SKIP_SPARE_ENABLE
- | CFG_HW_ECC_CORRECTION_ENABLE
- | CFG_ECC_EN_TAG_DISABLE
- | CFG_HW_ECC_SEL_RS
- | CFG_HW_ECC_ENABLE
- | CFG_TVAL4
- | (tag_size - 1));
+ | CFG_SKIP_SPARE_ENABLE);
if (!is_writing)
tag_size += SKIPPED_SPARE_BYTES;
dma_prepare(tag_ptr, tag_size, is_writing);
+ writel(BCH_CONFIG_BCH_TVAL16 | BCH_CONFIG_BCH_ECC_ENABLE, &info->reg->bch_config);
} else {
tag_size = mtd->oobsize;
reg_val |= (CFG_SKIP_SPARE_DISABLE
@@ -586,13 +581,13 @@ static int nand_rw_page(struct mtd_info *mtd, struct nand_chip *chip,
| CFG_HW_ECC_DISABLE
| (tag_size - 1));
dma_prepare(chip->oob_poi, tag_size, is_writing);
+
+ writel(BCH_CONFIG_BCH_ECC_DISABLE, &info->reg->bch_config);
}
writel(reg_val, &info->reg->config);
dma_prepare(buf, 1 << chip->page_shift, is_writing);
- writel(BCH_CONFIG_BCH_ECC_DISABLE, &info->reg->bch_config);
-
writel(tag_size - 1, &info->reg->dma_cfg_b);
nand_clear_interrupt_status(info->reg);
@@ -601,7 +596,7 @@ static int nand_rw_page(struct mtd_info *mtd, struct nand_chip *chip,
| CMD_SEC_CMD
| (CMD_ALE_BYTES5 << CMD_ALE_BYTE_SIZE_SHIFT)
| CMD_A_VALID
- | CMD_B_VALID
+ | (with_ecc ? 0 : CMD_B_VALID)
| (CMD_TRANS_SIZE_PAGE << CMD_TRANS_SIZE_SHIFT)
| CMD_CE0;
if (!is_writing)
@@ -614,7 +609,7 @@ static int nand_rw_page(struct mtd_info *mtd, struct nand_chip *chip,
reg_val = DMA_MST_CTRL_GO_ENABLE
| DMA_MST_CTRL_BURST_8WORDS
| DMA_MST_CTRL_EN_A_ENABLE
- | DMA_MST_CTRL_EN_B_ENABLE;
+ | (with_ecc ? 0 : DMA_MST_CTRL_EN_B_ENABLE);
if (!is_writing)
reg_val |= DMA_MST_CTRL_DIR_READ;