public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] what to do when the uboot can not mark the phisical bad block of nand flash?
@ 2011-11-24 13:36 liaohengquan1986
  2011-11-25  8:51 ` Marek Vasut
       [not found] ` <18a422dc.11f19.133df8c393d.Coremail.liaohengquan1986@163.com>
  0 siblings, 2 replies; 4+ messages in thread
From: liaohengquan1986 @ 2011-11-24 13:36 UTC (permalink / raw)
  To: u-boot

Hi, guys                I got a problem. I move a part of source code of linux/driver/mtd/nand to the u-boot. But I found that the u-boot can not mark the phsical bad block .
                when I run nand_erase() or nand_scrub(), it return error num as below:
    linux/driver/mtd/nand/nand_base.c
    2589            chip->erase_cmd(mtd, page & chip->pagemask);     2590                 status = chip->waitfunc(mtd, chip);
    2592                 /*
    2593                 * See if operation failed and additional status checks are
    2594                 * available
    2595                 */
    2596                 if ((status & NAND_STATUS_FAIL) && (chip->errstat))
    2597                         status = chip->errstat(mtd, chip, FL_ERASING,
    2598                                                status, page);
    2600                 /* See if block erase succeeded */
    2601                 if (status & NAND_STATUS_FAIL) {
    2602                         DEBUG(MTD_DEBUG_LEVEL0, "%s: Failed erase, "
    2603                                         "page 0x%08x\n", __func__, page);
    2604                         instr->state = MTD_ERASE_FAILED;
    2605                         instr->fail_addr =
    2606                                 ((loff_t)page << chip->page_shift);
    2607                         goto erase_exit;
    2608                 }
        you can find that if block erase is failed(status==-1), it only mark the instr(we will not use the instr later), and go to the erase_exit. So there is no code to mark the oob of the phisical bad block, neither add it to the bad block table.
       so ,I add the code of writing oob of the phisical bad block when it is erased failed, such as below:
                chip->erase_cmd(mtd, page & chip->pagemask);2589

- Ignored:
    2590                 status = chip->waitfunc(mtd, chip);
    2592                 /*
    2593                 * See if operation failed and additional status checks are
    2594                 * available
    2595                 */
    2596                 if ((status & NAND_STATUS_FAIL) && (chip->errstat))
    2597                         status = chip->errstat(mtd, chip, FL_ERASING,
    2598                                                status, page);
    2600                 /* See if block erase succeeded */
    2601                 if (status & NAND_STATUS_FAIL) {
    2602                         DEBUG(MTD_DEBUG_LEVEL0, "%s: Failed erase, "
    2603                                         "page 0x%08x\n", __func__, page);
    2604                         instr->state = MTD_ERASE_FAILED;
    2605                         instr->fail_addr =
    2606                                 ((loff_t)page << chip->page_shift);
                                     nand_write_oob(addr);
    2607                         goto erase_exit;
    2608                 }
    
       Guys, what do you think of it , and what would you to if you  got this problem.

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

* [U-Boot] what to do when the uboot can not mark the phisical bad block of nand flash?
  2011-11-24 13:36 [U-Boot] what to do when the uboot can not mark the phisical bad block of nand flash? liaohengquan1986
@ 2011-11-25  8:51 ` Marek Vasut
       [not found] ` <18a422dc.11f19.133df8c393d.Coremail.liaohengquan1986@163.com>
  1 sibling, 0 replies; 4+ messages in thread
From: Marek Vasut @ 2011-11-25  8:51 UTC (permalink / raw)
  To: u-boot

