Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16E9AC433F5 for ; Wed, 3 Nov 2021 13:16:58 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9508461076 for ; Wed, 3 Nov 2021 13:16:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9508461076 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F3DA18364F; Wed, 3 Nov 2021 14:16:37 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="fPt/j04+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E0C8C8314A; Wed, 3 Nov 2021 14:16:31 +0100 (CET) Received: from mail-io1-xd30.google.com (mail-io1-xd30.google.com [IPv6:2607:f8b0:4864:20::d30]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id CFE3D8347E for ; Wed, 3 Nov 2021 14:16:24 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd30.google.com with SMTP id g8so2639254iob.10 for ; Wed, 03 Nov 2021 06:16:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=obEFF+/zWCjk1AHaH3ZJse6KHTSNt/KvignKXg6U1Ps=; b=fPt/j04+S+LUecoddiCyrPyAlpmcxA1N+kA1UY1HADYV3FQaVouwcjabhYMnwT+g8a smMyCt0uW4ByD19tO7wyKqseIQJb0aeaUX/bbZgmatAauUo/UJ0lj0u/3Ts76WKY2ejj Zn49UCt/szPivlYzKtrN+Nyu47TR08Uyu+Ogc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=obEFF+/zWCjk1AHaH3ZJse6KHTSNt/KvignKXg6U1Ps=; b=kl5NJWVtAwgkCWcW1QYDyEaJHQSs2YjxDjp4OrYvu2BHJrjCF3YBrDK60lf0vPWWVa Png0n6B0rNqtIPR3/2yLbes0O8qRcrFKAc77iK22hxru018lLbQrfjtfVbhd3rNyIYHJ LsJjZ59I7JI8OuCmwNfZbHSexjsDevxbd+deRzQDxYeGhuiJjswT/m/yK0cesPJTDZnJ blYEJ3Db1upGe8egma4J0oV9LeazHXpuXlRM/S6MIo8xJWO5rdCFUxPcuVDtRdq+KSyx e6iEDSomGvHXsTcgF5JO8qo2zXbnIpDtfRz+rXKL2RM/gcuqtDsvWjMJauFcLgMEdRrr nKPA== X-Gm-Message-State: AOAM531CG+bBw6Jy+BLMvuGNBzM7zuqSLS6OJMxGiyi2+nMmrN6YQYMA ZznoknmBUi5pEYZCLk1QDAbp4UHrAWCPiA== X-Google-Smtp-Source: ABdhPJztzG/VAv2K/cazYzV2Peu0JCgXqcJLPTC+SuQOElpFMyJjlnQUELoDlEtSUmMfue0mlf5nKg== X-Received: by 2002:a5d:9b0f:: with SMTP id y15mr31247126ion.5.1635945383447; Wed, 03 Nov 2021 06:16:23 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id k7sm978204iob.7.2021.11.03.06.16.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Nov 2021 06:16:23 -0700 (PDT) From: Simon Glass To: u-boot@lists.denx.de Cc: Tom Rini , Albert Aribaud , Simon Glass , Artem Lapkin , Kever Yang , Philipp Tomsich Subject: [PATCH 4/4] rk3399: Don't enable the debug UART if there is no driver Date: Wed, 3 Nov 2021 07:16:08 -0600 Message-Id: <20211103131608.2213320-5-sjg@chromium.org> X-Mailer: git-send-email 2.33.1.1089.g2158813163f-goog In-Reply-To: <20211103131608.2213320-1-sjg@chromium.org> References: <20211103131608.2213320-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Some boards do not enable SPL_SERIAL so cannot use the debug UART. Add this condition to the code and drop use of the preprocessor while we are here. Signed-off-by: Simon Glass --- arch/arm/mach-rockchip/rk3399/rk3399.c | 34 ++++++++++++++------------ 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/arch/arm/mach-rockchip/rk3399/rk3399.c b/arch/arm/mach-rockchip/rk3399/rk3399.c index 2bc8e60b99b..d40969c8889 100644 --- a/arch/arm/mach-rockchip/rk3399/rk3399.c +++ b/arch/arm/mach-rockchip/rk3399/rk3399.c @@ -118,10 +118,6 @@ void board_debug_uart_init(void) #define GPIO0_BASE 0xff720000 #define PMUGRF_BASE 0xff320000 struct rk3399_grf_regs * const grf = (void *)GRF_BASE; -#ifdef CONFIG_TARGET_CHROMEBOOK_BOB - struct rk3399_pmugrf_regs * const pmugrf = (void *)PMUGRF_BASE; - struct rockchip_gpio_regs * const gpio = (void *)GPIO0_BASE; -#endif #if defined(CONFIG_DEBUG_UART_BASE) && (CONFIG_DEBUG_UART_BASE == 0xff180000) /* Enable early UART0 on the RK3399 */ @@ -140,19 +136,25 @@ void board_debug_uart_init(void) GRF_GPIO3B7_SEL_MASK, GRF_UART3_SOUT << GRF_GPIO3B7_SEL_SHIFT); #else -# ifdef CONFIG_TARGET_CHROMEBOOK_BOB - rk_setreg(&grf->io_vsel, 1 << 0); - - /* - * Let's enable these power rails here, we are already running the SPI - * Flash based code. - */ - spl_gpio_output(gpio, GPIO(BANK_B, 2), 1); /* PP1500_EN */ - spl_gpio_set_pull(&pmugrf->gpio0_p, GPIO(BANK_B, 2), GPIO_PULL_NORMAL); + struct rk3399_pmugrf_regs * const pmugrf = (void *)PMUGRF_BASE; + struct rockchip_gpio_regs * const gpio = (void *)GPIO0_BASE; - spl_gpio_output(gpio, GPIO(BANK_B, 4), 1); /* PP3000_EN */ - spl_gpio_set_pull(&pmugrf->gpio0_p, GPIO(BANK_B, 4), GPIO_PULL_NORMAL); -#endif /* CONFIG_TARGET_CHROMEBOOK_BOB */ + if (IS_ENABLED(CONFIG_SPL_BUILD) && + IS_ENABLED(CONFIG_TARGET_CHROMEBOOK_BOB)) { + rk_setreg(&grf->io_vsel, 1 << 0); + + /* + * Let's enable these power rails here, we are already running + * the SPI-Flash-based code. + */ + spl_gpio_output(gpio, GPIO(BANK_B, 2), 1); /* PP1500_EN */ + spl_gpio_set_pull(&pmugrf->gpio0_p, GPIO(BANK_B, 2), + GPIO_PULL_NORMAL); + + spl_gpio_output(gpio, GPIO(BANK_B, 4), 1); /* PP3000_EN */ + spl_gpio_set_pull(&pmugrf->gpio0_p, GPIO(BANK_B, 4), + GPIO_PULL_NORMAL); + } /* Enable early UART2 channel C on the RK3399 */ rk_clrsetreg(&grf->gpio4c_iomux, -- 2.33.1.1089.g2158813163f-goog