linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yazen Ghannam <yazen.ghannam@amd.com>
To: <linux-i2c@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <jdelvare@suse.com>,
	<terry.bowman@amd.com>, Yazen Ghannam <yazen.ghannam@amd.com>
Subject: [PATCH] i2c: piix4: Print FCH::PM::S5_RESET_STATUS
Date: Fri, 7 Apr 2023 15:37:20 -0500	[thread overview]
Message-ID: <20230407203720.18184-1-yazen.ghannam@amd.com> (raw)

The following register contains bits that indicate the cause for the
previous reset.

        PMx000000C0 (FCH::PM::S5_RESET_STATUS)

This is helpful for debug, etc., and it only needs to be read once from
a single FCH within the system. The register definition is AMD-specific.

Print it when the FCH MMIO space is first mapped. This register is not
related to I2C functionality, but read it here to leverage the existing
mapping.

Use an "info" log level so that it is printed every boot without requiring
the user to enable debug messages. This is beneficial when debugging
issues that cause spontaneous reboots and are hard to reproduce.

Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
---
 drivers/i2c/busses/i2c-piix4.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
index 809fbd014cd6..043b29f1e33c 100644
--- a/drivers/i2c/busses/i2c-piix4.c
+++ b/drivers/i2c/busses/i2c-piix4.c
@@ -100,6 +100,7 @@
 
 #define SB800_PIIX4_FCH_PM_ADDR			0xFED80300
 #define SB800_PIIX4_FCH_PM_SIZE			8
+#define SB800_PIIX4_FCH_PM_S5_RESET_STATUS	0xC0
 
 /* insmod parameters */
 
@@ -200,6 +201,9 @@ static int piix4_sb800_region_request(struct device *dev,
 
 		mmio_cfg->addr = addr;
 
+		addr += SB800_PIIX4_FCH_PM_S5_RESET_STATUS;
+		pr_info_once("S5_RESET_STATUS = 0x%08x", ioread32(addr));
+
 		return 0;
 	}
 
-- 
2.34.1


             reply	other threads:[~2023-04-07 20:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-07 20:37 Yazen Ghannam [this message]
2023-04-12 16:53 ` [PATCH] i2c: piix4: Print FCH::PM::S5_RESET_STATUS Jean Delvare
2023-04-12 17:13   ` Yazen Ghannam

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=20230407203720.18184-1-yazen.ghannam@amd.com \
    --to=yazen.ghannam@amd.com \
    --cc=jdelvare@suse.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=terry.bowman@amd.com \
    /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;
as well as URLs for NNTP newsgroup(s).