From patchwork Thu Dec 5 22:13:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Warren X-Patchwork-Id: 297427 X-Patchwork-Delegate: swarren@nvidia.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 508F62C00A1 for ; Fri, 6 Dec 2013 09:13:11 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751422Ab3LEWNK (ORCPT ); Thu, 5 Dec 2013 17:13:10 -0500 Received: from avon.wwwdotorg.org ([70.85.31.133]:48778 "EHLO avon.wwwdotorg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751993Ab3LEWNK (ORCPT ); Thu, 5 Dec 2013 17:13:10 -0500 Received: from severn.wwwdotorg.org (unknown [192.168.65.5]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by avon.wwwdotorg.org (Postfix) with ESMTPS id D1BA86233; Thu, 5 Dec 2013 15:13:09 -0700 (MST) Received: from swarren-lx1.nvidia.com (localhost [127.0.0.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by severn.wwwdotorg.org (Postfix) with ESMTPSA id 63827E47AA; Thu, 5 Dec 2013 15:12:56 -0700 (MST) From: Stephen Warren To: swarren@wwwdotorg.org Cc: linux-tegra@vger.kernel.org, Stephen Warren Subject: [flasher PATCH 4/4] Provide progress messages Date: Thu, 5 Dec 2013 15:13:02 -0700 Message-Id: <1386281582-18561-4-git-send-email-swarren@wwwdotorg.org> X-Mailer: git-send-email 1.8.1.5 In-Reply-To: <1386281582-18561-1-git-send-email-swarren@wwwdotorg.org> References: <1386281582-18561-1-git-send-email-swarren@wwwdotorg.org> X-NVConfidentiality: public X-Virus-Scanned: clamav-milter 0.97.8 at avon.wwwdotorg.org X-Virus-Status: Clean Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org From: Stephen Warren Print messages to the U-Boot console while executing the flashing process. For NAND and SPI at least, IO operations can be quite slow, and it's useful to know the U-Boot is executing what may be a long- running operation. Signed-off-by: Stephen Warren Reviewed-by: Thierry Reding --- tegra-uboot-flasher | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/tegra-uboot-flasher b/tegra-uboot-flasher index bd8af7caa888..87b87697c027 100755 --- a/tegra-uboot-flasher +++ b/tegra-uboot-flasher @@ -55,22 +55,32 @@ def run(dir, cmd): def gen_flashcmd_mmc(flash_image_addr, readback_addr, flash_img_size): flash_id = config['flash-id-uboot'] flash_img_size_sectors = flash_img_size / 512 - flashcmd = 'mmc dev %d 1 ; ' % flash_id + flashcmd = 'echo >>> Selecting MMC device... ; ' + flashcmd += 'mmc dev %d 1 ; ' % flash_id + flashcmd += 'echo >>> Writing image to MMC... ; ' flashcmd += 'mmc write 0x%08x 0 0x%x ; ' % (flash_image_addr, flash_img_size_sectors) + flashcmd += 'echo >>> Reading image back from MMC... ; ' flashcmd += 'mmc read 0x%08x 0 0x%x ; ' % (readback_addr, flash_img_size_sectors) return flashcmd def gen_flashcmd_nand(flash_image_addr, readback_addr, flash_img_size): - flashcmd = 'nand erase.chip ; ' + flashcmd = 'echo >>> Erasing NAND... ; ' + flashcmd += 'nand erase.chip ; ' + flashcmd += 'echo >>> Writing image to NAND... ; ' flashcmd += 'nand write 0x%08x 0 0x%08x ; ' % (flash_image_addr, flash_img_size) + flashcmd += 'echo >>> Reading image back from NAND... ; ' flashcmd += 'nand read 0x%08x 0 0x%08x ; ' % (readback_addr, flash_img_size) return flashcmd def gen_flashcmd_spi(flash_image_addr, readback_addr, flash_img_size): flash_id = config.get('flash-id-uboot', '0') - flashcmd = 'sf probe %s ; ' % flash_id + flashcmd = 'echo >>> Selecting SPI device... ; ' + flashcmd += 'sf probe %s ; ' % flash_id + flashcmd += 'echo >>> Erasing SPI... ; ' flashcmd += 'sf erase 0 0x%08x ; ' % config['flash-erase-size'] + flashcmd += 'echo >>> Writing image back to SPI... ; ' flashcmd += 'sf write 0x%08x 0 0x%08x ; ' % (flash_image_addr, flash_img_size) + flashcmd += 'echo >>> Reading image back from SPI... ; ' flashcmd += 'sf read 0x%08x 0 0x%08x ; ' % (readback_addr, flash_img_size) return flashcmd @@ -182,11 +192,14 @@ def func_flash(): run(workdir, cmd) bootcmd = '' + bootcmd += 'echo >>> Verifying image in RAM... ; ' bootcmd += 'crc32 0x%08x 0x%08x 0x%08x ; ' % (flash_image_addr, flash_img_size, soc['ram-base']) bootcmd += 'if itest.l *0x%08x != 0x%x; then echo CRC MISMATCH of initial image; exit; fi ; ' % (soc['ram-base'], flash_img_crc32_bs) bootcmd += gen_flashcmd(flash_image_addr, readback_addr, flash_img_size) + bootcmd += 'echo >>> Verifying image from flash... ; ' bootcmd += 'crc32 0x%08x 0x%08x 0x%08x ; ' % (readback_addr, flash_img_size, soc['ram-base']) bootcmd += 'if itest.l *0x%08x != 0x%x; then echo CRC MISMATCH of readback image; exit; fi ; ' % (soc['ram-base'], flash_img_crc32_bs) + bootcmd += 'echo >>> Setting up environment... ; ' bootcmd += 'env default -f -a ; ' # Perhaps U-Boot should set $boardname based on the ID EEPROM; then we wouldn't need this if config['dtbfn-extra'] != '': @@ -194,6 +207,7 @@ def func_flash(): for (var, value) in args.env: bootcmd += 'setenv %s %s ; ' % (var, value) bootcmd += 'saveenv ; ' + bootcmd += 'echo >>> Flashing OK, rebooting... ; ' # To update the bootloader, reset. # If wanting to run installer, set installer_args.configname in environment, 'run bootcmd' bootcmd += 'reset'