linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] soc/tegra: pmc: Print reset info during probe
@ 2022-08-17 18:44 Petlozu Pravareshwar
  2022-08-18 15:14 ` Thierry Reding
  0 siblings, 1 reply; 5+ messages in thread
From: Petlozu Pravareshwar @ 2022-08-17 18:44 UTC (permalink / raw)
  To: jonathanh, thierry.reding, p.zabel, dmitry.osipenko, ulf.hansson,
	kkartik, cai.huoqing, spatra, linux-tegra, linux-kernel
  Cc: petlozup

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] soc/tegra: pmc: Print reset info during probe
  2022-08-17 18:44 [PATCH] soc/tegra: pmc: Print reset info during probe Petlozu Pravareshwar
@ 2022-08-18 15:14 ` Thierry Reding
  2022-08-24 19:39   ` Petlozu Pravareshwar
  0 siblings, 1 reply; 5+ messages in thread
From: Thierry Reding @ 2022-08-18 15:14 UTC (permalink / raw)
  To: Petlozu Pravareshwar
  Cc: jonathanh, p.zabel, dmitry.osipenko, ulf.hansson, kkartik,
	cai.huoqing, spatra, linux-tegra, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 437 bytes --]

On Wed, Aug 17, 2022 at 06:44:56PM +0000, Petlozu Pravareshwar wrote:
> 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(+)

We already expose this information in sysfs, why do we need to print it
during boot?

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] soc/tegra: pmc: Print reset info during probe
  2022-08-18 15:14 ` Thierry Reding
@ 2022-08-24 19:39   ` Petlozu Pravareshwar
  2022-08-26 16:03     ` Thierry Reding
  0 siblings, 1 reply; 5+ messages in thread
From: Petlozu Pravareshwar @ 2022-08-24 19:39 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Jonathan Hunter, p.zabel, dmitry.osipenko, ulf.hansson, Kartik .,
	cai.huoqing, Sandipan Patra, linux-tegra, linux-kernel

> 
> On Wed, Aug 17, 2022 at 06:44:56PM +0000, Petlozu Pravareshwar wrote:
> > 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(+)
> 
> We already expose this information in sysfs, why do we need to print it
> during boot?
> 
> Thierry
There are some tests which would parse the boot log for this information.
But I agree, since we are already providing this information through sysfs,
there is no need to print it during boot.

Thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] soc/tegra: pmc: Print reset info during probe
  2022-08-24 19:39   ` Petlozu Pravareshwar
@ 2022-08-26 16:03     ` Thierry Reding
  2022-09-09 14:16       ` Petlozu Pravareshwar
  0 siblings, 1 reply; 5+ messages in thread
From: Thierry Reding @ 2022-08-26 16:03 UTC (permalink / raw)
  To: Petlozu Pravareshwar
  Cc: Jonathan Hunter, p.zabel, dmitry.osipenko, ulf.hansson, Kartik .,
	cai.huoqing, Sandipan Patra, linux-tegra, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1084 bytes --]

On Wed, Aug 24, 2022 at 07:39:46PM +0000, Petlozu Pravareshwar wrote:
> > 
> > On Wed, Aug 17, 2022 at 06:44:56PM +0000, Petlozu Pravareshwar wrote:
> > > 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(+)
> > 
> > We already expose this information in sysfs, why do we need to print it
> > during boot?
> > 
> > Thierry
> There are some tests which would parse the boot log for this information.
> But I agree, since we are already providing this information through sysfs,
> there is no need to print it during boot.

It'd be a good idea to transition the tests to try and obtain this
information through sysfs first and if that fails they could fall back
to using the boot log. Although to be honest, I think we've supported
this sysfs interface for long enough that we probably don't have to
worry about a fallback.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] soc/tegra: pmc: Print reset info during probe
  2022-08-26 16:03     ` Thierry Reding
@ 2022-09-09 14:16       ` Petlozu Pravareshwar
  0 siblings, 0 replies; 5+ messages in thread
From: Petlozu Pravareshwar @ 2022-09-09 14:16 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Jonathan Hunter, p.zabel, dmitry.osipenko, ulf.hansson, Kartik .,
	cai.huoqing, Sandipan Patra, linux-tegra, linux-kernel

> On Wed, Aug 24, 2022 at 07:39:46PM +0000, Petlozu Pravareshwar wrote:
> > >
> > > On Wed, Aug 17, 2022 at 06:44:56PM +0000, Petlozu Pravareshwar wrote:
> > > > 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(+)
> > >
> > > We already expose this information in sysfs, why do we need to print
> > > it during boot?
> > >
> > > Thierry
> > There are some tests which would parse the boot log for this information.
> > But I agree, since we are already providing this information through
> > sysfs, there is no need to print it during boot.
> 
> It'd be a good idea to transition the tests to try and obtain this information
> through sysfs first and if that fails they could fall back to using the boot log.
> Although to be honest, I think we've supported this sysfs interface for long
> enough that we probably don't have to worry about a fallback.
> 
> Thierry
Agree. Transitioning the tests to obtain the information through sysfs looks
good to me. I think this change can be discarded as printing the info in the
boot log is no longer needed.

Thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-09-09 14:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-17 18:44 [PATCH] soc/tegra: pmc: Print reset info during probe Petlozu Pravareshwar
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).