public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v1 6/7] dfu, nand, ubi: fix erasing after write finish
Date: Mon, 30 May 2016 12:15:56 +0200	[thread overview]
Message-ID: <574C12DC.90509@denx.de> (raw)
In-Reply-To: <20160530115157.52d49e92@amdc2363>

Hello Lukasz,

Am 30.05.2016 um 11:51 schrieb Lukasz Majewski:
> Hi Heiko,
>
>> Hello Scott,
>>
>> Am 25.05.2016 um 07:33 schrieb Scott Wood:
>>> On 05/25/2016 12:07 AM, Heiko Schocher wrote:
>>>> writting to ubi nand partitions need after write ends an erase
>>>> of the remaining sectors. This fail, if dfu write size was not
>>>> a multiple of erasesize, example log:
>>>>
>>>> Failure erase: -1
>
> Is this a new bug? Or is this a regression?

This is a fix of a current Bug.

>>>> Fix this error.
>>>>
>>>> Signed-off-by: Heiko Schocher <hs@denx.de>
>>>
>>> Why don't you just erase the whole partition up front?
>>
>> Good question ... I think the reason is that if we erase a big
>> partition at once on dfu start, dfu-util rans into timeout ... but
>> may I am wrong ...
>
> This is interesting, since we had similar problem with eMMC, but on the
> end of writing large files to FS.
>
> To fix this issue, the deferred write has been introduced [1]:
> SHA1: fc18f8d170ecc7e15269ad5312ec643addb42491

I had downloaded files > 300MiB IIRC without problems on NAND.

>> IIRC at the end of a DFU transfer DFU protocol sends a "flush" to the
>> device ...
>
> Yes, correct, we do that.
>
>> where we currently erase the remaining sectors
>
> I'm not the "regular" user of NAND part of DFU framework. However,
> AFAIK each sector is erased just before writing (dfu_nand.c @ line 62).

Yep, and this is currrent state and works fine (on the siemens boards)
And so we need at the end in the flush state of the dfu protcol
to erase the sectors on the end of the partition, if it is an ubi partition.

> The same scheme should be performed just before writing last chunk of
> data to NAND.
>
>> ... we need
>> this on an ubi partition, else there may remain old used UBI
>> sectors ... (BTW: we need an "ubi format" command ...)
>>
>> @Lukasz? Am I correct? Or could we simple erase before writting?
>
> I'm just wondering if have you tried erasing the whole NAND area before
> starting DFU operation?
> How long does it take to erase large NAND area for e.g. rootfs?

I must measure this value ... but just posted the etamin module support,
and there is a DDP Nand with 4GiB ... and there is a big fat (UBI) partition
at the end:

device nand2 <omap2-nand_concat>, # parts = 9
  #: name                size            offset          mask_flags
[...]
  8: rootfs              0xff080000      0x00f80000      0

> If I remember correctly, the timeout in dfu-util is 5 seconds sharp.

Yes, this is may too small, right, just erased the DDP nand on the
etamin module:

U-Boot# nand device 0
Device 0: nand0... is now current device
U-Boot# time nand erase f80000 7f080000

NAND erase: device 0 offset 0xf80000, size 0x7f080000
[...]
Erasing at 0x7ff80000 -- 100% complete.
OK

time: 3.999 seconds
U-Boot# nand device 1
Device 1: nand1... is now current device
U-Boot# time nand erase.chip

NAND erase.chip: device 1 whole chip
[...]
Erasing at 0x7ff80000 -- 100% complete.
OK

time: 4.019 seconds
U-Boot#

~8seconds for erasing the hole partition ...

> Generally, I'm fine with erasing NAND sectors just before writing (as
> we do it up till now in the NAND part of DFU).

Thanks for clarification!

bye,
Heiko
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

  reply	other threads:[~2016-05-30 10:15 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-25  5:07 [U-Boot] [PATCH v1 0/7] add support for the etamin draco board variant Heiko Schocher
2016-05-25  5:07 ` [U-Boot] [PATCH v1 1/7] siemens,am33x: add ubi fastmap support Heiko Schocher
2016-05-25  5:07 ` [U-Boot] [PATCH v1 2/7] ubi: add new ubi command "ubi dettach" Heiko Schocher
2016-05-25  5:47   ` Scott Wood
2016-05-25  6:28     ` Heiko Schocher
2016-05-25 14:46       ` Scott Wood
2016-05-25  5:07 ` [U-Boot] [PATCH v1 3/7] nand: add nand mtd concat support Heiko Schocher
2016-05-25  5:30   ` Scott Wood
2016-05-25  6:10     ` Heiko Schocher
2016-05-25 14:51       ` Scott Wood
2016-05-26  4:45         ` Heiko Schocher
2016-05-25  5:07 ` [U-Boot] [PATCH v1 4/7] mtd: nand: omap: allow to switch to BCH16 Heiko Schocher
2016-05-25  5:07 ` [U-Boot] [PATCH v1 5/7] am335x, dxr2: get ECC sType from I2C eeprom Heiko Schocher
2016-05-25  5:07 ` [U-Boot] [PATCH v1 6/7] dfu, nand, ubi: fix erasing after write finish Heiko Schocher
2016-05-25  5:33   ` Scott Wood
2016-05-25  6:21     ` Heiko Schocher
2016-05-30  9:51       ` Lukasz Majewski
2016-05-30 10:15         ` Heiko Schocher [this message]
2016-05-30 13:13           ` Lukasz Majewski
2016-05-25  5:07 ` [U-Boot] [PATCH v1 7/7] siemens,am33x: add draco etamin board Heiko Schocher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=574C12DC.90509@denx.de \
    --to=hs@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox