From patchwork Thu Dec 24 00:51:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Chou X-Patchwork-Id: 560778 X-Patchwork-Delegate: thomas@wytron.com.tw 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 B67F41409A0 for ; Thu, 24 Dec 2015 11:52:26 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 507E04BA78; Thu, 24 Dec 2015 01:52:14 +0100 (CET) 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 NlGKPjnXin-b; Thu, 24 Dec 2015 01:52:14 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 227A24BA7E; Thu, 24 Dec 2015 01:52:02 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 96E984BA11 for ; Thu, 24 Dec 2015 01:51:37 +0100 (CET) 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 UE7J69wJgTyH for ; Thu, 24 Dec 2015 01:51:37 +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 www.wytron.com.tw (220-134-43-68.HINET-IP.hinet.net [220.134.43.68]) by theia.denx.de (Postfix) with ESMTP id 2D7834BA0F for ; Thu, 24 Dec 2015 01:51:33 +0100 (CET) Received: from localhost.localdomain (unknown [192.168.1.250]) by www.wytron.com.tw (Postfix) with ESMTP id 973B3D00351; Thu, 24 Dec 2015 08:51:30 +0800 (CST) From: Thomas Chou To: u-boot@lists.denx.de Date: Thu, 24 Dec 2015 08:51:23 +0800 Message-Id: <1450918284-16174-4-git-send-email-thomas@wytron.com.tw> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1450918284-16174-1-git-send-email-thomas@wytron.com.tw> References: <1450918284-16174-1-git-send-email-thomas@wytron.com.tw> Cc: Marek Vasut , lftan@altera.com, clsee@altera.com Subject: [U-Boot] [PATCH 4/5] altera_qspi: show erase progress X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Show sector erase progress with dot and comma. Signed-off-by: Thomas Chou --- drivers/mtd/altera_qspi.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/mtd/altera_qspi.c b/drivers/mtd/altera_qspi.c index 8a630a6..0624ff4 100644 --- a/drivers/mtd/altera_qspi.c +++ b/drivers/mtd/altera_qspi.c @@ -52,6 +52,7 @@ struct altera_qspi_platdata { unsigned long size; }; +static uint flash_verbose; flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS]; /* FLASH chips info */ static void altera_qspi_get_locked_range(struct mtd_info *mtd, loff_t *ofs, @@ -74,6 +75,11 @@ void flash_print_info(flash_info_t *info) putc('\n'); } +void flash_set_verbose(uint v) +{ + flash_verbose = v; +} + int flash_erase(flash_info_t *info, int s_first, int s_last) { struct mtd_info *mtd = info->mtd; @@ -84,10 +90,13 @@ int flash_erase(flash_info_t *info, int s_first, int s_last) instr.mtd = mtd; instr.addr = mtd->erasesize * s_first; instr.len = mtd->erasesize * (s_last + 1 - s_first); + flash_set_verbose(1); ret = mtd_erase(mtd, &instr); + flash_set_verbose(0); if (ret) return ERR_PROTECTED; + puts(" done\n"); return 0; } @@ -160,6 +169,11 @@ static int altera_qspi_erase(struct mtd_info *mtd, struct erase_info *instr) mtd_erase_callback(instr); return -EIO; } + if (flash_verbose) + putc('.'); + } else { + if (flash_verbose) + putc(','); } addr += mtd->erasesize; }