Message ID | 2014455473.2375001.1344891007399.JavaMail.root@advansee.com |
---|---|
State | Accepted |
Commit | 0e499b07ef417b153e3feb54c249d56edbc364b4 |
Delegated to: | Scott Wood |
Headers | show |
On 13/08/2012 22:50, Benoît Thébaudeau wrote: > Use _mxc_nand_enable_hwecc() instead of duplicating its code. > > Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com> > Cc: Scott Wood <scottwood@freescale.com> > Cc: Stefano Babic <sbabic@denx.de> > --- Hi Benoît, > > +#ifdef CONFIG_MXC_NAND_HWECC > +static void mxc_nand_enable_hwecc(struct mtd_info *mtd, int mode) > +{ > + /* > + * If HW ECC is enabled, we turn it on during init. There is > + * no need to enable again here. > + */ > +} mxc_nand_enable_hwecc is still empty after your changes... > + > +#ifdef MXC_NFC_V1_1 > static int mxc_nand_read_oob_syndrome(struct mtd_info *mtd, > struct nand_chip *chip, > int page, int sndcmd) > @@ -1235,15 +1235,11 @@ int board_nand_init(struct nand_chip *this) > host->pagesize_2k = 0; > > this->ecc.size = 512; > - tmp = readw(&host->regs->config1); > - tmp |= NFC_ECC_EN; > - writew(tmp, &host->regs->config1); > + _mxc_nand_enable_hwecc(mtd, 1); ...but you are calling it after removing the code in the init function, and I do not understand how ECC is enabled. Best regards, Stefano Babic
Hi Stefano, > On 13/08/2012 22:50, Benoît Thébaudeau wrote: > > Use _mxc_nand_enable_hwecc() instead of duplicating its code. > > > > Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com> > > Cc: Scott Wood <scottwood@freescale.com> > > Cc: Stefano Babic <sbabic@denx.de> > > --- > > Hi Benoît, > > > > > +#ifdef CONFIG_MXC_NAND_HWECC > > +static void mxc_nand_enable_hwecc(struct mtd_info *mtd, int mode) > > +{ > > + /* > > + * If HW ECC is enabled, we turn it on during init. There is > > + * no need to enable again here. > > + */ > > +} > > mxc_nand_enable_hwecc is still empty after your changes... Yes, and it's normal. The change is a move of the _mxc_nand_enable_hwecc() function, not a filling of the mxc_nand_enable_hwecc() function (note the differing underscore). For some reason, the patch looks weird because it moves mxc_nand_enable_hwecc(), but the result is the same. > > + > > +#ifdef MXC_NFC_V1_1 > > static int mxc_nand_read_oob_syndrome(struct mtd_info *mtd, > > struct nand_chip *chip, > > int page, int sndcmd) > > @@ -1235,15 +1235,11 @@ int board_nand_init(struct nand_chip *this) > > host->pagesize_2k = 0; > > > > this->ecc.size = 512; > > - tmp = readw(&host->regs->config1); > > - tmp |= NFC_ECC_EN; > > - writew(tmp, &host->regs->config1); > > + _mxc_nand_enable_hwecc(mtd, 1); > > ...but you are calling it after removing the code in the init > function, > and I do not understand how ECC is enabled. It's not the same function. Best regards, Benoît
diff --git u-boot-4d3c95f.orig/drivers/mtd/nand/mxc_nand.c u-boot-4d3c95f/drivers/mtd/nand/mxc_nand.c index 4564b25..7a180e1 100644 --- u-boot-4d3c95f.orig/drivers/mtd/nand/mxc_nand.c +++ u-boot-4d3c95f/drivers/mtd/nand/mxc_nand.c @@ -355,16 +355,6 @@ static int mxc_nand_dev_ready(struct mtd_info *mtd) return 1; } -#ifdef CONFIG_MXC_NAND_HWECC -static void mxc_nand_enable_hwecc(struct mtd_info *mtd, int mode) -{ - /* - * If HW ECC is enabled, we turn it on during init. There is - * no need to enable again here. - */ -} - -#ifdef MXC_NFC_V1_1 static void _mxc_nand_enable_hwecc(struct mtd_info *mtd, int on) { struct nand_chip *nand_chip = mtd->priv; @@ -378,6 +368,16 @@ static void _mxc_nand_enable_hwecc(struct mtd_info *mtd, int on) writew(tmp, &host->regs->config1); } +#ifdef CONFIG_MXC_NAND_HWECC +static void mxc_nand_enable_hwecc(struct mtd_info *mtd, int mode) +{ + /* + * If HW ECC is enabled, we turn it on during init. There is + * no need to enable again here. + */ +} + +#ifdef MXC_NFC_V1_1 static int mxc_nand_read_oob_syndrome(struct mtd_info *mtd, struct nand_chip *chip, int page, int sndcmd) @@ -1235,15 +1235,11 @@ int board_nand_init(struct nand_chip *this) host->pagesize_2k = 0; this->ecc.size = 512; - tmp = readw(&host->regs->config1); - tmp |= NFC_ECC_EN; - writew(tmp, &host->regs->config1); + _mxc_nand_enable_hwecc(mtd, 1); #else this->ecc.layout = &nand_soft_eccoob; this->ecc.mode = NAND_ECC_SOFT; - tmp = readw(&host->regs->config1); - tmp &= ~NFC_ECC_EN; - writew(tmp, &host->regs->config1); + _mxc_nand_enable_hwecc(mtd, 0); #endif /* Reset NAND */ this->cmdfunc(mtd, NAND_CMD_RESET, -1, -1);
Use _mxc_nand_enable_hwecc() instead of duplicating its code. Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com> Cc: Scott Wood <scottwood@freescale.com> Cc: Stefano Babic <sbabic@denx.de> --- .../drivers/mtd/nand/mxc_nand.c | 28 +++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-)