scan_bbt requires the ECC mode to be set to HW 0 to detect the factory
bad block markers. Everyone else requires ECC mode '2'. Thus switch
ECC mode in scan_bbt only to prevent confusion in userspace (env
partition requiring to be written with different ECC mode than
everything else).
nand->options &= ~NAND_OWN_BUFFERS;
return;
}
nand->options &= ~NAND_OWN_BUFFERS;
return;
}
+static int am33xx_scan_bbt(struct mtd_info *mtd)
+{
+ int ret;
+
+ am33xx_nand_switch_ecc(NAND_ECC_HW, 0);
+ ret = nand_default_bbt(mtd);
+ am33xx_nand_switch_ecc(NAND_ECC_HW, 2);
+ return ret;
+}
+#else /* CONFIG_SPL_BUILD */
/* Check wait pin as dev ready indicator */
static int am33xx_spl_dev_ready(struct mtd_info *mtd)
{
return gpmc_cfg->status & (1 << 8);
}
/* Check wait pin as dev ready indicator */
static int am33xx_spl_dev_ready(struct mtd_info *mtd)
{
return gpmc_cfg->status & (1 << 8);
}
+
+static int am33xx_scan_bbt(struct mtd_info *mtd)
+{
+ return 0;
+}
nand->cmd_ctrl = am33xx_nand_hwcontrol;
nand->options = NAND_NO_PADDING | NAND_CACHEPRG | NAND_NO_AUTOINCR;
nand->cmd_ctrl = am33xx_nand_hwcontrol;
nand->options = NAND_NO_PADDING | NAND_CACHEPRG | NAND_NO_AUTOINCR;
+ nand->scan_bbt = am33xx_scan_bbt;
+
/* If we are 16 bit dev, our gpmc config tells us that */
if ((readl(&gpmc_cfg->cs[cs].config1) & 0x3000) == 0x1000) {
nand->options |= NAND_BUSWIDTH_16;
/* If we are 16 bit dev, our gpmc config tells us that */
if ((readl(&gpmc_cfg->cs[cs].config1) & 0x3000) == 0x1000) {
nand->options |= NAND_BUSWIDTH_16;
/* For undocumented reasons we need to currently keep our environment
* in 1-bit ECC so we configure ourself thusly. */
nand_curr_device = 0;
/* For undocumented reasons we need to currently keep our environment
* in 1-bit ECC so we configure ourself thusly. */
nand_curr_device = 0;
- am33xx_nand_switch_ecc(NAND_ECC_HW, 0);
+ am33xx_nand_switch_ecc(NAND_ECC_HW, 2);
#else
/* The NAND chip present requires that we have written data in with
* at least 4-bit ECC so we configure outself for that in SPL.
#else
/* The NAND chip present requires that we have written data in with
* at least 4-bit ECC so we configure outself for that in SPL.