|
| 1 | +From a3e00e49a8647ea9ba6f08a36c1bf6884f91619a Mon Sep 17 00:00:00 2001 |
| 2 | +From: Madhava Reddy Siddareddygari < [email protected]> |
| 3 | +Date: Tue, 1 Jun 2021 22:42:41 -0700 |
| 4 | +Subject: [PATCH] hwmon: (pmbus_core) Check adapter PEC support |
| 5 | + |
| 6 | +Currently, for Packet Error Checking (PEC) only the controller |
| 7 | +is checked for support. This causes problems on the cisco-8000 |
| 8 | +platform where a SMBUS transaction errors are observed. This is |
| 9 | +because PEC has to be enabled only if both controller and |
| 10 | +adapter supports it. |
| 11 | + |
| 12 | +Added code to check PEC capability for adapter and enable it |
| 13 | +only if both controller and adapter supports PEC. |
| 14 | + |
| 15 | +Signed-off-by: Madhava Reddy Siddareddygari < [email protected]> |
| 16 | +--- |
| 17 | + drivers/hwmon/pmbus/pmbus_core.c | 10 +++++++--- |
| 18 | + 1 file changed, 7 insertions(+), 3 deletions(-) |
| 19 | + |
| 20 | +diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c |
| 21 | +index df4a6de24..2f98b4785 100644 |
| 22 | +--- a/drivers/hwmon/pmbus/pmbus_core.c |
| 23 | ++++ b/drivers/hwmon/pmbus/pmbus_core.c |
| 24 | +@@ -2082,10 +2082,14 @@ static int pmbus_init_common(struct i2c_client *client, struct pmbus_data *data, |
| 25 | + data->has_status_word = true; |
| 26 | + } |
| 27 | + |
| 28 | +- /* Enable PEC if the controller supports it */ |
| 29 | ++ /* Enable PEC if the controller and bus supports it */ |
| 30 | + ret = i2c_smbus_read_byte_data(client, PMBUS_CAPABILITY); |
| 31 | +- if (ret >= 0 && (ret & PB_CAPABILITY_ERROR_CHECK)) |
| 32 | +- client->flags |= I2C_CLIENT_PEC; |
| 33 | ++ if (ret >= 0 && (ret & PB_CAPABILITY_ERROR_CHECK)) { |
| 34 | ++ if (i2c_check_functionality(client->adapter, |
| 35 | ++ I2C_FUNC_SMBUS_PEC)) { |
| 36 | ++ client->flags |= I2C_CLIENT_PEC; |
| 37 | ++ } |
| 38 | ++ } |
| 39 | + |
| 40 | + if (data->info->pages) |
| 41 | + pmbus_clear_faults(client); |
| 42 | +-- |
| 43 | +2.26.2 |
| 44 | + |
0 commit comments