From patchwork Tue Jul 21 15:06:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1543 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 977403F08B for ; Tue, 21 Jul 2020 17:06:36 +0200 (CEST) Received: by mail-pj1-f71.google.com with SMTP id a19sf2347362pjq.9 for ; Tue, 21 Jul 2020 08:06:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1595343995; cv=pass; d=google.com; s=arc-20160816; b=V9NWkFARQ621PpdID4NkDsB6pqIegpnoMNp1z9D64ox1TvEQ7xJHIyZ2jLW/FNDjEB ZlI5WO2J7/PDQ1O2TcV8UYjUemWSJoelMEzwK0gOqK26Ceu5s2hh8+F5yz9/z4zLrwMG W8Mgy7oWVP3pcHex0t0UBn4s9azBbThpkvO4IjA0rtTvLDAfcecAOMoKie4ZS1ygMurJ VAOuapMdyIP7HfbvD4pJA1KzbL2BZSrFGsGMMuJ2k4zkE6gHSdW3B68qCSR+9e7U8S76 98DJAVwgZQBvGcPn1GnaIufW4H4KwKlUUeRnSqqaDkUYPRVkWmS0Ilrk1tCQrKVJk+xM qQRw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=PhE4W2Hhn/4CCPQo2cH2jtR0e5CVcW5NChNl2EbXLpc=; b=xGCRTyVIp3uDQ4jKkvJ2xnK9vhl/wiHvyhlVEa2CQwh5MAuvhCB4fi6+9CR8U9BdtH WNdtnNxbZ/g7PKpfUnmyAkaDb2LkZdTfkzyhWu/ql4aD2KnqcXJ2WNtFZz9p11VDgLpu jBsAEcEqw50hKmd+VyfGQZrHurUi9ZT7aZ4Z3TtoO0YD8af8qz1h2IjcXUtqhriV21Fd E7aW92QBOqJHv6VXDUVZJAXJDGU81tP9XC4rcymiDGdpO3RrYCuVxo/Z9B5HGhJHacwc JU6uwIIA6HSwA+M74O0ddVpl1IzDR55zzWoya8kRDNgeWxM4WLIl17AsgZ+bLLLUguUB BW8w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Vrw6fIY7; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=PhE4W2Hhn/4CCPQo2cH2jtR0e5CVcW5NChNl2EbXLpc=; b=pvpNGWnFdj1Kn4/qjrC3q622qWqON8NZ78tpUEEGWq4nKBhrCh7R/9b7es1N+Zq38x mQdTU/RyZMuM4yyVCc2+gHcq3fBtpQ0Sb9hU1fnPfYzZOYtXWtM8FYIfVfi42P1V661A 25wkRxD+uORPpbFXiwjzwV5+FSCLypVc6MMUc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=PhE4W2Hhn/4CCPQo2cH2jtR0e5CVcW5NChNl2EbXLpc=; b=odk6tGcR/WWTkj3JyPcJQdpXjgieIdJUp+5prvrJpSpL/U3t0b29C2QFVfn9iM+Z5z inEvam2gJK5dDehuqANW+Q+qUOyVShrd3EuS+34W3Fo2XpBlyh0l+4u0uvJxUEflI/vt S+T0pZDRoAjYp9+KI+nHG/E6JHnGtbrrviUt0j3ph2vwWWgGXdT9MwjlXfb7vsFwYnmV QME0BVSmUIDef///Z7rpBVMNcQc89Us2k+/KIWlvnawhFiOpux+8WK8jUPWUZqOM7RpV 8qHxWUEOLuGvX+qvUCqx3X28J3xMCy9jy296J6Rh1aojMtf3FsUHgJnH4AORDsABJ6Ta crEg== X-Gm-Message-State: AOAM531ovf2uivzdDBIhNNHRJvDUL0vF9F33YJ4UxGlwtvQ+PnzZMSur qWLE864iVVLn4UoFWA/yFr7OW/l6 X-Google-Smtp-Source: ABdhPJzas2aZXqCkEsM3Q33T/F/2ikTEEYYU1aOlogjLALlu0ahg+0tXqiM1usbjOISfAXiHig2SKg== X-Received: by 2002:a17:90b:1296:: with SMTP id fw22mr5337000pjb.20.1595343995332; Tue, 21 Jul 2020 08:06:35 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:be15:: with SMTP id r21ls2893503pls.11.gmail; Tue, 21 Jul 2020 08:06:35 -0700 (PDT) X-Received: by 2002:a17:90a:d56:: with SMTP id 22mr4691678pju.58.1595343994773; Tue, 21 Jul 2020 08:06:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595343994; cv=none; d=google.com; s=arc-20160816; b=BSdpQL+OsyCBR00+wxrBKAzyUI1q9CV2J1tns9BVX90cCZC6QmYFL1P9RKC7wKgijd +sWzfiMAC23Y7+B+cpdtV3jBwSuAHXEiOdCOsLuQkyoMcPElqJgLtPnr8DN+XQ/rRDRq Y8auMmefpFz5sejGohVugpAG1EXNJc2DqDpvM+DhXklRaOWA4n2rX5cCh5XktiRgp00I niy/LN27L+r52d9SH3xbUevTe50vemw2r3b69YLaSRJ6eokGDVkERC0fDewWs8Io2/ly p3CX+7gqd0lNoMDNp9ZjTrMN3PrTeBT9yAcv1l98TTaiQ2v+fWSLveIXaeAmxLt0ZcSB BuFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=kJTvxFddUezOXB+bSIzZegS7m7D3F2NiD9ttg+cfFJc=; b=IU4YlQuW1UVQ5oxBwCOG+h3NLb7Z7/74kFXtSSLBZXqU/nzu75o7STKdgIwrt3RuuR WG2/wq2pvk2w0RCo++5bvD2KMDEX+/ad5HSuu29wIBrpvhY13yKvw5HgD7IP//vOny3c M2Egb+SIpLr8KreNUHEpSSG3B6jr/BHZhYFBebSWUWTjWzcW9+QaM9M3bbGZXuZM21aI IH0emqLwhhZkfniJU3d4xWObIz/lHeaC9zdFAGDvFjMERIilEotQr41L9zswELfLYZm8 VkZUF+5OYCY9Xugw4/pQkDC2U29UGKpKCpHR2F0zFCHPQd2cZ63N/IeIm6P+SCiQLarP XE9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Vrw6fIY7; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id x10sor25921748plb.9.2020.07.21.08.06.34 for (Google Transport Security); Tue, 21 Jul 2020 08:06:34 -0700 (PDT) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; X-Received: by 2002:a17:902:988b:: with SMTP id s11mr21597336plp.229.1595343994295; Tue, 21 Jul 2020 08:06:34 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:3df7:ef76:b2b5:fa14]) by smtp.gmail.com with ESMTPSA id h9sm20671276pfk.155.2020.07.21.08.06.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jul 2020 08:06:33 -0700 (PDT) From: Jagan Teki To: Kever Yang , Philipp Tomsich , Simon Glass Cc: Suniel Mahesh , U-Boot-Denx , linux-rockchip@lists.infradead.org, linux-amarula , Jagan Teki Subject: [PATCH v6 4/5] rockchip: Separate the reset cause from display cpuinfo Date: Tue, 21 Jul 2020 20:36:03 +0530 Message-Id: <20200721150604.35410-5-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200721150604.35410-1-jagan@amarulasolutions.com> References: <20200721150604.35410-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Vrw6fIY7; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , reset cause is a generic functionality based on the soc cru registers in rockchip. This can be used for printing the cause of reset in cpuinfo or some other place where reset cause is needed.  Other than cpuinfo, reset cause can also be using during bootcount for checking the specific reset cause and glow the led based on the reset cause. So, let's separate the reset cause code from cpuinfo, and add a check to build it for rk3399, rk3288 since these two soc are supporting reset cause as of now. Tested-by: Suniel Mahesh Signed-off-by: Jagan Teki Reviewed-by: Kever Yang --- Changes for v6: - collect Kever r-b arch/arm/include/asm/arch-rockchip/cru.h | 2 ++ arch/arm/mach-rockchip/Makefile | 5 ++++- arch/arm/mach-rockchip/cpu-info.c | 20 ++++++++++++-------- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/arch/arm/include/asm/arch-rockchip/cru.h b/arch/arm/include/asm/arch-rockchip/cru.h index d2057cb738..13ea4aba8e 100644 --- a/arch/arm/include/asm/arch-rockchip/cru.h +++ b/arch/arm/include/asm/arch-rockchip/cru.h @@ -30,4 +30,6 @@ enum { #define MHz 1000000 +char *get_reset_cause(void); + #endif /* _ROCKCHIP_CLOCK_H */ diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile index 5b38526fe0..121f23a563 100644 --- a/arch/arm/mach-rockchip/Makefile +++ b/arch/arm/mach-rockchip/Makefile @@ -22,11 +22,14 @@ ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),) # we can have the preprocessor correctly recognise both 0x0 and 0 # meaning "turn it off". obj-y += boot_mode.o -obj-$(CONFIG_DISPLAY_CPUINFO) += cpu-info.o obj-$(CONFIG_ROCKCHIP_COMMON_BOARD) += board.o obj-$(CONFIG_MISC_INIT_R) += misc.o endif +ifeq ($(CONFIG_TPL_BUILD),) +obj-$(CONFIG_DISPLAY_CPUINFO) += cpu-info.o +endif + obj-$(CONFIG_$(SPL_TPL_)RAM) += sdram.o obj-$(CONFIG_ROCKCHIP_PX30) += px30/ diff --git a/arch/arm/mach-rockchip/cpu-info.c b/arch/arm/mach-rockchip/cpu-info.c index bb5a198039..d0f030109f 100644 --- a/arch/arm/mach-rockchip/cpu-info.c +++ b/arch/arm/mach-rockchip/cpu-info.c @@ -13,7 +13,7 @@ #include #include -static char *get_reset_cause(void) +char *get_reset_cause(void) { struct rockchip_cru *cru = rockchip_get_cru(); char *cause = NULL; @@ -41,21 +41,25 @@ static char *get_reset_cause(void) cause = "unknown reset"; } - /** - * reset_reason env is used by rk3288, due to special use case - * to figure it the boot behavior. so keep this as it is. - */ - env_set("reset_reason", cause); - return cause; } +#if CONFIG_IS_ENABLED(DISPLAY_CPUINFO) int print_cpuinfo(void) { + char *cause = get_reset_cause(); + printf("SoC: Rockchip %s\n", CONFIG_SYS_SOC); - printf("Reset cause: %s\n", get_reset_cause()); + printf("Reset cause: %s\n", cause); + + /** + * reset_reason env is used by rk3288, due to special use case + * to figure it the boot behavior. so keep this as it is. + */ + env_set("reset_reason", cause); /* TODO print operating temparature and clock */ return 0; } +#endif