linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] arm: sun9i: Support AXP808 PMIC and Sunchip CX-A99 board
@ 2017-01-26 21:14 Rask Ingemann Lambertsen
  2017-01-26 21:15 ` [PATCH 1/5] DT: mfd: axp20x: Add AXP806 to list of current AXP20x family members Rask Ingemann Lambertsen
                   ` (5 more replies)
  0 siblings, 6 replies; 17+ messages in thread
From: Rask Ingemann Lambertsen @ 2017-01-26 21:14 UTC (permalink / raw)
  To: Chen-Yu Tsai, Lee Jones, Mark Brown, Rob Herring, Mark Rutland,
	Liam Girdwood
  Cc: linux-kernel, devicetree, linux-kernel

This patch series add support for the Sunchip CX-A99 board, which is used in
a few media players, making it the third device with an Allwinner A80 SoC
to be supported. The board uses the X-Powers AXP808 PMIC which this patch
series also adds support for.

Patch 1 adds a documentation line which was forgotten when device tree
bindings for the axp20x family were updated for the AXP806 PMIC. A line
immediately below the missing line will be inserted by patch 2, so I'm
including patch 1 in this series to avoid conflicts between patches.

Patch 2 adds the AXP808 to the axp20x device tree bindings.

Patch 3 adds support for the AXP808 to the axp20x MFD driver.

Patch 4 adds support for the AXP808 to the axp20x regulator driver.

Patch 5 add the device tree for the Sunchip CX-A99 board. This patch is v5 of
the only remaining patch from v4 of the patch series posted back in August.
Support for the AXP808 has made major improvements possible, notably Wifi.

Before trying out this patch series, you must also apply the patch
"regulator: axp20x: AXP806: Fix dcdcb being set instead of dcdce" [1]
to avoid damage to the DRAM chips through over-voltage.

[1] https://patchwork.kernel.org/patch/9530319/

Rask Ingemann Lambertsen (5):
  DT: mfd: axp20x: Add AXP806 to list of current AXP20x family members
  DT: mfd: axp20x: Add binding for the AXP808
  mfd: axp20x: Add support for the AXP808 PMIC
  regulator: axp20x: Add support for the AXP808 PMIC
  ARM: dts: sun9i: Initial support for the Sunchip CX-A99 board

 Documentation/devicetree/bindings/mfd/axp20x.txt |   8 +-
 arch/arm/boot/dts/Makefile                       |   3 +-
 arch/arm/boot/dts/sun9i-a80-cx-a99.dts           | 413 +++++++++++++++++++++++
 drivers/mfd/axp20x-rsb.c                         |   1 +
 drivers/mfd/axp20x.c                             |  28 ++
 drivers/regulator/axp20x-regulator.c             |   7 +-
 include/linux/mfd/axp20x.h                       |   1 +
 7 files changed, 455 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm/boot/dts/sun9i-a80-cx-a99.dts

-- 
2.10.2

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

* [PATCH 1/5] DT: mfd: axp20x: Add AXP806 to list of current AXP20x family members
  2017-01-26 21:14 [PATCH 0/5] arm: sun9i: Support AXP808 PMIC and Sunchip CX-A99 board Rask Ingemann Lambertsen
@ 2017-01-26 21:15 ` Rask Ingemann Lambertsen
  2017-01-27  4:38   ` Chen-Yu Tsai
  2017-02-01 13:26   ` Rob Herring
  2017-01-26 21:16 ` [PATCH 2/5] DT: mfd: axp20x: Add binding for the AXP808 Rask Ingemann Lambertsen
                   ` (4 subsequent siblings)
  5 siblings, 2 replies; 17+ messages in thread
From: Rask Ingemann Lambertsen @ 2017-01-26 21:15 UTC (permalink / raw)
  To: Chen-Yu Tsai, Lee Jones, Mark Brown, Rob Herring, Mark Rutland,
	Liam Girdwood
  Cc: linux-kernel, devicetree, linux-kernel

An entry for the AXP806 was forgotten, so add one.

Signed-off-by: Rask Ingemann Lambertsen <rask@formelder.dk>
Fixes: 204ae2963e10 ("mfd: axp20x: Add bindings for AXP806 PMIC")
---
 Documentation/devicetree/bindings/mfd/axp20x.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt b/Documentation/devicetree/bindings/mfd/axp20x.txt
index 8f3ad9a..86ae540 100644
--- a/Documentation/devicetree/bindings/mfd/axp20x.txt
+++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
@@ -6,6 +6,7 @@ axp202 (X-Powers)
 axp209 (X-Powers)
 axp221 (X-Powers)
 axp223 (X-Powers)
+axp806 (X-Powers)
 axp809 (X-Powers)
 
 Required properties:
-- 
2.10.2

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

* [PATCH 2/5] DT: mfd: axp20x: Add binding for the AXP808
  2017-01-26 21:14 [PATCH 0/5] arm: sun9i: Support AXP808 PMIC and Sunchip CX-A99 board Rask Ingemann Lambertsen
  2017-01-26 21:15 ` [PATCH 1/5] DT: mfd: axp20x: Add AXP806 to list of current AXP20x family members Rask Ingemann Lambertsen
@ 2017-01-26 21:16 ` Rask Ingemann Lambertsen
  2017-02-01 13:27   ` Rob Herring
  2017-01-26 21:17 ` [PATCH 3/5] mfd: axp20x: Add support for the AXP808 PMIC Rask Ingemann Lambertsen
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 17+ messages in thread
From: Rask Ingemann Lambertsen @ 2017-01-26 21:16 UTC (permalink / raw)
  To: Chen-Yu Tsai, Lee Jones, Mark Brown, Rob Herring, Mark Rutland,
	Liam Girdwood
  Cc: linux-kernel, devicetree, linux-kernel

The AXP808 does not support address space extension, but is otherwise
identical to the AXP806, including the chip ID, so add a compatible
string for it to the binding.

Signed-off-by: Rask Ingemann Lambertsen <rask@formelder.dk>
---
 Documentation/devicetree/bindings/mfd/axp20x.txt | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt b/Documentation/devicetree/bindings/mfd/axp20x.txt
index 86ae540..8195b06 100644
--- a/Documentation/devicetree/bindings/mfd/axp20x.txt
+++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
@@ -7,12 +7,13 @@ axp209 (X-Powers)
 axp221 (X-Powers)
 axp223 (X-Powers)
 axp806 (X-Powers)
+axp808 (X-Powers)
 axp809 (X-Powers)
 
 Required properties:
 - compatible: "x-powers,axp152", "x-powers,axp202", "x-powers,axp209",
 	      "x-powers,axp221", "x-powers,axp223", "x-powers,axp806",
-	      "x-powers,axp809"
+	      "x-powers,axp808", "x-powers,axp809"
 - reg: The I2C slave address or RSB hardware address for the AXP chip
 - interrupt-parent: The parent interrupt controller
 - interrupts: SoC NMI / GPIO interrupt connected to the PMIC's IRQ pin
@@ -87,7 +88,7 @@ LDO_IO1		: LDO		: ips-supply		: GPIO 1
 RTC_LDO		: LDO		: ips-supply		: always on
 DRIVEVBUS	: Enable output	: drivevbus-supply	: external regulator
 
-AXP806 regulators, type, and corresponding input supply names:
+AXP806/AXP808 regulators, type, and corresponding input supply names:
 
 Regulator	  Type		  Supply Name		  Notes
 ---------	  ----		  -----------		  -----
@@ -108,7 +109,7 @@ CLDO2		: LDO		: cldoin-supply		: shared supply
 CLDO3		: LDO		: cldoin-supply		: shared supply
 SW		: On/Off Switch : swin-supply
 
-Additionally, the AXP806 DC-DC regulators support poly-phase arrangements
+Additionally, the AXP806/AXP808 DC-DC regulators support poly-phase arrangements
 for higher output current. The possible groupings are: A+B, A+B+C, D+E.
 
 AXP809 regulators, type, and corresponding input supply names:
-- 
2.10.2

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

* [PATCH 3/5] mfd: axp20x: Add support for the AXP808 PMIC
  2017-01-26 21:14 [PATCH 0/5] arm: sun9i: Support AXP808 PMIC and Sunchip CX-A99 board Rask Ingemann Lambertsen
  2017-01-26 21:15 ` [PATCH 1/5] DT: mfd: axp20x: Add AXP806 to list of current AXP20x family members Rask Ingemann Lambertsen
  2017-01-26 21:16 ` [PATCH 2/5] DT: mfd: axp20x: Add binding for the AXP808 Rask Ingemann Lambertsen
@ 2017-01-26 21:17 ` Rask Ingemann Lambertsen
  2017-02-02  7:23   ` Chen-Yu Tsai
  2017-01-26 21:18 ` [PATCH 4/5] regulator: " Rask Ingemann Lambertsen
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 17+ messages in thread
From: Rask Ingemann Lambertsen @ 2017-01-26 21:17 UTC (permalink / raw)
  To: Chen-Yu Tsai, Lee Jones, Mark Brown, Rob Herring, Mark Rutland,
	Liam Girdwood
  Cc: linux-kernel, devicetree, linux-kernel

The X-Powers AXP808 is a PMIC which, like the very similar AXP806, is
used on boards featuring Allwinner's A80 SoC. Unlike the AXP806, it
doesn't support address space extension and its associated registers,
but the two are otherwise identical (including the chip ID).

This patch adds support for the interrupts on the AXP808 and enables
the regulator sub-device. The next patch in the series adds the actual
regulator support.

Signed-off-by: Rask Ingemann Lambertsen <rask@formelder.dk>
---
 drivers/mfd/axp20x-rsb.c   |  1 +
 drivers/mfd/axp20x.c       | 28 ++++++++++++++++++++++++++++
 include/linux/mfd/axp20x.h |  1 +
 3 files changed, 30 insertions(+)

