From patchwork Sun Dec 2 14:36:22 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Hesselbarth X-Patchwork-Id: 203244 X-Patchwork-Delegate: prafulla@marvell.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 195902C0081 for ; Mon, 3 Dec 2012 04:26:40 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id EE2834A056; Sun, 2 Dec 2012 18:26:26 +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 sLfA12encFxX; Sun, 2 Dec 2012 18:26:26 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 54E044A0A5; Sun, 2 Dec 2012 18:24:53 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 62AB34A026 for ; Sun, 2 Dec 2012 15:37:14 +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 GPKRDGe0V6Vf for ; Sun, 2 Dec 2012 15:37:13 +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-bk0-f44.google.com (mail-bk0-f44.google.com [209.85.214.44]) by theia.denx.de (Postfix) with ESMTPS id 521004A02E for ; Sun, 2 Dec 2012 15:37:10 +0100 (CET) Received: by mail-bk0-f44.google.com with SMTP id w11so739270bku.3 for ; Sun, 02 Dec 2012 06:37:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=GcXmq63XAxXR4XCweAOil3Md+uNZgaHEAaJ04ME9Brc=; b=DumiXA06Oa7CeHVIXWJOvU+hAGZ2PshkJwFEQE49zCWYHWileEQukZOLas9qYZGugi 4ACDP0zlpiARL1B2F7Jii/AUOd3oUKGIvReau40CPT16BkJDKp6RErFQS1KWC699wKLz DV1kOTuWehSWT/MN73Bv+2wt6M8X0SWZfzsjbfVmAImSklH/47ZflG0FT272c2+nr9kw ySYNlIDJyBxigY7pomxW+rEVe6Vea3OLZYGtZi3D0XYN54JZWlA/+a38VwzI7R3DnHhU aoCC6PvlXcbsgJIQ82VtdE+6BoX7wy1X2OvLa/Roi40pyIdsjtA/E4YNeRNaimhdn/rM R2+A== Received: by 10.204.153.15 with SMTP id i15mr2084650bkw.64.1354459029963; Sun, 02 Dec 2012 06:37:09 -0800 (PST) Received: from nijin.lan (dslc-082-083-245-055.pools.arcor-ip.net. [82.83.245.55]) by mx.google.com with ESMTPS id u3sm5605994bkw.9.2012.12.02.06.37.06 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 02 Dec 2012 06:37:07 -0800 (PST) From: Sebastian Hesselbarth To: Sebastian Hesselbarth Date: Sun, 2 Dec 2012 15:36:22 +0100 Message-Id: <1354458982-14403-11-git-send-email-sebastian.hesselbarth@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1354458982-14403-1-git-send-email-sebastian.hesselbarth@gmail.com> References: <1354458982-14403-1-git-send-email-sebastian.hesselbarth@gmail.com> X-Mailman-Approved-At: Sun, 02 Dec 2012 18:24:40 +0100 Cc: Dieter Kiermaier , Rabeeh Khoury , u-boot@lists.denx.de, Daniel Stodden , Andy Fleming Subject: [U-Boot] [PATCH 10/10] tools: Add support for Dove to kwboot 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 On Dove kwboot can also be used to boot an u-boot image into RAM. In contrast to Kirkwood, Dove does not support the UART boot mode sequence but requires the UART boot mode to be selected through strap pins. The SolidRun CuBox has a push button to allow uart boot mode but fails on the boot sequence sent by kwboot. This patch adds another cmdline option to allow to send a boot image without the boot sequence and adds support for Dove. Signed-off-by: Sebastian Hesselbarth --- Cc: u-boot@lists.denx.de Cc: Sebastian Hesselbarth Cc: Rabeeh Khoury Cc: Albert Aribaud Cc: Prafulla Wadaskar Cc: Andy Fleming Cc: Joe Hershberger Cc: Daniel Stodden Cc: Dieter Kiermaier --- tools/Makefile | 2 ++ tools/kwboot.c | 44 ++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/tools/Makefile b/tools/Makefile index 686840a..845384f 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -73,6 +73,7 @@ BIN_FILES-$(CONFIG_MX28) += mxsboot$(SFX) BIN_FILES-$(CONFIG_NETCONSOLE) += ncb$(SFX) BIN_FILES-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1$(SFX) BIN_FILES-$(CONFIG_KIRKWOOD) += kwboot$(SFX) +BIN_FILES-$(CONFIG_DOVE) += kwboot$(SFX) # Source files which exist outside the tools directory EXT_OBJ_FILES-$(CONFIG_BUILD_ENVCRC) += common/env_embedded.o @@ -104,6 +105,7 @@ NOPED_OBJ_FILES-y += os_support.o OBJ_FILES-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1.o NOPED_OBJ_FILES-y += ublimage.o OBJ_FILES-$(CONFIG_KIRKWOOD) += kwboot.o +OBJ_FILES-$(CONFIG_DOVE) += kwboot.o # Don't build by default #ifeq ($(ARCH),ppc) diff --git a/tools/kwboot.c b/tools/kwboot.c index e773f01..199678a 100644 --- a/tools/kwboot.c +++ b/tools/kwboot.c @@ -293,6 +293,30 @@ kwboot_bootmsg(int tty, void *msg) } static int +kwboot_bootmsg_uartmode(int tty) +{ + int rc; + char c; + + kwboot_printv("Please reboot the target into UART boot mode..."); + + do { + rc = tcflush(tty, TCIOFLUSH); + if (rc) + break; + + rc = kwboot_tty_recv(tty, &c, 1, KWBOOT_MSG_RSP_TIMEO); + + kwboot_spinner(); + + } while (rc || c != NAK); + + kwboot_printv("\n"); + + return rc; +} + +static int kwboot_xm_makeblock(struct kwboot_block *block, const void *data, size_t size, int pnum) { @@ -601,10 +625,11 @@ static void kwboot_usage(FILE *stream, char *progname) { fprintf(stream, - "Usage: %s -b [ -p ] [ -t ] " + "Usage: %s -b [ -p ] [ -t ] [ -u ] " "[-B ] \n", progname); fprintf(stream, "\n"); fprintf(stream, " -b : boot \n"); + fprintf(stream, " -u: target requires UART boot mode (e.g. Dove)\n"); fprintf(stream, " -p: patch to type 0x69 (uart boot)\n"); fprintf(stream, "\n"); fprintf(stream, " -t: mini terminal\n"); @@ -617,7 +642,7 @@ int main(int argc, char **argv) { const char *ttypath, *imgpath; - int rv, rc, tty, term, prot, patch; + int rv, rc, tty, uartmode, term, prot, patch; void *bootmsg; void *img; size_t size; @@ -628,6 +653,7 @@ main(int argc, char **argv) bootmsg = NULL; imgpath = NULL; img = NULL; + uartmode = 0; term = 0; patch = 0; size = 0; @@ -636,7 +662,7 @@ main(int argc, char **argv) kwboot_verbose = isatty(STDOUT_FILENO); do { - int c = getopt(argc, argv, "hb:ptB:"); + int c = getopt(argc, argv, "hb:ptuB:"); if (c < 0) break; @@ -654,6 +680,10 @@ main(int argc, char **argv) term = 1; break; + case 'u': + uartmode = 1; + break; + case 'B': speed = kwboot_tty_speed(atoi(optarg)); if (speed == -1) @@ -702,7 +732,13 @@ main(int argc, char **argv) } } - if (bootmsg) { + if (uartmode) { + rc = kwboot_bootmsg_uartmode(tty); + if (rc) { + perror("bootmsg"); + goto out; + } + } else if (bootmsg) { rc = kwboot_bootmsg(tty, bootmsg); if (rc) { perror("bootmsg");