From patchwork Tue Sep 10 02:44:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: afzal mohammed X-Patchwork-Id: 273752 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 011B72C0181 for ; Tue, 10 Sep 2013 12:44:58 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8146A4A063; Tue, 10 Sep 2013 04:44:57 +0200 (CEST) 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 KAcU9VwKtjyr; Tue, 10 Sep 2013 04:44:57 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 49D7A4A064; Tue, 10 Sep 2013 04:44:53 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8A2004A064 for ; Tue, 10 Sep 2013 04:44:47 +0200 (CEST) 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 qYnad40J3J4t for ; Tue, 10 Sep 2013 04:44:41 +0200 (CEST) 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 mail-pa0-f52.google.com (mail-pa0-f52.google.com [209.85.220.52]) by theia.denx.de (Postfix) with ESMTPS id 2AC324A063 for ; Tue, 10 Sep 2013 04:44:34 +0200 (CEST) Received: by mail-pa0-f52.google.com with SMTP id kq13so7004454pab.25 for ; Mon, 09 Sep 2013 19:44:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=JNQXkTXFiX6H2s6oQ7cuRlAPu6+tyAPVifsEgz/xp6I=; b=qg7g4vlLETk6kKGMEzaZ5h6aR7+Sm5cs7ecltn6r1KSUKNhPiG/771h5hEgoi8e7H8 Fnmm97T9YrwTM31oRrCoN2vTE/g8IkjWkq43696tdVzF5eFIe4qo/4gssGd8T9QFAv7L AmGPe0yCjTy8kRZs5Wg7n6JcKD8MNsGH2kd0Gu1CYFtS5bixoJypQ/Ndwfr00K9kn0To vo3rTyqreO35+8fXE2mqYYMDB54A3OQBYI395MRFAWWqehs1ouMCdop4tMuUXqykaFoC SMMQpCZSkcV+ZWvzfaoeseo+glAmhGAqBDcty+99DBGk11NFBZqZaaXNwVtn9jeUmOLc d7eQ== X-Received: by 10.68.130.104 with SMTP id od8mr1158441pbb.29.1378781071588; Mon, 09 Sep 2013 19:44:31 -0700 (PDT) Received: from localhost.localdomain ([27.57.152.201]) by mx.google.com with ESMTPSA id qf7sm21067171pac.14.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 09 Sep 2013 19:44:30 -0700 (PDT) From: Afzal Mohammed To: u-boot@lists.denx.de Date: Tue, 10 Sep 2013 08:14:09 +0530 Message-Id: X-Mailer: git-send-email 1.8.2.135.g7b592fa Cc: Pantelis Antoniou Subject: [U-Boot] [PATCH v2 1/3] dfu: unify mmc/nand read/write ops enum 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 MMC and NAND independently defines same enumerators for read/write. Unify them by defining enum in dfu header. RAM support that is being added newly also can make use of it. Signed-off-by: Afzal Mohammed Cc: Lukasz Majewski Cc: Pantelis Antoniou Acked-by: Lukasz Majewski --- v2: new drivers/dfu/dfu_mmc.c | 9 ++------- drivers/dfu/dfu_nand.c | 7 +------ include/dfu.h | 5 +++++ 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c index 0871a77..f942758 100644 --- a/drivers/dfu/dfu_mmc.c +++ b/drivers/dfu/dfu_mmc.c @@ -13,16 +13,11 @@ #include #include -enum dfu_mmc_op { - DFU_OP_READ = 1, - DFU_OP_WRITE, -}; - static unsigned char __aligned(CONFIG_SYS_CACHELINE_SIZE) dfu_file_buf[CONFIG_SYS_DFU_MAX_FILE_SIZE]; static long dfu_file_buf_len; -static int mmc_block_op(enum dfu_mmc_op op, struct dfu_entity *dfu, +static int mmc_block_op(enum dfu_op op, struct dfu_entity *dfu, u64 offset, void *buf, long *len) { char cmd_buf[DFU_CMD_BUF_SIZE]; @@ -65,7 +60,7 @@ static int mmc_file_buffer(struct dfu_entity *dfu, void *buf, long *len) return 0; } -static int mmc_file_op(enum dfu_mmc_op op, struct dfu_entity *dfu, +static int mmc_file_op(enum dfu_op op, struct dfu_entity *dfu, void *buf, long *len) { char cmd_buf[DFU_CMD_BUF_SIZE]; diff --git a/drivers/dfu/dfu_nand.c b/drivers/dfu/dfu_nand.c index 0ec12cf..edbf5a9 100644 --- a/drivers/dfu/dfu_nand.c +++ b/drivers/dfu/dfu_nand.c @@ -19,12 +19,7 @@ #include #include -enum dfu_nand_op { - DFU_OP_READ = 1, - DFU_OP_WRITE, -}; - -static int nand_block_op(enum dfu_nand_op op, struct dfu_entity *dfu, +static int nand_block_op(enum dfu_op op, struct dfu_entity *dfu, u64 offset, void *buf, long *len) { loff_t start, lim; diff --git a/include/dfu.h b/include/dfu.h index 47b9055..6115d90 100644 --- a/include/dfu.h +++ b/include/dfu.h @@ -29,6 +29,11 @@ enum dfu_layout { DFU_FS_EXT4, }; +enum dfu_op { + DFU_OP_READ = 1, + DFU_OP_WRITE, +}; + struct mmc_internal_data { /* RAW programming */ unsigned int lba_start;