mbox series

[v2,0/5] arm64: allwinner: h6: Enable AXP805 PMIC on Pine H64

Message ID 20180705031106.344-1-wens@csie.org
Headers show
Series arm64: allwinner: h6: Enable AXP805 PMIC on Pine H64 | expand

Message

Chen-Yu Tsai July 5, 2018, 3:11 a.m. UTC
Hi everyone,

This series enables the AXP805 PMIC found on the Pine64 Pine H64 board.
The AXP805 seems to be identical to the AXP806 when comparing datasheets.
The Pine H64 uses the PMIC in stand-alone or "self-working" mode, using
the I2C interface. Neither features are currently supported. This series
adds support for them, and then adds the PMIC to the device tree.

Changes since v1:

  - Mentioned "self-working mode" in device tree commit message
  - Shortened one line mfd cell into just one line
  - Dropped unrelated pinctrl change
  - Collected tags from Rob, Icenowy and Lee

Patch 1 adds a new device tree property to describe the self-working mode
for the AXP806.

Patch 2 adds support for the newly added property to the driver.

Patch 3 adds support for the using AXP806 with I2C.

Patch 4 converts raw clock/reset indices for the H6 R_CCU currently found
in the device tree to macros defined as part of the device tree bindings.

Patch 5 adds the PMIC and its regulators to the Pine H64 device tree.

First three patches should go in through Lee's mfd tree. We'll take the
other two through the sunxi tree.

Please have a look.

Regards
ChenYu

Chen-Yu Tsai (4):
  dt-bindings: mfd: axp20x: Add "self-working" mode for AXP806
  mfd: axp20x: Add self-working mode support for AXP806
  mfd: axp20x: Support AXP806 in I2C mode
  arm64: dts: allwinner: h6: Use macros for R_CCU clock and reset
    indices

Icenowy Zheng (1):
  arm64: dts: allwinner: h6: enable AXP805 PMIC on Pine H64

 .../devicetree/bindings/mfd/axp20x.txt        |   7 +-
 .../boot/dts/allwinner/sun50i-h6-pine-h64.dts | 109 ++++++++++++++++++
 arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi  |   8 +-
 drivers/mfd/axp20x-i2c.c                      |   2 +
 drivers/mfd/axp20x.c                          |  30 ++++-
 5 files changed, 148 insertions(+), 8 deletions(-)

Comments

Maxime Ripard July 5, 2018, 9:41 a.m. UTC | #1
On Thu, Jul 05, 2018 at 11:11:01AM +0800, Chen-Yu Tsai wrote:
> Hi everyone,
> 
> This series enables the AXP805 PMIC found on the Pine64 Pine H64 board.
> The AXP805 seems to be identical to the AXP806 when comparing datasheets.
> The Pine H64 uses the PMIC in stand-alone or "self-working" mode, using
> the I2C interface. Neither features are currently supported. This series
> adds support for them, and then adds the PMIC to the device tree.

Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>

Maxime
Lee Jones July 12, 2018, 12:29 p.m. UTC | #2
On Thu, 05 Jul 2018, Chen-Yu Tsai wrote:

> The AXP806 can operate in a standalone "self-working" mode, in which it
> is also responsible for power control of the overall system. This mode
> is similar to the master mode, but the EN/PWRON pin functions as a power
> button, instead of a level-triggered enable switch.
> 
> This patch adds code checking for the new "x-powers,self-working-mode"
> property, and a separate mfd_cell list that includes the power button
> (PEK) sub-device.
> 
> Reviewed-by: Icenowy Zheng <icenowy@aosc.io>
> Tested-by: Icenowy Zheng <icenowy@aosc.io>
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> ---
>  drivers/mfd/axp20x.c | 30 +++++++++++++++++++++++++++---
>  1 file changed, 27 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> index 9a2ef3d9b8f8..1988881529a9 100644
> --- a/drivers/mfd/axp20x.c
> +++ b/drivers/mfd/axp20x.c
> @@ -221,6 +221,11 @@ static const struct resource axp803_pek_resources[] = {
>  	DEFINE_RES_IRQ_NAMED(AXP803_IRQ_PEK_FAL_EDGE, "PEK_DBF"),
>  };
>  
> +static const struct resource axp806_pek_resources[] = {
> +	DEFINE_RES_IRQ_NAMED(AXP806_IRQ_POK_RISE, "PEK_DBR"),
> +	DEFINE_RES_IRQ_NAMED(AXP806_IRQ_POK_FALL, "PEK_DBF"),
> +};
> +
>  static const struct resource axp809_pek_resources[] = {
>  	DEFINE_RES_IRQ_NAMED(AXP809_IRQ_PEK_RIS_EDGE, "PEK_DBR"),
>  	DEFINE_RES_IRQ_NAMED(AXP809_IRQ_PEK_FAL_EDGE, "PEK_DBF"),
> @@ -730,6 +735,17 @@ static const struct mfd_cell axp803_cells[] = {
>  	{	.name			= "axp20x-regulator" },
>  };
>  
> +static const struct mfd_cell axp806_self_working_cells[] = {
> +	{
> +		.name			= "axp221-pek",
> +		.num_resources		= ARRAY_SIZE(axp806_pek_resources),
> +		.resources		= axp806_pek_resources,
> +	},
> +	{
> +		.name			= "axp20x-regulator",
> +	},

Nit: this should be on a single line, like it is above.

Once fixed, please re-submit with my:

For my own reference:
  Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
Lee Jones July 12, 2018, 12:30 p.m. UTC | #3
On Thu, 05 Jul 2018, Chen-Yu Tsai wrote:

> The Pine64 H64 board uses an AXP806 PMIC in I2C and self-working mode.
> The H64 SoC does not have the usual RSB controller.
> 
> This patch adds AXP806 to the list of devices supported in I2C mode.
> In theory, all RSB-based PMICs can also be used in I2C mode.
> 
> Reviewed-by: Icenowy Zheng <icenowy@aosc.io>
> Tested-by: Icenowy Zheng <icenowy@aosc.io>
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> ---
>  drivers/mfd/axp20x-i2c.c | 2 ++
>  1 file changed, 2 insertions(+)

For my own reference:
  Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>