From patchwork Mon Oct 1 18:22:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 977386 X-Patchwork-Delegate: sjg@chromium.org 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=chromium.org Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42P9yY3Jpnz9s3l for ; Tue, 2 Oct 2018 04:38:13 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 06597C21FA5; Mon, 1 Oct 2018 18:33:50 +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=RCVD_IN_DNSWL_BLOCKED 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 D93B2C21FF9; Mon, 1 Oct 2018 18:23:53 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 19E5EC22014; Mon, 1 Oct 2018 18:23:42 +0000 (UTC) Received: from mail-it1-f202.google.com (mail-it1-f202.google.com [209.85.166.202]) by lists.denx.de (Postfix) with ESMTPS id 8F709C21F35 for ; Mon, 1 Oct 2018 18:23:31 +0000 (UTC) Received: by mail-it1-f202.google.com with SMTP id i188-v6so12056449itf.6 for ; Mon, 01 Oct 2018 11:23:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=N+Tvfs/Fpn1dHWG29845L9vyYpKUshci41VsoH++ifI=; b=EfY6imkxy96sB/6HdcUA2gMCQGuSSnHsIiJSLcqX/1QCTSF5IsIV16p1Pqeu//9wjQ S95A2/5Zj6w6DmAKc9HXStT45Vw3EWOYiW4Q5/15qAERuDVo1IYy6nh1RTHyrocH/b0b s4E9ikaze0Zfw/FyIjsZy2e8xB7JqYb2aPYD6r6RsVoyoTm1CFMMI5479UD3+G3U52DK 9nnozZXVtM4UQ0oylCrvrL9yEkTIfJhxp5Bvox+olT4pP32U3mS+wIgInZoLlyTVOf0J K3zMdE78i1zWspGhNhA2U4EWOXCKOfgx0BdcotzasFdFET7qKRvofjvOQmjNEnW9OyMt 35lw== X-Gm-Message-State: ABuFfogpp4ekErD5aydUT+GBVqlPVzpwTXZSlKZWqhgMofMNGTe7iXLE lyW2oDE22r8qB08FFvSToAfkCE8= X-Google-Smtp-Source: ACcGV60DRtnRfBukTG5m0XEeIJZpvdTv2nL7pnIpnmAd+5Hy69fQvLUk6H6rJzayP5AEjKXlL6415XI= X-Received: by 2002:a24:2414:: with SMTP id f20-v6mr11752542ita.0.1538418210625; Mon, 01 Oct 2018 11:23:30 -0700 (PDT) Date: Mon, 1 Oct 2018 12:22:20 -0600 In-Reply-To: <20181001182249.129565-1-sjg@chromium.org> Message-Id: <20181001182249.129565-17-sjg@chromium.org> Mime-Version: 1.0 References: <20181001182249.129565-1-sjg@chromium.org> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog From: Simon Glass To: U-Boot Mailing List Subject: [U-Boot] [PATCH 16/45] serial: Allow serial to be absent in TPL 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" At present this option applies to SPL, but it should be available in TPL also, and separately. Change to using CONFIG_IS_ENABLED(), add a new Kconfig option and fix up hang(). Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- drivers/serial/Kconfig | 10 ++++++++++ drivers/serial/serial-uclass.c | 4 ++++ lib/hang.c | 5 +++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index 83f8c94d028..597db4b9cbb 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig @@ -53,6 +53,16 @@ config SPL_SERIAL_PRESENT This option enables the full UART in SPL, so if is it disabled, the full UART driver will be omitted, thus saving space. +config TPL_SERIAL_PRESENT + bool "Provide a serial driver in TPL" + depends on DM_SERIAL + default y + help + In very space-constrained devices even the full UART driver is too + large. In this case the debug UART can still be used in some cases. + This option enables the full UART in TPL, so if is it disabled, + the full UART driver will be omitted, thus saving space. + # Logic to allow us to use the imply keyword to set what the default port # should be. The default is otherwise 1. config CONS_INDEX_0 diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c index ffdcae09318..e50f0aa8510 100644 --- a/drivers/serial/serial-uclass.c +++ b/drivers/serial/serial-uclass.c @@ -26,6 +26,7 @@ static const unsigned long baudrate_table[] = CONFIG_SYS_BAUDRATE_TABLE; #error "Serial is required before relocation - define CONFIG_$(SPL_)SYS_MALLOC_F_LEN to make this work" #endif +#if CONFIG_IS_ENABLED(SERIAL_PRESENT) static int serial_check_stdout(const void *blob, struct udevice **devp) { int node; @@ -150,12 +151,15 @@ static void serial_find_console_or_panic(void) panic_str("No serial driver found"); #endif } +#endif /* CONFIG_SERIAL_PRESENT */ /* Called prior to relocation */ int serial_init(void) { +#if CONFIG_IS_ENABLED(SERIAL_PRESENT) serial_find_console_or_panic(); gd->flags |= GD_FLG_SERIAL_READY; +#endif return 0; } diff --git a/lib/hang.c b/lib/hang.c index bf56f4c662a..c5a78694be6 100644 --- a/lib/hang.c +++ b/lib/hang.c @@ -20,8 +20,9 @@ */ void hang(void) { -#if !defined(CONFIG_SPL_BUILD) || (defined(CONFIG_SPL_LIBCOMMON_SUPPORT) && \ - defined(CONFIG_SPL_SERIAL_SUPPORT)) +#if !defined(CONFIG_SPL_BUILD) || \ + (CONFIG_IS_ENABLED(LIBCOMMON_SUPPORT) && \ + CONFIG_IS_ENABLED(SERIAL_SUPPORT)) puts("### ERROR ### Please RESET the board ###\n"); #endif bootstage_error(BOOTSTAGE_ID_NEED_RESET);