Re: [PATCH v11 1/1] mux: Add driver for Renesas RZ/V2H USB VBENCTL VBUS_SEL mux
From: Tommaso Merciai
Date: Fri May 22 2026 - 04:34:13 EST
On Thu, May 07, 2026 at 11:44:16AM +0200, Tommaso Merciai wrote:
> Hi All,
>
> On Mon, Apr 27, 2026 at 03:03:37PM +0200, Tommaso Merciai wrote:
> > As per the RZ/V2H(P) HW manual, VBUSEN can be controlled by the VBUS_SEL
> > bit of the VBENCTL Control Register. This register is mapped in the
> > reset framework. The reset driver expose this register as mux-controller
> > and instantiates this driver. The consumer will use the mux API to
> > control the VBUS_SEL bit.
> >
> > Reviewed-by: Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>
> > Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@xxxxxxxxxxxxxx>
>
> Gentle ping.
A polite ping on this please.
Kind Regards,
Tommaso
>
> Kind Regards,
> Tommaso
>
> > ---
> > v10->v11:
> > - No changes.
> >
> > v9->v10:
> > - No changes.
> >
> > v8->v9:
> > - Fixed driver comment year (2025 -> 2026)
> > - Switch from devm_regmap_init_mmio() to dev_get_regmap().
> > - Drop unnecessasry include bitops.h, of.h, property.h and
> > drivers/reset/reset-rzv2h-usb2phy.h headers, driver is now based on regmap.
> > - Collected PZabel tag.
> >
> > v7->v8:
> > - No changes.
> >
> > v6->v7:
> > - No changes.
> >
> > v5->v6:
> > - No changes.
> >
> > v4->v5:
> > - Changed file name to rzv2h-usb-vbenctl.c and Fixed
> > Makefile, Kconfig, function names accordingly.
> > - Changed driver .name to "vbenctl" and fix auxiliary_device_id name.
> > - Updated commit msg.
> >
> > v3->v4:
> > - Removed mux_chip->dev.of_node not needed.
> >
> > v2->v3:
> > - Added mux_chip->dev.of_node = dev->of_node->child as the mux-controller
> > is an internal node.
> > - Fixed auxiliary_device_id name.
> > - Get rdev using from platform_data.
> > - Drop struct auxiliary_device adev from reset_rzv2h_usb2phy_adev
> > as it is needed.
> > - Drop to_reset_rzv2h_usb2phy_adev() as it is not needed.
> >
> > v1->v2:
> > - New patch
> >
> > drivers/mux/Kconfig | 11 +++++
> > drivers/mux/Makefile | 2 +
> > drivers/mux/rzv2h-usb-vbenctl.c | 85 +++++++++++++++++++++++++++++++++
> > 3 files changed, 98 insertions(+)
> > create mode 100644 drivers/mux/rzv2h-usb-vbenctl.c
> >
> > diff --git a/drivers/mux/Kconfig b/drivers/mux/Kconfig
> > index 6d17dfa25dad..7f334540c189 100644
> > --- a/drivers/mux/Kconfig
> > +++ b/drivers/mux/Kconfig
> > @@ -70,6 +70,17 @@ config MUX_MMIO
> > To compile the driver as a module, choose M here: the module will
> > be called mux-mmio.
> >
> > +config MUX_RZV2H_USB_VBENCTL
> > + tristate "Renesas RZ/V2H USB VBENCTL VBUS_SEL mux driver"
> > + depends on RESET_RZV2H_USB2PHY || COMPILE_TEST
> > + depends on OF
> > + select REGMAP
> > + select AUXILIARY_BUS
> > + default RESET_RZV2H_USB2PHY
> > + help
> > + Support for USB VBENCTL VBUS_SEL mux implemented on Renesas
> > + RZ/V2H SoCs.
> > +
> > endmenu
> >
> > endif # MULTIPLEXER
> > diff --git a/drivers/mux/Makefile b/drivers/mux/Makefile
> > index 6e9fa47daf56..3bd9b3846835 100644
> > --- a/drivers/mux/Makefile
> > +++ b/drivers/mux/Makefile
> > @@ -8,9 +8,11 @@ mux-adg792a-objs := adg792a.o
> > mux-adgs1408-objs := adgs1408.o
> > mux-gpio-objs := gpio.o
> > mux-mmio-objs := mmio.o
> > +mux-rzv2h-usb-vbenctl-objs := rzv2h-usb-vbenctl.o
> >
> > obj-$(CONFIG_MULTIPLEXER) += mux-core.o
> > obj-$(CONFIG_MUX_ADG792A) += mux-adg792a.o
> > obj-$(CONFIG_MUX_ADGS1408) += mux-adgs1408.o
> > obj-$(CONFIG_MUX_GPIO) += mux-gpio.o
> > obj-$(CONFIG_MUX_MMIO) += mux-mmio.o
> > +obj-$(CONFIG_MUX_RZV2H_USB_VBENCTL) += mux-rzv2h-usb-vbenctl.o
> > diff --git a/drivers/mux/rzv2h-usb-vbenctl.c b/drivers/mux/rzv2h-usb-vbenctl.c
> > new file mode 100644
> > index 000000000000..79197fddbf74
> > --- /dev/null
> > +++ b/drivers/mux/rzv2h-usb-vbenctl.c
> > @@ -0,0 +1,85 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/*
> > + * Renesas RZ/V2H(P) USB VBENCTL VBUS_SEL mux driver
> > + *
> > + * Copyright (C) 2026 Renesas Electronics Corp.
> > + */
> > +
> > +#include <linux/auxiliary_bus.h>
> > +#include <linux/err.h>
> > +#include <linux/module.h>
> > +#include <linux/mux/driver.h>
> > +#include <linux/regmap.h>
> > +
> > +#define RZV2H_VBENCTL 0xf0c
> > +
> > +struct mux_rzv2h_usb_vbenctl_priv {
> > + struct regmap_field *field;
> > +};
> > +
> > +static int mux_rzv2h_usb_vbenctl_set(struct mux_control *mux, int state)
> > +{
> > + struct mux_rzv2h_usb_vbenctl_priv *priv = mux_chip_priv(mux->chip);
> > +
> > + return regmap_field_write(priv->field, state);
> > +}
> > +
> > +static const struct mux_control_ops mux_rzv2h_usb_vbenctl_ops = {
> > + .set = mux_rzv2h_usb_vbenctl_set,
> > +};
> > +
> > +static int mux_rzv2h_usb_vbenctl_probe(struct auxiliary_device *adev,
> > + const struct auxiliary_device_id *id)
> > +{
> > + struct mux_rzv2h_usb_vbenctl_priv *priv;
> > + struct device *dev = &adev->dev;
> > + struct mux_chip *mux_chip;
> > + struct regmap *regmap;
> > + struct reg_field reg_field = {
> > + .reg = RZV2H_VBENCTL,
> > + .lsb = 0,
> > + .msb = 0,
> > + };
> > + int ret;
> > +
> > + regmap = dev_get_regmap(adev->dev.parent, NULL);
> > + if (!regmap)
> > + return -ENODEV;
> > +
> > + mux_chip = devm_mux_chip_alloc(dev, 1, sizeof(*priv));
> > + if (IS_ERR(mux_chip))
> > + return PTR_ERR(mux_chip);
> > +
> > + priv = mux_chip_priv(mux_chip);
> > +
> > + priv->field = devm_regmap_field_alloc(dev, regmap, reg_field);
> > + if (IS_ERR(priv->field))
> > + return PTR_ERR(priv->field);
> > +
> > + mux_chip->ops = &mux_rzv2h_usb_vbenctl_ops;
> > + mux_chip->mux[0].states = 2;
> > + mux_chip->mux[0].idle_state = MUX_IDLE_AS_IS;
> > +
> > + ret = devm_mux_chip_register(dev, mux_chip);
> > + if (ret < 0)
> > + return dev_err_probe(dev, ret, "Failed to register mux chip\n");
> > +
> > + return 0;
> > +}
> > +
> > +static const struct auxiliary_device_id mux_rzv2h_usb_vbenctl_ids[] = {
> > + { .name = "rzv2h_usb2phy_reset.vbenctl" },
> > + { /* sentinel */ }
> > +};
> > +MODULE_DEVICE_TABLE(auxiliary, mux_rzv2h_usb_vbenctl_ids);
> > +
> > +static struct auxiliary_driver mux_rzv2h_usb_vbenctl_driver = {
> > + .name = "vbenctl",
> > + .probe = mux_rzv2h_usb_vbenctl_probe,
> > + .id_table = mux_rzv2h_usb_vbenctl_ids,
> > +};
> > +module_auxiliary_driver(mux_rzv2h_usb_vbenctl_driver);
> > +
> > +MODULE_DESCRIPTION("RZ/V2H USB VBENCTL VBUS_SEL mux driver");
> > +MODULE_AUTHOR("Tommaso Merciai <tommaso.merciai.xr@xxxxxxxxxxxxxx>");
> > +MODULE_LICENSE("GPL");
> > --
> > 2.54.0
> >