From patchwork Mon Jun 8 18:31:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1349 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 0BE2A3F06D for ; Mon, 8 Jun 2020 20:32:17 +0200 (CEST) Received: by mail-pl1-f197.google.com with SMTP id q7sf12838977plr.4 for ; Mon, 08 Jun 2020 11:32:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1591641135; cv=pass; d=google.com; s=arc-20160816; b=fuwdKbZSqU6/VwNSich3WXnTntQGPhZwG5EvsSrV8ci92U8d1dKldETVKKDVoJtbcP YaoWtcL3aC9RObxB0EIReWTWML7N5kTBwfLm4Ak4HiHnWN4ZxvRj8Kjud+hHRv+UWUSd Y1CelSdZb3oFLyfi4p9QOCWSvU2cs5T7fKy02B5rUED1k99ngDQ23tiH7r/nWW2VFiTp l82X9Wt+GIGvgM7jmuATO7MGFImmrKdNS9qM1Jz0FHPr5rahx0qT6aLBqL0R+xplHJ7h NCBB9mOYYxVxD2HV8RzqJnyJoIKGWfNTYFxo8RLrEdgRjjLHnsXX6znH/KaNoENSpAPt 0gtg== 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=gFWziLD11Px5aIYOBj2GLBtrLuAZV3hkSSq/trZFNQE=; b=eyzhd1HaS6TsU0K3OeeAmnvQo8IaGkVHgSHGGP+CRtgPGbMUbyPbR+iQ9eTdnegRRy 0a6UkNhBNN1Qwp1To88n6ma9zIiFcCu0bwyEQUMinCE4DdWFCqm3eiJJgs8qFSIyQqDf 1MfInJTuPsvjsy0pLbQbLIkqyXHVPoorfYDRoHMooAQeF29/kp8baFNkWtUQZnDuArIL XihQPQu7XsQS/sAajKm3J1GOl423N02wZSYA9Lo8YUYF6eJmy61Y1m6UsbjZuFtLFZAB Sz2xVlf6+IQQ43SgUcrYQzGh1i2wfn4RtqRL8c/3OOSQKHyPcK2cYE7mMuv0f4FrX+dQ R72w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="oN/BomlY"; 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=gFWziLD11Px5aIYOBj2GLBtrLuAZV3hkSSq/trZFNQE=; b=gr3739YM1ISccm/OuE4TRDaHH9TnmB6cpqn58sRUwujDQdZfu+1hDPI2tWfs3TqBC8 nmntshLxiY7CFteZxy2eM17NX0yK70l3knlwxwFe4ZWOaE4FV+IoSrF4hCJ4sPUVe3ck IHStN8FcJ5HspmjmEsRanLAqL4CYmR0tWhAKg= 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=gFWziLD11Px5aIYOBj2GLBtrLuAZV3hkSSq/trZFNQE=; b=LopI6C0OFrdcu8hUwcC8Yy+/otarZTBa71zk9Z4cxDqBYviY/2N1gzC1VYAbMYeAS6 LPbBXUojZxQxzYqVq2eOS41AuDrbkT9xwyuopWPYVpmFpw+w/q0+win6plrYCtji+/Gs trc/IWnH/I0IRy4vGgfOZIdxXnBz+JBf8nOpPwbepToG0Q+hOmLpK+MKI8ZS7Wm9b6GY LYVOGmvEAmH29q8YHyFBPgGgOMspzu8A4AIDdGfXkeFSdqRWsm04L5P/X2UiX6d1FIw8 VHZVJc5aBvMCeNNFKwOqr8Ei1SAF+EOmpZFjh/EYOcloAG7BZAwPVV/lOq+4bSKI4LmK r2yw== X-Gm-Message-State: AOAM530uzcEgQwM7j3W4rzn+vZqiQDEW8SLWvTMg6OsFmEsw1MRy1r1j U3yrxL+A33g69iAHtZubdAuD1pFG X-Google-Smtp-Source: ABdhPJx3dBu0LPy3/6cj+gkcagt2N/SWGQqjwCCdTg8VmU/tcodZIOdK9mIm/sGmlzdkyK/E/u12Cg== X-Received: by 2002:a17:90a:c70d:: with SMTP id o13mr580801pjt.73.1591641135785; Mon, 08 Jun 2020 11:32:15 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a63:b219:: with SMTP id x25ls4717743pge.8.gmail; Mon, 08 Jun 2020 11:32:15 -0700 (PDT) X-Received: by 2002:a62:804d:: with SMTP id j74mr22375992pfd.233.1591641135295; Mon, 08 Jun 2020 11:32:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591641135; cv=none; d=google.com; s=arc-20160816; b=SfZvbH4P4xyQ9w+KNGnW1tF9o94w5TKncd0Zo4Gd9iEHuyJ69Fq3nJheAijbaj6T2q zPwOXBCBlyX5PHer+jFA76l0cxIh41xwAC04R4wrByX1aokUHXQKzglLMmoYTrYWM6ZE Q9TH5wsylV9hMeqnr+sAB0y7rMk44ylFdamOKGbLL9UTHoj8/Do+giV3B21dtSFHG2PB qitFdWL1Bc5vEmhMIbdQn/mEo7FCX/bkKJGmwYrkkzMK5pv4K1bi/MYlQM8GQwUNXOkm yb/H7POI5X7utZxuRA5emEJdqTrmQkjXwzEiVdmIUJhzVuwPh5XIESZiHHWn47NobdcE 5uYg== 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=rqJBGafkC3epYtnj6Q8KpKJpJibk/KrCcH9/odNpSyA=; b=VPF7msRTzL7lu3a2btr0sAxV0StGBXlis3B6QXUYgMPjSEFzcc4n8J5eNXuPk54UIB h6GIpDsLPYCAnz6tvAEdJ6iG98GWnDtF+Tx2xvwP/QegR7JYxNt1mg61ZrcinihpcAAw 9MooXjdYFnkdqfKHy8Bo7D++u4ng1Pd0UfWpFYrVBSRk430F7D/lX50bT3O0jzRuBWos R/ncDtt2tDp3CJ68ddRylAaymPsGH3fUHhWTtU+FwrFYcLylZ+tTXt5RMZ0YMXA+vBYZ 2RtP+pryGJyar5TUIqaCm+oO0++0pLXxGQFmdmZ5xBfh5uRpDrB84X0WkNn/GMNQDIMq MqfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="oN/BomlY"; 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 l1sor11499781plb.41.2020.06.08.11.32.15 for (Google Transport Security); Mon, 08 Jun 2020 11:32:15 -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:7297:: with SMTP id d23mr125758pll.282.1591641134981; Mon, 08 Jun 2020 11:32:14 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:9043:af95:b7b4:3ade]) by smtp.gmail.com with ESMTPSA id k29sm6680961pgf.77.2020.06.08.11.32.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jun 2020 11:32:14 -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 v3 4/5] rockchip: Separate the reset cause from display cpuinfo Date: Mon, 8 Jun 2020 14:31:43 -0400 Message-Id: <20200608183144.26809-5-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200608183144.26809-1-jagan@amarulasolutions.com> References: <20200608183144.26809-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="oN/BomlY"; 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. Signed-off-by: Jagan Teki Tested-by: Suniel Mahesh --- Changes for v3: - none 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 5eb17f9d55..317eb61049 100644 --- a/arch/arm/include/asm/arch-rockchip/cru.h +++ b/arch/arm/include/asm/arch-rockchip/cru.h @@ -31,4 +31,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..ef4898e00c 100644 --- a/arch/arm/mach-rockchip/Makefile +++ b/arch/arm/mach-rockchip/Makefile @@ -15,6 +15,10 @@ obj-tpl-$(CONFIG_ROCKCHIP_PX30) += px30-board-tpl.o obj-spl-$(CONFIG_ROCKCHIP_RK3036) += rk3036-board-spl.o +ifeq ($(CONFIG_ROCKCHIP_RK3288)$(CONFIG_ROCKCHIP_RK3399), y) +obj-y += cpu-info.o +endif + ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),) # Always include boot_mode.o, as we bypass it (i.e. turn it off) @@ -22,7 +26,6 @@ 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 diff --git a/arch/arm/mach-rockchip/cpu-info.c b/arch/arm/mach-rockchip/cpu-info.c index 21ca9dedce..76a840e2c3 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,12 +41,6 @@ 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); - /* * Clear glb_rst_st, so we can determine the last reset cause * for following resets. @@ -56,12 +50,22 @@ static char *get_reset_cause(void) return cause; } +#ifdef CONFIG_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