From: Jean Delvare <jdelvare@suse.de>
To: Linux I2C <linux-i2c@vger.kernel.org>
Cc: Wolfram Sang <wsa@the-dreams.de>,
linux-kernel@vger.kernel.org, Andrew Cooks <acooks@rationali.st>,
linux-acpi@vger.kernel.org, platypus-sw@opengear.com,
"Tobin C . Harding" <me@tobin.cc>,
Guenter Roeck <linux@roeck-us.net>,
Will Wagner <willw@carallon.com>
Subject: [PATCH v5 2/3] i2c: piix4: Fix probing of reserved ports on AMD Family 16h Model 30h
Date: Fri, 2 Aug 2019 14:54:38 +0200 [thread overview]
Message-ID: <20190802145438.601c9a8c@endymion> (raw)
In-Reply-To: <20190802145109.38dd4045@endymion>
Prevent bus timeouts and resets on Family 16h Model 30h by not probing
reserved Ports 3 and 4.
According to the AMD BIOS and Kernel Developer's Guides (BKDG), Port 3
and Port 4 are reserved on the following devices:
- Family 15h Model 60h-6Fh
- Family 15h Model 70h-7Fh
- Family 16h Model 30h-3Fh
Based on earlier work by Andrew Cooks.
Reported-by: Andrew Cooks <andrew.cooks@opengear.com>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
Changes since v4:
* Fix subject line
* Drop local variable port_count, use piix4_adapter_count
everywhere to represent the maximum number of main SMBus ports
* Exclude early Hudson2 implementations from this change
drivers/i2c/busses/i2c-piix4.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
--- linux-5.2.orig/drivers/i2c/busses/i2c-piix4.c 2019-08-02 14:08:17.003820098 +0200
+++ linux-5.2/drivers/i2c/busses/i2c-piix4.c 2019-08-02 14:15:38.284423549 +0200
@@ -72,7 +72,8 @@
#define PIIX4_BLOCK_DATA 0x14
/* Multi-port constants */
-#define PIIX4_MAX_ADAPTERS 4
+#define PIIX4_MAX_ADAPTERS 4
+#define HUDSON2_MAIN_PORTS 2 /* HUDSON2, KERNCZ reserves ports 3, 4 */
/* SB800 constants */
#define SB800_PIIX4_SMB_IDX 0xcd6
@@ -806,6 +807,7 @@ MODULE_DEVICE_TABLE (pci, piix4_ids);
static struct i2c_adapter *piix4_main_adapters[PIIX4_MAX_ADAPTERS];
static struct i2c_adapter *piix4_aux_adapter;
+static int piix4_adapter_count;
static int piix4_add_adapter(struct pci_dev *dev, unsigned short smba,
bool sb800_main, u8 port, bool notify_imc,
@@ -865,7 +867,15 @@ static int piix4_add_adapters_sb800(stru
int port;
int retval;
- for (port = 0; port < PIIX4_MAX_ADAPTERS; port++) {
+ if (dev->device == PCI_DEVICE_ID_AMD_KERNCZ_SMBUS ||
+ (dev->device == PCI_DEVICE_ID_AMD_HUDSON2_SMBUS &&
+ dev->revision >= 0x1F)) {
+ piix4_adapter_count = HUDSON2_MAIN_PORTS;
+ } else {
+ piix4_adapter_count = PIIX4_MAX_ADAPTERS;
+ }
+
+ for (port = 0; port < piix4_adapter_count; port++) {
retval = piix4_add_adapter(dev, smba, true, port, notify_imc,
piix4_main_port_names_sb800[port],
&piix4_main_adapters[port]);
@@ -987,7 +997,7 @@ static void piix4_adap_remove(struct i2c
static void piix4_remove(struct pci_dev *dev)
{
- int port = PIIX4_MAX_ADAPTERS;
+ int port = piix4_adapter_count;
while (--port >= 0) {
if (piix4_main_adapters[port]) {
--
Jean Delvare
SUSE L3 Support
next prev parent reply other threads:[~2019-08-02 12:54 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-02 12:51 [PATCH v5 0/3] Enable ACPI-defined peripherals on i2c-piix4 SMBus Jean Delvare
2019-08-02 12:52 ` [PATCH v5 1/3] i2c: piix4: Fix port selection for AMD Family 16h Model 30h Jean Delvare
2019-08-29 20:19 ` Wolfram Sang
2019-08-02 12:54 ` Jean Delvare [this message]
2019-08-29 20:20 ` [PATCH v5 2/3] i2c: piix4: Fix probing of reserved ports on " Wolfram Sang
2019-08-02 12:55 ` [PATCH v5 3/3] i2c: piix4: Add ACPI support Jean Delvare
2019-08-29 20:21 ` Wolfram Sang
2019-08-08 9:17 ` [PATCH v5 0/3] Enable ACPI-defined peripherals on i2c-piix4 SMBus Enrico Weigelt, metux IT consult
2019-08-09 8:33 ` Jean Delvare
2019-08-09 15:53 ` Enrico Weigelt, metux IT consult
2019-08-14 16:07 ` Wolfram Sang
2019-08-11 3:09 ` Andrew Cooks
2019-08-11 2:52 ` Andrew Cooks
2019-08-19 18:30 ` Enrico Weigelt, metux IT consult
2019-08-19 18:53 ` Wolfram Sang
2019-08-20 10:42 ` Enrico Weigelt, metux IT consult
2019-08-20 10:53 ` Wolfram Sang
2019-08-28 22:48 ` Andrew Cooks
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=20190802145438.601c9a8c@endymion \
--to=jdelvare@suse.de \
--cc=acooks@rationali.st \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=me@tobin.cc \
--cc=platypus-sw@opengear.com \
--cc=willw@carallon.com \
--cc=wsa@the-dreams.de \
/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).