[U-Boot] [PATCH] NAND: Allow nand_scan to be replaced by user
Marek Vasut
marek.vasut at gmail.com
Tue Dec 6 00:24:44 CET 2011
> On 12/05/2011 05:16 PM, Marek Vasut wrote:
> > This patch allows user to supply nand_scan() call replacement via the
> > usual method. This will be beneficial for PXA3XX NAND driver, which does
> > further init of the chip at this stage.
> >
> > Signed-off-by: Marek Vasut <marek.vasut at gmail.com>
> > Cc: Scott Wood <scottwood at freescale.com>
> > ---
> >
> > drivers/mtd/nand/nand_base.c | 12 +++++++++---
> > include/linux/mtd/nand.h | 2 ++
> > 2 files changed, 11 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> > index 27f6c77..baf7622 100644
> > --- a/drivers/mtd/nand/nand_base.c
> > +++ b/drivers/mtd/nand/nand_base.c
> > @@ -2974,10 +2974,16 @@ int nand_scan_tail(struct mtd_info *mtd)
> >
> > int nand_scan(struct mtd_info *mtd, int maxchips)
> > {
> >
> > int ret;
> >
> > + struct nand_chip *nand = mtd->priv;
> > +
> > + if (nand->scan) {
> > + ret = nand->scan(mtd);
> > + } else {
> > + ret = nand_scan_ident(mtd, maxchips, NULL);
> > + if (!ret)
> > + ret = nand_scan_tail(mtd);
> > + }
> >
> > - ret = nand_scan_ident(mtd, maxchips, NULL);
> > - if (!ret)
> > - ret = nand_scan_tail(mtd);
> >
> > return ret;
> >
> > }
>
> There is no need to change this code. Instead, we should stop calling
> nand_scan in the first place if we want to insert code between ident and
> tail.
>
> Does the approach in the following patch work for you?
> http://patchwork.ozlabs.org/patch/128816/
No, why use weak-aliased function if you can pass it like I do? If V2 passed the
function pointer like I do, I'll be OK with it. Though I tried very hard to keep
the pxa3xx driver as much unchanged as possible and this slightly breaks my
effort. Anyway, when do you expect to see this (in some modified version,
without the weak-aliased fn) mainline?
>
> -Scott
More information about the U-Boot
mailing list