• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Embedded Software » Linux » Linux forum » workaround: am3517 NAND (x8) write errors in Linux
Share
Linux
  • Forum
Options
  • Subscribe via RSS

workaround: am3517 NAND (x8) write errors in Linux

workaround: am3517 NAND (x8) write errors in Linux

This question is not answered
Anton Olofsson
Posted by Anton Olofsson
on Aug 30 2011 06:55 AM
Prodigy70 points

Hi!

We have a custom board with am3517 and Samsung k9f2g x8 NAND. Using Linux 2.6.37 from http://arago-project.org/git/people/?p=sriram/ti-psp-omap.git -- OMAPPSP_04.02.00.07 branch.

When writing flash (jffs2 and ubi) we were getting errors of this sort (for jffs2) -- "Write of X bytes at Y failed. returned -5, retlen 0 Not marking the space at Y as dirty because the flash driver returned retlen zero"

Seeing other posts related to this we wanted to share our findings. We have found that for some reason the flash read/write/erase operations can take a lot of time to finish in polled mode.

Increasing the timeout for omap_wait(...) in omap2 nand driver removes all problems (it seems).

--- a/drivers/mtd/nand/omap2.c

+++ b/drivers/mtd/nand/omap2.c

@@ -924,11 +924,11 @@ static int omap_wait(struct mtd_info *mtd, struct nand_chip *chip)

                                                        mtd);

        unsigned long timeo = jiffies;

        int status = NAND_STATUS_FAIL, state = this->state;

-

+       //HACK:

        if (state == FL_ERASING)

-               timeo += (HZ * 400) / 1000;

+               timeo += (HZ * 4000) / 1000;

        else

-               timeo += (HZ * 20) / 1000;

+               timeo += (HZ * 1000) / 1000;

 

This is a hack however as the above timeouts are silly to be honest (the above timeouts are just some big enough numbers, as samsung spec says that 5/10/500us should be enough for r/w/e).

Seeing how the omap_wait code is written the performance of the flash is still pretty good as it will only have the complete timeout if an error actually occur (we belive).

Enableing DMA prefetch also works, however when flash load is high errors can still occur. We belive this is because of fallback to polled mode operations if DMA is busy.

We are currently using DMA prefetch with the above change to omap_wait, which feels pretty stable.

This is what we have found as of yet. It would be nice to get some comments on wheter this might be a problem with the NAND timings set in x-loader. We have not noticed any problems with flash in u-boot though, so this seems unlikely(?).

Another note is that we cannot use subpage writes with UBI and must manually turn these off in kernel to get ubi to work. When subpage is off ubi seems to work well.

am3517 nand linux mtd jffs2 ubi
Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • Daniel Nystr��m
    Posted by Daniel Nystr��m
    on Sep 20 2011 01:51 AM
    Prodigy10 points

    I'm affected by this as well. Posting to subscribe the thread.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Anton Olofsson
    Posted by Anton Olofsson
    on Sep 20 2011 10:03 AM
    Prodigy70 points

    Subpage write seems to be fixed now : http://arago-project.org/git/people/?p=sriram/ti-psp-omap.git;a=commit;h=1f62a9d1143cffcdc5dbf5b433fb905fa5f78831

    Nice work!

    Regards,

    Anton

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Orjan Friberg
    Posted by Orjan Friberg
    on Jan 30 2012 10:08 AM
    Expert1065 points

    Anton,

    What was your final configuration where this worked?  NAND_OMAP_PREFETCH and NAND_OMAP_PREFETCH_DMA both on?  JFFS2 and/or UBIFS?

    I tried the subpage write patch (on a 2.6.32 kernel, JFFS2) but I still see the problem occasionally (once every 1-4 hours with heavy file system load).

    Thanks,

    Orjan

     

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Anton Olofsson
    Posted by Anton Olofsson
    on Jan 31 2012 03:43 AM
    Prodigy70 points

    Hello Orjan,

    I would try increasing the timeouts for polled mode if you havent already. (without this we also got errors during heavy load).

    "Final" solution for us (seems stable for both jffs2 & ubi):

    * NAND_OMAP_PREFETCH_DMA

    * subpage fix from arago

    * Increased timeout for polled mode (this was important even when using prefetch as polled mode might still be used from time to time).

    Regards,

    Anton

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Orjan Friberg
    Posted by Orjan Friberg
    on Jan 31 2012 04:11 AM
    Expert1065 points

    Thanks.  I wasn't sure if the increased timeout was needed once you got the subpage fix in place. 

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • David Andrey
    Posted by David Andrey
    on Apr 30 2012 07:15 AM
    Prodigy210 points

    Timeout value are ok, but the exit code have to be updated.


        while (time_before(jiffies, timeo)) {
            status = __raw_readb(this->IO_ADDR_R);
            if (status & NAND_STATUS_READY)
                break;
            cond_resched();
        }

    +    /* if we have time-out exit, then check again */
    +    if (!(status & NAND_STATUS_READY)) {
    +      status = __raw_readb(this->IO_ADDR_R);
    +    }

    OMAP NAND
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Anton Olofsson
    Posted by Anton Olofsson
    on Apr 04 2013 05:01 AM
    Prodigy70 points

    Update (concerning am335x),

    The reason for this (very late) post is that we found the same problem on am3359.

    David: Thank you! Fix seems to do the trick! On a note TI seems to have introduced a very similar fix in their am335x kernel (arago).

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • David Andrey
    Posted by David Andrey
    on Apr 04 2013 05:05 AM
    Prodigy210 points

    you're welcome ! Thanks for reporting :-)

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
TI E2E™ Community
  • Support Forums
  • Blogs
  • Videos
  • Groups
  • Site Support & Feedback
  • Settings
TI E2E™ Community Groups
  • TI University Program
  • Make the Switch
  • Microcontroller Projects
  • Motor Drive & Control
Other Communities
  • Deyisupport
  • Designsomething.org
  • beagleboard.org
  • TI on Element 14
  • TI on TechXchangeSM
Other Technical & Support Resources
  • WEBENCH® Design Center
  • Product Information Centers
  • Technical Documents
  • TI Design Network
  • TI Technical Articles
  • TI Training

All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
embedded processors, along with software, tools and the industry’s largest sales/support staff.

© Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy Policy | Terms of Use