From patchwork Mon Dec 31 11:13:46 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 208836 X-Patchwork-Delegate: jagannadh.teki@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 32A932C008C for ; Mon, 31 Dec 2012 22:16:56 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1B33C4A16B; Mon, 31 Dec 2012 12:16:51 +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 0nYuA2a1qdd5; Mon, 31 Dec 2012 12:16:50 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E01624A175; Mon, 31 Dec 2012 12:15:44 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E40B84A01E for ; Mon, 31 Dec 2012 12:15:10 +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 gAG3HGPGFF3H for ; Mon, 31 Dec 2012 12:15:06 +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 mail-pb0-f47.google.com (mail-pb0-f47.google.com [209.85.160.47]) by theia.denx.de (Postfix) with ESMTPS id BA4624A02A for ; Mon, 31 Dec 2012 12:14:25 +0100 (CET) Received: by mail-pb0-f47.google.com with SMTP id un1so6972137pbc.6 for ; Mon, 31 Dec 2012 03:14:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=UbgdHIm/DHKbeyHwQL5NDAFtHeShcD6Qf0nk8pl0HTg=; b=AyL/9asQhRpNceQlbe3/rXhRDONZNUEm8N2R6MOuf06ybqQDMNIE0jpjziqUzQU0ls 74Q+5YKKkwmvWK1DzRpmSp+6zq9fXkgpo7HSz0Buv4NVOMm9UubNxR9xxJW1rWS9mgE5 HyArQPmsPCLWOtrxRYRw03osFAJ6ayji2nmQ/VCiYOa5V4Vjf+rWpVWfhFLub5xXSUJ1 DvjqHvNKAwNUjx1mzt4Xf+8X/+qjgbNSaBu2FGRAefrRUWBLMu6dnEKhnEfzLwBNfX0y SuDw0p8ArxNLUd3YYHZrz9PszlXXBLg8yyeKubHYjnwEZ8VI7HoWc3wjd/avtLqV5ld+ NI8A== X-Received: by 10.66.85.74 with SMTP id f10mr119859887paz.38.1356952464063; Mon, 31 Dec 2012 03:14:24 -0800 (PST) Received: from localhost.localdomain ([49.204.11.250]) by mx.google.com with ESMTPS id nw9sm24715215pbb.42.2012.12.31.03.14.22 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 31 Dec 2012 03:14:23 -0800 (PST) From: Jagannadha Sutradharudu Teki To: u-boot@lists.denx.de Date: Mon, 31 Dec 2012 16:43:46 +0530 Message-Id: <1356952428-19824-8-git-send-email-jagannadh.teki@gmail.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1356952428-19824-1-git-send-email-jagannadh.teki@gmail.com> References: <1356952428-19824-1-git-send-email-jagannadh.teki@gmail.com> Subject: [U-Boot] [PATCH 07/12] cmd_sf: Add ASR(Array Slow Read) read instruction support 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 This patch provides a support to read a flash using 'asr' read instruction(rd_inst) for 'sf read' and 'sf update' commands. 'asr' is similar to afr(Array Fast Read) except that it's operated under slow speeds. Example: read 0x2000 length bytes starting at offset 0x0 to memory at 0x10000 using asr read instruction. u-boot> sf read asr 0x10000 0x0 0x2000 erase and write 0x2000 length bytes from memory at 0x10000 address to flash offset at 0x0 using pp write instruction and asr read instruction. u-boot> sf update pp asr 0x10000 0x0 0x2000 Signed-off-by: Jagannadha Sutradharudu Teki --- common/cmd_sf.c | 10 +++++++--- include/spi_flash_inst.h | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/common/cmd_sf.c b/common/cmd_sf.c index b1f19ef..3d9c93e 100644 --- a/common/cmd_sf.c +++ b/common/cmd_sf.c @@ -279,6 +279,8 @@ static int sf_parse_rd_inst_arg(char *arg, u8 *rd_inst) { if (strcmp(arg, "afr") == 0) *rd_inst = CMD_READ_ARRAY_FAST; + else if (strcmp(arg, "asr") == 0) + *rd_inst = CMD_READ_ARRAY_SLOW; else return 1; @@ -628,8 +630,9 @@ U_BOOT_CMD( "sf read rd_inst addr offset len\n" " - read `len' bytes starting at\n" " `offset' to memory at `addr' using\n" - " afr `rd_inst' read instruction\n" + " afr | asr `rd_inst' read instructions\n" " afr (Array Fast Read, 0bh)\n" + " asr (Array Slow Read, 02b)\n" "sf write wr_inst addr offset len\n" " - write `len' bytes from memory\n" " at `addr' to flash at `offset' using\n" @@ -644,7 +647,8 @@ U_BOOT_CMD( " pp | qpp `wr_inst' write instructions and\n" " pp (Page Program, 02h)\n" " qpp (Quad Page Program, 32h)\n" - " afr `rd_inst' read instruction\n" - " afr (Array Fast Read, 0bh)" + " afr | asr `rd_inst' read instructions\n" + " afr (Array Fast Read, 0bh)\n" + " asr (Array Slow Read, 02b)" SF_TEST_HELP ); diff --git a/include/spi_flash_inst.h b/include/spi_flash_inst.h index a530842..85c8e70 100644 --- a/include/spi_flash_inst.h +++ b/include/spi_flash_inst.h @@ -30,5 +30,6 @@ /* Read commands */ #define CMD_READ_ARRAY_FAST 0x0b +#define CMD_READ_ARRAY_SLOW 0x03 #endif /* _SPI_FLASH_INST_H_ */