Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1586434 > unrolled thread

[PATCH v2 0/2] mfd: axp20x: Restore master mode support on AXP806

Started byRask Ingemann Lambertsen <rask@formelder.dk>
First post2017-02-22 20:50 +0100
Last post2017-02-28 00:10 +0100
Articles 5 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2 0/2] mfd: axp20x: Restore master mode support on AXP806 Rask Ingemann Lambertsen <rask@formelder.dk> - 2017-02-22 20:50 +0100
    [PATCH v2 2/2] mfd: axp20x: Add support for dts property  "xpowers,master-mode" Rask Ingemann Lambertsen <rask@formelder.dk> - 2017-02-22 20:50 +0100
      Re: [PATCH v2 2/2] mfd: axp20x: Add support for dts property "xpowers,master-mode" Chen-Yu Tsai <wens@csie.org> - 2017-02-23 05:00 +0100
    [PATCH v2 1/2] dts: mfd: axp20x: Add "xpowers,master-mode" property  for AXP806 PMICs Rask Ingemann Lambertsen <rask@formelder.dk> - 2017-02-22 20:50 +0100
      Re: [PATCH v2 1/2] dts: mfd: axp20x: Add "xpowers,master-mode"  property for AXP806 PMICs Rob Herring <robh@kernel.org> - 2017-02-28 00:10 +0100

#1586434 — [PATCH v2 0/2] mfd: axp20x: Restore master mode support on AXP806

FromRask Ingemann Lambertsen <rask@formelder.dk>
Date2017-02-22 20:50 +0100
Subject[PATCH v2 0/2] mfd: axp20x: Restore master mode support on AXP806
Message-ID<tdL5f-6CX-1@gated-at.bofh.it>
The AXP806 (and very similar AXP808) PMICs can be wired to either master
mode or slave mode on a board-by-board basis. A register on the PMIC needs
to be set accordingly for the PMIC to respond to other register accesses.
The "xpowers,master-mode" property introduced in this patch series lets a
board's device tree specify the correct operating mode to use.

Known boards with the Allwinner A80 SoC include an AXP806 or AXP808.
The AXP806 support used to rely on the vendor boot loader to set the
operating mode, but nowadays, mainline U-Boot (since V2016.11) is usable
on boards using the A80 SoC, but doesn't yet have any support for the
AXP806 PMIC. So for kernel 4.11, a patch went in to always set the
AXP806 to slave mode to keep those two boards working (see below). That,
however, broke support for boards where the PMIC is wired for master mode.

There are so far three boards using the AXP806 PMIC support:
- Merrii A80 Optimus and Cubieboard4 developer boards with an AXP809
  paired with an AXP806 in slave mode. A device tree for each of these
  boards have been in the tree for a while now.
- Sunchip CX-A99 which uses just an AXP808 in master mode. An
  out-of-tree device tree works with the 4.9.9 and 4.10-rc7 kernels.
  A device tree will be submitted along with support for *-supply
  properties taking a regulator list.

The default needs to be slave mode for compatibility with the two boards'
device trees that are using the "xpowers,axp806" compatible since kernel
4.9 when the AXP806 support was added.

Patch 1 adds the "xpowers,master-mode" property to the AXP806 binding.
Patch 2 adds support for it to the axp20x driver.

Rask Ingemann Lambertsen (2):
  dts: mfd: axp20x: Add "xpowers,master-mode" property for AXP806 PMICs
  mfd: axp20x: Add support for dts property "xpowers,master-mode"

 Documentation/devicetree/bindings/mfd/axp20x.txt |  3 +++
 drivers/mfd/axp20x.c                             | 21 +++++++++++++--------
 2 files changed, 16 insertions(+), 8 deletions(-)

-- 
2.10.2

[toc] | [next] | [standalone]


#1586435 — [PATCH v2 2/2] mfd: axp20x: Add support for dts property "xpowers,master-mode"

FromRask Ingemann Lambertsen <rask@formelder.dk>
Date2017-02-22 20:50 +0100
Subject[PATCH v2 2/2] mfd: axp20x: Add support for dts property "xpowers,master-mode"
Message-ID<tdL5g-6CX-7@gated-at.bofh.it>
In reply to#1586434
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(-)

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,
-- 
2.10.2