> Hi, guys                I got a problem. I move a part of source code of
> linux/driver/mtd/nand to the u-boot. But I found that the u-boot can not
> mark the phsical bad block . when I run nand_erase() or nand_scrub(), it
> return error num as below: linux/driver/mtd/nand/nand_base.c
>     2589            chip->erase_cmd(mtd, page & chip->pagemask);     2590  
>               status = chip->waitfunc(mtd, chip); 2592                 /*
>     2593                 * See if operation failed and additional status
> checks are 2594                 * available
>     2595                 */
>     2596                 if ((status & NAND_STATUS_FAIL) &&
> (chip->errstat)) 2597                         status = chip->errstat(mtd,
> chip, FL_ERASING, 2598                                               
> status, page); 2600                 /* See if block erase succeeded */
>     2601                 if (status & NAND_STATUS_FAIL) {
>     2602                         DEBUG(MTD_DEBUG_LEVEL0, "%s: Failed erase,
> " 2603                                         "page 0x%08x\n", __func__,
> page); 2604                         instr->state = MTD_ERASE_FAILED;
>     2605                         instr->fail_addr =
>     2606                                 ((loff_t)page <<
> chip->page_shift); 2607                         goto erase_exit;
>     2608                 }
>         you can find that if block erase is failed(status==-1), it only
> mark the instr(we will not use the instr later), and go to the erase_exit.
> So there is no code to mark the oob of the phisical bad block, neither add
> it to the bad block table. so ,I add the code of writing oob of the
> phisical bad block when it is erased failed, such as below:
> chip->erase_cmd(mtd, page & chip->pagemask);2589
> 
> - Ignored:
>     2590                 status = chip->waitfunc(mtd, chip);
>     2592                 /*
>     2593                 * See if operation failed and additional status
> checks are 2594                 * available
>     2595                 */
>     2596                 if ((status & NAND_STATUS_FAIL) &&
> (chip->errstat)) 2597                         status = chip->errstat(mtd,
> chip, FL_ERASING, 2598                                               
> status, page); 2600                 /* See if block erase succeeded */
>     2601                 if (status & NAND_STATUS_FAIL) {
>     2602                         DEBUG(MTD_DEBUG_LEVEL0, "%s: Failed erase,
> " 2603                                         "page 0x%08x\n", __func__,
> page); 2604                         instr->state = MTD_ERASE_FAILED;
>     2605                         instr->fail_addr =
>     2606                                 ((loff_t)page <<
> chip->page_shift); nand_write_oob(addr);
>     2607                         goto erase_exit;
>     2608                 }
> 
>        Guys, what do you think of it , and what would you to if you  got
> this problem.

Can you please fix your mailer and send this stuff again? It's really hard to 
decode what you're asking please.

M

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

