Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 52a474de authored by Mike Hench's avatar Mike Hench Committed by Artem Bityutskiy
Browse files

mtd: eLBC NAND: remove elbc_fcm_ctrl->oob_poi



The eLBC NAND driver currently follows up each program/write operation with a
read-back of the page, in order to [ostensibly] fill in ECC data for the
caller. However, the page address used for this read is always -1, so the read
will never work correctly.  Remove this useless (and potentially problematic)
block of code.

Signed-off-by: default avatarMatthew L. Creech <mlcreech@gmail.com>
Signed-off-by: default avatarArtem Bityutskiy <dedekind1@gmail.com>
parent fb542750
Loading
Loading
Loading
Loading
+2 −31
Original line number Diff line number Diff line
@@ -75,7 +75,6 @@ struct fsl_elbc_fcm_ctrl {
	unsigned int use_mdr;    /* Non zero if the MDR is to be set      */
	unsigned int oob;        /* Non zero if operating on OOB data     */
	unsigned int counter;	 /* counter for the initializations	  */
	char *oob_poi;           /* Place to write ECC after read back    */
};

/* These map to the positions used by the FCM hardware ECC generator */
@@ -435,7 +434,6 @@ static void fsl_elbc_cmdfunc(struct mtd_info *mtd, unsigned int command,

	/* PAGEPROG reuses all of the setup from SEQIN and adds the length */
	case NAND_CMD_PAGEPROG: {
		int full_page;
		dev_vdbg(priv->dev,
		         "fsl_elbc_cmdfunc: NAND_CMD_PAGEPROG "
			 "writing %d bytes.\n", elbc_fcm_ctrl->index);
@@ -445,34 +443,12 @@ static void fsl_elbc_cmdfunc(struct mtd_info *mtd, unsigned int command,
		 * write so the HW generates the ECC.
		 */
		if (elbc_fcm_ctrl->oob || elbc_fcm_ctrl->column != 0 ||
		    elbc_fcm_ctrl->index != mtd->writesize + mtd->oobsize) {
		    elbc_fcm_ctrl->index != mtd->writesize + mtd->oobsize)
			out_be32(&lbc->fbcr, elbc_fcm_ctrl->index);
			full_page = 0;
		} else {
		else
			out_be32(&lbc->fbcr, 0);
			full_page = 1;
		}

		fsl_elbc_run_command(mtd);

		/* Read back the page in order to fill in the ECC for the
		 * caller.  Is this really needed?
		 */
		if (full_page && elbc_fcm_ctrl->oob_poi) {
			out_be32(&lbc->fbcr, 3);
			set_addr(mtd, 6, page_addr, 1);

			elbc_fcm_ctrl->read_bytes = mtd->writesize + 9;

			fsl_elbc_do_read(chip, 1);
		fsl_elbc_run_command(mtd);

			memcpy_fromio(elbc_fcm_ctrl->oob_poi + 6,
				&elbc_fcm_ctrl->addr[elbc_fcm_ctrl->index], 3);
			elbc_fcm_ctrl->index += 3;
		}

		elbc_fcm_ctrl->oob_poi = NULL;
		return;
	}

@@ -752,13 +728,8 @@ static void fsl_elbc_write_page(struct mtd_info *mtd,
                                struct nand_chip *chip,
                                const uint8_t *buf)
{
	struct fsl_elbc_mtd *priv = chip->priv;
	struct fsl_elbc_fcm_ctrl *elbc_fcm_ctrl = priv->ctrl->nand;

	fsl_elbc_write_buf(mtd, buf, mtd->writesize);
	fsl_elbc_write_buf(mtd, chip->oob_poi, mtd->oobsize);

	elbc_fcm_ctrl->oob_poi = chip->oob_poi;
}

static int fsl_elbc_chip_init(struct fsl_elbc_mtd *priv)