diff --git a/drivers/mfd/axp20x-rsb.c b/drivers/mfd/axp20x-rsb.c
index a732cb5..96ea2e9 100644
--- a/drivers/mfd/axp20x-rsb.c
+++ b/drivers/mfd/axp20x-rsb.c
@@ -62,6 +62,7 @@ static int axp20x_rsb_remove(struct sunxi_rsb_device *rdev)
 static const struct of_device_id axp20x_rsb_of_match[] = {
 	{ .compatible = "x-powers,axp223", .data = (void *)AXP223_ID },
 	{ .compatible = "x-powers,axp806", .data = (void *)AXP806_ID },
+	{ .compatible = "x-powers,axp808", .data = (void *)AXP808_ID },
 	{ .compatible = "x-powers,axp809", .data = (void *)AXP809_ID },
 	{ },
 };
diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index 25115fe..2d3383e 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -41,6 +41,7 @@ static const char * const axp20x_model_names[] = {
 	"AXP223",
 	"AXP288",
 	"AXP806",
+	"AXP808",
 	"AXP809",
 };
 
@@ -148,6 +149,13 @@ static const struct regmap_range axp806_writeable_ranges[] = {
 	regmap_reg_range(AXP806_REG_ADDR_EXT, AXP806_REG_ADDR_EXT),
 };
 
+static const struct regmap_range axp808_writeable_ranges[] = {
+	regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_DATACACHE(3)),
+	regmap_reg_range(AXP806_PWR_OUT_CTRL1, AXP806_CLDO3_V_CTRL),
+	regmap_reg_range(AXP20X_IRQ1_EN, AXP20X_IRQ2_EN),
+	regmap_reg_range(AXP20X_IRQ1_STATE, AXP20X_IRQ2_STATE),
+};
+
 static const struct regmap_range axp806_volatile_ranges[] = {
 	regmap_reg_range(AXP20X_IRQ1_STATE, AXP20X_IRQ2_STATE),
 };
@@ -162,6 +170,11 @@ static const struct regmap_access_table axp806_volatile_table = {
 	.n_yes_ranges	= ARRAY_SIZE(axp806_volatile_ranges),
 };
 