* [U-Boot] what to do when the uboot can not mark the phisical bad block of nand flash?
       [not found] ` <18a422dc.11f19.133df8c393d.Coremail.liaohengquan1986@163.com>
@ 2011-11-26 11:43   ` Marek Vasut
       [not found]   ` <55115875.ca03.133efb6f79a.Coremail.liaohengquan1986@163.com>
  1 sibling, 0 replies; 4+ messages in thread
From: Marek Vasut @ 2011-11-26 11:43 UTC (permalink / raw)
  To: u-boot

> OK?guys,I can discribe this question in the other way.
> When I download the program image to the nand flash in the uboot.
> At firist, I need to erase the nand flash by running the command of "nand
> erase" or "nand scrub" in the cmdline. But sometimes this step will be
> failed because one block of this flash is bad, and this command will
> return "Failed erase".

Scrub wont, but it's stupid to use. Nand erase should mark the block bad into 
BBT. Anyway, what version of uboot do you use?
> 
> Guys what would you do when you got this problem? Do I need to mrak this
> block as bad block and add it to the bad block table with  software? how
> to do this ? Thank you !
> 
> At 2011-11-25 16:51:17,"Marek Vasut" <marek.vasut@gmail.com> wrote:
> >> Hi, guys                I got a problem. I move a part of source code of
> >> linux/driver/mtd/nand to the u-boot. But I found that the u-boot can not
> >> mark the phsical bad block . when I run nand_erase() or nand_scrub(), it
> >> return error num as below: linux/driver/mtd/nand/nand_base.c
> >> 
> >>     2589            chip->erase_cmd(mtd, page & chip->pagemask);    
> >>     2590
> >>     
> >>               status = chip->waitfunc(mtd, chip); 2592                
> >>               /*
> >>     
> >>     2593                 * See if operation failed and additional status
> >> 
> >> checks are 2594                 * available
> >> 
> >>     2595                 */
> >>     2596                 if ((status & NAND_STATUS_FAIL) &&
> >> 
> >> (chip->errstat)) 2597                         status =
> >> chip->errstat(mtd, chip, FL_ERASING, 2598
> >> status, page); 2600                 /* See if block erase succeeded */
> >> 
> >>     2601                 if (status & NAND_STATUS_FAIL) {
> >>     2602                         DEBUG(MTD_DEBUG_LEVEL0, "%s: Failed
> >>     erase,
> >> 
> >> " 2603                                         "page 0x%08x\n",
> >> __func__, page); 2604                         instr->state =
> >> MTD_ERASE_FAILED;
> >> 
> >>     2605                         instr->fail_addr =
> >>     2606                                 ((loff_t)page <<
> >> 
> >> chip->page_shift); 2607                         goto erase_exit;
> >> 
> >>     2608                 }
> >>     
> >>         you can find that if block erase is failed(status==-1), it only
> >> 
> >> mark the instr(we will not use the instr later), and go to the
> >> erase_exit. So there is no code to mark the oob of the phisical bad
> >> block, neither add it to the bad block table. so ,I add the code of
> >> writing oob of the phisical bad block when it is erased failed, such as
> >> below:
> >> chip->erase_cmd(mtd, page & chip->pagemask);2589
> >> 
> >> - Ignored:
> >>     2590                 status = chip->waitfunc(mtd, chip);
> >>     2592                 /*
> >>     2593                 * See if operation failed and additional status
> >> 
> >> checks are 2594                 * available
> >> 
> >>     2595                 */
> >>     2596                 if ((status & NAND_STATUS_FAIL) &&
> >> 
> >> (chip->errstat)) 2597                         status =
> >> chip->errstat(mtd, chip, FL_ERASING, 2598
> >> status, page); 2600                 /* See if block erase succeeded */
> >> 
> >>     2601                 if (status & NAND_STATUS_FAIL) {
> >>     2602                         DEBUG(MTD_DEBUG_LEVEL0, "%s: Failed
> >>     erase,
> >> 
> >> " 2603                                         "page 0x%08x\n",
> >> __func__, page); 2604                         instr->state =
> >> MTD_ERASE_FAILED;
> >> 
> >>     2605                         instr->fail_addr =
> >>     2606                                 ((loff_t)page <<
> >> 
> >> chip->page_shift); nand_write_oob(addr);
> >> 
> >>     2607                         goto erase_exit;
> >>     2608                 }
> >>     
> >>        Guys, what do you think of it , and what would you to if you  got
> >> 
> >> this problem.
> >
> >Can you please fix your mailer and send this stuff again? It's really hard
> >to decode what you're asking please.
> >
> >M

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

* [U-Boot] what to do when the uboot can not mark the phisical bad block of nand flash?
       [not found]   ` <55115875.ca03.133efb6f79a.Coremail.liaohengquan1986@163.com>
