From patchwork Fri Aug 17 08:47:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Packham X-Patchwork-Id: 958704 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="RdEAx9qr"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 41sH153lTtz9ryn for ; Fri, 17 Aug 2018 18:48:41 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 36D46C21D8A; Fri, 17 Aug 2018 08:48:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 90E1EC21DEC; Fri, 17 Aug 2018 08:48:19 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 5E8CBC21E16; Fri, 17 Aug 2018 08:48:01 +0000 (UTC) Received: from mail-pl0-f48.google.com (mail-pl0-f48.google.com [209.85.160.48]) by lists.denx.de (Postfix) with ESMTPS id C8E50C21DD7 for ; Fri, 17 Aug 2018 08:47:57 +0000 (UTC) Received: by mail-pl0-f48.google.com with SMTP id w19-v6so3409572ply.8 for ; Fri, 17 Aug 2018 01:47:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=YeLc/mVIzeWVc74iImNNG72JpC3tth7p+kwUveJP078=; b=RdEAx9qrsCPYrLfJ9O877u/BO1rMh+Ju6ZQ+np3SZ4qwQ3kZelRPVG41oLomPquLIt /F5resuO+3Ks9qNt8U3sGj9VLw0+2BFzFab1kqH9akrIjcCT+e7eZutxbcXjh9xlsKU/ acZtyN9tO5z6jQXzZRPg2dlPUXOtlqciqgA74ng510gAE5/cSzcZwRVG0FIPD89xipHn 1wwPY683MIxjLDM1btD6CwCSNB22lnvSQR2d5DWzz4TMJTJ8eR6P7rvk1rQ/1M4eXYZd A7u5xqH6c3b2yfMCpe4xKDnM+p25X+PS+jklVrASwXY0aik1bSFDbMrJ8SMAAktX1rcZ JQUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=YeLc/mVIzeWVc74iImNNG72JpC3tth7p+kwUveJP078=; b=tRN8Gd9LcX59sbJNSLiewcTzRVjdIB9ifpFA1swE0XZyv+eusNDj6Nz9zjxUGfw9pi 4FzlYRTYS/PRTvVs0/VjicH2GG79m7kbgB/skd/4tBM1mjXwt7V+QM5di91C+gI4a1t+ d3K74aPWozvxd5cYLj5unEMdjsnipx6u5v+H3c4cB+WBZ9GEH63HPsf/aTQYiEUktjxZ y2+ZbFQrfWPZyD3jhKL1N4UVVNhBwYZLfM+Yef6Zan6p0PzZh9lYanoIBhm3lGxOzyb+ f7mnZkeSHGMf+XYKrrUBLeuwKgJzwqCyEqC8Itd1Hfv42l/P5aUdBnXCQs4xVtV/vC6d 2q/A== X-Gm-Message-State: AOUpUlGzSXXujFj7tAKHgprCsxjXRotw3QjAI4Hso951IVzPBNAhyH+b XeDD7eRo0X6YiKzy5uNB/weiA6A6fHk= X-Google-Smtp-Source: AA+uWPxRUp66ytJkiTvqeLFIs2e+WOLXwcWwRKNWtMJhdb7p4K+unIydBX+yyEB9FtcbFYpa9EZRGQ== X-Received: by 2002:a17:902:6b:: with SMTP id 98-v6mr32165119pla.68.1534495676279; Fri, 17 Aug 2018 01:47:56 -0700 (PDT) Received: from chrisp-dl.ws.atlnz.lc ([2001:df5:b000:22:3a2c:4aff:fe70:2b02]) by smtp.gmail.com with ESMTPSA id 143-v6sm2336484pfy.156.2018.08.17.01.47.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 17 Aug 2018 01:47:55 -0700 (PDT) From: Chris Packham To: u-boot@lists.denx.de Date: Fri, 17 Aug 2018 20:47:42 +1200 Message-Id: <20180817084742.11628-2-judge.packham@gmail.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180817084742.11628-1-judge.packham@gmail.com> References: <20180817084742.11628-1-judge.packham@gmail.com> Cc: Tom Rini , Baruch Siach , Prafulla Wadaskar , Luka Perkov , Stefan Roese , Chris Packham Subject: [U-Boot] [PATCH v2 2/2] ARM: mach-mvebu: handle fall-back to UART boot X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" The bootROM in the Armada-38x (and similar) SoC has two modes for UART boot. The first is when the normal boot media is blank (or otherwise missing the kwb header). The second is when the boot sequence has been interrupted with the magic byte sequence on the UART lines. In the first mode the bootROM routine and error code register will indicate that there was an error booting from the configured media in bits 7:0. In the second mode there is no error to indicate but the boot source is provided via bits 31:28. Handle both situations so that kwboot can be used for both boot strapping a blank board and for intercepting a regular boot sequence. Signed-off-by: Chris Packham Signed-off-by: Sean Nyekjaer --- I think this probably applies to more than just the A38X but I've been conservative in restricting this for now. If other Marvell SoCs are found to have the same behaviour we can extend this to cover them. Changes in v2: - new arch/arm/mach-mvebu/include/mach/soc.h | 2 ++ arch/arm/mach-mvebu/spl.c | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/arch/arm/mach-mvebu/include/mach/soc.h b/arch/arm/mach-mvebu/include/mach/soc.h index 660dd148abc5..6e2e14efe0b7 100644 --- a/arch/arm/mach-mvebu/include/mach/soc.h +++ b/arch/arm/mach-mvebu/include/mach/soc.h @@ -114,6 +114,8 @@ #define BOOTROM_ERR_MODE_OFFS 28 #define BOOTROM_ERR_MODE_MASK (0xf << BOOTROM_ERR_MODE_OFFS) #define BOOTROM_ERR_MODE_UART 0x6 +#define BOOTROM_ERR_CODE_OFFS 0 +#define BOOTROM_ERR_CODE_MASK (0xf << BOOTROM_ERR_CODE_OFFS) #if defined(CONFIG_ARMADA_375) /* SAR values for Armada 375 */ diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c index 4c3933b8354d..9dd7c84b6874 100644 --- a/arch/arm/mach-mvebu/spl.c +++ b/arch/arm/mach-mvebu/spl.c @@ -28,6 +28,16 @@ static u32 get_boot_device(void) if (boot_device == BOOTROM_ERR_MODE_UART) return BOOT_DEVICE_UART; +#ifdef CONFIG_ARMADA_38X + /* + * If the bootrom error code contains any other than zeros it's an + * error condition and the bootROM has fallen back to UART boot + */ + boot_device = (val & BOOTROM_ERR_CODE_MASK) >> BOOTROM_ERR_CODE_OFFS; + if (boot_device) + return BOOT_DEVICE_UART; +#endif + /* * Now check the SAR register for the strapped boot-device */