+static const struct regmap_access_table axp808_writeable_table = {
+	.yes_ranges	= axp808_writeable_ranges,
+	.n_yes_ranges	= ARRAY_SIZE(axp808_writeable_ranges),
+};
+
 static struct resource axp152_pek_resources[] = {
 	DEFINE_RES_IRQ_NAMED(AXP152_IRQ_PEK_RIS_EDGE, "PEK_DBR"),
 	DEFINE_RES_IRQ_NAMED(AXP152_IRQ_PEK_FAL_EDGE, "PEK_DBF"),
@@ -320,6 +333,15 @@ static const struct regmap_config axp806_regmap_config = {
 	.cache_type	= REGCACHE_RBTREE,
 };
 
+static const struct regmap_config axp808_regmap_config = {
+	.reg_bits	= 8,
+	.val_bits	= 8,
+	.wr_table	= &axp808_writeable_table,
+	.volatile_table	= &axp806_volatile_table,
+	.max_register	= AXP806_VREF_TEMP_WARN_L,
+	.cache_type	= REGCACHE_RBTREE,
+};
+
 #define INIT_REGMAP_IRQ(_variant, _irq, _off, _mask)			\
 	[_variant##_IRQ_##_irq] = { .reg_offset = (_off), .mask = BIT(_mask) }
 
@@ -842,6 +864,12 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
 		axp20x->regmap_cfg = &axp806_regmap_config;
 		axp20x->regmap_irq_chip = &axp806_regmap_irq_chip;
 		break;
+	case AXP808_ID:
+		axp20x->nr_cells = ARRAY_SIZE(axp806_cells);
+		axp20x->cells = axp806_cells;
+		axp20x->regmap_cfg = &axp808_regmap_config;
+		axp20x->regmap_irq_chip = &axp806_regmap_irq_chip;
+		break;
 	case AXP809_ID:
 		axp20x->nr_cells = ARRAY_SIZE(axp809_cells);
 		axp20x->cells = axp809_cells;
diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
index 0aa4ef7..b9b7eae 100644
--- a/include/linux/mfd/axp20x.h
+++ b/include/linux/mfd/axp20x.h
@@ -21,6 +21,7 @@ enum {
 	AXP223_ID,
 	AXP288_ID,
 	AXP806_ID,
+	AXP808_ID,
 	AXP809_ID,
 	NR_AXP20X_VARIANTS,
 };
-- 
2.10.2

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

* [PATCH 4/5] regulator: axp20x: Add support for the AXP808 PMIC
  2017-01-26 21:14 [PATCH 0/5] arm: sun9i: Support AXP808 PMIC and Sunchip CX-A99 board Rask Ingemann Lambertsen
                   ` (2 preceding siblings ...)
  2017-01-26 21:17 ` [PATCH 3/5] mfd: axp20x: Add support for the AXP808 PMIC Rask Ingemann Lambertsen
@ 2017-01-26 21:18 ` Rask Ingemann Lambertsen
  2017-01-27 11:42   ` Mark Brown
  2017-01-26 21:19 ` [PATCH 5/5] ARM: dts: sun9i: Initial support for the Sunchip CX-A99 board Rask Ingemann Lambertsen
  2017-01-26 21:49 ` [PATCH 0/5] arm: sun9i: Support AXP808 PMIC and " Rask Ingemann Lambertsen
  5 siblings, 1 reply; 17+ messages in thread
From: Rask Ingemann Lambertsen @ 2017-01-26 21:18 UTC (permalink / raw)
  To: Chen-Yu Tsai, Lee Jones, Mark Brown, Rob Herring, Mark Rutland,
	Liam Girdwood
  Cc: linux-kernel, devicetree, linux-kernel

The regulators are the same as on the AXP806.

Signed-off-by: Rask Ingemann Lambertsen <rask@formelder.dk>
---
 drivers/regulator/axp20x-regulator.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
index a3ade9e..034dce8 100644
--- a/drivers/regulator/axp20x-regulator.c
+++ b/drivers/regulator/axp20x-regulator.c
@@ -370,6 +370,7 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
 		step = 75;
 		break;
 	case AXP806_ID:
+	case AXP808_ID:
 		/*
 		 * AXP806 DCDC work frequency setting has the same range and
 		 * step as AXP22X, but at a different register.
@@ -459,6 +460,7 @@ static int axp20x_set_dcdc_workmode(struct regulator_dev *rdev, int id, u32 work
 		break;
 
 	case AXP806_ID:
+	case AXP808_ID:
 		reg = AXP806_DCDC_MODE_CTRL2;
 		/*
 		 * AXP806 DCDC regulator IDs have the same range as AXP22X.
@@ -492,8 +494,8 @@ static bool axp20x_is_polyphase_slave(struct axp20x_dev *axp20x, int id)
 {
 	u32 reg = 0;
 
-	/* Only AXP806 has poly-phase outputs */
-	if (axp20x->variant != AXP806_ID)
+	/* Only AXP806 and AXP808 have poly-phase outputs */
+	if (axp20x->variant != AXP806_ID && axp20x->variant != AXP808_ID)
 		return false;
 
 	regmap_read(axp20x->regmap, AXP806_DCDC_MODE_CTRL2, &reg);
@@ -541,6 +543,7 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
 						  "x-powers,drive-vbus-en");
 		break;
 	case AXP806_ID:
+	case AXP808_ID:
 		regulators = axp806_regulators;
 		nregulators = AXP806_REG_ID_MAX;
 		break;
-- 
2.10.2

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

* [PATCH 5/5] ARM: dts: sun9i: Initial support for the Sunchip CX-A99 board
  2017-01-26 21:14 [PATCH 0/5] arm: sun9i: Support AXP808 PMIC and Sunchip CX-A99 board Rask Ingemann Lambertsen
                   ` (3 preceding siblings ...)
  2017-01-26 21:18 ` [PATCH 4/5] regulator: " Rask Ingemann Lambertsen
@ 2017-01-26 21:19 ` Rask Ingemann Lambertsen
  2017-02-02  7:36   ` Chen-Yu Tsai
  2017-01-26 21:49 ` [PATCH 0/5] arm: sun9i: Support AXP808 PMIC and " Rask Ingemann Lambertsen
  5 siblings, 1 reply; 17+ messages in thread
From: Rask Ingemann Lambertsen @ 2017-01-26 21:19 UTC (permalink / raw)
  To: Chen-Yu Tsai, Lee Jones, Mark Brown, Rob Herring, Mark Rutland,
	Liam Girdwood
  Cc: linux-kernel, devicetree, linux-kernel

The Suncip CX-A99 board is found in at least four brands of media players.
It features an Allwinner A80 ARM SoC and is found in two models:

1) 2 GiB DDR3 DRAM and 16 GB eMMC
2) 4 GiB DDR3 DRAM and 32 GB eMMC

For details of the board, see the linux-sunxi page
<URL:https://linux-sunxi.org/Sunchip_CX-A99>.

Supported features (+ means tested):
+ One Cortex-A7 CPU core
+ AXP808 power management chip
+ OZ80120 voltage regulator
+ Serial console port (internal)
+ eMMC and SD card slot
+ USB 2.0 host ports on on-board USB hub
+ SATA port on on-board SATA-to-USB bridge *
+ IEEE 802.11 a/b/g/n/ac SDIO Wifi
+ Real-time clock
+ LEDs
- IR receiver for remote control

* In addition to connecting a SATA device, some unknown magic is necessary
  after power-up to get the SATA-to-USB bridge to show up on the USB bus.
  As a workaround, run the vendor U-Boot once after power-up.

So far unsupported features:
- Using more than one CPU core or any of the Cortex-A15 CPU cores
- USB 3.0 OTG port (except for supplying 5V power)
- IEEE 802.3 10/100/1000 megabit Ethernet
- HDMI connector
- SPDIF audio output
- Jack socket with composite video and analog stereo audio
- Bluetooth
- FM radio receiver (assuming it is even wired on the board)

Signed-off-by: Rask Ingemann Lambertsen <rask@formelder.dk>
---

Changes in v5:
- Switched pinmux modes to generic properties and dropped 
  #include <dt-bindings/pinctrl/sun4i-a10.h> as a consequence.
- Dropped pinctrl properties from GPIO nodes and dropped the pinmux
  nodes for them.
- AXP808 regulators added.
- Dropped the now unused #include <sunxi-common-regulators.dtsi>.
- Ampak AP6335 SDIO-Wifi added.
- USB Vbus changes as per v4 comments.
- Added "broken-cd" to mmc0 because GPIO interrupts don't work.

Changes in v4:
- Node names had underscores changed to hyphens.
- Changed formatting of the ac100/rtc node's clock output name list to match
 that of the same node in the cubieboard4 and a80-optimus device trees.

Changes in v3:
None.

Changes in v2:
- Fixed formatting and style issues found by scripts/checkpatch.pl.

 arch/arm/boot/dts/Makefile             |   3 +-
 arch/arm/boot/dts/sun9i-a80-cx-a99.dts | 413 +++++++++++++++++++++++++++++++++
 2 files changed, 415 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/sun9i-a80-cx-a99.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index e7994df..d9f47e1 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -859,7 +859,8 @@ dtb-$(CONFIG_MACH_SUN8I) += \
 	sun8i-r16-parrot.dtb
 dtb-$(CONFIG_MACH_SUN9I) += \
 	sun9i-a80-optimus.dtb \
-	sun9i-a80-cubieboard4.dtb
+	sun9i-a80-cubieboard4.dtb \
+	sun9i-a80-cx-a99.dtb
 dtb-$(CONFIG_ARCH_TANGO) += \
 	tango4-vantage-1172.dtb
 dtb-$(CONFIG_ARCH_TEGRA_2x_SOC) += \
diff --git a/arch/arm/boot/dts/sun9i-a80-cx-a99.dts b/arch/arm/boot/dts/sun9i-a80-cx-a99.dts
new file mode 100644
index 0000000..8925093
--- /dev/null
+++ b/arch/arm/boot/dts/sun9i-a80-cx-a99.dts
@@ -0,0 +1,413 @@
+/*
+ * sun9i-a80-cx-a99.dts - Device Tree file for the Sunchip CX-A99 board.
+ *
+ * Copyright (C) 2017 Rask Ingemann Lambertsen <rask@formelder.dk>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This file is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * The Sunchip CX-A99 board is found in several similar Android media
+ * players, such as:
+ *
+ * Instabox Fantasy A8 (no external antenna)
+ * Jesurun CS-Q8 (ships with larger remote control)
+ * Jesurun Maxone
+ * Rikomagic (RKM) MK80/MK80LE
+ * Tronsmart Draco AW80 Meta/Telos
+ *
+ * See <URL:https://linux-sunxi.org/Sunchip_CX-A99> for more information.
+ */
+
+/dts-v1/;
+#include "sun9i-a80.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+	model = "Sunchip CX-A99";
+	compatible = "sunchip,cx-a99", "allwinner,sun9i-a80";
+
+	aliases {
+		serial0 = &uart0;
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+
+	leds {
+		compatible = "gpio-leds";
+
+		blue {
+			gpios = <&pio 6 10 GPIO_ACTIVE_HIGH>;	/* PG10 */
+			label = "cx-a99:blue:status";
+			default-state = "on";
+		};
+
+		red {
+			gpios = <&pio 6 11 GPIO_ACTIVE_HIGH>;	/* PG11 */
+			label = "cx-a99:red:status";
+		};
+	};
+
+	powerseq_wifi: powerseq-wifi {
+		compatible = "mmc-pwrseq-simple";
+		clocks = <&ac100_rtc 1>;
+		clock-names = "ext_clock";
+		reset-gpios = <&r_pio 1 0 GPIO_ACTIVE_LOW>;	/* PM0 */
+		post-power-on-delay-ms = <1>;	/* Minimum 2 cycles. */
+	};
+
+	/* USB 3.0 OTG connector. For now, only Vbus is supported. */
+	reg_usb0_vbus: regulator-usb0-vbus {
+		compatible = "regulator-fixed";
+		regulator-name = "usb0-vbus";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		gpio = <&pio 7 15 GPIO_ACTIVE_HIGH>;	/* PH15 */
+		enable-active-high;
+		regulator-always-on;
+	};
+
+	/*
+	 * A GL850G hub with two external USB connectors is connected
+	 * to ehci0. Each has a Vbus regulator controlled by a GPIO:
+	 * PL7 for port 1, closest to the 12 V power connector, and
+	 * PL8 for port 2, next to the SD card slot.
+	 * Because regulator-fixed doesn't support a GPIO list, and
+	 * allwinner,sun9i-a80-usb-phy doesn't support more than one
+	 * supply, we have to use regulator-always-on on usb1-2-vbus.
+	 * Note that the GPIO pins also need cldo1 to be enabled.
+	 */
+	reg_usb1_1_vbus: regulator-usb1-1-vbus {
+		compatible = "regulator-fixed";
+		regulator-name = "usb1-1-vbus";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		gpio = <&r_pio 0 7 GPIO_ACTIVE_HIGH>;	/* PL7 */
+		enable-active-high;
+	};
+
+	reg_usb1_2_vbus: regulator-usb1-2-vbus {
+		compatible = "regulator-fixed";
+		regulator-name = "usb1-2-vbus";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		gpio = <&r_pio 0 8 GPIO_ACTIVE_HIGH>;	/* PL8 */
+		enable-active-high;
+		regulator-always-on;
+	};
+
+	/* OZ80120 voltage regulator for the four Cortex-A15 cores. */
+	reg_vdd_cpub: regulator-vdd-cpub {
+		compatible = "regulator-gpio";
+
+		regulator-boot-on;
+		regulator-always-on;
+		regulator-min-microvolt = < 800000>;
+		regulator-max-microvolt = <1100000>;
+		regulator-name = "vdd-cpub";
+
+		enable-gpio = <&r_pio 0 2 GPIO_ACTIVE_HIGH>;	/* PL2 */
+		enable-active-high;
+		gpios = <&r_pio 0 3 GPIO_ACTIVE_HIGH>,		/* PL3 */
+			<&r_pio 0 4 GPIO_ACTIVE_HIGH>,		/* PL4 */
+			<&r_pio 0 5 GPIO_ACTIVE_HIGH>;		/* PL5 */
+
+		gpios-states = <1 0 0>;
+		states = <	 750000 0x7
+				 800000 0x3
+				 850000 0x5
+				 900000 0x1
+				 950000 0x6
+				1000000 0x2
+				1100000 0x4
+				1200000 0x0>;
+	};
+};
+
+&ehci0 {
+	status = "okay";
+};
+
+&ehci2 {
+	status = "okay";
+};
+
+/* SD card slot. */
+&mmc0 {
+	bus-width = <4>;
+	cd-gpios = <&pio 7 17 GPIO_ACTIVE_LOW>;	/* PH17 */
+	broken-cd;				/* Interrupts don't work. */
+	pinctrl-names = "default";
+	pinctrl-0 = <&mmc0_pins>;
+	vmmc-supply = <&reg_dcdce>;
+	status = "okay";
+};
+
+/* Ampak AP6335 IEEE 802.11 a/b/g/n/ac "Wifi". */
+&mmc1 {
+	bus-width = <4>;
+	non-removable;
+	pinctrl-names = "default";
+	pinctrl-0 = <&mmc1_pins>;
+	vmmc-supply = <&reg_cldo3>;	/* See cldo2,cldo3 note. */
+	vqmmc-supply = <&reg_aldo2>;
+	mmc-pwrseq = <&powerseq_wifi>;
+	status = "okay";
+};
+
+/* On-board eMMC card. */
+&mmc2 {
+	bus-width = <8>;
+	non-removable;
+	pinctrl-names = "default";
+	pinctrl-0 = <&mmc2_8bit_pins>;
+	vmmc-supply = <&reg_dcdce>;
+	status = "okay";
+};
+
+&osc32k {
+	clocks = <&ac100_rtc 0>;
+};
+
+&r_ir {
+	status = "okay";
+};
+
+&r_rsb {
+	status = "okay";
+
+	ac100: codec@e89 {
+		compatible = "x-powers,ac100";
+		reg = <0xe89>;
+
+		ac100_codec: codec {
+			compatible = "x-powers,ac100-codec";
+			interrupt-parent = <&r_pio>;
+			interrupts = <0 9 IRQ_TYPE_LEVEL_LOW>;	/* PL9 */
+			#clock-cells = <0>;
+			clock-output-names = "4M_adda";
+		};
+
+		ac100_rtc: rtc {
+			compatible = "x-powers,ac100-rtc";
+			interrupt-parent = <&nmi_intc>;
+			interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+			clocks = <&ac100_codec>;
+			#clock-cells = <1>;
+			clock-output-names = "cko1_rtc",
+					     "cko2_rtc",
+					     "cko3_rtc";
+		};
+	};
+
+	pmic@745 {
+		compatible = "x-powers,axp808", "x-powers,axp806";
+		reg = <0x745>;
+		interrupt-parent = <&nmi_intc>;
+		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+		interrupt-controller;
+		#interrupt-cells = <1>;
+
+		swin-supply = <&reg_dcdce>;
+
+		/* In comments: Status taken from vendor sys_config1.fex. */
+		regulators {
+			/* 3.0 V (enabled). */
+			reg_aldo1: aldo1 {
+				regulator-boot-on;
+				regulator-min-microvolt = <3000000>;
+				regulator-max-microvolt = <3000000>;
+				regulator-name = "vcc-3v0-1";
+			};
+
+			/* 1.8 V (enabled). */
+			reg_aldo2: aldo2 {
+				regulator-boot-on;
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <3600000>;
+				regulator-name = "vcc-pg-pm-wifi+btio-audio";
+			};
+
+			/* 2.5 V (enabled). */
+			reg_aldo3: aldo3 {
+				regulator-boot-on;
+				regulator-min-microvolt = <2500000>;
+				regulator-max-microvolt = <2500000>;
+				regulator-name = "vcc-pa-gmac2v5";
+			};
+
+			/* 1.8 V (enabled). */
+			reg_bldo1: bldo1 {
+				regulator-boot-on;
+				regulator-always-on;	/* Hang if disabled */
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-name = "vdd18-dll-vcc18-pll";
+			};
+
+			/* 0.9 V (enabled). */
+			reg_bldo2: bldo2 {
+				regulator-boot-on;
+				regulator-always-on;	/* Hang if disabled */
+				regulator-min-microvolt = < 800000>;
+				regulator-max-microvolt = <1100000>;
+				regulator-name = "vdd-cpus";
+			};
+
+			/* 1.2 V (disabled). */
+			reg_bldo3: bldo3 {
+				regulator-min-microvolt = <1200000>;
+				regulator-max-microvolt = <1200000>;
+				regulator-name = "vcc12-hsic";
+			};
+
+			/* 1.1 V (enabled). */
+			reg_bldo4: bldo4 {
+				regulator-boot-on;
+				regulator-min-microvolt = <1100000>;
+				regulator-max-microvolt = <1100000>;
+				regulator-name = "vdd09-hdmi";
+			};
+
+			/* 3.3 V (enabled). PLx pins control some regulators. */
+			reg_cldo1: cldo1 {
+				regulator-boot-on;
+				regulator-always-on;
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-name = "vcc-pl-led";
+			};
+
+			/*
+			 * cldo2 and cldo3 are connected in parallel.
+			 * There is currently no way to express that.
+			 * For now, use regulator-always-on on cldo2 and lock
+			 * the voltage on both to 3.3 V.
+			 *
+			 * 3.3 V (disabled).
+			 */
+			reg_cldo2: cldo2 {
+				regulator-always-on;
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-name = "vbat2-wifi+bt";
+			};
+
+			/* 3.3 V (disabled). */
+			reg_cldo3: cldo3 {
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-name = "vbat1-wifi+bt";
+			};
+
+			/* 0.9 V (enabled). */
+			reg_dcdca: dcdca {
+				regulator-boot-on;
+				regulator-always-on;
+				regulator-min-microvolt = < 800000>;
+				regulator-max-microvolt = <1100000>;
+				regulator-name = "vdd-cpua";
+			};
+
+			/* 1.5 V (enabled). */
+			reg_dcdcb: dcdcb {
+				regulator-boot-on;
+				regulator-always-on;
+				regulator-min-microvolt = <1500000>;
+				regulator-max-microvolt = <1500000>;
+				regulator-name = "vcc-dram";
+			};
+
+			/* 0.9 V (disabled). */
+			reg_dcdcc: dcdcc {
+				regulator-min-microvolt = <900000>;
+				regulator-max-microvolt = <900000>;
+				regulator-name = "vdd-gpu";
+			};
+
+			/* 0.9 V (enabled). */
+			reg_dcdcd: dcdcd {
+				regulator-boot-on;
+				regulator-always-on;	/* Hang if disabled. */
+				regulator-min-microvolt = <900000>;
+				regulator-max-microvolt = <900000>;
+				regulator-name = "vdd-sys";
+			};
+
+			/* 3.3 V (enabled). */
+			reg_dcdce: dcdce {
+				regulator-boot-on;
+				regulator-always-on;
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-name = "vcc-pb-pc-pd-pe-pf-ph-mmc-spdif";
+			};
+
+			/* 3.3 V (disabled). */
+			reg_sw: sw {
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-name = "vcc-gmac3v3";
+			};
+		};
+	};
+};
+
+/*
+ * 5-pin connector opposite of the SD card slot:
+ * 1 = GND (pointed to by small triangle), 2 = GND, 3 = 3.3 V, 4 = RX, 5 = TX.
+ */
+&uart0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart0_pins_a>;
+	status = "okay";
+};
+
+/* The port has two Vbus supplies. See workaround at regulator-usb1-1-vbus. */
+&usbphy1 {
+	phy-supply = <&reg_usb1_1_vbus>;
+	status = "okay";
+};
+
+&usbphy3 {
+	status = "okay";
+};
-- 
2.10.2

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

* Re: [PATCH 0/5] arm: sun9i: Support AXP808 PMIC and Sunchip CX-A99 board
  2017-01-26 21:14 [PATCH 0/5] arm: sun9i: Support AXP808 PMIC and Sunchip CX-A99 board Rask Ingemann Lambertsen
                   ` (4 preceding siblings ...)
  2017-01-26 21:19 ` [PATCH 5/5] ARM: dts: sun9i: Initial support for the Sunchip CX-A99 board Rask Ingemann Lambertsen
@ 2017-01-26 21:49 ` Rask Ingemann Lambertsen
  5 siblings, 0 replies; 17+ messages in thread
From: Rask Ingemann Lambertsen @ 2017-01-26 21:49 UTC (permalink / raw)
  To: Chen-Yu Tsai, Lee Jones, Mark Brown, Rob Herring, Mark Rutland,
	Liam Girdwood
  Cc: devicetree, linux-kernel

Please Cc: linux-arm-kernel@lists.infradead.org on replies as I accidentally
left it out when mailing out this series. I have sent a copy with identical
message-ids to linux-arm-kernel@lists.infradead.org, so replies should be
threaded properly.

-- 
Rask Ingemann Lambertsen

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

* Re: [PATCH 1/5] DT: mfd: axp20x: Add AXP806 to list of current AXP20x family members
  2017-01-26 21:15 ` [PATCH 1/5] DT: mfd: axp20x: Add AXP806 to list of current AXP20x family members Rask Ingemann Lambertsen
@ 2017-01-27  4:38   ` Chen-Yu Tsai
  2017-02-01 13:26   ` Rob Herring
  1 sibling, 0 replies; 17+ messages in thread
From: Chen-Yu Tsai @ 2017-01-27  4:38 UTC (permalink / raw)
  To: Rask Ingemann Lambertsen
  Cc: Chen-Yu Tsai, Lee Jones, Mark Brown, Rob Herring, Mark Rutland,
	Liam Girdwood, devicetree, linux-kernel, linux-arm-kernel

On Fri, Jan 27, 2017 at 5:23 AM, Rask Ingemann Lambertsen
<rask@formelder.dk> wrote:
> An entry for the AXP806 was forgotten, so add one.
>
> Signed-off-by: Rask Ingemann Lambertsen <rask@formelder.dk>
> Fixes: 204ae2963e10 ("mfd: axp20x: Add bindings for AXP806 PMIC")

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

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

* Re: [PATCH 4/5] regulator: axp20x: Add support for the AXP808 PMIC
  2017-01-26 21:18 ` [PATCH 4/5] regulator: " Rask Ingemann Lambertsen
@ 2017-01-27 11:42   ` Mark Brown
  2017-02-02  7:25     ` Chen-Yu Tsai
  0 siblings, 1 reply; 17+ messages in thread
From: Mark Brown @ 2017-01-27 11:42 UTC (permalink / raw)
  To: Rask Ingemann Lambertsen
  Cc: Chen-Yu Tsai, Lee Jones, Rob Herring, Mark Rutland,
	Liam Girdwood, linux-kernel, devicetree

[-- Attachment #1: Type: text/plain, Size: 165 bytes --]

On Thu, Jan 26, 2017 at 10:18:11PM +0100, Rask Ingemann Lambertsen wrote:
> The regulators are the same as on the AXP806.

Acked-by: Mark Brown <broonie@kernel.org>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 1/5] DT: mfd: axp20x: Add AXP806 to list of current AXP20x family members
  2017-01-26 21:15 ` [PATCH 1/5] DT: mfd: axp20x: Add AXP806 to list of current AXP20x family members Rask Ingemann Lambertsen
  2017-01-27  4:38   ` Chen-Yu Tsai
@ 2017-02-01 13:26   ` Rob Herring
  1 sibling, 0 replies; 17+ messages in thread
From: Rob Herring @ 2017-02-01 13:26 UTC (permalink / raw)
  To: Rask Ingemann Lambertsen
  Cc: Chen-Yu Tsai, Lee Jones, Mark Brown, Mark Rutland, Liam Girdwood,
	linux-kernel, devicetree

On Thu, Jan 26, 2017 at 10:15:14PM +0100, Rask Ingemann Lambertsen wrote:
> An entry for the AXP806 was forgotten, so add one.
> 
> Signed-off-by: Rask Ingemann Lambertsen <rask@formelder.dk>
> Fixes: 204ae2963e10 ("mfd: axp20x: Add bindings for AXP806 PMIC")
> ---
>  Documentation/devicetree/bindings/mfd/axp20x.txt | 1 +
>  1 file changed, 1 insertion(+)

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

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

* Re: [PATCH 2/5] DT: mfd: axp20x: Add binding for the AXP808
  2017-01-26 21:16 ` [PATCH 2/5] DT: mfd: axp20x: Add binding for the AXP808 Rask Ingemann Lambertsen
@ 2017-02-01 13:27   ` Rob Herring
  2017-02-02  7:20     ` Chen-Yu Tsai
  0 siblings, 1 reply; 17+ messages in thread
From: Rob Herring @ 2017-02-01 13:27 UTC (permalink / raw)
  To: Rask Ingemann Lambertsen
  Cc: Chen-Yu Tsai, Lee Jones, Mark Brown, Mark Rutland, Liam Girdwood,
	linux-kernel, devicetree

On Thu, Jan 26, 2017 at 10:16:13PM +0100, Rask Ingemann Lambertsen wrote:
> The AXP808 does not support address space extension, but is otherwise
> identical to the AXP806, including the chip ID, so add a compatible
> string for it to the binding.
> 
> Signed-off-by: Rask Ingemann Lambertsen <rask@formelder.dk>
> ---
>  Documentation/devicetree/bindings/mfd/axp20x.txt | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)

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

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

