Fwd: [PATCH linux dev-4.13 3/5] pmbus (core): One-shot retries for failure to set page

George Keishing gkeishin at in.ibm.com
Wed Apr 4 14:06:48 AEST 2018


Test and verified working.

Tested-by: George Keishing <gkeishin at in.ibm.com>


Thanks and Regards,
   George Keishing
   IBM Systems &Technology Lab, Firmware Development,
“ There isn't enough time in a day to be lazy!!! .”





From:   Andrew Jeffery <andrew at aj.id.au>
To:     gkeishin at in.ibm.com
Date:   04/04/2018 09:25 AM
Subject:        Fwd: [PATCH linux dev-4.13 3/5] pmbus (core): One-shot 
retries for failure to set page





----- Original message -----
From: Andrew Jeffery <andrew at aj.id.au>
To: joel at jms.id.au
Cc: Andrew Jeffery <andrew at aj.id.au>, openbmc at lists.ozlabs.org, Eddie 
James <eajames at linux.vnet.ibm.com>, Matt Spinler 
<mspinler at linux.vnet.ibm.com>
Subject: [PATCH linux dev-4.13 3/5] pmbus (core): One-shot retries for 
failure to set page
Date: Tue,  3 Apr 2018 23:56:53 +0930

Work around the shonky behaviour seen with the MAX31785 where we fail
to set the page register in some circumstances.

There's no real elegant way to do this. We can propagate the error up,
but that forces us to retry the operation way up the call tree in any
number of places. It also forces callers to split out pmbus_set_page()
from the pmbus_{read,write}_{byte,word}_data() functions in order to
differentiate between a failure to set the page and a failure to read a
register (that might not exist, in which case an error is anticiptated).

Cc: Eddie James <eajames at linux.vnet.ibm.com>
Cc: Matt Spinler <mspinler at linux.vnet.ibm.com>
Signed-off-by: Andrew Jeffery <andrew at aj.id.au>
---
 drivers/hwmon/pmbus/pmbus_core.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/hwmon/pmbus/pmbus_core.c 
b/drivers/hwmon/pmbus/pmbus_core.c
index ee7e0684c29f..ee1bf11c7fc6 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -167,9 +167,17 @@ int pmbus_set_page(struct i2c_client *client, int 
page)
                                 return 0;
 
                 if (!(data->info->func[page] & PMBUS_PAGE_VIRTUAL)) {
+                                dev_dbg(&client->dev, "Want page %u, %u 
cached\n", page,
+                                                data->currpage);
+
                                 rv = i2c_smbus_write_byte_data(client, 
PMBUS_PAGE, page);
-                                if (rv < 0)
-                                                return rv;
+                                if (rv) {
+                                                rv = 
i2c_smbus_write_byte_data(client, PMBUS_PAGE,
+                       page);
+                                                dev_dbg(&client->dev,
+                                                                "Failed 
to set page %u, performed one-shot retry %s: %d\n",
+                                                                page, rv 
? "and failed" : "with success", rv);
+                                }
 
                                 rv = i2c_smbus_read_byte_data(client, 
PMBUS_PAGE);
                                 if (rv < 0)
-- 
2.14.1





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20180404/617c9cae/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 7547 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20180404/617c9cae/attachment-0001.jpe>


More information about the openbmc mailing list