* [PATCH v8 0/2] mfd: add X-Powers AC200 support
@ 2026-09-02 19:28 James Hilliard
2026-09-02 19:28 ` [PATCH v8 1/2] dt-bindings: mfd: x-powers: Add AC200 James Hilliard
2026-09-02 19:28 ` [PATCH v8 2/2] mfd: ac200: Add X-Powers AC200 support James Hilliard
0 siblings, 2 replies; 6+ messages in thread
From: James Hilliard @ 2026-09-02 19:28 UTC (permalink / raw)
To: Lee Jones, Arnd Bergmann, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, James Hilliard
Cc: Andrew Lunn, Jagielski, Jedrzej, Andre Przywara, Chen-Yu Tsai,
Jernej Skrabec, linux-sunxi, mfd, devicetree, linux-kernel,
Krzysztof Kozlowski
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/20260818-submit-acx00-of-dynamic-v1-v9-0-b8c8d9ad0d83@gmail.com
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
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
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/20260811-submit-ac200-mfd-v7-0-8b06f552a4d7@gmail.com
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/20260811-submit-ac200-mfd-v6-0-c5b1292c8498@gmail.com
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/20260809-submit-acx00-of-dynamic-v1-v5-0-bfa1f8518b28@gmail.com
To: Lee Jones <lee@kernel.org>
To: Rob Herring <robh@kernel.org>
To: Krzysztof Kozlowski <krzk+dt@kernel.org>
To: Conor Dooley <conor+dt@kernel.org>
To: James Hilliard <james.hilliard1@gmail.com>
Cc: mfd@lists.linux.dev
Cc: devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
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,
--
James Hilliard <james.hilliard1@gmail.com>
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH v8 1/2] dt-bindings: mfd: x-powers: Add AC200 2026-09-02 19:28 [PATCH v8 0/2] mfd: add X-Powers AC200 support James Hilliard @ 2026-09-02 19:28 ` James Hilliard 2026-09-02 19:35 ` sashiko-bot 2026-09-02 19:28 ` [PATCH v8 2/2] mfd: ac200: Add X-Powers AC200 support James Hilliard 1 sibling, 1 reply; 6+ messages in thread From: James Hilliard @ 2026-09-02 19:28 UTC (permalink / raw) To: Lee Jones, Arnd Bergmann, Rob Herring, Krzysztof Kozlowski, Conor Dooley, James Hilliard Cc: Andrew Lunn, Jagielski, Jedrzej, Andre Przywara, Chen-Yu Tsai, Jernej Skrabec, linux-sunxi, mfd, devicetree, linux-kernel, Krzysztof Kozlowski 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. Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Signed-off-by: James Hilliard <james.hilliard1@gmail.com> --- .../devicetree/bindings/mfd/x-powers,ac200.yaml | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/Documentation/devicetree/bindings/mfd/x-powers,ac200.yaml b/Documentation/devicetree/bindings/mfd/x-powers,ac200.yaml new file mode 100644 index 000000000000..609831b15c80 --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/x-powers,ac200.yaml @@ -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 <james.hilliard1@gmail.com> + +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>; + }; + }; +... -- 2.53.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v8 1/2] dt-bindings: mfd: x-powers: Add AC200 2026-09-02 19:28 ` [PATCH v8 1/2] dt-bindings: mfd: x-powers: Add AC200 James Hilliard @ 2026-09-02 19:35 ` sashiko-bot 0 siblings, 0 replies; 6+ messages in thread From: sashiko-bot @ 2026-09-02 19:35 UTC (permalink / raw) To: James Hilliard; +Cc: robh, mfd, lee, devicetree, linux-sunxi, conor+dt > 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. > > Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> > Signed-off-by: James Hilliard <james.hilliard1@gmail.com> Sashiko has reviewed this patch and found no issues. It looks great! -- Sashiko AI review · https://sashiko.dev/#/patchset/20260902-submit-ac200-mfd-v8-0-2aa06720b8ac@gmail.com?part=1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v8 2/2] mfd: ac200: Add X-Powers AC200 support 2026-09-02 19:28 [PATCH v8 0/2] mfd: add X-Powers AC200 support James Hilliard 2026-09-02 19:28 ` [PATCH v8 1/2] dt-bindings: mfd: x-powers: Add AC200 James Hilliard @ 2026-09-02 19:28 ` James Hilliard 2026-09-02 19:40 ` sashiko-bot 1 sibling, 1 reply; 6+ messages in thread From: James Hilliard @ 2026-09-02 19:28 UTC (permalink / raw) To: Lee Jones, Arnd Bergmann, Rob Herring, Krzysztof Kozlowski, Conor Dooley, James Hilliard Cc: Andrew Lunn, Jagielski, Jedrzej, Andre Przywara, Chen-Yu Tsai, Jernej Skrabec, linux-sunxi, mfd, devicetree, linux-kernel 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. Signed-off-by: James Hilliard <james.hilliard1@gmail.com> --- drivers/mfd/Kconfig | 11 +++++ drivers/mfd/Makefile | 1 + drivers/mfd/ac200.c | 136 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 148 insertions(+) diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index e4fd4572472f..cac3fff5aee9 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -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 diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 72d3944b0ad8..f8101d2a9ce9 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -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 diff --git a/drivers/mfd/ac200.c b/drivers/mfd/ac200.c new file mode 100644 index 000000000000..8445a460ef6c --- /dev/null +++ b/drivers/mfd/ac200.c @@ -0,0 +1,136 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * MFD core driver for the X-Powers AC200 + * + * Copyright (C) 2019 Jernej Skrabec <jernej.skrabec@gmail.com> + * Copyright (C) 2026 James Hilliard <james.hilliard1@gmail.com> + */ + +#include <linux/clk.h> +#include <linux/delay.h> +#include <linux/i2c.h> +#include <linux/module.h> +#include <linux/regmap.h> + +#define AC200_SYS_CONTROL_REG 0x0002 +#define AC200_SYS_CONTROL_CHIP_RESET_DEASSERT BIT(0) + +/* Interface register accessible from every register page. */ +#define AC200_TWI_REG_ADDR_H 0x00fe +#define AC200_MAX_REG 0xa1f2 + +static const struct regmap_range_cfg ac200_range_cfg[] = { + { + .range_max = AC200_MAX_REG, + .selector_reg = AC200_TWI_REG_ADDR_H, + .selector_mask = 0xff, + .window_len = 256, + }, +}; + +/* + * Each AC200 sub-block can reset independently, invalidating its register + * contents without regmap's knowledge. Cache only the common page selector; + * this avoids a selector read-modify-write for every access on the same page + * without ever returning stale functional-register values. + */ +static bool ac200_volatile_reg(struct device *dev, unsigned int reg) +{ + return reg != AC200_TWI_REG_ADDR_H; +} + +static const struct regmap_config ac200_regmap_config = { + .name = "ac200", + .reg_bits = 8, + .reg_stride = 2, + .val_bits = 16, + .ranges = ac200_range_cfg, + .num_ranges = ARRAY_SIZE(ac200_range_cfg), + .max_register = AC200_MAX_REG, + .volatile_reg = ac200_volatile_reg, + .cache_type = REGCACHE_MAPLE, +}; + +static void ac200_disable(struct regmap *regmap) +{ + regmap_write(regmap, AC200_SYS_CONTROL_REG, 0); +} + +static int ac200_probe(struct i2c_client *client) +{ + struct device *dev = &client->dev; + struct regmap *regmap; + struct clk *clk; + int ret; + + clk = devm_clk_get_enabled(dev, NULL); + if (IS_ERR(clk)) + return dev_err_probe(dev, PTR_ERR(clk), + "failed to enable input clock\n"); + + ret = devm_clk_rate_exclusive_get(dev, clk); + if (ret) + return dev_err_probe(dev, ret, "failed to lock clock rate\n"); + + regmap = devm_regmap_init_i2c(client, &ac200_regmap_config); + if (IS_ERR(regmap)) + return dev_err_probe(dev, PTR_ERR(regmap), + "failed to initialize regmap\n"); + + i2c_set_clientdata(client, regmap); + + /* + * No minimum delay is documented. Match the vendor driver's 40 ms delay + * before its first AC200 register access after enabling the input clock. + */ + msleep(40); + + ret = regmap_write(regmap, AC200_SYS_CONTROL_REG, 0); + if (ret) + return ret; + + ret = regmap_write(regmap, AC200_SYS_CONTROL_REG, + AC200_SYS_CONTROL_CHIP_RESET_DEASSERT); + if (ret) + return ret; + + return 0; +} + +static void ac200_remove(struct i2c_client *client) +{ + ac200_disable(i2c_get_clientdata(client)); +} + +static void ac200_shutdown(struct i2c_client *client) +{ + ac200_disable(i2c_get_clientdata(client)); +} + +static const struct of_device_id ac200_of_match[] = { + { .compatible = "x-powers,ac200" }, + { } +}; +MODULE_DEVICE_TABLE(of, ac200_of_match); + +static const struct i2c_device_id ac200_i2c_ids[] = { + { .name = "ac200" }, + { } +}; +MODULE_DEVICE_TABLE(i2c, ac200_i2c_ids); + +static struct i2c_driver ac200_driver = { + .driver = { + .name = "ac200", + .of_match_table = ac200_of_match, + }, + .probe = ac200_probe, + .remove = ac200_remove, + .shutdown = ac200_shutdown, + .id_table = ac200_i2c_ids, +}; +module_i2c_driver(ac200_driver); + +MODULE_AUTHOR("James Hilliard <james.hilliard1@gmail.com>"); +MODULE_DESCRIPTION("X-Powers AC200 MFD core driver"); +MODULE_LICENSE("GPL"); -- 2.53.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v8 2/2] mfd: ac200: Add X-Powers AC200 support 2026-09-02 19:28 ` [PATCH v8 2/2] mfd: ac200: Add X-Powers AC200 support James Hilliard @ 2026-09-02 19:40 ` sashiko-bot 2026-09-03 8:39 ` Lee Jones 0 siblings, 1 reply; 6+ messages in thread From: sashiko-bot @ 2026-09-02 19:40 UTC (permalink / raw) To: James Hilliard; +Cc: linux-sunxi, devicetree, lee, conor+dt, mfd, robh 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 <james.hilliard1@gmail.com> 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. > diff --git a/drivers/mfd/ac200.c b/drivers/mfd/ac200.c > new file mode 100644 > index 0000000000000..8445a460ef6c2 > --- /dev/null > +++ b/drivers/mfd/ac200.c [ ... ] > +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? [ ... ] -- Sashiko AI review · https://sashiko.dev/#/patchset/20260902-submit-ac200-mfd-v8-0-2aa06720b8ac@gmail.com?part=2 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v8 2/2] mfd: ac200: Add X-Powers AC200 support 2026-09-02 19:40 ` sashiko-bot @ 2026-09-03 8:39 ` Lee Jones 0 siblings, 0 replies; 6+ messages in thread From: Lee Jones @ 2026-09-03 8:39 UTC (permalink / raw) To: sashiko-reviews Cc: James Hilliard, linux-sunxi, devicetree, conor+dt, mfd, robh On Wed, 02 Sep 2026, sashiko-bot@kernel.org 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. > -- > > commit d8592c963caa9b21487926208ea5815e059be1be > Author: James Hilliard <james.hilliard1@gmail.com> > > 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. > > > diff --git a/drivers/mfd/ac200.c b/drivers/mfd/ac200.c > > new file mode 100644 > > index 0000000000000..8445a460ef6c2 > > --- /dev/null > > +++ b/drivers/mfd/ac200.c > > [ ... ] > > > +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? > > [ ... ] > > -- > Sashiko AI review · https://sashiko.dev/#/patchset/20260902-submit-ac200-mfd-v8-0-2aa06720b8ac@gmail.com?part=2 -- Lee Jones ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-09-03 8:39 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-09-02 19:28 [PATCH v8 0/2] mfd: add X-Powers AC200 support James Hilliard 2026-09-02 19:28 ` [PATCH v8 1/2] dt-bindings: mfd: x-powers: Add AC200 James Hilliard 2026-09-02 19:35 ` sashiko-bot 2026-09-02 19:28 ` [PATCH v8 2/2] mfd: ac200: Add X-Powers AC200 support James Hilliard 2026-09-02 19:40 ` sashiko-bot 2026-09-03 8:39 ` Lee Jones
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox