From: Lukasz Majewski Date: Mon, 04 Nov 2013 11:17:04 +0100 Subject: [U-Boot] [RFC PATCH 2/2] usb: dfu: correct dfu buffer inited value In-Reply-To: <1381915599-27906-2-git-send-email-voice.shen@atmel.com> References: <1381915599-27906-1-git-send-email-voice.shen@atmel.com> <1381915599-27906-2-git-send-email-voice.shen@atmel.com> Message-ID: <20131104111704.43a3be15@amdc308.digital.local> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Bo, > After dfu buffer is initialized, the buffer should be all available, > while not 0. Initialize its value to min(dfu_buf_size, dfu->r_left). > > Signed-off-by: Bo Shen > > --- > drivers/dfu/dfu.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c > index 65c6984..b8c8aa4 100644 > --- a/drivers/dfu/dfu.c > +++ b/drivers/dfu/dfu.c > @@ -288,7 +288,7 @@ int dfu_read(struct dfu_entity *dfu, void *buf, > int size, int blk_seq_num) dfu->offset = 0; > dfu->i_buf_end = dfu_get_buf() + dfu_buf_size; > dfu->i_buf = dfu->i_buf_start; > - dfu->b_left = 0; > + dfu->b_left = min(dfu_buf_size, dfu->r_left); > I've testd in on Trats. It causes dfu read to be performed two times. Could you write a more verbose message to explain the problem that you are trying to solve? I can _only_ suppose that you want to read/write data from/to NAND memory. So, I'm curious why dfu-util breaks with your setup but works at am335x. Both chips are supposed to use dfu_nand.c for performing NAND read/write. > dfu->bad_skip = 0; > -- Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group