From patchwork Tue Jul 14 09:32:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1489 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id E8B3A3F1BD for ; Tue, 14 Jul 2020 11:33:45 +0200 (CEST) Received: by mail-pj1-f69.google.com with SMTP id a19sf1911654pjq.9 for ; Tue, 14 Jul 2020 02:33:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1594719224; cv=pass; d=google.com; s=arc-20160816; b=bmUkmcXPmxQm1j9uvVi2PpHY19pXXlqRP3WKtf9MMEXCHanvd6cc8p/iMDnOZ0PRgk aH6Ew3K3cRdGV1GH1c3gRtfydr35VcuTxspBMDX37cAXP219VNmRPzB6rSuI49RSated JLWr2m1wu7airN0h8mR+7tLr+uDfzet1LbT0wYd/ZRJE59SkX9NaPDpM6m2UuvnOwYxg wX0bzue3dnjKBozutq2QlRClKZOzNpyR+yKP5BtSzHf7uSAuYOxt7anEDq/13HZ0dw5y 6gwJztJIxxdHT1YkjiqQ7gx/pqlBbumt3/SBUStG4//TD4Kgh2HIeKVKF5R/iulJI1jm EQBw== 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=2TkQ6q84Ei2FaU3afKYaa3zw6VFlqM4eiUfVGLcQ3cE=; b=XUjkljD7cqglck9oygsx5qIhLTPFGcm4cBj/WMY9G69Qx4M8abMMB1GeYNrG987neZ OtUuuZwsEXqY2FRUA/e6eHFRiZRCA/6Lej7/S5hFz73kfe1scuGmA4lMs5cmBiqMK7ww V91aU8zgrzHlNC6Xbdpbsly5/KJOme14SpH4T59kXpnoftYCkvPN86MaUF6UNz4XEsdH /zw+AgZObcPPA3HeXqQ/79SajkV3FEjR6KeXjv9yCXuNzEIbGax2Gyxva+VuSic4Buh1 gwJ+34/F/HB2LN+W6rGFcxY1tFfOUNQFNPrKW23LTU8lWuxB2JX9Q+sxLPQ5QgRRuIkU m+Xw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=G3Ld5S7h; 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=2TkQ6q84Ei2FaU3afKYaa3zw6VFlqM4eiUfVGLcQ3cE=; b=rIDaLoJ55tKiMFfk3pGVh7Z+AHNgJDAXVZ7TqTjJtApajQicHmK+LDnLTPPI4BXThG J6LXO3OynA1d+tcNFfrt9OW0luIpnLMy7id+rIgnbbKRJoli/RcTyM0RIddF9wsToyFa r1L4Gz2tf06RFtu2UolU9K1gvYlVKYQpoLSQo= 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=2TkQ6q84Ei2FaU3afKYaa3zw6VFlqM4eiUfVGLcQ3cE=; b=IBGPRUQCcc9Fh5BfShH7YnPG+g15OynZ8iXfy2UGHwWxGgZKsxESn8gvIKJPYyu9gF 1xNSK02kpwR7iFCdZz1Gj1PD2eT+kEQacdtdsHIod1HJch7pAY6DdZ0w6vzEOxAqZpxj 3ENgV/kqlTOrN4sAb4ARMD+gdTxupIXixRCed2PzBBoBixxW2Eq7mF3cJsHVWrz9rJNB T9eEel9YGHOm4P+cBsOryEREPagIcoZqiek238W3N2ZnWS27loJgl1oU4ziZzdYBq7ae ocEkS7nAeCcoMfGkcSN6LxmAdvyuAjHppey7Qum2nAc5CRFPfZIPZT3x991Mi4spnm7K 9v7w== X-Gm-Message-State: AOAM5325SnaiHxWjkz2+UHQUADIsmkHJ2kBioyOlEF63llfV2ID8LBT3 Rb98H1+rFCwy6cd1WAuDUhJ6MAI1 X-Google-Smtp-Source: ABdhPJy74ld3aGtjY7LBrqxmDoh3mska4RT2F3QUIYpb/zXxCtJ9WZfQSCZm7+KNwZUVaagDU9TC4g== X-Received: by 2002:a65:6106:: with SMTP id z6mr2821512pgu.310.1594719224736; Tue, 14 Jul 2020 02:33:44 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90a:1b4d:: with SMTP id q71ls1292377pjq.2.gmail; Tue, 14 Jul 2020 02:33:44 -0700 (PDT) X-Received: by 2002:a17:90b:1650:: with SMTP id il16mr3558055pjb.79.1594719224215; Tue, 14 Jul 2020 02:33:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594719224; cv=none; d=google.com; s=arc-20160816; b=eRl0yTRgVHYNVJlB8jv6fb52t7QN4Lu9r3Q6xpoE3+vFKZHoezfxDg3hH7eSBshoNF kd7tWJeH2fV+4frngx8mOZdxx7xJFSL+SV5+3AcALwpJfqxbY24wjJGEizvmV9BEhVOm hYGLv0rEmUga2oWk00qCdR0WHyHNqZLbUXa+MfWDeyHYcMGbJ3MWLCLc/9SbJDtnilSJ dXrjwGpm5Ko/UNiVCTZG9phwVDXQ287+87MAMKlrIpgLJD+5EoiyJStTLQK194NpNmj6 IY3pw5e9zRIK/rXbZoZJ21Za5+FVOJ7Jz8MopZKNpNcGvoAW3QP9imqzlZs4XB0shegd ihUA== 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=90v5epVkOEwYIjeAeEBw6zdLOS6I1eoIWmoYhdfWQFc=; b=EQuHUWJ4VbM47ZsK2W0z8NVsg8YQQ8hqRw2QSkUv3SaRMjmWm8HjAcQBDUy3X/n2iT p/+gkFWSDDfXjiro1HBdwC+Pxv7X74d2KkPLSjc+1Sb0Pn5OWmqb19IPtHc/A+3B+7y0 64xkc1jXzGLTtaodfd4oqjXZzYrz5H8aMLOf7oV6uLN9W5EfVJl4+Ox/+oWI0r2lutdM JFYlDiuSrddcfXAQXto6CzRujJfSi2rKs4f2ne08uemoy4+4p3Mi7NFetGjFuqbBwybx zpGfzXgwNaWhpXC/Q/kERsgTrnzQUCEwsKqbCtIbM8VXeCr6lLZSeU8h6auJh9XOjs8i UJUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=G3Ld5S7h; 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 l187sor20436885pge.81.2020.07.14.02.33.44 for (Google Transport Security); Tue, 14 Jul 2020 02:33:44 -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:a63:8c4f:: with SMTP id q15mr2727143pgn.373.1594719223913; Tue, 14 Jul 2020 02:33:43 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:659e:b3d0:e662:3980]) by smtp.gmail.com with ESMTPSA id g6sm16924771pfr.129.2020.07.14.02.33.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2020 02:33:43 -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 v5 3/5] rockchip: Separate the reset cause from display cpuinfo Date: Tue, 14 Jul 2020 15:02:27 +0530 Message-Id: <20200714093229.28763-4-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200714093229.28763-1-jagan@amarulasolutions.com> References: <20200714093229.28763-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=G3Ld5S7h; 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 v5: - update Makefile 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