From patchwork Tue Sep 17 06:46:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Longchamp X-Patchwork-Id: 275383 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 D10362C00C5 for ; Tue, 17 Sep 2013 16:47:36 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C43AE4A096; Tue, 17 Sep 2013 08:47:18 +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 68SbwMSaXQXv; Tue, 17 Sep 2013 08:47:18 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9A4AD4A0B6; Tue, 17 Sep 2013 08:46:56 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E59484A06E for ; Tue, 17 Sep 2013 08:46:43 +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 PAOryu09nNHq for ; Tue, 17 Sep 2013 08:46:37 +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-de.keymile.com (mail-de.keymile.com [195.8.104.250]) by theia.denx.de (Postfix) with ESMTPS id 0D9F74A07A for ; Tue, 17 Sep 2013 08:46:26 +0200 (CEST) Received: from [10.9.1.54] (port=65281 helo=mailrelay.de.keymile.net) by mail-de.keymile.com with esmtp (Exim 4.76) (envelope-from ) id 1VLp3H-0004Cj-2p; Tue, 17 Sep 2013 08:46:23 +0200 Received: from chber1-10533x.keymile.net (chber1-10533x.keymile.net [172.31.40.3]) by mailrelay.de.keymile.net (8.12.2/8.12.2) with ESMTP id r8H6i11Y026230; Tue, 17 Sep 2013 08:44:04 +0200 (MEST) From: Valentin Longchamp To: U-Boot Mailing List , Jagannadha Sutradharudu Teki Date: Tue, 17 Sep 2013 08:46:18 +0200 Message-Id: <1379400379-5759-3-git-send-email-valentin.longchamp@keymile.com> X-Mailer: git-send-email 1.8.0.1 In-Reply-To: <1379400379-5759-1-git-send-email-valentin.longchamp@keymile.com> References: <1379400379-5759-1-git-send-email-valentin.longchamp@keymile.com> Cc: Valentin Longchamp , Holger Brunck Subject: [U-Boot] [PATCH 2/3] cmd_sf: add 'release' command 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 The release command is the pendant of the probe command. This command allows to call spi_flash_free from the command line. This may be necessary for some boards where sf probe does change the state of the hardware (like with some pin multiplexing changes for instance). Signed-off-by: Valentin Longchamp --- common/cmd_sf.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/common/cmd_sf.c b/common/cmd_sf.c index 4af0f0a..b8ef3f4 100644 --- a/common/cmd_sf.c +++ b/common/cmd_sf.c @@ -133,6 +133,14 @@ static int do_spi_flash_probe(int argc, char * const argv[]) return 0; } +static int do_spi_flash_release(int argc, char * const argv[]) +{ + if (flash) + spi_flash_free(flash); + flash = NULL; + + return 0; +} /** * Write a block of data to SPI flash, first checking if it is different from * what is already there. @@ -501,6 +509,8 @@ static int do_spi_flash(cmd_tbl_t *cmdtp, int flag, int argc, ret = do_spi_flash_read_write(argc, argv); else if (strcmp(cmd, "erase") == 0) ret = do_spi_flash_erase(argc, argv); + else if (strcmp(cmd, "release") == 0) + ret = do_spi_flash_release(argc, argv); #ifdef CONFIG_CMD_SF_TEST else if (!strcmp(cmd, "test")) ret = do_spi_flash_test(argc, argv); @@ -535,6 +545,7 @@ U_BOOT_CMD( "sf erase offset [+]len - erase `len' bytes from `offset'\n" " `+len' round up `len' to block size\n" "sf update addr offset len - erase and write `len' bytes from memory\n" - " at `addr' to flash at `offset'" + " at `addr' to flash at `offset'\n" + "sf release - release the current flash device" SF_TEST_HELP );