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 08533C433F5 for ; Sun, 3 Apr 2022 23:09:33 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5BCC283C80; Mon, 4 Apr 2022 01:08:27 +0200 (CEST) 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="BREZUNJP"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D810C83C0E; Mon, 4 Apr 2022 01:07:27 +0200 (CEST) Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) (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 9288F83B44 for ; Mon, 4 Apr 2022 01:07:07 +0200 (CEST) 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-ej1-x629.google.com with SMTP id i27so9355347ejd.9 for ; Sun, 03 Apr 2022 16:07:07 -0700 (PDT) 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=qNaIVinnjyTEdVWuLf6tj77yjEVId1Eqi/bzuww+39Y=; b=BREZUNJP+Y09zsfOdV9ghUJptLd1gnQkpBwpwt8CeoDdlYExIVT771YiqpzN4aKlqj dBQeVj0PT1ytpwjTahVClp3ickx8eT3Ic+whdemEpBBrtOjmOddXJsI7uwuNzqkfYCFZ ibR+HkB53JskUs2OCU9aYj1c1Z1150pqX50p++ZpDe/GXEU2wFCQJyKDhblIT2MAjSVH yzx2wUQkMdnA+HQy+N6xWvhBkM+ywNTgT8eJq30kPK2uUvgZ7iW85w4f5+08hamoQLXc m2XqqiEg7gYxjxIUS9nVG8hW2w8TEYnzRpUKh8C37DLtmejxKpqgy2T2nIGssQ3rKdEO R3xg== 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=qNaIVinnjyTEdVWuLf6tj77yjEVId1Eqi/bzuww+39Y=; b=ePC/KL2OAHB8lPpA2pcZOAGPhjXo0gFUuKKh6IM46Z10VbFOFt84C6uMUn+6S9aNwK GlKuwyWX4pqcsMosG0XAfdB3/qzsgQlAWgjBKJkxcnk544Wi3eQ1vMjJSKMRQpVbrodK VNTkMYp7Qbx5F0xT1vckRVjCW+HSi50dYh4Jtq/bksqvOlgkyHyVYJRnjpaIvKiDWhKz n8g5U6mACIuPRpy8y33amT1WWv74RZo1HxOKDrVG3JAiLTqr0gBp3px1LcwjbtTO3B9d qD8mYMQtEVr9ykeaGX/Odn4eB8G9qZzrX97Qy8KMSN21PIj6rvtjrelUtDKwmNG1jNCS BKPg== X-Gm-Message-State: AOAM533IToKUZcd7v64jzLiyQUtrMs1w690EBq3SzoBHvv106jTg/KmI SEA4cVttm6K1prsO1yUTI0Y= X-Google-Smtp-Source: ABdhPJy4W3LNXhG4zrYiH7jC5srkfO0ECeDUAE0TdOX4o31RgAteCLcWB/6F1ob2eZeyw+JDm6tX9g== X-Received: by 2002:a17:907:2d90:b0:6db:729e:7f25 with SMTP id gt16-20020a1709072d9000b006db729e7f25mr8536471ejc.203.1649027227003; Sun, 03 Apr 2022 16:07:07 -0700 (PDT) Received: from debian.home (81-204-249-205.fixed.kpn.net. [81.204.249.205]) by smtp.gmail.com with ESMTPSA id c14-20020a170906340e00b006ce98f2581asm3645597ejb.205.2022.04.03.16.07.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Apr 2022 16:07:06 -0700 (PDT) From: Johan Jonker To: kever.yang@rock-chips.com Cc: sjg@chromium.org, philipp.tomsich@vrull.eu, heiko@sntech.de, peng.fan@nxp.com, jh80.chung@samsung.com, u-boot@lists.denx.de Subject: [PATCH v4 02/12] rockchip: spl: change call condition rockchip_stimer_init() Date: Mon, 4 Apr 2022 01:06:49 +0200 Message-Id: <20220403230659.12039-3-jbx6244@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220403230659.12039-1-jbx6244@gmail.com> References: <20220403230659.12039-1-jbx6244@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.5 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 Reviewed-by: Simon Glass --- 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 7a8db632b8..0017ca71b0 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; @@ -71,7 +72,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 @@ -81,6 +81,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); @@ -95,8 +96,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) { @@ -133,9 +134,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