Skip to content

Commit

Permalink
hwmon: (pmbus_core) Do not enable PEC if adapter doesn't (#215)
Browse files Browse the repository at this point in the history
Currently, for Packet Error Checking (PEC) only the controller
is checked for support. This causes problems on the cisco-8000
platform where a SMBUS transaction errors are observed. This is
because PEC has to be enabled only if both controller and
adapter supports it.

Added code to check PEC capability for adapter and enable it
only if both controller and adapter supports PEC.

Signed-off-by: Madhava Reddy Siddareddygari <msiddare@cisco.com>
  • Loading branch information
msiddare committed Jun 15, 2021
1 parent fcf7cdc commit 53e75e5
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions patch/cisco-hwmon-pmbus_core-pec-support-check.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
From a3e00e49a8647ea9ba6f08a36c1bf6884f91619a Mon Sep 17 00:00:00 2001
From: Madhava Reddy Siddareddygari <msiddare@cisco.com>
Date: Tue, 1 Jun 2021 22:42:41 -0700
Subject: [PATCH] hwmon: (pmbus_core) Check adapter PEC support

Currently, for Packet Error Checking (PEC) only the controller
is checked for support. This causes problems on the cisco-8000
platform where a SMBUS transaction errors are observed. This is
because PEC has to be enabled only if both controller and
adapter supports it.

Added code to check PEC capability for adapter and enable it
only if both controller and adapter supports PEC.

Signed-off-by: Madhava Reddy Siddareddygari <msiddare@cisco.com>
---
drivers/hwmon/pmbus/pmbus_core.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
index df4a6de24..2f98b4785 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -2082,10 +2082,14 @@ static int pmbus_init_common(struct i2c_client *client, struct pmbus_data *data,
data->has_status_word = true;
}

- /* Enable PEC if the controller supports it */
+ /* Enable PEC if the controller and bus supports it */
ret = i2c_smbus_read_byte_data(client, PMBUS_CAPABILITY);
- if (ret >= 0 && (ret & PB_CAPABILITY_ERROR_CHECK))
- client->flags |= I2C_CLIENT_PEC;
+ if (ret >= 0 && (ret & PB_CAPABILITY_ERROR_CHECK)) {
+ if (i2c_check_functionality(client->adapter,
+ I2C_FUNC_SMBUS_PEC)) {
+ client->flags |= I2C_CLIENT_PEC;
+ }
+ }

if (data->info->pages)
pmbus_clear_faults(client);
--
2.26.2

0 comments on commit 53e75e5

Please sign in to comment.