public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: lee.jones@linaro.org (Lee Jones)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/2] mfd: axp20x: Add support for dts property "xpowers,master-mode"
Date: Tue, 14 Mar 2017 16:19:16 +0000	[thread overview]
Message-ID: <20170314161916.77ityr7jdfxtsaij@dell> (raw)
In-Reply-To: <ef82cd5bbea5a5eedcafd3f57e7b7409dd9b4b5e.1487791329.git.rask@formelder.dk>

On Wed, 22 Feb 2017, Rask Ingemann Lambertsen wrote:

> commit b101829a029a ("mfd: axp20x: Fix AXP806 access errors on cold boot")
> was intended to fix the case where a board uses an AXP806 in slave mode,
> but the boot loader leaves it in master mode for lack of AXP806 support.
> But now the driver breaks on boards where the PMIC is operating in master
> mode. This patch lets the driver use the new device tree property
> "xpowers,master-mode" to set the correct operating mode for the board.
> 
> Fixes: 8824ee857348 ("mfd: axp20x: Add support for AXP806 PMIC")
> Signed-off-by: Rask Ingemann Lambertsen <rask@formelder.dk>
> ---
> Changes from v1 to v2:
> Changed the commit message such that Fixes: points to the commit which added
> the AXP806 driver because the property should have been included from the
> beginning of the AXP806 support.
> 
>  drivers/mfd/axp20x.c | 21 +++++++++++++--------
>  1 file changed, 13 insertions(+), 8 deletions(-)

Applied, thanks.

> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> index 25115fe..0512900 100644
> --- a/drivers/mfd/axp20x.c
> +++ b/drivers/mfd/axp20x.c
> @@ -31,6 +31,7 @@
>  
>  #define AXP20X_OFF	0x80
>  
> +#define AXP806_REG_ADDR_EXT_ADDR_MASTER_MODE	0
>  #define AXP806_REG_ADDR_EXT_ADDR_SLAVE_MODE	BIT(4)
>  
>  static const char * const axp20x_model_names[] = {
> @@ -877,15 +878,19 @@ int axp20x_device_probe(struct axp20x_dev *axp20x)
>  	 * the these device addressing bits (in the upper 4 bits of the
>  	 * registers) match.
>  	 *
> -	 * Since we only support an AXP806 chained to an AXP809 in slave
> -	 * mode, and there isn't any existing hardware which uses AXP806
> -	 * in master mode, or has 2 AXP806s in the same system, we can
> -	 * just program the register address extension to the slave mode
> -	 * address.
> +	 * By default we support an AXP806 chained to an AXP809 in slave
> +	 * mode. Boards which use an AXP806 in master mode can set the
> +	 * property "x-powers,master-mode" to override the default.
>  	 */
> -	if (axp20x->variant == AXP806_ID)
> -		regmap_write(axp20x->regmap, AXP806_REG_ADDR_EXT,
> -			     AXP806_REG_ADDR_EXT_ADDR_SLAVE_MODE);
> +	if (axp20x->variant == AXP806_ID) {
> +		if (of_property_read_bool(axp20x->dev->of_node,
> +					  "x-powers,master-mode"))
> +			regmap_write(axp20x->regmap, AXP806_REG_ADDR_EXT,
> +				     AXP806_REG_ADDR_EXT_ADDR_MASTER_MODE);
> +		else
> +			regmap_write(axp20x->regmap, AXP806_REG_ADDR_EXT,
> +				     AXP806_REG_ADDR_EXT_ADDR_SLAVE_MODE);
> +	}
>  
>  	ret = regmap_add_irq_chip(axp20x->regmap, axp20x->irq,
>  			  IRQF_ONESHOT | IRQF_SHARED | axp20x->irq_flags,

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

      parent reply	other threads:[~2017-03-14 16:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-22 19:40 [PATCH v2 0/2] mfd: axp20x: Restore master mode support on AXP806 Rask Ingemann Lambertsen
2017-02-22 19:41 ` [PATCH v2 1/2] dts: mfd: axp20x: Add "xpowers,master-mode" property for AXP806 PMICs Rask Ingemann Lambertsen
2017-02-27 23:00   ` Rob Herring
2017-03-14 16:19   ` Lee Jones
2017-02-22 19:42 ` [PATCH v2 2/2] mfd: axp20x: Add support for dts property "xpowers,master-mode" Rask Ingemann Lambertsen
2017-02-23  3:57   ` [PATCH v2 2/2] mfd: axp20x: Add support for dts property "xpowers, master-mode" Chen-Yu Tsai
2017-03-14 16:19   ` Lee Jones [this message]

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=20170314161916.77ityr7jdfxtsaij@dell \
    --to=lee.jones@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.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