Skip to contentSkip to conversation

mfd: add X-Powers AC200 support

PATCH Superseded James Hilliard 3 participants 6 messages Sep 2 – Sep 3

Subsystems (3)

v8 of 13 Superseded Latest is v13 →

lore
Share & tools
lore
#0 lore raw

v8 cover mfd: add X-Powers AC200 support

The X-Powers AC200 is an I2C-controlled mixed-signal companion IC with a paged register map shared by its audio, video, RTC and Fast Ethernet PHY functions.

Add the parent binding and an I2C provider which enables and rate-locks the shared input clock, initializes the paged regmap and controls the common reset. Audio, video and RTC functions can be added as MFD children.

The current regmap consumer is the separately submitted AC200/AC300 Ethernet PHY series:

https://patch.msgid.link/[email protected]

The PHY remains enumerated on MDIO, its primary management bus. Its AC200 package node follows the x-powers,ac200 phandle for ancillary I2C register access, adds a managed device link and obtains the regmap with dev_get_regmap(). This series and the PHY series can be merged in either order; AC200 Ethernet support requires both.

This work builds on earlier AC200 work by Jernej Skrabec and Andre Przywara:

https://github.com/jernejsk/linux-1/commits/ac200-v4

Public AC200 documentation is linked from:

https://linux-sunxi.org/AC200

Validation included an x86_64 W=1 object build, dt_binding_check, and a combined W=1 build with the PHY series. On AC200 hardware, the provider and PHY completed 100 overlapping bind cycles while preserving both device links and recovering a 100 Mbps full-duplex link.

Assisted-by Codex:gpt-5.6-sol

---
Changes v7 -> v8:
- identify the PHY series as the current regmap consumer
- describe future MFD children and the MDIO/I2C split
- store the regmap directly as driver data (suggested by Lee Jones)
- reset the chip from the remove callback (suggested by Lee Jones)
- drop the revision log and inherited-driver attribution (suggested by Lee Jones)
- add Krzysztof's Reviewed-by tag to the binding
- rebase on the current MFD for-mfd-next branch
- Link to v7: https://patch.msgid.link/[email protected]

Changes v6 -> v7:
- drop the managed external-syscon helper and AC200 syscon registration
- leave the regmap attached to the I2C provider for direct device lookup
- reduce the MFD series from three patches to two
- Link to v6: https://patch.msgid.link/[email protected]

Changes v5 -> v6:
- split the MFD work from the independently mergeable networking series
- put the merge routing and shared DT design at the start of the cover letter
- rebase on the MFD for-mfd-next branch
- Link to v5: https://patch.msgid.link/[email protected]

To: Lee Jones <[email protected]>
To: Rob Herring <[email protected]>
To: Krzysztof Kozlowski <[email protected]>
To: Conor Dooley <[email protected]>
To: James Hilliard <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
James Hilliard (2):
dt-bindings: mfd: x-powers: Add AC200
mfd: ac200: Add X-Powers AC200 support

 .../devicetree/bindings/mfd/x-powers,ac200.yaml    |  49 ++++++++
 drivers/mfd/Kconfig                                |  11 ++
 drivers/mfd/Makefile                               |   1 +
 drivers/mfd/ac200.c                                | 136 +++++++++++++++++++++
 4 files changed, 197 insertions(+)

---
base-commit: 9d0e4b1ae5b045a2c92b0b9a1c3b268191c219d9
change-id: 20260811-submit-ac200-mfd-8bad6d09e285

Best regards,

Signature · 1 line
James Hilliard <[email protected]>
#1 lore raw

PATCH v8 1/2 dt-bindings: mfd: x-powers: Add AC200

The AC200 is an I2C-controlled mixed-signal companion IC containing audio, video, RTC and Fast Ethernet PHY functions.

Describe the parent device and its shared input clock. The Ethernet PHY is represented by a PHY package on its MDIO bus, with a phandle back to this device for access to the package control registers, so it does not require an MFD child node. Function-specific supplies belong to their consumer bindings rather than the shared parent.