@ 2011-11-29 14:31     ` Marek Vasut
  0 siblings, 0 replies; 4+ messages in thread
From: Marek Vasut @ 2011-11-29 14:31 UTC (permalink / raw)
  To: u-boot

> The boot version is 1.3.1. So how the Nand erase mark the bad block into
> BBT in the software?

Ok, please:
1) Stop top-pasting replied
2) Use mainline u-boot or something not prehistoric. please!

M
> 
> 
> ? 2011-11-26 19:43:40?"Marek Vasut" <marek.vasut@gmail.com> ???
> 
> >> OK?guys,I can discribe this question in the other way.
> >> When I download the program image to the nand flash in the uboot.
> >> At firist, I need to erase the nand flash by running the command of
> >> "nand erase" or "nand scrub" in the cmdline. But sometimes this step
> >> will be failed because one block of this flash is bad, and this command
> >> will return "Failed erase".
> >
> >Scrub wont, but it's stupid to use. Nand erase should mark the block bad
> >into BBT. Anyway, what version of uboot do you use?
> >
> >> Guys what would you do when you got this problem? Do I need to mrak this
> >> block as bad block and add it to the bad block table with  software? how
> >> to do this ? Thank you !
> >> 
> >> At 2011-11-25 16:51:17,"Marek Vasut" <marek.vasut@gmail.com> wrote:
> >> >> Hi, guys                I got a problem. I move a part of source code
> >> >> of linux/driver/mtd/nand to the u-boot. But I found that the u-boot
> >> >> can not mark the phsical bad block . when I run nand_erase() or
> >> >> nand_scrub(), it return error num as below:
> >> >> linux/driver/mtd/nand/nand_base.c
> >> >> 
> >> >>     2589            chip->erase_cmd(mtd, page & chip->pagemask);
> >> >>     2590
> >> >>     
> >> >>               status = chip->waitfunc(mtd, chip); 2592
> >> >>               /*
> >> >>     
> >> >>     2593                 * See if operation failed and additional
> >> >>     status
> >> >> 
> >> >> checks are 2594                 * available
> >> >> 
> >> >>     2595                 */
> >> >>     2596                 if ((status & NAND_STATUS_FAIL) &&
> >> >> 
> >> >> (chip->errstat)) 2597                         status =
> >> >> chip->errstat(mtd, chip, FL_ERASING, 2598
> >> >> status, page); 2600                 /* See if block erase succeeded
> >> >> */
> >> >> 
> >> >>     2601                 if (status & NAND_STATUS_FAIL) {
> >> >>     2602                         DEBUG(MTD_DEBUG_LEVEL0, "%s: Failed
> >> >>     erase,
> >> >> 
> >> >> " 2603                                         "page 0x%08x\n",
> >> >> __func__, page); 2604                         instr->state =
> >> >> MTD_ERASE_FAILED;
> >> >> 
> >> >>     2605                         instr->fail_addr =
> >> >>     2606                                 ((loff_t)page <<
> >> >> 
> >> >> chip->page_shift); 2607                         goto erase_exit;
> >> >> 
> >> >>     2608                 }
> >> >>     
> >> >>         you can find that if block erase is failed(status==-1), it
> >> >>         only
> >> >> 
> >> >> mark the instr(we will not use the instr later), and go to the
> >> >> erase_exit. So there is no code to mark the oob of the phisical bad
> >> >> block, neither add it to the bad block table. so ,I add the code of
> >> >> writing oob of the phisical bad block when it is erased failed, such
> >> >> as below:
> >> >> chip->erase_cmd(mtd, page & chip->pagemask);2589
> >> >> 
> >> >> - Ignored:
> >> >>     2590                 status = chip->waitfunc(mtd, chip);
> >> >>     2592                 /*
> >> >>     2593                 * See if operation failed and additional
> >> >>     status
> >> >> 
> >> >> checks are 2594                 * available
> >> >> 
> >> >>     2595                 */
> >> >>     2596                 if ((status & NAND_STATUS_FAIL) &&
> >> >> 
> >> >> (chip->errstat)) 2597                         status =
> >> >> chip->errstat(mtd, chip, FL_ERASING, 2598
> >> >> status, page); 2600                 /* See if block erase succeeded
> >> >> */
> >> >> 
> >> >>     2601                 if (status & NAND_STATUS_FAIL) {
> >> >>     2602                         DEBUG(MTD_DEBUG_LEVEL0, "%s: Failed
> >> >>     erase,
> >> >> 
> >> >> " 2603                                         "page 0x%08x\n",
> >> >> __func__, page); 2604                         instr->state =
> >> >> MTD_ERASE_FAILED;
> >> >> 
> >> >>     2605                         instr->fail_addr =
> >> >>     2606                                 ((loff_t)page <<
> >> >> 
> >> >> chip->page_shift); nand_write_oob(addr);
> >> >> 
> >> >>     2607                         goto erase_exit;
> >> >>     2608                 }
> >> >>     
> >> >>        Guys, what do you think of it , and what would you to if you 
> >> >>        got
> >> >> 
> >> >> this problem.
> >> >
> >> >Can you please fix your mailer and send this stuff again? It's really
> >> >hard to decode what you're asking please.
> >> >
> >> >M

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

end of thread, other threads:[~2011-11-29 14:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-24 13:36 [U-Boot] what to do when the uboot can not mark the phisical bad block of nand flash? liaohengquan1986
2011-11-25  8:51 ` Marek Vasut
     [not found] ` <18a422dc.11f19.133df8c393d.Coremail.liaohengquan1986@163.com>
2011-11-26 11:43   ` Marek Vasut
     [not found]   ` <55115875.ca03.133efb6f79a.Coremail.liaohengquan1986@163.com>
2011-11-29 14:31     ` Marek Vasut

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