All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] mfd: axp20x: Restore master mode support on AXP806
@ 2017-02-18 19:45 ` Rask Ingemann Lambertsen
  0 siblings, 0 replies; 16+ messages in thread
From: Rask Ingemann Lambertsen @ 2017-02-18 19:45 UTC (permalink / raw)
  To: Chen-Yu Tsai, Lee Jones, Rob Herring, Mark Rutland
  Cc: devicetree, linux-kernel, linux-arm-kernel

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 0/2] mfd: axp20x: Restore master mode support on AXP806
@ 2017-02-18 19:45 ` Rask Ingemann Lambertsen
  0 siblings, 0 replies; 16+ messages in thread
From: Rask Ingemann Lambertsen @ 2017-02-18 19:45 UTC (permalink / raw)
  To: Chen-Yu Tsai, Lee Jones, Rob Herring, Mark Rutland
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

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

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 0/2] mfd: axp20x: Restore master mode support on AXP806
@ 2017-02-18 19:45 ` Rask Ingemann Lambertsen
  0 siblings, 0 replies; 16+ messages in thread
From: Rask Ingemann Lambertsen @ 2017-02-18 19:45 UTC (permalink / raw)
  To: linux-arm-kernel

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/2] dts: mfd: axp20x: Add xpowers,master-mode property for AXP806 PMICs
  2017-02-18 19:45 ` Rask Ingemann Lambertsen
@ 2017-02-18 19:51   ` Rask Ingemann Lambertsen
  -1 siblings, 0 replies; 16+ messages in thread
From: Rask Ingemann Lambertsen @ 2017-02-18 19:51 UTC (permalink / raw)
  To: Chen-Yu Tsai, Lee Jones, Rob Herring, Mark Rutland
  Cc: devicetree, linux-kernel, linux-arm-kernel

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: b101829a029a ("mfd: axp20x: Fix AXP806 access errors on cold boot")
Signed-off-by: Rask Ingemann Lambertsen <rask@formelder.dk>
---
 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 86ae540..9af3457 100644
--- a/Documentation/devicetree/bindings/mfd/axp20x.txt
+++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
@@ -29,6 +29,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

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 1/2] dts: mfd: axp20x: Add xpowers,master-mode property for AXP806 PMICs
@ 2017-02-18 19:51   ` Rask Ingemann Lambertsen
  0 siblings, 0 replies; 16+ messages in thread
From: Rask Ingemann Lambertsen @ 2017-02-18 19:51 UTC (permalink / raw)
  To: linux-arm-kernel

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: b101829a029a ("mfd: axp20x: Fix AXP806 access errors on cold boot")
Signed-off-by: Rask Ingemann Lambertsen <rask@formelder.dk>
---
 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 86ae540..9af3457 100644
--- a/Documentation/devicetree/bindings/mfd/axp20x.txt
+++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
@@ -29,6 +29,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

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 2/2] mfd: axp20x: Add support for dts property "xpowers,master-mode"
@ 2017-02-18 20:11   ` Rask Ingemann Lambertsen
  0 siblings, 0 replies; 16+ messages in thread
From: Rask Ingemann Lambertsen @ 2017-02-18 20:11 UTC (permalink / raw)
  To: Chen-Yu Tsai, Lee Jones, Rob Herring, Mark Rutland
  Cc: devicetree, linux-kernel, linux-arm-kernel

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: b101829a029a ("mfd: axp20x: Fix AXP806 access errors on cold boot")
Signed-off-by: Rask Ingemann Lambertsen <rask@formelder.dk>
---
 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

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 2/2] mfd: axp20x: Add support for dts property "xpowers,master-mode"
@ 2017-02-18 20:11   ` Rask Ingemann Lambertsen
  0 siblings, 0 replies; 16+ messages in thread
From: Rask Ingemann Lambertsen @ 2017-02-18 20:11 UTC (permalink / raw)
  To: Chen-Yu Tsai, Lee Jones, Rob Herring, Mark Rutland
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

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: b101829a029a ("mfd: axp20x: Fix AXP806 access errors on cold boot")
Signed-off-by: Rask Ingemann Lambertsen <rask-SivP7zSAdNDZaaYASwVUlg@public.gmane.org>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 2/2] mfd: axp20x: Add support for dts property "xpowers,master-mode"
@ 2017-02-18 20:11   ` Rask Ingemann Lambertsen
  0 siblings, 0 replies; 16+ messages in thread
From: Rask Ingemann Lambertsen @ 2017-02-18 20:11 UTC (permalink / raw)
  To: linux-arm-kernel

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: b101829a029a ("mfd: axp20x: Fix AXP806 access errors on cold boot")
Signed-off-by: Rask Ingemann Lambertsen <rask@formelder.dk>
---
 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

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] dts: mfd: axp20x: Add xpowers,master-mode property for AXP806 PMICs
@ 2017-02-21  3:16     ` Chen-Yu Tsai
  0 siblings, 0 replies; 16+ messages in thread