* Re: [PATCH 2/5] DT: mfd: axp20x: Add binding for the AXP808
  2017-02-01 13:27   ` Rob Herring
@ 2017-02-02  7:20     ` Chen-Yu Tsai
  0 siblings, 0 replies; 17+ messages in thread
From: Chen-Yu Tsai @ 2017-02-02  7:20 UTC (permalink / raw)
  To: Rask Ingemann Lambertsen
  Cc: Chen-Yu Tsai, Rob Herring, Lee Jones, Mark Brown, Mark Rutland,
	Liam Girdwood, linux-kernel, devicetree

On Wed, Feb 1, 2017 at 9:27 PM, Rob Herring <robh@kernel.org> wrote:
> On Thu, Jan 26, 2017 at 10:16:13PM +0100, Rask Ingemann Lambertsen wrote:
>> The AXP808 does not support address space extension, but is otherwise
>> identical to the AXP806, including the chip ID, so add a compatible
>> string for it to the binding.
>>
>> Signed-off-by: Rask Ingemann Lambertsen <rask@formelder.dk>
>> ---
>>  Documentation/devicetree/bindings/mfd/axp20x.txt | 7 ++++---
>>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> Acked-by: Rob Herring <robh@kernel.org>

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

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

* Re: [PATCH 3/5] mfd: axp20x: Add support for the AXP808 PMIC
  2017-01-26 21:17 ` [PATCH 3/5] mfd: axp20x: Add support for the AXP808 PMIC Rask Ingemann Lambertsen
@ 2017-02-02  7:23   ` Chen-Yu Tsai
  2017-02-03 21:47     ` Rask Ingemann Lambertsen
  0 siblings, 1 reply; 17+ messages in thread
From: Chen-Yu Tsai @ 2017-02-02  7:23 UTC (permalink / raw)
  To: Rask Ingemann Lambertsen
  Cc: Chen-Yu Tsai, Lee Jones, Mark Brown, Rob Herring, Mark Rutland,
	Liam Girdwood, devicetree, linux-kernel, linux-arm-kernel

On Fri, Jan 27, 2017 at 5:25 AM, Rask Ingemann Lambertsen
<rask@formelder.dk> wrote:
> The X-Powers AXP808 is a PMIC which, like the very similar AXP806, is
> used on boards featuring Allwinner's A80 SoC. Unlike the AXP806, it
> doesn't support address space extension and its associated registers,
> but the two are otherwise identical (including the chip ID).
>
> This patch adds support for the interrupts on the AXP808 and enables
> the regulator sub-device. The next patch in the series adds the actual
> regulator support.
>
> Signed-off-by: Rask Ingemann Lambertsen <rask@formelder.dk>

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

> ---
>  drivers/mfd/axp20x-rsb.c   |  1 +
>  drivers/mfd/axp20x.c       | 28 ++++++++++++++++++++++++++++
>  include/linux/mfd/axp20x.h |  1 +
>  3 files changed, 30 insertions(+)
>
> diff --git a/drivers/mfd/axp20x-rsb.c b/drivers/mfd/axp20x-rsb.c
> index a732cb5..96ea2e9 100644
> --- a/drivers/mfd/axp20x-rsb.c
> +++ b/drivers/mfd/axp20x-rsb.c
> @@ -62,6 +62,7 @@ static int axp20x_rsb_remove(struct sunxi_rsb_device *rdev)
>  static const struct of_device_id axp20x_rsb_of_match[] = {
>         { .compatible = "x-powers,axp223", .data = (void *)AXP223_ID },
>         { .compatible = "x-powers,axp806", .data = (void *)AXP806_ID },
> +       { .compatible = "x-powers,axp808", .data = (void *)AXP808_ID },
>         { .compatible = "x-powers,axp809", .data = (void *)AXP809_ID },
>         { },
>  };
> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> index 25115fe..2d3383e 100644
> --- a/drivers/mfd/axp20x.c
> +++ b/drivers/mfd/axp20x.c
> @@ -41,6 +41,7 @@ static const char * const axp20x_model_names[] = {
>         "AXP223",
>         "AXP288",
>         "AXP806",
> +       "AXP808",
>         "AXP809",
>  };
>
> @@ -148,6 +149,13 @@ static const struct regmap_range axp806_writeable_ranges[] = {
>         regmap_reg_range(AXP806_REG_ADDR_EXT, AXP806_REG_ADDR_EXT),
>  };
>
> +static const struct regmap_range axp808_writeable_ranges[] = {
> +       regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_DATACACHE(3)),
> +       regmap_reg_range(AXP806_PWR_OUT_CTRL1, AXP806_CLDO3_V_CTRL),
> +       regmap_reg_range(AXP20X_IRQ1_EN, AXP20X_IRQ2_EN),
> +       regmap_reg_range(AXP20X_IRQ1_STATE, AXP20X_IRQ2_STATE),
> +};
> +
>  static const struct regmap_range axp806_volatile_ranges[] = {
>         regmap_reg_range(AXP20X_IRQ1_STATE, AXP20X_IRQ2_STATE),
>  };
> @@ -162,6 +170,11 @@ static const struct regmap_access_table axp806_volatile_table = {
>         .n_yes_ranges   = ARRAY_SIZE(axp806_volatile_ranges),
>  };
>
> +static const struct regmap_access_table axp808_writeable_table = {
> +       .yes_ranges     = axp808_writeable_ranges,
> +       .n_yes_ranges   = ARRAY_SIZE(axp808_writeable_ranges),

You could probably get away with using axp806_writeable_ranges,
and pass ARRAY_SIZE(axp808_writeable_ranges) - 1 for .n_yes_ranges.

Or maybe the compiler figures out the 2 arrays share common data.

ChenYu

> +};
> +
>  static struct resource axp152_pek_resources[] = {
>         DEFINE_RES_IRQ_NAMED(AXP152_IRQ_PEK_RIS_EDGE, "PEK_DBR"),
>         DEFINE_RES_IRQ_NAMED(AXP152_IRQ_PEK_FAL_EDGE, "PEK_DBF"),
> @@ -320,6 +333,15 @@ static const struct regmap_config axp806_regmap_config = {
>         .cache_type     = REGCACHE_RBTREE,
>  };
>
> +static const struct regmap_config axp808_regmap_config = {
> +       .reg_bits       = 8,
> +       .val_bits       = 8,
> +       .wr_table       = &axp808_writeable_table,
> +       .volatile_table = &axp806_volatile_table,
> +       .max_register   = AXP806_VREF_TEMP_WARN_L,
> +       .cache_type     = REGCACHE_RBTREE,
> +};
> +
>  #define INIT_REGMAP_IRQ(_variant, _irq, _off, _mask)                   \
>         [_variant##_IRQ_##_irq] = { .reg_offset = (_off), .mask = BIT(_mask) }
>
> @@ -842,6 +864,12 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
>                 axp20x->regmap_cfg = &axp806_regmap_config;
>                 axp20x->regmap_irq_chip = &axp806_regmap_irq_chip;
>                 break;
> +       case AXP808_ID:
> +               axp20x->nr_cells = ARRAY_SIZE(axp806_cells);
> +               axp20x->cells = axp806_cells;
> +               axp20x->regmap_cfg = &axp808_regmap_config;
> +               axp20x->regmap_irq_chip = &axp806_regmap_irq_chip;
> +               break;
>         case AXP809_ID:
>                 axp20x->nr_cells = ARRAY_SIZE(axp809_cells);
>                 axp20x->cells = axp809_cells;
> diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
> index 0aa4ef7..b9b7eae 100644
> --- a/include/linux/mfd/axp20x.h
> +++ b/include/linux/mfd/axp20x.h
> @@ -21,6 +21,7 @@ enum {
>         AXP223_ID,
>         AXP288_ID,
>         AXP806_ID,
> +       AXP808_ID,
>         AXP809_ID,
>         NR_AXP20X_VARIANTS,
>  };
> --
> 2.10.2
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 4/5] regulator: axp20x: Add support for the AXP808 PMIC
  2017-01-27 11:42   ` Mark Brown
