mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RFC PATCH] soc: aspeed: Add B650D4U power passthrough support
@ 2026-10-02 13:16 Prasanth Kumar Padarthi
  2026-10-02 16:47 ` Tan Siewert
  2026-10-03 13:54 ` Krzysztof Kozlowski
  0 siblings, 2 replies; 4+ messages in thread
From: Prasanth Kumar Padarthi @ 2026-10-02 13:16 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: devicetree, linux-aspeed, linux-kernel, joel, ryan_chen,
	tan.siewert, Prasanth Kumar Padarthi

Add the AST2600 SCU passthrough selector support used by the
ASRock Rack B650D4U host power-control circuit. This RFC includes
the driver, Devicetree binding, and board node to discuss the final
kernel-facing interface.

Signed-off-by: Prasanth Kumar Padarthi <prasanth.padarthi10@gmail.com>
---
 .../asrock,b650d4u-power-passthrough.yaml     |  23 ++++
 .../dts/aspeed/aspeed-bmc-asrock-b650d4u.dts  |   5 +
 drivers/soc/aspeed/Kconfig                    |   9 ++
 drivers/soc/aspeed/Makefile                   |   1 +
 drivers/soc/aspeed/aspeed-b650d4u-power.c     | 110 ++++++++++++++++++
 5 files changed, 148 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/aspeed/asrock,b650d4u-power-passthrough.yaml
 create mode 100644 drivers/soc/aspeed/aspeed-b650d4u-power.c

diff --git a/Documentation/devicetree/bindings/soc/aspeed/asrock,b650d4u-power-passthrough.yaml b/Documentation/devicetree/bindings/soc/aspeed/asrock,b650d4u-power-passthrough.yaml
new file mode 100644
index 000000000000..e6451d17955c
--- /dev/null
+++ b/Documentation/devicetree/bindings/soc/aspeed/asrock,b650d4u-power-passthrough.yaml
@@ -0,0 +1,23 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/aspeed/asrock,b650d4u-power-passthrough.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ASRock Rack B650D4U power passthrough
+
+maintainers:
+  - Prasanth Kumar Padarthi <prasanth.padarthi10@gmail.com>
+
+properties:
+  compatible:
+    const: asrock,b650d4u-power-passthrough
+
+  aspeed,scu:
+    $ref: /schemas/types.yaml#/definitions/phandle
+
+required:
+  - compatible
+  - aspeed,scu
+
+additionalProperties: false
diff --git a/arch/arm/boot/dts/aspeed/aspeed-bmc-asrock-b650d4u.dts b/arch/arm/boot/dts/aspeed/aspeed-bmc-asrock-b650d4u.dts
index a4e384588a54..86291c250562 100644
--- a/arch/arm/boot/dts/aspeed/aspeed-bmc-asrock-b650d4u.dts
+++ b/arch/arm/boot/dts/aspeed/aspeed-bmc-asrock-b650d4u.dts
@@ -32,6 +32,11 @@ gfx_memory: framebuffer {
 			size = <0x01000000>;
 		};
 	};
