From: "Joshua Peisach" <jpeisach@ubuntu.com>
To: "Sven Peter" <sven@kernel.org>, "Janne Grunau" <j@jannau.net>,
"Neal Gompa" <neal@gompa.dev>, "Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Philipp Zabel" <p.zabel@pengutronix.de>
Cc: <asahi@lists.linux.dev>, <linux-arm-kernel@lists.infradead.org>,
<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/3] reset: Add Apple SoC CIO reset driver
Date: Sun, 09 Aug 2026 10:30:49 -0400 [thread overview]
Message-ID: <DKKHHITWR3F4.390HXQFLQR8X5@ubuntu.com> (raw)
In-Reply-To: <20260809-b4-cio-reset-v1-2-4f33777d9b4b@kernel.org>
On Sun Aug 9, 2026 at 8:16 AM EDT, Sven Peter wrote:
> Add a driver for the reset of the CIO (USB4/Thunderbolt) blocks on
> Apple Silicon SoCs which has to be deasserted before their
> co-processor can be booted. On t8103 each port comes with a dedicated
> register page while t600x uses a single register with one request bit
> per port shared by all ports of a die inside the PMGR MMIO region.
>
> Signed-off-by: Sven Peter <sven@kernel.org>
> ---
> MAINTAINERS | 1 +
> drivers/reset/Kconfig | 10 +++
> drivers/reset/Makefile | 1 +
> drivers/reset/reset-apple-cio.c | 182 ++++++++++++++++++++++++++++++++++++++++
> 4 files changed, 194 insertions(+)
> +
> +static int apple_cio_reset_probe(struct platform_device *pdev)
> +{
> + struct device *dev = &pdev->dev;
> + struct apple_cio_reset *priv;
> + int ret;
> +
> + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> + if (!priv)
> + return -ENOMEM;
> +
> + priv->variant = of_device_get_match_data(dev);
Might be a dumb question, but does priv->variant also need to be
checked? Because later priv->variant->pmgr_child is and I *think*
it could return NULL.
(Or is this not necessary since in theory the device should only run
this if detected... so this should never be an issue?)
> +
> + ret = devm_mutex_init(dev, &priv->lock);
> + if (ret)
> + return ret;
> +
> + if (priv->variant->pmgr_child) {
> + priv->regmap = syscon_node_to_regmap(dev->of_node->parent);
> + if (IS_ERR(priv->regmap))
> + return dev_err_probe(dev, PTR_ERR(priv->regmap),
> + "Failed to get parent regmap");
> +
> + ret = of_property_read_u32(dev->of_node, "reg", &priv->offset);
> + if (ret)
> + return dev_err_probe(dev, ret, "Failed to read reg offset");
> + } else {
> + void __iomem *base;
> +
> + base = devm_platform_ioremap_resource(pdev, 0);
> + if (IS_ERR(base))
> + return PTR_ERR(base);
> +
> + priv->regmap = devm_regmap_init_mmio(dev, base,
> + &apple_cio_reset_regmap_config);
> + if (IS_ERR(priv->regmap))
> + return dev_err_probe(dev, PTR_ERR(priv->regmap),
> + "Failed to init MMIO regmap");
> + }
> +
> + priv->rcdev.owner = THIS_MODULE;
> + priv->rcdev.ops = &apple_cio_reset_ops;
> + priv->rcdev.of_node = dev->of_node;
> + priv->rcdev.nr_resets = priv->variant->nr_resets;
> +
> + return devm_reset_controller_register(dev, &priv->rcdev);
> +}
> +
> +static const struct of_device_id apple_cio_reset_match[] = {
> + {
> + .compatible = "apple,t8103-cio-reset",
> + .data = &apple_t8103_cio_reset,
> + },
> + {
> + .compatible = "apple,t6000-cio-reset",
> + .data = &apple_t6000_cio_reset,
> + },
> + {},
> +};
> +MODULE_DEVICE_TABLE(of, apple_cio_reset_match);
> +
> +static struct platform_driver apple_cio_reset_driver = {
> + .driver = {
> + .name = "apple-cio-reset",
> + .of_match_table = apple_cio_reset_match,
> + },
> + .probe = apple_cio_reset_probe,
> +};
> +module_platform_driver(apple_cio_reset_driver);
> +
> +MODULE_AUTHOR("Sven Peter <sven@kernel.org>");
> +MODULE_DESCRIPTION("Apple SoC CIO block reset driver");
> +MODULE_LICENSE("Dual MIT/GPL");
next prev parent reply other threads:[~2026-08-09 14:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-09 12:16 [PATCH 0/3] Apple SoC CIO (USB4/Thunderbolt) reset controller Sven Peter
2026-08-09 12:16 ` [PATCH 1/3] dt-bindings: reset: Add Apple SoC CIO reset Sven Peter
2026-08-09 12:16 ` [PATCH 2/3] reset: Add Apple SoC CIO reset driver Sven Peter
2026-08-09 14:30 ` Joshua Peisach [this message]
2026-08-09 15:20 ` Sven Peter
2026-08-09 17:13 ` Joshua Peisach
2026-08-09 12:16 ` [PATCH 3/3] arm64: dts: apple: Add CIO reset controllers Sven Peter
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=DKKHHITWR3F4.390HXQFLQR8X5@ubuntu.com \
--to=jpeisach@ubuntu.com \
--cc=asahi@lists.linux.dev \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=j@jannau.net \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=neal@gompa.dev \
--cc=p.zabel@pengutronix.de \
--cc=robh@kernel.org \
--cc=sven@kernel.org \
/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