From: Lukasz Majewski <l.majewski@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 6/7] dfu, nand, ubi: fix erasing after write finish
Date: Thu, 23 Jun 2016 17:00:46 +0200 [thread overview]
Message-ID: <20160623170046.04219870@amdc2363> (raw)
In-Reply-To: <1465282545-2810-7-git-send-email-hs@denx.de>
Hi Heiko,
> 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
>
> Fix this error.
>
> Signed-off-by: Heiko Schocher <hs@denx.de>
>
> ---
>
> Changes in v2:
> - rebase to current mainline commit id:
> e4a94ce4ac77396b181663c0493c50bc2d5b9143
> and the "mtd: nand Sync with Linux v4.6" patches:
> [U-Boot,1/7] mtd: nand: Remove jz4740 driver
> http://patchwork.ozlabs.org/patch/627922/
> [U-Boot,2/7] mtd: nand: Remove docg4 driver and palmtreo680
> flashing tool http://patchwork.ozlabs.org/patch/627924/
> [U-Boot,3/7] mtd: nand: Remove nand_info_t typedef
> http://patchwork.ozlabs.org/patch/627923/
> [U-Boot,4/7] nand: Embed mtd_info in struct nand_chip
> http://patchwork.ozlabs.org/patch/627925/
> [U-Boot,5/7] mtd: nand: Add+use mtd_to/from_nand and
> nand_get/set_controller_data http://patchwork.ozlabs.org/patch/627926/
> [U-Boot,6/7] mtd: nand: Add page argument to write_page() etc.
> http://patchwork.ozlabs.org/patch/627927/
> [U-Boot,7/7] mtd: nand: Sync with Linux v4.6
> http://patchwork.ozlabs.org/patch/627928/
>
> drivers/dfu/dfu_nand.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/dfu/dfu_nand.c b/drivers/dfu/dfu_nand.c
> index 5906057..1ca10d4 100644
> --- a/drivers/dfu/dfu_nand.c
> +++ b/drivers/dfu/dfu_nand.c
> @@ -143,6 +143,7 @@ static int dfu_read_medium_nand(struct dfu_entity
> *dfu, u64 offset, void *buf, static int dfu_flush_medium_nand(struct
> dfu_entity *dfu) {
> int ret = 0;
> + u64 off;
>
> /* in case of ubi partition, erase rest of the partition */
> if (dfu->data.nand.ubi) {
> @@ -159,7 +160,16 @@ static int dfu_flush_medium_nand(struct
> dfu_entity *dfu) mtd = nand_info[nand_curr_device];
>
> memset(&opts, 0, sizeof(opts));
> - opts.offset = dfu->data.nand.start + dfu->offset +
> + off = dfu->offset;
> + if ((off & (mtd->erasesize - 1)) != 0) {
> + /*
> + * last write ended with unaligned length
> + * sector is erased, jump to next
> + */
> + off = off & ~((mtd->erasesize - 1));
> + off += mtd->erasesize;
> + }
> + opts.offset = dfu->data.nand.start + off +
> dfu->bad_skip;
> opts.length = dfu->data.nand.start +
> dfu->data.nand.size - opts.offset;
Acked-by: Lukasz Majewski <l.majewski@samsung.com>
--
Best regards,
Lukasz Majewski
Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
next prev parent reply other threads:[~2016-06-23 15:00 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-07 6:55 [U-Boot] [PATCH v3 0/7] add support for the etamin draco board variant Heiko Schocher
2016-06-07 6:55 ` [U-Boot] [PATCH v3 1/7] siemens,am33x: add ubi fastmap support Heiko Schocher
2016-06-09 18:03 ` [U-Boot] [U-Boot, v3, 1/7] siemens, am33x: " Tom Rini
2016-06-07 6:55 ` [U-Boot] [PATCH v3 2/7] ubi: add new ubi command "ubi detach" Heiko Schocher
2016-06-09 18:03 ` [U-Boot] [U-Boot,v3,2/7] " Tom Rini
2016-06-07 6:55 ` [U-Boot] [PATCH v3 3/7] nand: add nand mtd concat support Heiko Schocher
2016-06-09 18:03 ` [U-Boot] [U-Boot,v3,3/7] " Tom Rini
2016-06-07 6:55 ` [U-Boot] [PATCH v3 4/7] mtd: nand: omap: allow to switch to BCH16 Heiko Schocher
2016-06-09 18:03 ` [U-Boot] [U-Boot, v3, " Tom Rini
2016-06-07 6:55 ` [U-Boot] [PATCH v3 5/7] am335x, dxr2: get ECC sType from I2C eeprom Heiko Schocher
2016-06-09 18:03 ` [U-Boot] [U-Boot, v3, " Tom Rini
2016-06-07 6:55 ` [U-Boot] [PATCH v3 6/7] dfu, nand, ubi: fix erasing after write finish Heiko Schocher
2016-06-09 18:04 ` [U-Boot] [U-Boot, v3, " Tom Rini
2016-06-23 15:00 ` Lukasz Majewski [this message]
2016-06-07 6:55 ` [U-Boot] [PATCH v3 7/7] siemens,am33x: add draco etamin board Heiko Schocher
2016-06-09 18:04 ` [U-Boot] [U-Boot,v3,7/7] " Tom Rini
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=20160623170046.04219870@amdc2363 \
--to=l.majewski@samsung.com \
--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