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 5A279C433EF for ; Wed, 29 Dec 2021 18:50:18 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8975181EB2; Wed, 29 Dec 2021 19:50:15 +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="CDSbX1oi"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 267238302C; Wed, 29 Dec 2021 17:59:03 +0100 (CET) Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) (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 091A7811BA for ; Wed, 29 Dec 2021 17:59:00 +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-x533.google.com with SMTP id z29so88461319edl.7 for ; Wed, 29 Dec 2021 08:59:00 -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:mime-version :content-transfer-encoding; bh=VGOTkqQc3IcycD/gMvdaZfZQwKkLuTR9h9zGsbXPS6g=; b=CDSbX1oi0B0ozvqZZbO/57AJ1YlZQ8NVonYoPVcAJ4Vyra4Qlu1M69RHVGAjes0tHV pvIrpRA8sOKkBqxDaESlVnKVTC7VcPjVSMrbaY/ndABwR8Pfp8UilAT4hKwY6dnqSKmy 1DXwYMKi6F0DZeHpCV2rN5jhV0aw6sggjfA2mcSakDo8QYyao4krvOC/c23f6UXfnouB XOlzzHtOdGPAJtq9ELEF3SzOSAUov9EeccH6Cp9iRuFFZuItpU1/a75Be5EdE6Ozj1Cy lb5cNmH8oz5pP52s+1tCE3jkh3HFu8AzVL06BchX2JQyksiRba9/nrjJWPv22IMwD49o aNVg== 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:mime-version :content-transfer-encoding; bh=VGOTkqQc3IcycD/gMvdaZfZQwKkLuTR9h9zGsbXPS6g=; b=T4udBphpR9APwDkcMxr2Ke6DSsIgia6QnqE9SyTIBlSnxmp59mwZux1Zu1EIvArm3E dJS976QA7J7qYAb7d4EmHYYp5HHLMOfST5I2iPOYETx8mDJ3etqYW+oDeHVVaxnUz9ZM ns8WnWdemHVZrKBvT6YzduPyevVorHD1R1ENnIGdW5Oijdi6z57UH7mRm262YemBkTRh A9GXcXjcFzLDNM64NSbzQ0tS7thGXVD3IE8kzBJsnWrHqtKyxG05N3PefbeJNDkYcaAV IILgHMNYqS98J7XqGW5hJfGXEjxenCVmheeCwIXRrqwC6yMxNNX9/bpGfW/L8z69lg1K YcMA== X-Gm-Message-State: AOAM532gTPyxWhJCiP7/pnCqMZp3rIrOrNePsZ1ncFMw435cPRJO3Ke7 heVsCGowHL61uYNM5U6KTpg= X-Google-Smtp-Source: ABdhPJxSY+QeStRE7az0Vp/WmRdh6PDmGf1bBypGDzoH7wX9I4YqwOvn0pt38Ky1yl/nV8SKHLlWQQ== X-Received: by 2002:a17:906:1db2:: with SMTP id u18mr21518283ejh.729.1640797139637; Wed, 29 Dec 2021 08:58:59 -0800 (PST) Received: from debian.home (81-204-249-205.fixed.kpn.net. [81.204.249.205]) by smtp.gmail.com with ESMTPSA id g19sm8695051edr.6.2021.12.29.08.58.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Dec 2021 08:58:59 -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 v2 1/4] rockchip: spl: change call condition rockchip_stimer_init() Date: Wed, 29 Dec 2021 17:58:47 +0100 Message-Id: <20211229165850.6911-1-jbx6244@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Wed, 29 Dec 2021 19:50:14 +0100 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 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..31558415 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_BASE)) + 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