@ 2017-02-02  7:25     ` Chen-Yu Tsai
  0 siblings, 0 replies; 17+ messages in thread
From: Chen-Yu Tsai @ 2017-02-02  7:25 UTC (permalink / raw)
  To: Rask Ingemann Lambertsen
  Cc: Mark Brown, Chen-Yu Tsai, Lee Jones, Rob Herring, Mark Rutland,
	Liam Girdwood, linux-kernel, devicetree, linux-arm-kernel

On Fri, Jan 27, 2017 at 7:42 PM, Mark Brown <broonie@kernel.org> wrote:
> On Thu, Jan 26, 2017 at 10:18:11PM +0100, Rask Ingemann Lambertsen wrote:
>> The regulators are the same as on the AXP806.
>
> Acked-by: Mark Brown <broonie@kernel.org>

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

This probably needs to go in with the mfd patches adding the ID.

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

* Re: [PATCH 5/5] ARM: dts: sun9i: Initial support for the Sunchip CX-A99 board
  2017-01-26 21:19 ` [PATCH 5/5] ARM: dts: sun9i: Initial support for the Sunchip CX-A99 board Rask Ingemann Lambertsen
@ 2017-02-02  7:36   ` Chen-Yu Tsai
  2017-02-05 19:23     ` Rask Ingemann Lambertsen
  0 siblings, 1 reply; 17+ messages in thread
From: Chen-Yu Tsai @ 2017-02-02  7:36 UTC (permalink / raw)
  To: Rask Ingemann Lambertsen
  Cc: Chen-Yu Tsai, Lee Jones, Mark Brown, Rob Herring, Mark Rutland,
	Liam Girdwood, devicetree, linux-kernel, linux-arm-kernel

