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: 11662169 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 39FD613B1 for ; Tue, 14 Jul 2020 09:34:55 +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 E3304212CC for ; Tue, 14 Jul 2020 09:34:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="07MeNO4A"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="G3Ld5S7h" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E3304212CC 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=00287DY0Kt5jAfld0zwnsOZjt0AHawlpHeoSYAEC9Ic=; b=07MeNO4Afda6unBG0WvNfdA+S +tOeITrzsIb52C0OL0gJhe7EFZBcSmYOC9/aMsDx8TTAluKG5nI0TlXehKk3m4qQ3yyVWkpzgJOpG POP0FCNz6qm1BMWBQeovZTkIECbNm2c8MOndTAKUfPMOs9c8jU0ZxAeWpIGbFjL7VHmNgifhIdCq/ /hEDiIj0OXCkkNK69a6oZbwt0QWtSkZTM5e3zTSjiBPCnsKJVmAuvEEszopCiEqNEBaS18SHXSIgO Sgu+kmMNUPSy4ljSCxSNiZCHHa1WBclJJ8Cme1Bp8okgbm9G/t8ULr6IhS9a16S5Qtxo4ph1RLw+W 6oE88/DYw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jvHKo-00045Z-6w; Tue, 14 Jul 2020 09:34:46 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jvHJq-0003ao-D0 for linux-rockchip@lists.infradead.org; Tue, 14 Jul 2020 09:33:49 +0000 Received: by mail-pf1-x442.google.com with SMTP id s26so7348765pfm.4 for ; Tue, 14 Jul 2020 02:33:45 -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=90v5epVkOEwYIjeAeEBw6zdLOS6I1eoIWmoYhdfWQFc=; b=G3Ld5S7hT9N/7VIzE7ly2ZbqSjoKa74L9Pdg/lF6/kzNT0newtI975MvSvtWJ9za5p PL8D46bzCS7I8ER8PMh9KiHRHqfqpd9SZDvpY0jLkbsPHxMhqn5dIDXrj4u05QVfa7Cw yR30JSJPwId31XwgyWgzZzrxLokLmumeLw6lA= 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=90v5epVkOEwYIjeAeEBw6zdLOS6I1eoIWmoYhdfWQFc=; b=LjFyRyXhA2WlSa8iv7YUSRppBqM7LBJf0SSHpY1MaA1rzOHZQ4AAFn+t7yh3yKP8hN Oi343HzdXc5v9lCUF3PbBT1uI6ZzqrxFHOrUa7939DNw4iZlksRClyzXzdaKh/zjDKOx tHb7UAcfQ1AInZqbi54OAJolPMQGKU8lyGoZKNjjcK+BJLbju2zWQK8n/T2AGjhfSJPA 5dC1xmTtp5fKsVoA+cAQNfNSv80bLfpRtTx25XBbcUuXh/slQFwowhTLSc/9jMI7kkfo vk7DwwmUJqorABZJFp+lirqrjlp95+ABlgv7bjdbC/NEFwiloaOgxMidFqVRy+Pkc0ON DX+g== X-Gm-Message-State: AOAM5324M1FhlNsNvhfRej0jk0fwLEnYk9NKJw1jPH0mA+Aw2/jhlp+p 4hP7E5z8N5rasSgYvwB4lA/LjA== X-Google-Smtp-Source: ABdhPJxpuM5CZw1/Cqpi+8BORKX56WmeswG/GVZLKPTnWUrNnQMXhddruRBtvSnRzV+2FsO7IgMwvg== 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200714_053346_523304_C2C7A765 X-CRM114-Status: GOOD ( 14.96 ) 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:442 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -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 Message has at least one valid DKIM or DK signature -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 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