+
+	host-power-passthrough {
+		compatible = "asrock,b650d4u-power-passthrough";
+		aspeed,scu = <&syscon>;
+	};
 };
 
 &fmc {
diff --git a/drivers/soc/aspeed/Kconfig b/drivers/soc/aspeed/Kconfig
index 11e4db998c06..1b0281e0bfb0 100644
--- a/drivers/soc/aspeed/Kconfig
+++ b/drivers/soc/aspeed/Kconfig
@@ -58,6 +58,15 @@ config ASPEED_SBC
 	  Say yes to provide information about the secure boot controller in
 	  debugfs.
 
+config ASPEED_B650D4U_POWER
+	tristate "ASRock B650D4U host power passthrough"
+	select REGMAP
+	select MFD_SYSCON
+	default ARCH_ASPEED
+	help
+	  Enable the AST2600 GPIO passthrough selector used by the
+	  ASRock Rack B650D4U host power-control circuit. This selector routes the host power pulse through the board's passthrough logic during power sequencing.
+
 config ASPEED_XDMA
 	tristate "ASPEED XDMA Engine Driver"
 	select REGMAP
diff --git a/drivers/soc/aspeed/Makefile b/drivers/soc/aspeed/Makefile
index 5f61bb4cc36c..3e9618d1eafc 100644
--- a/drivers/soc/aspeed/Makefile
+++ b/drivers/soc/aspeed/Makefile
@@ -5,4 +5,5 @@ obj-$(CONFIG_ASPEED_UART_ROUTING)	+= aspeed-uart-routing.o
 obj-$(CONFIG_ASPEED_P2A_CTRL)		+= aspeed-p2a-ctrl.o
 obj-$(CONFIG_ASPEED_SOCINFO)		+= aspeed-socinfo.o
 obj-$(CONFIG_ASPEED_SBC)		+= aspeed-sbc.o
+obj-$(CONFIG_ASPEED_B650D4U_POWER)	+= aspeed-b650d4u-power.o
 obj-$(CONFIG_ASPEED_XDMA)		+= aspeed-xdma.o
diff --git a/drivers/soc/aspeed/aspeed-b650d4u-power.c b/drivers/soc/aspeed/aspeed-b650d4u-power.c
new file mode 100644
index 000000000000..22a6925539dc
--- /dev/null
+++ b/drivers/soc/aspeed/aspeed-b650d4u-power.c
@@ -0,0 +1,110 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+#include <linux/device.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/mfd/syscon.h>
+#include <linux/mutex.h>
+#include <linux/kstrtox.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/bits.h>
+
+#define ASPEED_SCU_PROTECTION        0x000
+#define ASPEED_SCU_GPIO_PASSTHROUGH  0x4bc
+#define ASPEED_SCU_GPIO_ACTION       0x51c
+#define ASPEED_SCU_UNLOCK_KEY        0x1688a8a8
+#define ASPEED_B650D4U_POWER_MASK    GENMASK(27, 26)
+
+static struct regmap *b650d4u_scu;
+static DEFINE_MUTEX(b650d4u_lock);
+
+static int b650d4u_set_passthrough(bool enable)
+{
+	int ret;
+
+	mutex_lock(&b650d4u_lock);
+
+	ret = regmap_write(b650d4u_scu, ASPEED_SCU_PROTECTION,
+			   ASPEED_SCU_UNLOCK_KEY);
+	if (ret) {
+		pr_err("B650D4U: SCU unlock failed: %d\n", ret);
+		goto out;
+	}
+
+	ret = regmap_update_bits(b650d4u_scu,
+				 ASPEED_SCU_GPIO_PASSTHROUGH,
+				 ASPEED_B650D4U_POWER_MASK,
+				 enable ? ASPEED_B650D4U_POWER_MASK : 0);
+	if (ret) {
+		pr_err("B650D4U: passthrough update failed: %d\n", ret);
+		goto out;
+	}
+
+	if (!enable)
+		ret = regmap_write(b650d4u_scu,
+				   ASPEED_SCU_GPIO_ACTION, 0);
+
+out:
+	mutex_unlock(&b650d4u_lock);
+	return ret;
+}
+
+static ssize_t passthrough_store(struct device *dev,
+				 struct device_attribute *attr,
+				 const char *buf, size_t count)
+{
+	bool enable;
+	int ret;
+
+	ret = kstrtobool(buf, &enable);
+	if (ret)
+		return ret;
+
+	ret = b650d4u_set_passthrough(enable);
+	return ret ? ret : count;
+}
+static DEVICE_ATTR_WO(passthrough);
+
+static int aspeed_b650d4u_power_probe(struct platform_device *pdev)
+{
+	int ret;
+
+	b650d4u_scu = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
+						      "aspeed,scu");
+	if (IS_ERR(b650d4u_scu))
+		return dev_err_probe(&pdev->dev, PTR_ERR(b650d4u_scu),
+				     "failed to get AST2600 SCU regmap\n");
+
+	ret = b650d4u_set_passthrough(true);
+	if (ret)
+		return dev_err_probe(&pdev->dev, ret,
+				     "failed to enable power GPIO passthrough\n");
+
+	ret = device_create_file(&pdev->dev, &dev_attr_passthrough);
+	if (ret)
+		return dev_err_probe(&pdev->dev, ret,
+				     "failed to create passthrough control\n");
+
+	dev_info(&pdev->dev, "enabled GPIO passthrough selector 1\n");
+	return 0;
+}
+
+static const struct of_device_id aspeed_b650d4u_power_of_match[] = {
+	{ .compatible = "asrock,b650d4u-power-passthrough" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, aspeed_b650d4u_power_of_match);
+
+static struct platform_driver aspeed_b650d4u_power_driver = {
+	.probe = aspeed_b650d4u_power_probe,
+	.driver = {
+		.name = "aspeed-b650d4u-power",
+		.of_match_table = aspeed_b650d4u_power_of_match,
+	},
+};
+module_platform_driver(aspeed_b650d4u_power_driver);
+
+MODULE_DESCRIPTION("ASRock Rack B650D4U host power GPIO passthrough");
+MODULE_LICENSE("GPL");
-- 
2.47.3


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

end of thread, other threads:[~2026-10-03 13:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-02 13:16 [RFC PATCH] soc: aspeed: Add B650D4U power passthrough support Prasanth Kumar Padarthi
2026-10-02 16:47 ` Tan Siewert
2026-10-02 17:28   ` Prasanth
2026-10-03 13:54 ` Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®