[U-Boot] [PATCH v1 6/7] dfu, nand, ubi: fix erasing after write finish

Lukasz Majewski l.majewski at samsung.com
Mon May 30 11:51:57 CEST 2016


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?

> >>
> >> Fix this error.
> >>
> >> Signed-off-by: Heiko Schocher <hs at 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

> 
> 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).

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?

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


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

> 
> bye,
> Heiko


-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group


More information about the U-Boot mailing list