openbmc.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Barth <msbarth@linux.ibm.com>
To: Eddie James <eajames@linux.ibm.com>, openbmc@lists.ozlabs.org
Cc: Andrew Jeffery <andrew@aj.id.au>
Subject: Re: [PATCH linux dev-5.10 06/14] pmbus: (max31785) Add a local pmbus_set_page() implementation
Date: Wed, 11 Aug 2021 11:13:32 -0500	[thread overview]
Message-ID: <d5b97b7a-5e64-1b66-4237-45b06ffe9524@linux.ibm.com> (raw)
In-Reply-To: <20210811154232.12649-7-eajames@linux.ibm.com>

On 8/11/21 10:42 AM, Eddie James wrote:
> From: Andrew Jeffery <andrew@aj.id.au>
>
> Extensive testing and tracing has shown that the MAX31785 is unreliable
> in the face of PAGE write commands, ACK'ing the PAGE request but
> reporting a value of 0 on some subsequent PAGE reads. The trace data
> suggests that a one-shot retry of the PAGE write is enough to get the
> requested value to stick.
>
> As we configure the device before registering with the PMBus core,
> centralise PAGE handling inside the driver and implement the one-shot
> retry semantics there.
>
> OpenBMC-Staging-Count: 1
> Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
> Signed-off-by: Joel Stanley <joel@jms.id.au>
Reviewed-by: Matthew Barth <msbarth@linux.ibm.com>
> ---
>  drivers/hwmon/pmbus/max31785.c | 32 ++++++++++++++++++++++++++------
>  1 file changed, 26 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/hwmon/pmbus/max31785.c b/drivers/hwmon/pmbus/max31785.c
> index d097f72d4d47..7518fff356f9 100644
> --- a/drivers/hwmon/pmbus/max31785.c
> +++ b/drivers/hwmon/pmbus/max31785.c
> @@ -362,6 +362,27 @@ static int max31785_write_word_data(struct i2c_client *client, int page,
>  	return -ENXIO;
>  }
>  
> +static int max31785_pmbus_set_page(struct i2c_client *client, int page)
> +{
> +	int ret;
> +	int i;
> +
> +	for (i = 0; i < 2; i++) {
> +		ret = max31785_i2c_smbus_write_byte_data(client, PMBUS_PAGE, page);
> +		if (ret < 0)
> +			return ret;
> +
> +		ret = max31785_i2c_smbus_read_byte_data(client, PMBUS_PAGE);
> +		if (ret < 0)
> +			return ret;
> +
> +		if (ret == page)
> +			return 0;
> +	}
> +
> +	return -EIO;
> +}
> +
>  /*
>   * Returns negative error codes if an unrecoverable problem is detected, 0 if a
>   * recoverable problem is detected, or a positive value on success.
> @@ -392,7 +413,7 @@ static int max31785_of_fan_config(struct i2c_client *client,
>  		return -ENXIO;
>  	}
>  
> -	ret = max31785_i2c_smbus_write_byte_data(client, PMBUS_PAGE, page);
> +	ret = max31785_pmbus_set_page(client, page);
>  	if (ret < 0)
>  		return ret;
>  
> @@ -599,7 +620,7 @@ static int max31785_of_tmp_config(struct i2c_client *client,
>  		return -ENXIO;
>  	}
>  
> -	ret = max31785_i2c_smbus_write_byte_data(client, PMBUS_PAGE, page);
> +	ret = max31785_pmbus_set_page(client, page);
>  	if (ret < 0)
>  		return ret;
>  
> @@ -700,7 +721,7 @@ static int max31785_configure_dual_tach(struct i2c_client *client,
>  	int i;
>  
>  	for (i = 0; i < MAX31785_NR_FAN_PAGES; i++) {
> -		ret = max31785_i2c_smbus_write_byte_data(client, PMBUS_PAGE, i);
> +		ret = max31785_pmbus_set_page(client, i);
>  		if (ret < 0)
>  			return ret;
>  
> @@ -741,7 +762,7 @@ static int max31785_probe(struct i2c_client *client)
>  
>  	*info = max31785_info;
>  
> -	ret = max31785_i2c_smbus_write_byte_data(client, PMBUS_PAGE, 255);
> +	ret = max31785_pmbus_set_page(client, 255);
>  	if (ret < 0)
>  		return ret;
>  
> @@ -785,8 +806,7 @@ static int max31785_probe(struct i2c_client *client)
>  		if (!have_fan || fan_configured)
>  			continue;
>  
> -		ret = max31785_i2c_smbus_write_byte_data(client, PMBUS_PAGE,
> -							 i);
> +		ret = max31785_pmbus_set_page(client, i);
>  		if (ret < 0)
>  			return ret;
>  

  reply	other threads:[~2021-08-11 16:42 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-11 15:42 [PATCH linux dev-5.10 00/14] Rainier and Everest system fixes Eddie James
2021-08-11 15:42 ` [PATCH linux dev-5.10 01/14] i2c: Allow throttling of transfers to client devices Eddie James
2021-08-11 15:42 ` [PATCH linux dev-5.10 02/14] pmbus: (ucd9000) Throttle SMBus transfers to avoid poor behaviour Eddie James
2021-08-11 15:42 ` [PATCH linux dev-5.10 03/14] ucd9000: Add a throttle delay attribute in debugfs Eddie James
2021-08-11 15:42 ` [PATCH linux dev-5.10 04/14] fsi: run clock at 100MHz Eddie James
2021-08-11 15:42 ` [PATCH linux dev-5.10 05/14] pmbus: (core) Add a one-shot retry in pmbus_set_page() Eddie James
2021-08-11 15:42 ` [PATCH linux dev-5.10 06/14] pmbus: (max31785) Add a local pmbus_set_page() implementation Eddie James
2021-08-11 16:13   ` Matthew Barth [this message]
2021-08-11 15:42 ` [PATCH linux dev-5.10 07/14] pmbus: (max31785) Retry enabling fans after writing MFR_FAN_CONFIG Eddie James
2021-08-11 16:14   ` Matthew Barth
2021-08-11 15:42 ` [PATCH linux dev-5.10 08/14] ARM: dts: aspeed: Rainier: Add fan controller properties Eddie James
2021-08-11 16:14   ` Matthew Barth
2021-08-11 15:42 ` [PATCH linux dev-5.10 09/14] ARM: dts: aspeed: Everest: " Eddie James
2021-08-11 16:15   ` Matthew Barth
2021-08-11 15:42 ` [PATCH linux dev-5.10 10/14] ARM: dts: aspeed: Rainier 4U: Delete fan dual-tach properties Eddie James
2021-08-11 16:17   ` Matthew Barth
2021-08-11 15:42 ` [PATCH linux dev-5.10 11/14] ARM: dts: aspeed: Add Rainier 2U and 4U device trees for pass 1 hardware Eddie James
2021-08-11 15:42 ` [PATCH linux dev-5.10 12/14] fsi: sbefifo: Increase command timeouts to 30 seconds Eddie James
2021-08-11 15:42 ` [PATCH linux dev-5.10 13/14] fsi: occ: Add dynamic debug to dump command and response Eddie James
2021-08-11 15:42 ` [PATCH linux dev-5.10 14/14] fsi: sbefifo: Use interruptible mutex locking Eddie James

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=d5b97b7a-5e64-1b66-4237-45b06ffe9524@linux.ibm.com \
    --to=msbarth@linux.ibm.com \
    --cc=andrew@aj.id.au \
    --cc=eajames@linux.ibm.com \
    --cc=openbmc@lists.ozlabs.org \
    /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).