From: Petlozu Pravareshwar <petlozup@nvidia.com>
To: <jonathanh@nvidia.com>, <thierry.reding@gmail.com>,
<p.zabel@pengutronix.de>, <dmitry.osipenko@collabora.com>,
<ulf.hansson@linaro.org>, <kkartik@nvidia.com>,
<cai.huoqing@linux.dev>, <spatra@nvidia.com>,
<linux-tegra@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: <petlozup@nvidia.com>
Subject: [PATCH] soc/tegra: pmc: Print reset info during probe
Date: Wed, 17 Aug 2022 18:44:56 +0000 [thread overview]
Message-ID: <20220817184456.1184459-1-petlozup@nvidia.com> (raw)
During PMC probe, print previous reset related info
such as reset reason and reset level.
Signed-off-by: Petlozu Pravareshwar <petlozup@nvidia.com>
---
drivers/soc/tegra/pmc.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
index 34d36a28f7d6..dd98ea034149 100644
--- a/drivers/soc/tegra/pmc.c
+++ b/drivers/soc/tegra/pmc.c
@@ -2177,6 +2177,31 @@ static int tegra_pmc_pinctrl_init(struct tegra_pmc *pmc)
return 0;
}
+static void tegra_pmc_show_reset_status(void)
+{
+ u32 val, rst_src, rst_lvl;
+
+ val = tegra_pmc_readl(pmc, pmc->soc->regs->rst_status);
+ rst_src = (val & pmc->soc->regs->rst_source_mask) >>
+ pmc->soc->regs->rst_source_shift;
+ rst_lvl = (val & pmc->soc->regs->rst_level_mask) >>
+ pmc->soc->regs->rst_level_shift;
+
+ if (rst_src >= pmc->soc->num_reset_sources)
+ dev_warn(pmc->dev, "reset source: UNKNOWN\n");
+ else if (pmc->soc->reset_sources[rst_src] == NULL)
+ dev_warn(pmc->dev, "reset source: UNUSED\n");
+ else
+ dev_info(pmc->dev, "reset source: %s\n",
+ pmc->soc->reset_sources[rst_src]);
+
+ if (rst_lvl >= pmc->soc->num_reset_levels)
+ dev_warn(pmc->dev, "reset level: UNKNOWN\n");
+ else
+ dev_info(pmc->dev, "reset level: %s\n",
+ pmc->soc->reset_levels[rst_lvl]);
+}
+
static ssize_t reset_reason_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
@@ -2979,6 +3004,8 @@ static int tegra_pmc_probe(struct platform_device *pdev)
tegra_pmc_init_tsense_reset(pmc);
+ tegra_pmc_show_reset_status();
+
tegra_pmc_reset_sysfs_init(pmc);
if (IS_ENABLED(CONFIG_DEBUG_FS)) {
--
2.17.1
next reply other threads:[~2022-08-17 18:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-17 18:44 Petlozu Pravareshwar [this message]
2022-08-18 15:14 ` Thierry Reding
2022-08-24 19:39 ` Petlozu Pravareshwar
2022-08-26 16:03 ` Thierry Reding
2022-09-09 14:16 ` Petlozu Pravareshwar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220817184456.1184459-1-petlozup@nvidia.com \
--to=petlozup@nvidia.com \
--cc=cai.huoqing@linux.dev \
--cc=dmitry.osipenko@collabora.com \
--cc=jonathanh@nvidia.com \
--cc=kkartik@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=spatra@nvidia.com \
--cc=thierry.reding@gmail.com \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®