Hi,

On Fri, Jan 27, 2017 at 5:27 AM, Rask Ingemann Lambertsen
<rask@formelder.dk> wrote:
> The Suncip CX-A99 board is found in at least four brands of media players.
> It features an Allwinner A80 ARM SoC and is found in two models:
>
> 1) 2 GiB DDR3 DRAM and 16 GB eMMC
> 2) 4 GiB DDR3 DRAM and 32 GB eMMC
>
> For details of the board, see the linux-sunxi page
> <URL:https://linux-sunxi.org/Sunchip_CX-A99>.
>
> Supported features (+ means tested):
> + One Cortex-A7 CPU core
> + AXP808 power management chip
> + OZ80120 voltage regulator
> + Serial console port (internal)
> + eMMC and SD card slot
> + USB 2.0 host ports on on-board USB hub
> + SATA port on on-board SATA-to-USB bridge *
> + IEEE 802.11 a/b/g/n/ac SDIO Wifi
> + Real-time clock
> + LEDs
> - IR receiver for remote control
>
> * In addition to connecting a SATA device, some unknown magic is necessary
>   after power-up to get the SATA-to-USB bridge to show up on the USB bus.
>   As a workaround, run the vendor U-Boot once after power-up.
>
> So far unsupported features:
> - Using more than one CPU core or any of the Cortex-A15 CPU cores
> - USB 3.0 OTG port (except for supplying 5V power)
> - IEEE 802.3 10/100/1000 megabit Ethernet
> - HDMI connector
> - SPDIF audio output
> - Jack socket with composite video and analog stereo audio
> - Bluetooth
> - FM radio receiver (assuming it is even wired on the board)
>
> Signed-off-by: Rask Ingemann Lambertsen <rask@formelder.dk>
> ---
>
> Changes in v5:
> - Switched pinmux modes to generic properties and dropped
>   #include <dt-bindings/pinctrl/sun4i-a10.h> as a consequence.
> - Dropped pinctrl properties from GPIO nodes and dropped the pinmux
>   nodes for them.
> - AXP808 regulators added.
> - Dropped the now unused #include <sunxi-common-regulators.dtsi>.
> - Ampak AP6335 SDIO-Wifi added.
> - USB Vbus changes as per v4 comments.
> - Added "broken-cd" to mmc0 because GPIO interrupts don't work.
>
> Changes in v4:
> - Node names had underscores changed to hyphens.
> - Changed formatting of the ac100/rtc node's clock output name list to match
>  that of the same node in the cubieboard4 and a80-optimus device trees.
>
> Changes in v3:
> None.
>
> Changes in v2:
> - Fixed formatting and style issues found by scripts/checkpatch.pl.
>
>  arch/arm/boot/dts/Makefile             |   3 +-
>  arch/arm/boot/dts/sun9i-a80-cx-a99.dts | 413 +++++++++++++++++++++++++++++++++
>  2 files changed, 415 insertions(+), 1 deletion(-)
>  create mode 100644 arch/arm/boot/dts/sun9i-a80-cx-a99.dts
>
> diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
> index e7994df..d9f47e1 100644
> --- a/arch/arm/boot/dts/Makefile
> +++ b/arch/arm/boot/dts/Makefile
> @@ -859,7 +859,8 @@ dtb-$(CONFIG_MACH_SUN8I) += \
>         sun8i-r16-parrot.dtb
>  dtb-$(CONFIG_MACH_SUN9I) += \
>         sun9i-a80-optimus.dtb \
> -       sun9i-a80-cubieboard4.dtb
> +       sun9i-a80-cubieboard4.dtb \
> +       sun9i-a80-cx-a99.dtb
>  dtb-$(CONFIG_ARCH_TANGO) += \
>         tango4-vantage-1172.dtb
>  dtb-$(CONFIG_ARCH_TEGRA_2x_SOC) += \
> diff --git a/arch/arm/boot/dts/sun9i-a80-cx-a99.dts b/arch/arm/boot/dts/sun9i-a80-cx-a99.dts
> new file mode 100644
> index 0000000..8925093
> --- /dev/null
> +++ b/arch/arm/boot/dts/sun9i-a80-cx-a99.dts
> @@ -0,0 +1,413 @@
> +/*
> + * sun9i-a80-cx-a99.dts - Device Tree file for the Sunchip CX-A99 board.
> + *
> + * Copyright (C) 2017 Rask Ingemann Lambertsen <rask@formelder.dk>
> + *
> + * This file is dual-licensed: you can use it either under the terms
> + * of the GPL or the X11 license, at your option. Note that this dual
> + * licensing only applies to this file, and not this project as a
> + * whole.
> + *
> + *  a) This file is free software; you can redistribute it and/or
> + *     modify it under the terms of the GNU General Public License as
> + *     published by the Free Software Foundation; either version 2 of the
> + *     License, or (at your option) any later version.
> + *
> + *     This file is distributed in the hope that it will be useful,
> + *     but WITHOUT ANY WARRANTY; without even the implied warranty of
> + *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + *     GNU General Public License for more details.
> + *
> + * Or, alternatively,
> + *
> + *  b) Permission is hereby granted, free of charge, to any person
> + *     obtaining a copy of this software and associated documentation
> + *     files (the "Software"), to deal in the Software without
> + *     restriction, including without limitation the rights to use,
> + *     copy, modify, merge, publish, distribute, sublicense, and/or
> + *     sell copies of the Software, and to permit persons to whom the
> + *     Software is furnished to do so, subject to the following
> + *     conditions:
> + *
> + *     The above copyright notice and this permission notice shall be
> + *     included in all copies or substantial portions of the Software.
> + *
> + *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> + *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
> + *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> + *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
> + *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
> + *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> + *     OTHER DEALINGS IN THE SOFTWARE.
> + */
> +
> +/*
> + * The Sunchip CX-A99 board is found in several similar Android media
> + * players, such as:
> + *
> + * Instabox Fantasy A8 (no external antenna)
> + * Jesurun CS-Q8 (ships with larger remote control)
> + * Jesurun Maxone
> + * Rikomagic (RKM) MK80/MK80LE
> + * Tronsmart Draco AW80 Meta/Telos
> + *
> + * See <URL:https://linux-sunxi.org/Sunchip_CX-A99> for more information.
> + */
> +
> +/dts-v1/;
> +#include "sun9i-a80.dtsi"
> +
> +#include <dt-bindings/gpio/gpio.h>
> +
> +/ {
> +       model = "Sunchip CX-A99";
> +       compatible = "sunchip,cx-a99", "allwinner,sun9i-a80";
> +
> +       aliases {
> +               serial0 = &uart0;
> +       };
> +
> +       chosen {
> +               stdout-path = "serial0:115200n8";
> +       };
> +
> +       leds {
> +               compatible = "gpio-leds";
> +
> +               blue {
> +                       gpios = <&pio 6 10 GPIO_ACTIVE_HIGH>;   /* PG10 */
> +                       label = "cx-a99:blue:status";
> +                       default-state = "on";

Please add a note justifying default-state = "on".

> +               };
> +
> +               red {
> +                       gpios = <&pio 6 11 GPIO_ACTIVE_HIGH>;   /* PG11 */
> +                       label = "cx-a99:red:status";
> +               };
> +       };
> +
> +       powerseq_wifi: powerseq-wifi {
> +               compatible = "mmc-pwrseq-simple";
> +               clocks = <&ac100_rtc 1>;
> +               clock-names = "ext_clock";
> +               reset-gpios = <&r_pio 1 0 GPIO_ACTIVE_LOW>;     /* PM0 */
> +               post-power-on-delay-ms = <1>;   /* Minimum 2 cycles. */
> +       };
> +
> +       /* USB 3.0 OTG connector. For now, only Vbus is supported. */
> +       reg_usb0_vbus: regulator-usb0-vbus {
> +               compatible = "regulator-fixed";
> +               regulator-name = "usb0-vbus";
> +               regulator-min-microvolt = <5000000>;
> +               regulator-max-microvolt = <5000000>;
> +               gpio = <&pio 7 15 GPIO_ACTIVE_HIGH>;    /* PH15 */
> +               enable-active-high;
> +               regulator-always-on;

It's bad to leave VBUS for OTG connectors on. You never know
what is plugged in.

> +       };
> +
> +       /*
> +        * A GL850G hub with two external USB connectors is connected
> +        * to ehci0. Each has a Vbus regulator controlled by a GPIO:
> +        * PL7 for port 1, closest to the 12 V power connector, and
> +        * PL8 for port 2, next to the SD card slot.
> +        * Because regulator-fixed doesn't support a GPIO list, and
> +        * allwinner,sun9i-a80-usb-phy doesn't support more than one
> +        * supply, we have to use regulator-always-on on usb1-2-vbus.
> +        * Note that the GPIO pins also need cldo1 to be enabled.
> +        */
> +       reg_usb1_1_vbus: regulator-usb1-1-vbus {
> +               compatible = "regulator-fixed";
> +               regulator-name = "usb1-1-vbus";
> +               regulator-min-microvolt = <5000000>;
> +               regulator-max-microvolt = <5000000>;
> +               gpio = <&r_pio 0 7 GPIO_ACTIVE_HIGH>;   /* PL7 */
> +               enable-active-high;
> +       };
> +
> +       reg_usb1_2_vbus: regulator-usb1-2-vbus {
> +               compatible = "regulator-fixed";
> +               regulator-name = "usb1-2-vbus";
> +               regulator-min-microvolt = <5000000>;
> +               regulator-max-microvolt = <5000000>;
> +               gpio = <&r_pio 0 8 GPIO_ACTIVE_HIGH>;   /* PL8 */
> +               enable-active-high;
> +               regulator-always-on;
> +       };
> +
> +       /* OZ80120 voltage regulator for the four Cortex-A15 cores. */
> +       reg_vdd_cpub: regulator-vdd-cpub {
> +               compatible = "regulator-gpio";
> +
> +               regulator-boot-on;
> +               regulator-always-on;
> +               regulator-min-microvolt = < 800000>;
> +               regulator-max-microvolt = <1100000>;
> +               regulator-name = "vdd-cpub";
> +
> +               enable-gpio = <&r_pio 0 2 GPIO_ACTIVE_HIGH>;    /* PL2 */
> +               enable-active-high;
> +               gpios = <&r_pio 0 3 GPIO_ACTIVE_HIGH>,          /* PL3 */
> +                       <&r_pio 0 4 GPIO_ACTIVE_HIGH>,          /* PL4 */
> +                       <&r_pio 0 5 GPIO_ACTIVE_HIGH>;          /* PL5 */
> +
> +               gpios-states = <1 0 0>;
> +               states = <       750000 0x7
> +                                800000 0x3
> +                                850000 0x5
> +                                900000 0x1
> +                                950000 0x6
> +                               1000000 0x2
> +                               1100000 0x4
> +                               1200000 0x0>;
> +       };
> +};
> +
> +&ehci0 {
> +       status = "okay";
> +};
> +
> +&ehci2 {
> +       status = "okay";
> +};
> +
> +/* SD card slot. */
> +&mmc0 {
> +       bus-width = <4>;
> +       cd-gpios = <&pio 7 17 GPIO_ACTIVE_LOW>; /* PH17 */
> +       broken-cd;                              /* Interrupts don't work. */

This should be handled by the driver.

> +       pinctrl-names = "default";
> +       pinctrl-0 = <&mmc0_pins>;
> +       vmmc-supply = <&reg_dcdce>;
> +       status = "okay";
> +};
> +
> +/* Ampak AP6335 IEEE 802.11 a/b/g/n/ac "Wifi". */
> +&mmc1 {
> +       bus-width = <4>;
> +       non-removable;
> +       pinctrl-names = "default";
> +       pinctrl-0 = <&mmc1_pins>;
> +       vmmc-supply = <&reg_cldo3>;     /* See cldo2,cldo3 note. */
> +       vqmmc-supply = <&reg_aldo2>;
> +       mmc-pwrseq = <&powerseq_wifi>;
> +       status = "okay";
> +};
> +
> +/* On-board eMMC card. */
> +&mmc2 {
> +       bus-width = <8>;
> +       non-removable;
> +       pinctrl-names = "default";
> +       pinctrl-0 = <&mmc2_8bit_pins>;
> +       vmmc-supply = <&reg_dcdce>;
> +       status = "okay";
> +};
> +
> +&osc32k {
> +       clocks = <&ac100_rtc 0>;
> +};
> +
> +&r_ir {
> +       status = "okay";
> +};
> +
> +&r_rsb {
> +       status = "okay";
> +
> +       ac100: codec@e89 {
> +               compatible = "x-powers,ac100";
> +               reg = <0xe89>;
> +
> +               ac100_codec: codec {
> +                       compatible = "x-powers,ac100-codec";
> +                       interrupt-parent = <&r_pio>;
> +                       interrupts = <0 9 IRQ_TYPE_LEVEL_LOW>;  /* PL9 */
> +                       #clock-cells = <0>;
> +                       clock-output-names = "4M_adda";
> +               };
> +
> +               ac100_rtc: rtc {
> +                       compatible = "x-powers,ac100-rtc";
> +                       interrupt-parent = <&nmi_intc>;
> +                       interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
> +                       clocks = <&ac100_codec>;
> +                       #clock-cells = <1>;
> +                       clock-output-names = "cko1_rtc",
> +                                            "cko2_rtc",
> +                                            "cko3_rtc";
> +               };
> +       };
> +
> +       pmic@745 {
> +               compatible = "x-powers,axp808", "x-powers,axp806";
> +               reg = <0x745>;
> +               interrupt-parent = <&nmi_intc>;
> +               interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
> +               interrupt-controller;
> +               #interrupt-cells = <1>;
> +
> +               swin-supply = <&reg_dcdce>;
> +
> +               /* In comments: Status taken from vendor sys_config1.fex. */
> +               regulators {
> +                       /* 3.0 V (enabled). */
> +                       reg_aldo1: aldo1 {
> +                               regulator-boot-on;
> +                               regulator-min-microvolt = <3000000>;
> +                               regulator-max-microvolt = <3000000>;
> +                               regulator-name = "vcc-3v0-1";
> +                       };
> +
> +                       /* 1.8 V (enabled). */
> +                       reg_aldo2: aldo2 {
> +                               regulator-boot-on;
> +                               regulator-min-microvolt = <1800000>;
> +                               regulator-max-microvolt = <3600000>;
> +                               regulator-name = "vcc-pg-pm-wifi+btio-audio";
> +                       };
> +
> +                       /* 2.5 V (enabled). */
> +                       reg_aldo3: aldo3 {
> +                               regulator-boot-on;
> +                               regulator-min-microvolt = <2500000>;
> +                               regulator-max-microvolt = <2500000>;
> +                               regulator-name = "vcc-pa-gmac2v5";
> +                       };
> +
> +                       /* 1.8 V (enabled). */
> +                       reg_bldo1: bldo1 {
> +                               regulator-boot-on;
> +                               regulator-always-on;    /* Hang if disabled */

If you specify always-on, you don't need to add boot-on.

> +                               regulator-min-microvolt = <1800000>;
> +                               regulator-max-microvolt = <1800000>;
> +                               regulator-name = "vdd18-dll-vcc18-pll";
> +                       };
> +
> +                       /* 0.9 V (enabled). */
> +                       reg_bldo2: bldo2 {
> +                               regulator-boot-on;
> +                               regulator-always-on;    /* Hang if disabled */
> +                               regulator-min-microvolt = < 800000>;
> +                               regulator-max-microvolt = <1100000>;
> +                               regulator-name = "vdd-cpus";
> +                       };
> +
> +                       /* 1.2 V (disabled). */
> +                       reg_bldo3: bldo3 {
> +                               regulator-min-microvolt = <1200000>;
> +                               regulator-max-microvolt = <1200000>;
> +                               regulator-name = "vcc12-hsic";
> +                       };
> +
> +                       /* 1.1 V (enabled). */
> +                       reg_bldo4: bldo4 {
> +                               regulator-boot-on;
> +                               regulator-min-microvolt = <1100000>;
> +                               regulator-max-microvolt = <1100000>;
> +                               regulator-name = "vdd09-hdmi";
> +                       };
> +
> +                       /* 3.3 V (enabled). PLx pins control some regulators. */
> +                       reg_cldo1: cldo1 {
> +                               regulator-boot-on;
> +                               regulator-always-on;
> +                               regulator-min-microvolt = <3300000>;
> +                               regulator-max-microvolt = <3300000>;
> +                               regulator-name = "vcc-pl-led";
> +                       };
> +
> +                       /*
> +                        * cldo2 and cldo3 are connected in parallel.
> +                        * There is currently no way to express that.
> +                        * For now, use regulator-always-on on cldo2 and lock
> +                        * the voltage on both to 3.3 V.
> +                        *
> +                        * 3.3 V (disabled).
> +                        */
> +                       reg_cldo2: cldo2 {
> +                               regulator-always-on;
> +                               regulator-min-microvolt = <3300000>;
> +                               regulator-max-microvolt = <3300000>;
> +                               regulator-name = "vbat2-wifi+bt";
> +                       };
> +
> +                       /* 3.3 V (disabled). */
> +                       reg_cldo3: cldo3 {
> +                               regulator-min-microvolt = <3300000>;
> +                               regulator-max-microvolt = <3300000>;
> +                               regulator-name = "vbat1-wifi+bt";
> +                       };
> +
> +                       /* 0.9 V (enabled). */
> +                       reg_dcdca: dcdca {
> +                               regulator-boot-on;
> +                               regulator-always-on;
> +                               regulator-min-microvolt = < 800000>;
> +                               regulator-max-microvolt = <1100000>;
> +                               regulator-name = "vdd-cpua";
> +                       };
> +
> +                       /* 1.5 V (enabled). */
> +                       reg_dcdcb: dcdcb {
> +                               regulator-boot-on;
> +                               regulator-always-on;
> +                               regulator-min-microvolt = <1500000>;
> +                               regulator-max-microvolt = <1500000>;
> +                               regulator-name = "vcc-dram";
> +                       };
> +
> +                       /* 0.9 V (disabled). */
> +                       reg_dcdcc: dcdcc {
> +                               regulator-min-microvolt = <900000>;
> +                               regulator-max-microvolt = <900000>;
> +                               regulator-name = "vdd-gpu";
> +                       };
> +
> +                       /* 0.9 V (enabled). */
> +                       reg_dcdcd: dcdcd {
> +                               regulator-boot-on;
> +                               regulator-always-on;    /* Hang if disabled. */
> +                               regulator-min-microvolt = <900000>;
> +                               regulator-max-microvolt = <900000>;
> +                               regulator-name = "vdd-sys";
> +                       };
> +
> +                       /* 3.3 V (enabled). */
> +                       reg_dcdce: dcdce {
> +                               regulator-boot-on;
> +                               regulator-always-on;
> +                               regulator-min-microvolt = <3300000>;
> +                               regulator-max-microvolt = <3300000>;
> +                               regulator-name = "vcc-pb-pc-pd-pe-pf-ph-mmc-spdif";

This is probably vcc-io or something shorter.

Regards
ChenYu

> +                       };
> +
> +                       /* 3.3 V (disabled). */
> +                       reg_sw: sw {
> +                               regulator-min-microvolt = <3300000>;
> +                               regulator-max-microvolt = <3300000>;
> +                               regulator-name = "vcc-gmac3v3";
> +                       };
> +               };
> +       };
> +};
> +
> +/*
> + * 5-pin connector opposite of the SD card slot:
> + * 1 = GND (pointed to by small triangle), 2 = GND, 3 = 3.3 V, 4 = RX, 5 = TX.
> + */
> +&uart0 {
> +       pinctrl-names = "default";
> +       pinctrl-0 = <&uart0_pins_a>;
> +       status = "okay";
> +};
> +
> +/* The port has two Vbus supplies. See workaround at regulator-usb1-1-vbus. */
> +&usbphy1 {
> +       phy-supply = <&reg_usb1_1_vbus>;
> +       status = "okay";
> +};
> +
> +&usbphy3 {
> +       status = "okay";
> +};
> --
> 2.10.2
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 3/5] mfd: axp20x: Add support for the AXP808 PMIC
  2017-02-02  7:23   ` Chen-Yu Tsai
@ 2017-02-03 21:47     ` Rask Ingemann Lambertsen
  0 siblings, 0 replies; 17+ messages in thread
