/* omap_enable_ecc - This function enables the hardware ecc functionality @mtd: MTD device structure @mode: Read/Write mode  */
static void omap_enable_hwecc(struct mtd_info *mtd, int32_t mode)
/* omap_enable_ecc - This function enables the hardware ecc functionality @mtd: MTD device structure @mode: Read/Write mode  */
static void omap_enable_hwecc(struct mtd_info *mtd, int32_t mode)
{
	struct nand_chip *chip = mtd->priv;
	uint32_t val, dev_width = (chip->options & NAND_BUSWIDTH_16) >> 1;
	switch (mode) {
	case NAND_ECC_READ:
	case NAND_ECC_WRITE:
		writel(ECCCLEAR | ECCRESULTREG1, &gpmc_cfg->ecc_control);
		writel(ECCSIZE1 | ECCSIZE0 | ECCSIZE0SEL,
			&gpmc_cfg->ecc_size_config);
		val = (dev_width << 7) | (cs << 1) | (0x1);
		writel(val, &gpmc_cfg->ecc_config);
		break;
	default:
		printf("Error: Unrecognized Mode[%d]!\n", mode);
		break;
	}
}