From: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
To: Philipp Zabel <p.zabel@pengutronix.de>
Cc: tomm.merciai@gmail.com, linux-renesas-soc@vger.kernel.org,
biju.das.jz@bp.renesas.com, Vinod Koul <vkoul@kernel.org>,
Kishon Vijay Abraham I <kishon@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Fabrizio Castro <fabrizio.castro.jz@renesas.com>,
Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>,
Peter Rosin <peda@axentia.se>,
Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Magnus Damm <magnus.damm@gmail.com>,
Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-phy@lists.infradead.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 06/21] reset: rzv2h-usb2phy: Add support for VBUS mux controller registration
Date: Wed, 5 Nov 2025 18:24:35 +0100 [thread overview]
Message-ID: <aQuIU9C0A_JMEpAn@tom-desktop> (raw)
In-Reply-To: <4857ace4d241d3a0de4fe7247312ff07c930b11e.camel@pengutronix.de>
Hi Philipp,
Thanks for your review!
On Wed, Nov 05, 2025 at 05:04:54PM +0100, Philipp Zabel wrote:
> On Mi, 2025-11-05 at 16:39 +0100, Tommaso Merciai wrote:
> > The RZ/V2H USB2 PHY requires control of the VBUS selection line
> > (VBENCTL) through a mux controller described in the device tree as
> > "mux-controller". This change adds support for registering
> > vbus-sel-mux auxiliary driver during probe.
> >
> > This enables proper management of USB2.0 VBUS source selection on
> > platforms using the RZ/V2H SoC.
> >
> > Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
> > ---
> > v1->v2:
> > - New patch
> >
> > drivers/reset/Kconfig | 1 +
> > drivers/reset/reset-rzv2h-usb2phy.c | 65 +++++++++++++++++++++++++++++
> > 2 files changed, 66 insertions(+)
> >
> > diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig
> > index e1ae624661f3..f54e216ca7f6 100644
> > --- a/drivers/reset/Kconfig
> > +++ b/drivers/reset/Kconfig
> > @@ -255,6 +255,7 @@ config RESET_RZG2L_USBPHY_CTRL
> > config RESET_RZV2H_USB2PHY
> > tristate "Renesas RZ/V2H(P) (and similar SoCs) USB2PHY Reset driver"
> > depends on ARCH_RENESAS || COMPILE_TEST
> > + select AUXILIARY_BUS
> > help
> > Support for USB2PHY Port reset Control found on the RZ/V2H(P) SoC
> > (and similar SoCs).
> > diff --git a/drivers/reset/reset-rzv2h-usb2phy.c b/drivers/reset/reset-rzv2h-usb2phy.c
> > index 5bdd39274612..6074aa8cc13a 100644
> > --- a/drivers/reset/reset-rzv2h-usb2phy.c
> > +++ b/drivers/reset/reset-rzv2h-usb2phy.c
> > @@ -5,8 +5,10 @@
> > * Copyright (C) 2025 Renesas Electronics Corporation
> > */
> >
> > +#include <linux/auxiliary_bus.h>
> > #include <linux/cleanup.h>
> > #include <linux/delay.h>
> > +#include <linux/idr.h>
> > #include <linux/io.h>
> > #include <linux/module.h>
> > #include <linux/of.h>
> > @@ -14,6 +16,9 @@
> > #include <linux/pm_runtime.h>
> > #include <linux/reset.h>
> > #include <linux/reset-controller.h>
> > +#include <linux/reset/reset_rzv2h_usb2phy.h>
> > +
> > +static DEFINE_IDA(auxiliary_ids);
> >
> > struct rzv2h_usb2phy_regval {
> > u16 reg;
> > @@ -104,6 +109,62 @@ static int rzv2h_usb2phy_reset_of_xlate(struct reset_controller_dev *rcdev,
> > return 0;
> > }
> >
> > +static void rzv2h_usb2phy_reset_adev_unregister(void *data)
> > +{
> > + struct auxiliary_device *adev = data;
> > +
> > + auxiliary_device_delete(adev);
> > + auxiliary_device_uninit(adev);
> > +}
> > +
> > +static void rzv2h_usb2phy_reset_adev_release(struct device *dev)
> > +{
> > + struct auxiliary_device *adev = to_auxiliary_dev(dev);
> > +
> > + ida_free(&auxiliary_ids, adev->id);
> > +}
> > +
> > +static int rzv2h_usb2phy_reset_mux_register(struct device *dev,
> > + void __iomem *base,
> > + const char *mux_name)
> > +{
> > + struct reset_rzv2h_usb2phy_adev *rdev;
> > + struct auxiliary_device *adev;
> > + int ret;
> > +
> > + rdev = devm_kzalloc(dev, sizeof(*rdev), GFP_KERNEL);
> > + if (!rdev)
> > + return -ENOMEM;
> > +
> > + rdev->base = base;
> > +
> > + adev = &rdev->adev;
> > + adev->name = mux_name;
> > + adev->dev.parent = dev->parent;
> > + adev->dev.release = rzv2h_usb2phy_reset_adev_release;
> > + adev->dev.of_node = dev->of_node;
> > + ret = ida_alloc(&auxiliary_ids, GFP_KERNEL);
> > + if (ret < 0)
> > + return ret;
> > + adev->id = ret;
> > +
> > + ret = auxiliary_device_init(adev);
> > + if (ret)
> > + goto cleanup_ida;
> > +
> > + ret = auxiliary_device_add(adev);
> > + if (ret) {
> > + auxiliary_device_uninit(adev);
> > + goto cleanup_ida;
> > + }
> > +
> > + return devm_add_action_or_reset(dev, rzv2h_usb2phy_reset_adev_unregister, adev);
>
> Can't you use __devm_auxiliary_device_create()?
Ack Thanks.
We can do:
adev = __devm_auxiliary_device_create(dev, dev->driver->name,
mux_name, rdev, id);
if (!adev) {
ida_free(&auxiliary_ids, id);
return -ENOMEM;
}
Then we can get base rdev from auxiliary driver just using:
struct reset_rzv2h_usb2phy_adev *rdev = adev->dev.platform_data;
I will use this into the next versio.
Thanks & Regards,
Tommaso
>
> regards
> Philipp
next prev parent reply other threads:[~2025-11-05 17:24 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-05 15:38 [PATCH v2 00/21] Add USB2.0 support for RZ/G3E Tommaso Merciai
2025-11-05 15:38 ` [PATCH v2 01/21] phy: renesas: rcar-gen3-usb2: Use devm_pm_runtime_enable() Tommaso Merciai
2025-11-05 15:38 ` [PATCH v2 02/21] phy: renesas: rcar-gen3-usb2: Factor out VBUS control logic Tommaso Merciai
2025-11-05 15:38 ` [PATCH v2 03/21] reset: rzv2h-usb2phy: Keep PHY clock enabled for entire device lifetime Tommaso Merciai
2025-11-05 15:59 ` Philipp Zabel
2025-11-06 8:30 ` Tommaso Merciai
2025-11-05 15:39 ` [PATCH v2 04/21] dt-bindings: reset: renesas,rzv2h-usb2phy: Add '#mux-state-cells' property Tommaso Merciai
2025-11-05 17:16 ` Rob Herring (Arm)
2025-11-07 17:18 ` Tommaso Merciai
2025-11-05 15:39 ` [PATCH v2 05/21] mux: Add driver for Renesas RZ/V2H USB VBUS_SEL mux Tommaso Merciai
2025-11-05 15:39 ` [PATCH v2 06/21] reset: rzv2h-usb2phy: Add support for VBUS mux controller registration Tommaso Merciai
2025-11-05 16:04 ` Philipp Zabel
2025-11-05 17:24 ` Tommaso Merciai [this message]
2025-11-05 15:39 ` [PATCH v2 07/21] dt-bindings: phy: renesas,usb2-phy: Document USB VBUS regulator Tommaso Merciai
2025-11-05 15:39 ` [PATCH v2 08/21] dt-bindings: phy: renesas,usb2-phy: Document mux-states property Tommaso Merciai
2025-11-05 15:39 ` [PATCH v2 09/21] phy: renesas: rcar-gen3-usb2: Add regulator for OTG VBUS control Tommaso Merciai
2025-11-05 15:39 ` [PATCH v2 10/21] phy: renesas: rcar-gen3-usb2: Use mux-state for phyrst management Tommaso Merciai
2025-11-05 15:39 ` [PATCH v2 11/21] dt-bindings: usb: renesas,usbhs: Add RZ/G3E SoC support Tommaso Merciai
2025-11-05 15:39 ` [PATCH v2 12/21] dt-bindings: phy: renesas,usb2-phy: Document RZ/G3E SoC Tommaso Merciai
2025-11-05 15:39 ` [PATCH v2 13/21] dt-bindings: reset: Document RZ/G3E USB2PHY reset Tommaso Merciai
2025-11-05 15:39 ` [PATCH v2 14/21] arm64: dts: renesas: r9a09g057: Add USB2.0 VBUS_SEL mux-controller support Tommaso Merciai
2025-11-05 15:39 ` [PATCH v2 15/21] arm64: dts: renesas: r9a09g056: " Tommaso Merciai
2025-11-05 15:39 ` [PATCH v2 16/21] arm64: dts: renesas: r9a09g056: Add USB2.0 PHY VBUS internal regulator node Tommaso Merciai
2025-11-05 15:39 ` [PATCH v2 17/21] arm64: dts: renesas: r9a09g056n48-rzv2n-evk: Enable USB2 PHY0 VBUS support Tommaso Merciai
2025-11-05 15:39 ` [PATCH v2 18/21] arm64: dts: renesas: r9a09g057: Add USB2.0 PHY VBUS internal regulator node Tommaso Merciai
2025-11-05 15:39 ` [PATCH v2 19/21] arm64: dts: renesas: r9a09g057h44-rzv2h-evk: Enable USB2 PHY0 VBUS support Tommaso Merciai
2025-11-05 15:39 ` [PATCH v2 20/21] arm64: dts: renesas: r9a09g047: Add USB2.0 support Tommaso Merciai
2025-11-05 15:39 ` [PATCH v2 21/21] arm64: dts: renesas: r9a09g047e57-smarc: Enable " Tommaso Merciai
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=aQuIU9C0A_JMEpAn@tom-desktop \
--to=tommaso.merciai.xr@bp.renesas.com \
--cc=arnd@arndb.de \
--cc=biju.das.jz@bp.renesas.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=fabrizio.castro.jz@renesas.com \
--cc=geert+renesas@glider.be \
--cc=gregkh@linuxfoundation.org \
--cc=kishon@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=p.zabel@pengutronix.de \
--cc=peda@axentia.se \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=robh@kernel.org \
--cc=tomm.merciai@gmail.com \
--cc=vkoul@kernel.org \
--cc=yoshihiro.shimoda.uh@renesas.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;
as well as URLs for NNTP newsgroup(s).