From: Rask Ingemann Lambertsen @ 2017-02-03 21:47 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Mark Rutland, devicetree, Liam Girdwood, Rob Herring,
	linux-kernel, Mark Brown, Lee Jones, linux-arm-kernel,
	Maxime Ripard

On Thu, Feb 02, 2017 at 03:23:33PM +0800, Chen-Yu Tsai wrote:
> On Fri, Jan 27, 2017 at 5:25 AM, Rask Ingemann Lambertsen
> <rask@formelder.dk> wrote:
[...]
> > diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> > index 25115fe..2d3383e 100644
> > --- a/drivers/mfd/axp20x.c
> > +++ b/drivers/mfd/axp20x.c
[...]
> > @@ -148,6 +149,13 @@ static const struct regmap_range axp806_writeable_ranges[] = {
> >         regmap_reg_range(AXP806_REG_ADDR_EXT, AXP806_REG_ADDR_EXT),
> >  };
> >
> > +static const struct regmap_range axp808_writeable_ranges[] = {
> > +       regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_DATACACHE(3)),
> > +       regmap_reg_range(AXP806_PWR_OUT_CTRL1, AXP806_CLDO3_V_CTRL),
> > +       regmap_reg_range(AXP20X_IRQ1_EN, AXP20X_IRQ2_EN),
> > +       regmap_reg_range(AXP20X_IRQ1_STATE, AXP20X_IRQ2_STATE),
> > +};
> > +
> >  static const struct regmap_range axp806_volatile_ranges[] = {
> >         regmap_reg_range(AXP20X_IRQ1_STATE, AXP20X_IRQ2_STATE),
> >  };
> > @@ -162,6 +170,11 @@ static const struct regmap_access_table axp806_volatile_table = {
> >         .n_yes_ranges   = ARRAY_SIZE(axp806_volatile_ranges),
> >  };
> >
> > +static const struct regmap_access_table axp808_writeable_table = {
> > +       .yes_ranges     = axp808_writeable_ranges,
> > +       .n_yes_ranges   = ARRAY_SIZE(axp808_writeable_ranges),
> 
> You could probably get away with using axp806_writeable_ranges,
> and pass ARRAY_SIZE(axp808_writeable_ranges) - 1 for .n_yes_ranges.

Assuming that register ranges not supported on the AXP808 are always
at one end of the table, I think it will ease maintenance by avoiding
duplicate data should entries be added or removed in the future. I'll put
a comment above axp806_writeable_ranges to point out what's going on.

> Or maybe the compiler figures out the 2 arrays share common data.

It doesn't as of gcc 6.2.1.

-- 
Rask Ingemann Lambertsen

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

* Re: [PATCH 5/5] ARM: dts: sun9i: Initial support for the Sunchip CX-A99 board
  2017-02-02  7:36   ` Chen-Yu Tsai
@ 2017-02-05 19:23     ` Rask Ingemann Lambertsen
  0 siblings, 0 replies; 17+ messages in thread
From: Rask Ingemann Lambertsen @ 2017-02-05 19:23 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Mark Rutland, devicetree, Liam Girdwood, Rob Herring,
	linux-kernel, Mark Brown, Maxime Ripard, Lee Jones,
	linux-arm-kernel

On Thu, Feb 02, 2017 at 03:36:41PM +0800, Chen-Yu Tsai wrote:
> Hi,
> 
> On Fri, Jan 27, 2017 at 5:27 AM, Rask Ingemann Lambertsen
> <rask@formelder.dk> wrote:
[...]
> > diff --git a/arch/arm/boot/dts/sun9i-a80-cx-a99.dts b/arch/arm/boot/dts/sun9i-a80-cx-a99.dts
> > new file mode 100644
> > index 0000000..8925093
> > --- /dev/null
> > +++ b/arch/arm/boot/dts/sun9i-a80-cx-a99.dts
[...]
> > +       leds {
> > +               compatible = "gpio-leds";
> > +
> > +               blue {
> > +                       gpios = <&pio 6 10 GPIO_ACTIVE_HIGH>;   /* PG10 */
> > +                       label = "cx-a99:blue:status";
> > +                       default-state = "on";
> 
> Please add a note justifying default-state = "on".

I think I'll remove it instead. The device ships with a U-Boot and Android
installation where blue means "on" and red means "stand-by" (which is simply
implemented by blanking the screen, it seems), but I doubt many people want
to run the rather old Android version available for this device. Instead,
I was going to point to the quick setup guide, but it has no mention of the
LEDs at all, so I guess the user won't expect the blue LED to turn on.

> > +       /* USB 3.0 OTG connector. For now, only Vbus is supported. */
> > +       reg_usb0_vbus: regulator-usb0-vbus {
> > +               compatible = "regulator-fixed";
> > +               regulator-name = "usb0-vbus";
> > +               regulator-min-microvolt = <5000000>;
> > +               regulator-max-microvolt = <5000000>;
> > +               gpio = <&pio 7 15 GPIO_ACTIVE_HIGH>;    /* PH15 */
> > +               enable-active-high;
> > +               regulator-always-on;
> 
> It's bad to leave VBUS for OTG connectors on. You never know
> what is plugged in.

The comment is misleading as the connector is not an OTG one but just a
standard-A receptacle wired to the SoC's OTG port. I'll change the comment.

> > +/* SD card slot. */
> > +&mmc0 {
> > +       bus-width = <4>;
> > +       cd-gpios = <&pio 7 17 GPIO_ACTIVE_LOW>; /* PH17 */
> > +       broken-cd;                              /* Interrupts don't work. */
> 
> This should be handled by the driver.

The MMC core, without broken-cd, requests the GPIO driver to enable
interrupt delivery on the pin and will fall back to polling the GPIO pin
if the GPIO driver refuses to enable interrupt delivery. What I see is
that the GPIO driver accepts to deliver interrupts, but only the first
interrupt is triggered (as evident from /proc/interrupts showing only 1).
The vendor sys_config.fex also sets the GPIO pin to polled operation, so
maybe there is a hardware bug.

The sunxi-mmc driver doesn't really support operation with broken-cd only
because it spams the console and dmesg with useless error messages, see
https://www.mail-archive.com/linux-sunxi@googlegroups.com/msg19963.html
for an example.

The comment should probably read something like "GPIO pin delivers no
interrupts, poll it".

> > +                       /* 1.8 V (enabled). */
> > +                       reg_bldo1: bldo1 {
> > +                               regulator-boot-on;
> > +                               regulator-always-on;    /* Hang if disabled */
> 
> If you specify always-on, you don't need to add boot-on.

Ack.

> > +                       /* 3.3 V (enabled). */
> > +                       reg_dcdce: dcdce {
> > +                               regulator-boot-on;
> > +                               regulator-always-on;
> > +                               regulator-min-microvolt = <3300000>;
> > +                               regulator-max-microvolt = <3300000>;
> > +                               regulator-name = "vcc-pb-pc-pd-pe-pf-ph-mmc-spdif";
> 
> This is probably vcc-io or something shorter.

I'm verbose with the names of the regulators for documentation purposes
because unlike some of the boards aimed at developers, documentation is on
this device is scarse. I see that with -mmc now added after my latest round
of probing with a multimeter, the line went above 80 characters. Will it be
OK with vcc-pb,c,d,e,f,h-mmc-spdif?

-- 
Rask Ingemann Lambertsen

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

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

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-26 21:14 [PATCH 0/5] arm: sun9i: Support AXP808 PMIC and Sunchip CX-A99 board Rask Ingemann Lambertsen
2017-01-26 21:15 ` [PATCH 1/5] DT: mfd: axp20x: Add AXP806 to list of current AXP20x family members Rask Ingemann Lambertsen
2017-01-27  4:38   ` Chen-Yu Tsai
2017-02-01 13:26   ` Rob Herring
2017-01-26 21:16 ` [PATCH 2/5] DT: mfd: axp20x: Add binding for the AXP808 Rask Ingemann Lambertsen
2017-02-01 13:27   ` Rob Herring
2017-02-02  7:20     ` Chen-Yu Tsai
2017-01-26 21:17 ` [PATCH 3/5] mfd: axp20x: Add support for the AXP808 PMIC Rask Ingemann Lambertsen
2017-02-02  7:23   ` Chen-Yu Tsai
2017-02-03 21:47     ` Rask Ingemann Lambertsen
2017-01-26 21:18 ` [PATCH 4/5] regulator: " Rask Ingemann Lambertsen
2017-01-27 11:42   ` Mark Brown
2017-02-02  7:25     ` Chen-Yu Tsai
2017-01-26 21:19 ` [PATCH 5/5] ARM: dts: sun9i: Initial support for the Sunchip CX-A99 board Rask Ingemann Lambertsen
2017-02-02  7:36   ` Chen-Yu Tsai
2017-02-05 19:23     ` Rask Ingemann Lambertsen
2017-01-26 21:49 ` [PATCH 0/5] arm: sun9i: Support AXP808 PMIC and " Rask Ingemann Lambertsen

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).