[toc] | [prev] | [next] | [standalone]


#1586635 — Re: [PATCH v2 2/2] mfd: axp20x: Add support for dts property "xpowers,master-mode"

FromChen-Yu Tsai <wens@csie.org>
Date2017-02-23 05:00 +0100
SubjectRe: [PATCH v2 2/2] mfd: axp20x: Add support for dts property "xpowers,master-mode"
Message-ID<tdSJr-3U6-3@gated-at.bofh.it>
In reply to#1586435
On Thu, Feb 23, 2017 at 3:42 AM, Rask Ingemann Lambertsen
<rask@formelder.dk> 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>

Acked-by: Chen-Yu Tsai <wens@csie.org>

[toc] | [prev] | [next] | [standalone]


#1586438 — [PATCH v2 1/2] dts: mfd: axp20x: Add "xpowers,master-mode" property for AXP806 PMICs

FromRask Ingemann Lambertsen <rask@formelder.dk>
Date2017-02-22 20:50 +0100
Subject[PATCH v2 1/2] dts: mfd: axp20x: Add "xpowers,master-mode" property for AXP806 PMICs
Message-ID<tdL5g-6CX-15@gated-at.bofh.it>
In reply to#1586434
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. To let the device tree describe which mode of operation is needed,
this patch introduces a new property "xpowers,master-mode".

Fixes: 204ae2963e10 ("mfd: axp20x: Add bindings for AXP806 PMIC")
Signed-off-by: Rask Ingemann Lambertsen <rask@formelder.dk>
Acked-by: Chen-Yu Tsai <wens@csie.org>
---
Changes from v1 to v2:
Changed the commit message such that Fixes: points to the commit which
introduced the bindings for the AXP806 because the property should have been
included from the beginning of the AXP806 support.

 Documentation/devicetree/bindings/mfd/axp20x.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt b/Documentation/devicetree/bindings/mfd/axp20x.txt
index 8f3ad9a..b41d260 100644
--- a/Documentation/devicetree/bindings/mfd/axp20x.txt
+++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
@@ -28,6 +28,9 @@ Optional properties:
 		  regulator to drive the OTG VBus, rather then as an input pin
 		  which signals whether the board is driving OTG VBus or not.
 
+- x-powers,master-mode: Boolean (axp806 only). Set this when the PMIC is
+			wired for master mode. The default is slave mode.
+
 - <input>-supply: a phandle to the regulator supply node. May be omitted if
 		  inputs are unregulated, such as using the IPSOUT output
 		  from the PMIC.
-- 
2.10.2

[toc] | [prev] | [next] | [standalone]


#1589035 — Re: [PATCH v2 1/2] dts: mfd: axp20x: Add "xpowers,master-mode" property for AXP806 PMICs

FromRob Herring <robh@kernel.org>
Date2017-02-28 00:10 +0100
SubjectRe: [PATCH v2 1/2] dts: mfd: axp20x: Add "xpowers,master-mode" property for AXP806 PMICs
Message-ID<tfCAy-47Y-9@gated-at.bofh.it>
In reply to#1586438
On Wed, Feb 22, 2017 at 08:41:02PM +0100, 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. To let the device tree describe which mode of operation is needed,
> this patch introduces a new property "xpowers,master-mode".
> 
> Fixes: 204ae2963e10 ("mfd: axp20x: Add bindings for AXP806 PMIC")
> Signed-off-by: Rask Ingemann Lambertsen <rask@formelder.dk>
> Acked-by: Chen-Yu Tsai <wens@csie.org>
> ---
> Changes from v1 to v2:
> Changed the commit message such that Fixes: points to the commit which
> introduced the bindings for the AXP806 because the property should have been
> included from the beginning of the AXP806 support.
> 
>  Documentation/devicetree/bindings/mfd/axp20x.txt | 3 +++
>  1 file changed, 3 insertions(+)

Acked-by: Rob Herring <robh@kernel.org>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web