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: 11675845 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5101B6C1 for ; Tue, 21 Jul 2020 15:06:39 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2BA0A206E3 for ; Tue, 21 Jul 2020 15:06:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="jpM090bT"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="Vrw6fIY7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2BA0A206E3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=DELc1fymUQW3OUPklVxskJIKsOYXW79CE9IYU4ltjLI=; b=jpM090bT5tU2gXfY/+jEyH3sj THzXaqnf2KkULJeWFKnX4QIHIUGVoaWFeYOGz08nx50fZh3jCvFk2UFckmm4GCFwdn74SmfdX4ZiD 3wbnHIf7zOyOkZ/vtw3YdQubBXrBqZ+IIXkFxVPHHMXbZH19JUU8FTmx8bEyz22RaGJ9zk261mZmr bg9hjMnODZbeRlF2pE7iSfvPFtF4uP6UfSYWpn+BiChAqCM32dQ/Pk7cwK2PrfP91wk+VXL+vWA0F QWYdJw3cyhWBHPnqiJg4EZUwTQ7kGMgDTRqFokEP2ddL2RW6Z9ykwwqlAtRNnucaSNOxKSg68SVL0 uLqaNmWQw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxtqo-0007QN-Ew; Tue, 21 Jul 2020 15:06:38 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxtqm-0007Oo-9y for linux-rockchip@lists.infradead.org; Tue, 21 Jul 2020 15:06:37 +0000 Received: by mail-pl1-x643.google.com with SMTP id t6so10388386plo.3 for ; Tue, 21 Jul 2020 08:06:35 -0700 (PDT) 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; bh=kJTvxFddUezOXB+bSIzZegS7m7D3F2NiD9ttg+cfFJc=; b=Vrw6fIY7rbvWJWt6FUpD0CwpXCOgAuljkwJvFxke2DBWsALPT+YDUjGKPr2IQu8Btx l6+iT2NPojs9QZa4D5JZHP6ybhQMZEhXy2Su5OyKYn5MOsepBL5Bv9Oa4T8HaUqLwkv7 WpZsw8Ke7Jh7wIZ63cwlEKjImaGstLPAkLGdk= 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; bh=kJTvxFddUezOXB+bSIzZegS7m7D3F2NiD9ttg+cfFJc=; b=dg/7E1wh1pS0D4PxHH5YSML9zk09lHn4bHnkCJAdfJ7vRvcqI2MW3SzzQODhIUX4by repniuEQldM9NEA/i5XB2rEjFWsHkSrovLw9O+p9R4vpRWicMaOEw0lgYkEbRQp+xkTc CoXVC3M9fnjnz46Ol4yZP7nuI9fqmUP15IbMTzn5UOpnXdCMKTnbPBq8SWBqmyInJf25 d+qISX1ec2bxANql6e6BMiOvsj3pjp1BCLVhmT0r2K38rEaf9RxyTIe/97+K8lmkXwFP R26xQcK7ve2lIDNhr5FmS1ym0cseI1iM4/RyJtaXQt/YcCo+RL8XNHawzILBGS4MiyPE vOMg== X-Gm-Message-State: AOAM532hETXIhgvGaVVBj4mma2j4sEZVzdqFClOMTbk8gVNyBJ3UFl+w OKia+06zV3cDyXM1vXeysXJShw== X-Google-Smtp-Source: ABdhPJy9cgU6Elu6GVTCGIRGvEKg3CzdFlp9/Ct/93sWk8mBHd7a+ncaZCZQhqW/NoDRClAkpPxFeQ== 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200721_110636_378383_060ECA0F X-CRM114-Status: GOOD ( 15.22 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:643 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: U-Boot-Denx , linux-rockchip@lists.infradead.org, linux-amarula , Jagan Teki , Suniel Mahesh Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org 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