The input clock must run at 24 or 27 MHz when the Ethernet PHY is used, matching the rates encoded by its documented clock selector.

---
 .../devicetree/bindings/mfd/x-powers,ac200.yaml    | 49 ++++++++++++++++++++++
 1 file changed, 49 insertions(+)
Documentation/devicetree/bindings/mfd/x-powers,ac200.yaml new file +49 -0
new file mode 100644
index 000000000000..609831b15c80
@@ -0,0 +1,49 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mfd/x-powers,ac200.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: X-Powers AC200 mixed-signal IC
+
+maintainers:
+  - James Hilliard <[email protected]>
+
+description:
+  The AC200 is a mixed-signal companion IC containing audio, video, RTC and
+  Fast Ethernet PHY functions. Its control registers are accessed over I2C.
+
+properties:
+  compatible:
+    const: x-powers,ac200
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+    description:
+      AC200 input clock. When using the Ethernet PHY, its configured rate must
+      be 24 or 27 MHz, matching the rates encoded by the documented EPHY clock
+      selector.
+
+required:
+  - compatible
+  - reg
+  - clocks
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        mixed-signal@10 {
+            compatible = "x-powers,ac200";
+            reg = <0x10>;
+            clocks = <&pwm 5>;
+        };
+    };
+...
Signature · 1 line
2.53.0
#2 lore raw

Re: [PATCH v8 1/2] dt-bindings: mfd: x-powers: Add AC200

Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 9 lines

The AC200 is an I2C-controlled mixed-signal companion IC containing audio, video, RTC and Fast Ethernet PHY functions.

Describe the parent device and its shared input clock. The Ethernet PHY is represented by a PHY package on its MDIO bus, with a phandle back to this device for access to the package control registers, so it does not require an MFD child node. Function-specific supplies belong to their consumer bindings rather than the shared parent.

Quoted 5 lines

The input clock must run at 24 or 27 MHz when the Ethernet PHY is used, matching the rates encoded by its documented clock selector.

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#3 lore raw

PATCH v8 2/2 mfd: ac200: Add X-Powers AC200 support

In reply to James Hilliard

The X-Powers AC200 is a mixed-signal companion IC with a paged register map accessed over I2C.

Enable and rate-lock the shared input clock, wait 40 ms before the first register access, initialize the paged regmap and reset the chip. Assert reset again during driver removal and system shutdown.

The Ethernet PHY is enumerated on its MDIO bus rather than as an MFD child. It follows the x-powers,ac200 phandle and uses this regmap for ancillary package-control access. Other AC200 functions can be added as MFD children.

Cache only the common page selector. Individual functions can reset independently and invalidate their other registers, so leave all functional registers volatile.

---
 drivers/mfd/Kconfig  |  11 +++++
 drivers/mfd/Makefile |   1 +
 drivers/mfd/ac200.c  | 136 +++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 148 insertions(+)
drivers/mfd/Kconfig +11 -0
index e4fd4572472f..cac3fff5aee9 100644
@@ -205,6 +205,17 @@ config MFD_AC100
 	  This driver include only the core APIs. You have to select individual
 	  components like codecs or RTC under the corresponding menus.
 
+config MFD_AC200
+	tristate "X-Powers AC200"
+	depends on I2C
+	depends on OF
+	select REGMAP_I2C
+	help
+	  Support for the X-Powers AC200 mixed-signal companion IC. The AC200
+	  contains audio, video, RTC and Fast Ethernet PHY functions and is
+	  co-packaged with some Allwinner H6 and H616 SoCs. This driver provides
+	  the shared register access used by the individual function drivers.
+
 config MFD_AXP20X
 	tristate
 	select MFD_CORE
drivers/mfd/Makefile +1 -0
index 72d3944b0ad8..f8101d2a9ce9 100644
@@ -150,6 +150,7 @@ obj-$(CONFIG_MFD_DA9052_SPI)	+= da9052-spi.o
 obj-$(CONFIG_MFD_DA9052_I2C)	+= da9052-i2c.o
 
 obj-$(CONFIG_MFD_AC100)		+= ac100.o
