diff options
author | Marcel Ziswiler <marcel.ziswiler@toradex.com> | 2018-09-06 14:47:20 +0200 |
---|---|---|
committer | Max Krummenacher <max.krummenacher@toradex.com> | 2018-09-20 17:20:20 +0200 |
commit | f1e533e5c889d76d9221422865af55a47f0440a1 (patch) | |
tree | 0e712516edccb1179bc6897f431f83f75599236b | |
parent | 08972759fde2309f36e3c12a482098c9222d12cc (diff) |
mtd: nand: colibri_t20: more comments/debug output
Add more comments resp. debug output concerning block size and ECC
requirements of NAND flashes. This in aiding further investigation/
integration of support for future NAND flash parts.
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
-rw-r--r-- | board/toradex/colibri_t20/colibri_t20.c | 3 | ||||
-rw-r--r-- | drivers/mtd/nand/tegra_nand.c | 18 |
2 files changed, 16 insertions, 5 deletions
diff --git a/board/toradex/colibri_t20/colibri_t20.c b/board/toradex/colibri_t20/colibri_t20.c index 67b21d67f65..ca6c0e18710 100644 --- a/board/toradex/colibri_t20/colibri_t20.c +++ b/board/toradex/colibri_t20/colibri_t20.c @@ -111,7 +111,8 @@ int arch_misc_init(void) setenv("leb-size", "504KiB"); break; default: - printf("Failed detecting NAND block erase size.\n"); + printf("Failed detecting NAND block erase size " + "(%d KiB).\n", nand_info[0]->erasesize >> 10); } } diff --git a/drivers/mtd/nand/tegra_nand.c b/drivers/mtd/nand/tegra_nand.c index e6dbdbbf2c1..3910dd80ff9 100644 --- a/drivers/mtd/nand/tegra_nand.c +++ b/drivers/mtd/nand/tegra_nand.c @@ -170,7 +170,8 @@ static void read_buf(struct mtd_info *mtd, uint8_t *buf, int len) int i, s; unsigned int reg; struct nand_chip *chip = mtd_to_nand(mtd); - struct nand_drv *info = (struct nand_drv *)nand_get_controller_data(chip); + struct nand_drv *info = + (struct nand_drv *)nand_get_controller_data(chip); for (i = 0; i < len; i += 4) { s = (len - i) > 4 ? 4 : len - i; @@ -545,8 +546,16 @@ static int nand_rw_page(struct mtd_info *mtd, struct nand_chip *chip, tag_size += SKIPPED_SPARE_BYTES; bounce_buffer_start(&bbstate_oob, (void *)tag_ptr, tag_size, bbflags); - writel(virt_to_phys(bbstate_oob.bounce_buffer), &info->reg->tag_ptr); - writel(BCH_CONFIG_BCH_TVAL16 | BCH_CONFIG_BCH_ECC_ENABLE, &info->reg->bch_config); + writel(virt_to_phys(bbstate_oob.bounce_buffer), + &info->reg->tag_ptr); + /* + * TBD: We should really check whether or not enough OOB is + * actually available for such configuration resp. properly + * choose a configuration which actually works (see e.g. + * current mainline Linux kernel driver). + */ + 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 @@ -556,7 +565,8 @@ static int nand_rw_page(struct mtd_info *mtd, struct nand_chip *chip, | (tag_size - 1)); bounce_buffer_start(&bbstate_oob, (void *)chip->oob_poi, tag_size, bbflags); - writel(virt_to_phys(bbstate_oob.bounce_buffer), &info->reg->tag_ptr); + writel(virt_to_phys(bbstate_oob.bounce_buffer), + &info->reg->tag_ptr); writel(BCH_CONFIG_BCH_ECC_DISABLE, &info->reg->bch_config); } writel(reg_val, &info->reg->config); |