From: Chen-Yu Tsai @ 2017-02-21  3:16 UTC (permalink / raw)
  To: Rask Ingemann Lambertsen
  Cc: Chen-Yu Tsai, Lee Jones, Rob Herring, Mark Rutland, devicetree,
	linux-kernel, linux-arm-kernel

On Sun, Feb 19, 2017 at 3:51 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. To let the device tree describe which mode of operation is needed,
> this patch introduces a new property "xpowers,master-mode".
>
> Fixes: b101829a029a ("mfd: axp20x: Fix AXP806 access errors on cold boot")

I think this should point to the original commit that added support
for the AXP806.

Otherwise,

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

> Signed-off-by: Rask Ingemann Lambertsen <rask@formelder.dk>
> ---
>  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 86ae540..9af3457 100644
> --- a/Documentation/devicetree/bindings/mfd/axp20x.txt
> +++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
> @@ -29,6 +29,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
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] dts: mfd: axp20x: Add xpowers,master-mode property for AXP806 PMICs
@ 2017-02-21  3:16     ` Chen-Yu Tsai
  0 siblings, 0 replies; 16+ messages in thread
From: Chen-Yu Tsai @ 2017-02-21  3:16 UTC (permalink / raw)
  To: Rask Ingemann Lambertsen
  Cc: Chen-Yu Tsai, Lee Jones, Rob Herring, Mark Rutland, devicetree,
	linux-kernel, linux-arm-kernel

On Sun, Feb 19, 2017 at 3:51 AM, Rask Ingemann Lambertsen
<rask-SivP7zSAdNDZaaYASwVUlg@public.gmane.org> 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: b101829a029a ("mfd: axp20x: Fix AXP806 access errors on cold boot")

I think this should point to the original commit that added support
for the AXP806.

Otherwise,

Acked-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>

> Signed-off-by: Rask Ingemann Lambertsen <rask-SivP7zSAdNDZaaYASwVUlg@public.gmane.org>
> ---
>  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 86ae540..9af3457 100644
> --- a/Documentation/devicetree/bindings/mfd/axp20x.txt
> +++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
> @@ -29,6 +29,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
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/2] dts: mfd: axp20x: Add xpowers,master-mode property for AXP806 PMICs
@ 2017-02-21  3:16     ` Chen-Yu Tsai
  0 siblings, 0 replies; 16+ messages in thread
From: Chen-Yu Tsai @ 2017-02-21  3:16 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, Feb 19, 2017 at 3:51 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. To let the device tree describe which mode of operation is needed,
> this patch introduces a new property "xpowers,master-mode".
>
> Fixes: b101829a029a ("mfd: axp20x: Fix AXP806 access errors on cold boot")

I think this should point to the original commit that added support
for the AXP806.

Otherwise,

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

> Signed-off-by: Rask Ingemann Lambertsen <rask@formelder.dk>
> ---
>  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 86ae540..9af3457 100644
> --- a/Documentation/devicetree/bindings/mfd/axp20x.txt
> +++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
> @@ -29,6 +29,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
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/2] mfd: axp20x: Add support for dts property "xpowers,master-mode"
@ 2017-02-21  3:21     ` Chen-Yu Tsai
  0 siblings, 0 replies; 16+ messages in thread
From: Chen-Yu Tsai @ 2017-02-21  3:21 UTC (permalink / raw)
  To: Rask Ingemann Lambertsen
  Cc: Chen-Yu Tsai, Lee Jones, Rob Herring, Mark Rutland, devicetree,
	linux-kernel, linux-arm-kernel

On Sun, Feb 19, 2017 at 4:11 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: b101829a029a ("mfd: axp20x: Fix AXP806 access errors on cold boot")

Same comment as the previous patch. You are fixing or adding something that
we should've had from the beginning.

ChenYu

> Signed-off-by: Rask Ingemann Lambertsen <rask@formelder.dk>
> ---
>  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
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/2] mfd: axp20x: Add support for dts property "xpowers,master-mode"
@ 2017-02-21  3:21     ` Chen-Yu Tsai
  0 siblings, 0 replies; 16+ messages in thread
