From mboxrd@z Thu Jan 1 00:00:00 1970 From: Scott Wood Date: Mon, 5 Dec 2011 17:21:28 -0600 Subject: [U-Boot] [PATCH] NAND: Allow nand_scan to be replaced by user In-Reply-To: <1323126962-20525-1-git-send-email-marek.vasut@gmail.com> References: <1323126962-20525-1-git-send-email-marek.vasut@gmail.com> Message-ID: <4EDD51F8.8050307@freescale.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 > Cc: Scott Wood > --- > 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/ -Scott