From patchwork Thu Nov 7 06:29:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bo Shen X-Patchwork-Id: 289201 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 55DEF2C00BA for ; Thu, 7 Nov 2013 17:30:34 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A94154A313; Thu, 7 Nov 2013 07:30:31 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VXOaubQOSuXU; Thu, 7 Nov 2013 07:30:31 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2361B4A316; Thu, 7 Nov 2013 07:30:30 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9D6D64A313 for ; Thu, 7 Nov 2013 07:30:23 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uoMy+6-Kl+rm for ; Thu, 7 Nov 2013 07:30:18 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from sjogate2.atmel.com (newsmtp5.atmel.com [204.2.163.5]) by theia.denx.de (Postfix) with ESMTP id 252E24A2E7 for ; Thu, 7 Nov 2013 07:30:11 +0100 (CET) Received: from shaarm01.corp.atmel.com ([10.217.6.34]) by sjogate2.atmel.com (8.13.6/8.13.6) with ESMTP id rA76Na9p018873; Wed, 6 Nov 2013 22:23:37 -0800 (PST) From: Bo Shen To: Marek Vasut , l.majewski@majess.pl Date: Thu, 7 Nov 2013 14:29:41 +0800 Message-Id: <1383805781-23146-1-git-send-email-voice.shen@atmel.com> X-Mailer: git-send-email 1.7.9.5 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH v2] usb: dfu: make nand upload working X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Nowhere pass a value to len, which always 0, make no transfer which cause uploading failed. This patch make nand upload working. However it needs enough malloc buffer to store read data, that means the buffer at least equal to the upload partition size, or else it doesn't work. Signed-off-by: Bo Shen Tested-by: Heiko Schocher --- Changes in v2: - Move code to nand part, or else it will break mmc drivers/dfu/dfu_nand.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/dfu/dfu_nand.c b/drivers/dfu/dfu_nand.c index 1c2e03b..cf082e2 100644 --- a/drivers/dfu/dfu_nand.c +++ b/drivers/dfu/dfu_nand.c @@ -121,6 +121,7 @@ static int dfu_read_medium_nand(struct dfu_entity *dfu, u64 offset, void *buf, switch (dfu->layout) { case DFU_RAW_ADDR: + *len = dfu->data.nand.size; ret = nand_block_read(dfu, offset, buf, len); break; default: