public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Lukasz Majewski <l.majewski@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V2 2/2] dfu: fix some issues with reads/uploads
Date: Fri, 20 Jun 2014 09:53:47 +0200	[thread overview]
Message-ID: <20140620095347.177daeff@amdc2363> (raw)
In-Reply-To: <1402512447-31897-2-git-send-email-swarren@wwwdotorg.org>

Hi Stephen,

> From: Stephen Warren <swarren@nvidia.com>
> 
> DFU read support appears to rely upon dfu->read_medium() updating the
> passed-by-reference len parameter to indicate the remaining size
> available for reading.
> 
> dfu_read_medium_mmc() never does this, and the implementation of
> dfu_read_medium_nand() will only work if called just once; it
> hard-codes the value to the total size of the NAND device
> irrespective of read offset.
> 
> I believe that overloading dfu->read_medium() is confusing. As such,
> this patch introduces a new function dfu->get_medium_size() which can
> be used to explicitly find out the medium size, and nothing else.
> dfu_read() is modified to use this function to set the initial value
> for dfu->r_left, rather than attempting to use the side-effects of
> dfu->read_medium() for this purpose.
> 
> Due to this change, dfu_read() must initially set dfu->b_left to 0,
> since no data has been read.
> 
> dfu_read_buffer_fill() must also be modified not to adjust dfu->r_left
> when simply copying data from dfu->i_buf_start to the upload request
> buffer. r_left represents the amount of data left to be read from HW.
> That value is not affected by the memcpy(), but only by calls to
> dfu->read_medium().
> 
> After this change, I can read from either a 4MB or 1.5MB chunk of a
> 4MB eMMC boot partion with CONFIG_SYS_DFU_DATA_BUF_SIZE==1MB. Without
> this change, attempting to do that would result in DFU read returning
> no data at all due to r_left never being set.
> 
> Signed-off-by: Stephen Warren <swarren@nvidia.com>

Applied to u-boot-dfu

Thanks for the patch.

-- 
Best regards,

Lukasz Majewski

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

  parent reply	other threads:[~2014-06-20  7:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-11 18:47 [U-Boot] [PATCH V2 1/2] fs: implement size/fatsize/ext4size Stephen Warren
2014-06-11 18:47 ` [U-Boot] [PATCH V2 2/2] dfu: fix some issues with reads/uploads Stephen Warren
2014-06-17  8:59   ` Lukasz Majewski
2014-06-20  7:53   ` Lukasz Majewski [this message]
2014-06-17  8:57 ` [U-Boot] [PATCH V2 1/2] fs: implement size/fatsize/ext4size Lukasz Majewski
2014-06-18 17:40   ` Tom Rini
2014-06-20  7:53 ` Lukasz Majewski

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=20140620095347.177daeff@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