mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] don't scan bbt if CONFIG_NAND_BBT not set
@ 2013-11-04  3:36 张忠山
  2013-11-04  8:29 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: 张忠山 @ 2013-11-04  3:36 UTC (permalink / raw)
  To: barebox; +Cc: 张忠山

From: 张忠山 <zzs0213@gmail.com>

when CONFIG_NAND_BBT not set, chip->scan_bbt is NULL and
NAND_SKIP_BBTSCAN not set. So barebox crashed, this is the message

    ......

    nand: ONFI param page 0 valid
    nand: ONFI flash detected
    nand: NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda (Micron MT29F2G08AAD), 256MiB, page size: 2048, OOB size: 64
    prefetch abort
    pc : [<00000004>]    lr : [<23f0b8d0>]
    sp : 23ffff08  ip : 7fffffff  fp : 00000000
    r10: 04000000  r9 : 00000000  r8 : 00000001
    r7 : 23b637f8  r6 : 00000000  r5 : 23b63ad4  r4 : 23b638b4
    r3 : 00000000  r2 : fffff200  r1 : 0000000a  r0 : 23b63ad4
    Flags: nZCv  IRQs off  FIQs off  Mode SVC_32

may be the best solution is set NAND_SKIP_BBTSCAN somewhere when
CONFIG_NAND_BBT not selected, but I don't known where is the best
position.

Signed-off-by: 张忠山 <zzs0213@gmail.com>
---
 drivers/mtd/nand/nand_base.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index d249565..1dbd5bf 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -3597,8 +3597,12 @@ int nand_scan_tail(struct mtd_info *mtd)
 	if (chip->options & NAND_SKIP_BBTSCAN)
 		return 0;
 
+#ifdef CONFIG_NAND_BBT
 	/* Build bad block table */
 	return chip->scan_bbt(mtd);
+#else
+	return 0;
+#endif
 }
 EXPORT_SYMBOL(nand_scan_tail);
 
-- 
1.7.9.5



_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] don't scan bbt if CONFIG_NAND_BBT not set
  2013-11-04  3:36 [PATCH] don't scan bbt if CONFIG_NAND_BBT not set 张忠山
@ 2013-11-04  8:29 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2013-11-04  8:29 UTC (permalink / raw)
  To: 张忠山; +Cc: barebox, 张忠山

On Mon, Nov 04, 2013 at 11:36:49AM +0800, 张忠山 wrote:
> From: 张忠山 <zzs0213@gmail.com>
> 
> when CONFIG_NAND_BBT not set, chip->scan_bbt is NULL and
> NAND_SKIP_BBTSCAN not set. So barebox crashed, this is the message
> 
>     ......
> 
>     nand: ONFI param page 0 valid
>     nand: ONFI flash detected
>     nand: NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda (Micron MT29F2G08AAD), 256MiB, page size: 2048, OOB size: 64
>     prefetch abort
>     pc : [<00000004>]    lr : [<23f0b8d0>]
>     sp : 23ffff08  ip : 7fffffff  fp : 00000000
>     r10: 04000000  r9 : 00000000  r8 : 00000001
>     r7 : 23b637f8  r6 : 00000000  r5 : 23b63ad4  r4 : 23b638b4
>     r3 : 00000000  r2 : fffff200  r1 : 0000000a  r0 : 23b63ad4
>     Flags: nZCv  IRQs off  FIQs off  Mode SVC_32
> 
> may be the best solution is set NAND_SKIP_BBTSCAN somewhere when
> CONFIG_NAND_BBT not selected, but I don't known where is the best
> position.

I think it's ok like you did.

> 
> Signed-off-by: 张忠山 <zzs0213@gmail.com>
> ---
>  drivers/mtd/nand/nand_base.c |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> index d249565..1dbd5bf 100644
> --- a/drivers/mtd/nand/nand_base.c
> +++ b/drivers/mtd/nand/nand_base.c
> @@ -3597,8 +3597,12 @@ int nand_scan_tail(struct mtd_info *mtd)
>  	if (chip->options & NAND_SKIP_BBTSCAN)
>  		return 0;
>  
> +#ifdef CONFIG_NAND_BBT
>  	/* Build bad block table */
>  	return chip->scan_bbt(mtd);
> +#else
> +	return 0;
> +#endif

I applied this with:

	if (!IS_ENABLED(CONFIG_NAND_BBT))
		return 0;

Please use IS_ENABLED() where appropriate in future since it's easier to
read and leads to better compile coverage.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-11-04  8:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-04  3:36 [PATCH] don't scan bbt if CONFIG_NAND_BBT not set 张忠山
2013-11-04  8:29 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox