mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tan Siewert <tan.siewert@9elements.com>
To: Prasanth Kumar Padarthi <prasanth.padarthi10@gmail.com>,
	linux-arm-kernel@lists.infradead.org
Cc: devicetree@vger.kernel.org, linux-aspeed@lists.ozlabs.org,
	linux-kernel@vger.kernel.org, joel@jms.id.au,
	ryan_chen@aspeedtech.com,
	Andrew Jeffery <andrew@codeconstruct.com.au>
Subject: Re: [RFC PATCH] soc: aspeed: Add B650D4U power passthrough support
Date: Fri, 2 Oct 2026 18:47:09 +0200	[thread overview]
Message-ID: <9cfcd3e7-bbc3-47c6-ad43-72b595a90110@9elements.com> (raw)
In-Reply-To: <20261002131634.113680-1-prasanth.padarthi10@gmail.com>

On 10/2/26 3:16 PM, Prasanth Kumar Padarthi wrote:
> 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>

This is definitely not the way how to solve this. I've already said on 
linux-aspeed as well as off-the-list, requesting the GPIO lines is 
enough and enabling GPIOP passthrough here does not make any sense, as 
it would be disabled by pinctrl anyways.
There's a whole implementation in userspace to solve this issue (at 
least if you use OpenBMC). The issue you're facing here is, from my 
point of view, a configuration error, and you'll not solve it with a 
kernel driver that literally just enables GPIOP passthrough...

So my answer to this patch is:
NACKed-by: Tan Siewert <tan.siewert@9elements.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");


  reply	other threads:[~2026-10-02 16:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-02 13:16 Prasanth Kumar Padarthi
2026-10-02 16:47 ` Tan Siewert [this message]
2026-10-02 17:28   ` Prasanth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9cfcd3e7-bbc3-47c6-ad43-72b595a90110@9elements.com \
    --to=tan.siewert@9elements.com \
    --cc=andrew@codeconstruct.com.au \
    --cc=devicetree@vger.kernel.org \
    --cc=joel@jms.id.au \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-aspeed@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=prasanth.padarthi10@gmail.com \
    --cc=ryan_chen@aspeedtech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®