From 53e75e5ea3ec41f83c5763c7c359bf5062ba2719 Mon Sep 17 00:00:00 2001 From: msiddare <84937930+msiddare@users.noreply.github.com> Date: Tue, 15 Jun 2021 12:15:40 -0700 Subject: [PATCH] hwmon: (pmbus_core) Do not enable PEC if adapter doesn't (#215) 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 --- ...o-hwmon-pmbus_core-pec-support-check.patch | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 patch/cisco-hwmon-pmbus_core-pec-support-check.patch diff --git a/patch/cisco-hwmon-pmbus_core-pec-support-check.patch b/patch/cisco-hwmon-pmbus_core-pec-support-check.patch new file mode 100644 index 000000000000..3d836b9c1f64 --- /dev/null +++ b/patch/cisco-hwmon-pmbus_core-pec-support-check.patch @@ -0,0 +1,44 @@ +From a3e00e49a8647ea9ba6f08a36c1bf6884f91619a Mon Sep 17 00:00:00 2001 +From: Madhava Reddy Siddareddygari +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 +--- + 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 +