+obj-$(CONFIG_MFD_AC200)		+= ac200.o
 obj-$(CONFIG_MFD_AXP20X)	+= axp20x.o
 obj-$(CONFIG_MFD_AXP20X_I2C)	+= axp20x-i2c.o
 obj-$(CONFIG_MFD_AXP20X_RSB)	+= axp20x-rsb.o
drivers/mfd/ac200.c new file +136 -0

136 lines not on this page · raw message

Signature · 1 line
2.53.0
#4 lore raw

Re: [PATCH v8 2/2] mfd: ac200: Add X-Powers AC200 support

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] Unconditional global chip reset in shutdown/remove breaks RTC wake, Wake-on-LAN, and live PHY…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Unconditional global chip reset in shutdown/remove breaks RTC wake, Wake-on-LAN, and live PHY state. --

commit d8592c963caa9b21487926208ea5815e059be1be
Author: James Hilliard <[email protected]>

mfd: ac200: Add X-Powers AC200 support

This commit adds support for the X-Powers AC200 mixed-signal companion IC. It enables the shared input clock, initializes the paged regmap, and asserts a chip reset during probe, driver removal, and system shutdown.

Quoted 5 lines
drivers/mfd/ac200.c new file +0 -0
new file mode 100644
index 0000000000000..8445a460ef6c2

[ ... ]

drivers/mfd/ac200.c line 57

Quoted 4 lines
drivers/mfd/ac200.c new file +4 -0
+static void ac200_disable(struct regmap *regmap)
+{
+	regmap_write(regmap, AC200_SYS_CONTROL_REG, 0);
+}

[Severity: High]
Does asserting a global chip reset here wipe the hardware state of all co-packaged functions, including the RTC and Fast Ethernet PHY?

Since ac200_disable() is unconditionally called by ac200_shutdown() and ac200_remove(), could this kill the PHY and clear the RTC during system shutdown, breaking Wake-on-LAN and Wake-on-RTC from power-off states?

Furthermore, because the PHY is enumerated separately on the MDIO bus and only references this MFD via a phandle, will unbinding the AC200 driver at runtime (via ac200_remove) forcefully reset the PHY hardware out from under the active MDIO PHY driver and lead to unpredictable network failures?

[ ... ]

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
maintainer
#5 lore raw

Re: [PATCH v8 2/2] mfd: ac200: Add X-Powers AC200 support

Quoted 2 lines · On Wed, 02 Sep 2026, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Unconditional global chip reset in shutdown/remove breaks RTC wake, Wake-on-LAN, and live PHY state.

Is that true? Needs a response from you.

Quoted 41 lines

--

commit d8592c963caa9b21487926208ea5815e059be1be
Author: James Hilliard <[email protected]>

mfd: ac200: Add X-Powers AC200 support

This commit adds support for the X-Powers AC200 mixed-signal companion IC. It enables the shared input clock, initializes the paged regmap, and asserts a chip reset during probe, driver removal, and system shutdown.

Quoted 5 lines
drivers/mfd/ac200.c new file +0 -0
new file mode 100644
index 0000000000000..8445a460ef6c2

[ ... ]

drivers/mfd/ac200.c line 57

Quoted 4 lines
drivers/mfd/ac200.c new file +4 -0
+static void ac200_disable(struct regmap *regmap)
+{
+	regmap_write(regmap, AC200_SYS_CONTROL_REG, 0);
+}

[Severity: High]
Does asserting a global chip reset here wipe the hardware state of all co-packaged functions, including the RTC and Fast Ethernet PHY?

Since ac200_disable() is unconditionally called by ac200_shutdown() and ac200_remove(), could this kill the PHY and clear the RTC during system shutdown, breaking Wake-on-LAN and Wake-on-RTC from power-off states?

Furthermore, because the PHY is enumerated separately on the MDIO bus and only references this MFD via a phandle, will unbinding the AC200 driver at runtime (via ac200_remove) forcefully reset the PHY hardware out from under the active MDIO PHY driver and lead to unpredictable network failures?

[ ... ]

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Signature · 1 line
Lee Jones