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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 3C056C433F5 for ; Thu, 30 Dec 2021 16:49:01 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 533A582FAF; Thu, 30 Dec 2021 17:48:49 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="fn3ttt1K"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8311281277; Thu, 30 Dec 2021 17:48:41 +0100 (CET) Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) (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 0ECEA81277 for ; Thu, 30 Dec 2021 17:48:36 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jbx6244@gmail.com Received: by mail-ed1-x529.google.com with SMTP id j6so100049578edw.12 for ; Thu, 30 Dec 2021 08:48:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wPPjmsVRo70uI3fzDk1kNYTly9bGS6skpXIBrTUbShc=; b=fn3ttt1K680JLyzJUPLAlrFY78L9QBsONnYmzVKgXXpCIsKNFiD/CawU0n9FWU/a45 87WP91zc/IIHphlNpJ13CT6OD70cTvHNH2C7y8pIYOEmrhoIT7Ay5CH4Fok0dkq+cinF DenWxCi8o9yZd0mF2wkZdB5yNQFaQnwoylVQRC0egtoiZYk/xk26TfsjWH4QK23Odsfk w0lJM82lDQf9Y8XchkifljvNP09b7IcyM00tufnVjwJZWx8jsg4T/rQVEutZ2WJjvQYT Wa/rE81C/BBw7mZik0lB7S9vPnaVKL6XeXPnpEBQZhAVsrGNCtLpXPYyj4CfhoIDqpR5 yvJA== 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=wPPjmsVRo70uI3fzDk1kNYTly9bGS6skpXIBrTUbShc=; b=GlZG4mPr3oG96nRJSp4W4foX76LRLlp3YnLcewxNa+IGkzQ7JbvJf0azWRLyk0bnMc TXZhnsYrJYiDJ9p6pbRAK/aa3eCpomoGeOPZiuu7OyaUobme+EybjZ0VLX6U6fO8D2q4 2JbB0uop2fr8M0TARlDa8H6Sb5uP/vyZwo4mtCPiBBxUg3dX+Qup31MafKuIUKQL+kwC ALURDztBzDCSRcTNrUyCtT8QHHaY57s4QJv7eErTMh2UB0sHCBmE/PG4qai7DndbbiZI 7Qf+JydBNUba9eIxy9dOdtem4FIeuIipEVAwcZMWQVtHu3T89UrWxPtBAf//yrsdNDrK F4wg== X-Gm-Message-State: AOAM53212LGgM7mKFkbL5w8Il0foMAwpuQpxzvGha7JEvVM8VOQ2HbTJ ugegmlD1feZnZp09xb69gCA= X-Google-Smtp-Source: ABdhPJwibUcJYJzSXlfmb/2fI72KNRbqYQY/RULxNHI05XP/ZKydPdFojIpIwzFGnekk+fFt5Yw6oA== X-Received: by 2002:a05:6402:51cd:: with SMTP id r13mr30702689edd.184.1640882915755; Thu, 30 Dec 2021 08:48:35 -0800 (PST) Received: from debian.home (81-204-249-205.fixed.kpn.net. [81.204.249.205]) by smtp.gmail.com with ESMTPSA id f27sm7804046ejc.137.2021.12.30.08.48.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Dec 2021 08:48:35 -0800 (PST) From: Johan Jonker To: kever.yang@rock-chips.com Cc: sjg@chromium.org, philipp.tomsich@vrull.eu, u-boot@lists.denx.de Subject: [PATCH v3 3/6] rockchip: spl: change call condition rockchip_stimer_init() Date: Thu, 30 Dec 2021 17:48:22 +0100 Message-Id: <20211230164825.6489-3-jbx6244@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211230164825.6489-1-jbx6244@gmail.com> References: <20211230164825.6489-1-jbx6244@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 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 The Rockchip SoCs rk3066/rk3188 have no CONFIG_ROCKCHIP_STIMER_BASE defined. Currently only rk3188 has an exception. Make this more generic and call the function rockchip_stimer_init() only when CONFIG_ROCKCHIP_STIMER_BASE is available. Signed-off-by: Johan Jonker --- Changed V3: use CONFIG_ROCKCHIP_STIMER Changed V2: use IS_ENABLED add include kconfig.h move define location so that rockchip_stimer_init() is always visible to the compiler --- arch/arm/mach-rockchip/spl.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-rockchip/spl.c b/arch/arm/mach-rockchip/spl.c index 02c40fb3..1dac3805 100644 --- a/arch/arm/mach-rockchip/spl.c +++ b/arch/arm/mach-rockchip/spl.c @@ -16,6 +16,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -70,7 +71,6 @@ u32 spl_mmc_boot_mode(const u32 boot_device) return MMCSD_MODE_RAW; } -#if !defined(CONFIG_ROCKCHIP_RK3188) #define TIMER_LOAD_COUNT_L 0x00 #define TIMER_LOAD_COUNT_H 0x04 #define TIMER_CONTROL_REG 0x10 @@ -80,6 +80,7 @@ u32 spl_mmc_boot_mode(const u32 boot_device) __weak void rockchip_stimer_init(void) { +#if defined(CONFIG_ROCKCHIP_STIMER_BASE) /* If Timer already enabled, don't re-init it */ u32 reg = readl(CONFIG_ROCKCHIP_STIMER_BASE + TIMER_CONTROL_REG); @@ -94,8 +95,8 @@ __weak void rockchip_stimer_init(void) writel(0xffffffff, CONFIG_ROCKCHIP_STIMER_BASE + 4); writel(TIMER_EN | TIMER_FMODE, CONFIG_ROCKCHIP_STIMER_BASE + TIMER_CONTROL_REG); -} #endif +} __weak int board_early_init_f(void) { @@ -132,9 +133,11 @@ void board_init_f(ulong dummy) hang(); } arch_cpu_init(); -#if !defined(CONFIG_ROCKCHIP_RK3188) - rockchip_stimer_init(); -#endif + + /* Init secure timer */ + if (IS_ENABLED(CONFIG_ROCKCHIP_STIMER)) + rockchip_stimer_init(); + #ifdef CONFIG_SYS_ARCH_TIMER /* Init ARM arch timer in arch/arm/cpu/armv7/arch_timer.c */ timer_init(); -- 2.20.1