From: Chen-Yu Tsai @ 2017-02-21  3:21 UTC (permalink / raw)
  To: Rask Ingemann Lambertsen
  Cc: Chen-Yu Tsai, Lee Jones, Rob Herring, Mark Rutland, devicetree,
	linux-kernel, linux-arm-kernel

On Sun, Feb 19, 2017 at 4:11 AM, Rask Ingemann Lambertsen
<rask-SivP7zSAdNDZaaYASwVUlg@public.gmane.org> 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: b101829a029a ("mfd: axp20x: Fix AXP806 access errors on cold boot")

Same comment as the previous patch. You are fixing or adding something that
we should've had from the beginning.

ChenYu

> Signed-off-by: Rask Ingemann Lambertsen <rask-SivP7zSAdNDZaaYASwVUlg@public.gmane.org>
> ---
>  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
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 2/2] mfd: axp20x: Add support for dts property "xpowers, master-mode"
@ 2017-02-21  3:21     ` Chen-Yu Tsai
  0 siblings, 0 replies; 16+ messages in thread
From: Chen-Yu Tsai @ 2017-02-21  3:21 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, Feb 19, 2017 at 4:11 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: b101829a029a ("mfd: axp20x: Fix AXP806 access errors on cold boot")

Same comment as the previous patch. You are fixing or adding something that
we should've had from the beginning.

ChenYu

> Signed-off-by: Rask Ingemann Lambertsen <rask@formelder.dk>
> ---
>  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
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] dts: mfd: axp20x: Add xpowers,master-mode property for AXP806 PMICs
  2017-02-18 19:51   ` Rask Ingemann Lambertsen
@ 2017-02-27 17:05     ` Rob Herring
  -1 siblings, 0 replies; 16+ messages in thread
From: Rob Herring @ 2017-02-27 17:05 UTC (permalink / raw)
  To: Rask Ingemann Lambertsen
  Cc: Chen-Yu Tsai, Lee Jones, Mark Rutland, devicetree, linux-kernel,
	linux-arm-kernel

On Sat, Feb 18, 2017 at 08:51:18PM +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: b101829a029a ("mfd: axp20x: Fix AXP806 access errors on cold boot")
> Signed-off-by: Rask Ingemann Lambertsen <rask@formelder.dk>
> ---
>  Documentation/devicetree/bindings/mfd/axp20x.txt | 3 +++
>  1 file changed, 3 insertions(+)

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/2] dts: mfd: axp20x: Add xpowers,master-mode property for AXP806 PMICs
@ 2017-02-27 17:05     ` Rob Herring
  0 siblings, 0 replies; 16+ messages in thread
From: Rob Herring @ 2017-02-27 17:05 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Feb 18, 2017 at 08:51:18PM +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: b101829a029a ("mfd: axp20x: Fix AXP806 access errors on cold boot")
> Signed-off-by: Rask Ingemann Lambertsen <rask@formelder.dk>
> ---
>  Documentation/devicetree/bindings/mfd/axp20x.txt | 3 +++
>  1 file changed, 3 insertions(+)

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2017-02-27 17:05 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-18 19:45 [PATCH 0/2] mfd: axp20x: Restore master mode support on AXP806 Rask Ingemann Lambertsen
2017-02-18 19:45 ` Rask Ingemann Lambertsen
2017-02-18 19:45 ` Rask Ingemann Lambertsen
2017-02-18 19:51 ` [PATCH 1/2] dts: mfd: axp20x: Add xpowers,master-mode property for AXP806 PMICs Rask Ingemann Lambertsen
2017-02-18 19:51   ` Rask Ingemann Lambertsen
2017-02-21  3:16   ` Chen-Yu Tsai
2017-02-21  3:16     ` Chen-Yu Tsai
2017-02-21  3:16     ` Chen-Yu Tsai
2017-02-27 17:05   ` Rob Herring
2017-02-27 17:05     ` Rob Herring
2017-02-18 20:11 ` [PATCH 2/2] mfd: axp20x: Add support for dts property "xpowers,master-mode" Rask Ingemann Lambertsen
2017-02-18 20:11   ` Rask Ingemann Lambertsen
2017-02-18 20:11   ` Rask Ingemann Lambertsen
2017-02-21  3:21   ` Chen-Yu Tsai
2017-02-21  3:21     ` [PATCH 2/2] mfd: axp20x: Add support for dts property "xpowers, master-mode" Chen-Yu Tsai
2017-02-21  3:21     ` [PATCH 2/2] mfd: axp20x: Add support for dts property "xpowers,master-mode" Chen-Yu Tsai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.