From patchwork Wed May 27 10:00:54 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: simon polette X-Patchwork-Id: 27723 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by bilbo.ozlabs.org (Postfix) with ESMTPS id 14669B707D for ; Wed, 27 May 2009 20:06:33 +1000 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1M9FzA-0003Pi-VT; Wed, 27 May 2009 10:03:49 +0000 Received: from ey-out-1920.google.com ([74.125.78.149]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1M9FwQ-00068n-0p for linux-mtd@lists.infradead.org; Wed, 27 May 2009 10:01:06 +0000 Received: by ey-out-1920.google.com with SMTP id 13so819971eye.24 for ; Wed, 27 May 2009 03:00:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=ur+DnbGEj7b/+g44TC1zM55JPQMO1F5s7wJ0p2R3nHo=; b=YX36RtWzE/uv7T4uNw1njcj9n6DdM7VLJVXTxXbJG0k6OY+ZLwYs+F4L2HYLZYrn5G HyNZInNSZYbXTbjD6D4LuTHewhI64oPbU+qbVoEnY/baq4eKXge3Yja8a9NKcMUHigX2 Yf7K93vHVfCJ5m2JLhr3rCTELfOvHd/EJNx4U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=mP3fmGs++TcC5XlDowD9tO6fn17Ui2Izqg9fyn4jca7JtJUGvkWV38bWJ7RcuUPpC7 cxNMcLQNQPcytrMvzjbVQMbNnwlWvF/4vT9X6Hm9QThV3QhlWyiOZkDSBlUeNEf8uQCD ekZtjPUYxf7axmVBZaoJPC4nKUnBHVLrGalzk= MIME-Version: 1.0 Received: by 10.216.13.75 with SMTP id a53mr3636429wea.22.1243418454247; Wed, 27 May 2009 03:00:54 -0700 (PDT) In-Reply-To: <1243405314.11172.5.camel@localhost.localdomain> References: <72795ccb0905250844w13ed9798me95d70614050f676@mail.gmail.com> <1243323142.21646.129.camel@localhost.localdomain> <72795ccb0905260240q6389dd35j681dbe50a6d4990f@mail.gmail.com> <1243331031.21646.134.camel@localhost.localdomain> <72795ccb0905260247p6c204cc4w78eaafd28ffc3cf8@mail.gmail.com> <72795ccb0905260321n3b4646brb9adc90425b5304b@mail.gmail.com> <72795ccb0905260455x701ea6e9u5bafc7c394609a4b@mail.gmail.com> <1243405314.11172.5.camel@localhost.localdomain> Date: Wed, 27 May 2009 12:00:54 +0200 Message-ID: <72795ccb0905270300p7ac111fduba8d656a8031a96c@mail.gmail.com> Subject: Re: [PATCH] mtd: Nand Atmel: add On Flash BBT support From: simon polette To: dedekind@infradead.org X-Spam-Score: 0.0 (/) X-Mailman-Approved-At: Wed, 27 May 2009 06:03:44 -0400 Cc: linux-mtd , linux-arm-kernel@lists.arm.linux.org.uk, spolette@adetelgroup.com X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org 2009/5/27 Artem Bityutskiy : > On Tue, 2009-05-26 at 13:55 +0200, simon polette wrote: >> 2009/5/26 simon polette : >> > 2009/5/26 simon polette : >> >> 2009/5/26 Artem Bityutskiy : >> >>> On Tue, 2009-05-26 at 11:40 +0200, simon polette wrote: >> >>>> 2009/5/26 Artem Bityutskiy : >> >>>> > On Mon, 2009-05-25 at 17:44 +0200, simon polette wrote: >> >>>> >> +config       MTD_NAND_ATMEL_FLASH_BBT >> >>>> >> +     bool "Use On-Flash Bad Block Table" >> >>>> >> +     depends on MTD_NAND_ATMEL >> >>>> >> +     help >> >>>> >> +       This enables the On-Flash BBT, which mean that the bad blocks >> >>>> >> +       will be scanned one time then the BBT will be stored >> >>>> >> +       in flash, so scanning Nand flash for bad blocks will be no more >> >>>> >> +       necessary for the next boots. >> >>>> >> + >> >>>> > >> >>>> > I do not think you need a config option for this. It should be >> >>>> > a module parameter instead. >> >>>> > >> >>>> > -- >> >>>> > Best regards, >> >>>> > Artem Bityutskiy (Битюцкий Артём) >> >>>> > >> >>>> > >> >>>> >> >>>> Yes, good idea, but do you think that I can keep a config option to >> >>>> define the default state of that param, it means doing something like >> >>>> : >> >>>> #ifdef CONFIG_MTD_NAND_ATMEL_FLASH_BBT >> >>>> static int use_on_flash_bbt = 1; >> >>>> #else >> >>>> static int use_on_flash_bbt = 0; >> >>>> #endif >> >>>> module_param(use_on_flash_bbt, int, 0); >> >>> >> >>> I think it is generally bad idea if each nand driver will >> >>> introduce a separate config option for this kind of stuff. >> >>> >> >>> You may always boot your kernel with something like >> >>> atmel_nand.on_flash_bbt=1 in the kernel parameters. >> >>> >> >>> -- >> >>> Best regards, >> >>> Artem Bityutskiy (Битюцкий Артём) >> >>> >> >>> >> >> >> >> Ok, I asked this question cause it's what have been done in the nand >> >> diskonchip driver. >> >> I'll send you a new patch soon. >> >> >> >> Best regards, >> >> >> >> Simon Polette >> >> Adeneo - Adetelgroup >> >> >> > >> > So here is the new patch : >> > >> > Signed-off-by: Simon Polette >> > --- >> >  drivers/mtd/nand/atmel_nand.c |    9 +++++++++ >> >  1 files changed, 9 insertions(+), 0 deletions(-) >> > >> > diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c >> > index 47a33ce..e113594 100644 >> > --- a/drivers/mtd/nand/atmel_nand.c >> > +++ b/drivers/mtd/nand/atmel_nand.c >> > @@ -24,6 +24,7 @@ >> > >> >  #include >> >  #include >> > +#include >> >  #include >> >  #include >> >  #include Signed-off-by: Simon Polette >> > >> > @@ -47,6 +48,9 @@ >> >  #define no_ecc         0 >> >  #endif >> > >> > +static int on_flash_bbt = 0; >> > +module_param(on_flash_bbt, int, 0); >> > + >> >  /* Register access macros */ >> >  #define ecc_readl(add, reg)                            \ >> >        __raw_readl(add + ATMEL_ECC_##reg) >> > @@ -465,6 +469,11 @@ static int __init atmel_nand_probe(struct >> > platform_device *pdev) >> >                } >> >        } >> > >> > +       if (on_flash_bbt) { >> > +               printk("atmel_nand: Use On Flash BBT\n"); >> > +               nand_chip->options |= NAND_USE_FLASH_BBT; >> > +       } >> > + >> >        /* first scan to find the device and get the page size */ >> >        if (nand_scan_ident(mtd, 1)) { >> >                res = -ENXIO; >> > -- >> > 1.6.0.4 >> > >> > -- >> > Best regards, >> > >> > Simon Polette >> > Adeneo - Adetelgroup >> > >> A line have been mistakenly inserted into the patch, probably by a >> middle click, sorry for the inconvenience. >> >> >> Signed-off-by: Simon Polette >> --- >>  drivers/mtd/nand/atmel_nand.c |    9 +++++++++ >>  1 files changed, 9 insertions(+), 0 deletions(-) >> >> diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c >> index 47a33ce..e113594 100644 >> --- a/drivers/mtd/nand/atmel_nand.c >> +++ b/drivers/mtd/nand/atmel_nand.c >> @@ -24,6 +24,7 @@ >> >>  #include >>  #include >> +#include >>  #include >>  #include >>  #include >> @@ -47,6 +48,9 @@ >>  #define no_ecc               0 >>  #endif >> >> +static int on_flash_bbt = 0; >> +module_param(on_flash_bbt, int, 0); >> + >>  /* Register access macros */ >>  #define ecc_readl(add, reg)                          \ >>       __raw_readl(add + ATMEL_ECC_##reg) >> @@ -465,6 +469,11 @@ static int __init atmel_nand_probe(struct >> platform_device *pdev) >>               } >>       } >> >> +     if (on_flash_bbt) { >> +             printk("atmel_nand: Use On Flash BBT\n"); >> +             nand_chip->options |= NAND_USE_FLASH_BBT; >> +     } > > Is it please also possible to add KERN_INFO to the 'printk()' > please. And also add it to the already existing 'printk()' in > the driver: printk("No SmartMedia card inserted.\n"); > > -- > Best regards, > Artem Bityutskiy (Битюцкий Артём) > > Hoping the patch is correct now : Signed-off-by: Simon Polette --- drivers/mtd/nand/atmel_nand.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c index 47a33ce..2802992 100644 --- a/drivers/mtd/nand/atmel_nand.c +++ b/drivers/mtd/nand/atmel_nand.c @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -47,6 +48,9 @@ #define no_ecc 0 #endif +static int on_flash_bbt = 0; +module_param(on_flash_bbt, int, 0); + /* Register access macros */ #define ecc_readl(add, reg) \ __raw_readl(add + ATMEL_ECC_##reg) @@ -459,12 +463,17 @@ static int __init atmel_nand_probe(struct platform_device *pdev) if (host->board->det_pin) { if (gpio_get_value(host->board->det_pin)) { - printk("No SmartMedia card inserted.\n"); + printk(KERN_INFO "No SmartMedia card inserted.\n"); res = ENXIO; goto err_no_card; } } + if (on_flash_bbt) { + printk(KERN_INFO "atmel_nand: Use On Flash BBT\n"); + nand_chip->options |= NAND_USE_FLASH_BBT; + } + /* first scan to find the device and get the page size */ if (nand_scan_ident(mtd, 1)) { res = -ENXIO; -- 1.6.0.4