* [PATCH v12 0/1] Add USB2.0 VBUS mux driver for RZ/G3E
@ 2026-07-15 10:12 Tommaso Merciai
2026-07-15 10:12 ` [PATCH v12 1/1] mux: Add driver for Renesas RZ/V2H USB VBENCTL VBUS_SEL mux Tommaso Merciai
0 siblings, 1 reply; 7+ messages in thread
From: Tommaso Merciai @ 2026-07-15 10:12 UTC (permalink / raw)
To: tomm.merciai, peda, prabhakar.mahadev-lad.rj, peda, p.zabel,
ulf.hansson
Cc: linux-renesas-soc, biju.das.jz, Tommaso Merciai, Ulf Hansson,
Josua Mayer, linux-kernel
Dear All,
This patch adds a new mux driver for RZ/V2H USB VBENCTL VBUS_SEL.
All patches in the original series ([0]) have been merged except this one,
so this is just a follow-up patch to add the mux driver.
[0] https://patchwork.kernel.org/project/linux-renesas-soc/cover/cover.1775047175.git.tommaso.merciai.xr@bp.renesas.com/
Thanks & Regards,
Tommaso
v11->v12
- No changes, just rebased on top of next-20260714
v10->v11:
- Rebased on top of next-20260424
- PATCHES 2,3,4,5 of [0] have been merged except this one,
so this is just a follow-up patch to add the mux driver.
v9->v10:
- Rebased on top of next-20260331
- PATCH 4/5: Use struct reg_sequence and regmap_multi_reg_write()
to handle initialization, assert and deassert sequences and drop
custom struct rzv2h_usb2phy_regval.
v8->v9
- Rebased on top of next-20260326
- PATCH 1/6: 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.
- PATCH 4/6: Collected PZabel tag.
- PATCH 5/6: New patch.
- PATCH 6/6: Drop linux/reset/reset_rzv2h_usb2phy.h dependecy as the
driver is now based on regmap and does not need the
reset driver's private header, update driver accordingly.
- Collected PZabel tag.
- Update cover letter.
v7->v8:
- Rebased on top of next-20260311
- Updated series cover letter as part of the series was already merged.
v6->v7:
- Rebased on top of next-20260128
- Split series into per subsystem series, no changes.
v5->v6:
- Rebased on top of next-20251219
- Re-arranged series order per subsystem patches.
- Patch: 3/14: Collected tag.
- Patch: 4/14: Fixed commit message.
- Split from dts patches will send separate series.
- Added merge strategy in cover letter.
v4->v5:
- Rebased on top of next-20251127
- Patch 01/22: Added Reviewed-by tag from Conor Dooley.
- Patch 06/22: 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.
- Patch 07/22: Update mux_name to "vbenctl" to match the driver name.
Updated commit message.
- Patch 11/22: Fixed if statement for mux_state error check.
v3->v4:
- Rebased on top of next-20251121
- Added patch 01/22 to remove nodename pattern from mux-controller schema.
- Switch back to v2 implementation for mux controller in patches
5/22, 15/22, 16/22, 21/22.
- Improved commit bodies for patches 5/22, 15/22, 16/22, 21/22.
- Removed mux_chip->dev.of_node not needed in patch 06/22.
- Collected CDooley tag in patch 09/22.
- Added missing select MULTIPLEXER into Kconfig in patch 11/22.
v2->v3:
- Rebased on top of next-20251110 + [1] + [2]
- Add missing Cc: stable@vger.kernel.org in patch 03/21
- Patch 03/21: Added missing Cc: stable@vger.kernel.org.
Improved commit body describing the removal of rzv2h_usbphy_assert_helper()
from rzv2h_usb2phy_reset_probe().
- Patch 04/21: Manipulate mux-controller as an internal node.
Improved commit body.
- Patch 05/21: The main driver is using now __devm_auxiliary_device_create()
then update the aux driver accordingly.
- Patch 06/21: Use __devm_auxiliary_device_create() to create the aux device.
- Patch 08/21: Improved commit body and mux-states description.
- Patch 14/21: Manipulate the mux controller as an internal node,
and update commit body accordingly.
- Patch 15/21: Manipulate the mux controller as an internal node,
and update commit body accordingly.
- Patch 20/21: Manipulate the mux controller as an internal node.
v1->v2:
- Rebased on top of next-20251103 + [1] + [2]
- Reworked series to use mux-state for controlling VBUS_SEL
as suggested by PZabel added also mux bindings documentation
on phy and rst side.
- Collected Conor Dooley tags
- Dropped unnecessary rzv2h_usbphy_assert_helper() function from
rzv2h_usb2phy_reset_probe()
Tommaso Merciai (1):
mux: Add driver for Renesas RZ/V2H USB VBENCTL VBUS_SEL mux
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
--
2.54.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v12 1/1] mux: Add driver for Renesas RZ/V2H USB VBENCTL VBUS_SEL mux
2026-07-15 10:12 [PATCH v12 0/1] Add USB2.0 VBUS mux driver for RZ/G3E Tommaso Merciai
@ 2026-07-15 10:12 ` Tommaso Merciai
2026-07-15 13:53 ` Alvin Šipraga
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Tommaso Merciai @ 2026-07-15 10:12 UTC (permalink / raw)
To: tomm.merciai, peda, prabhakar.mahadev-lad.rj, peda, p.zabel,
ulf.hansson
Cc: linux-renesas-soc, biju.das.jz, Tommaso Merciai, Ulf Hansson,
Josua Mayer, linux-kernel
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@pengutronix.de>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
v11->v12
- No changes, just rebased on top of next-20260714
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@bp.renesas.com>");
+MODULE_LICENSE("GPL");
--
2.54.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v12 1/1] mux: Add driver for Renesas RZ/V2H USB VBENCTL VBUS_SEL mux
2026-07-15 10:12 ` [PATCH v12 1/1] mux: Add driver for Renesas RZ/V2H USB VBENCTL VBUS_SEL mux Tommaso Merciai
@ 2026-07-15 13:53 ` Alvin Šipraga
2026-08-06 15:20 ` Lad, Prabhakar
2026-08-07 6:23 ` Peter Rosin
2 siblings, 0 replies; 7+ messages in thread
From: Alvin Šipraga @ 2026-07-15 13:53 UTC (permalink / raw)
To: Tommaso Merciai
Cc: tomm.merciai, peda, prabhakar.mahadev-lad.rj, peda, p.zabel,
ulf.hansson, linux-renesas-soc, biju.das.jz, Ulf Hansson,
Josua Mayer, linux-kernel
On Wed, Jul 15, 2026 at 12:12:46PM +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@pengutronix.de>
> Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
Reviewed-by: Alvin Šipraga <alvin.sipraga@analog.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v12 1/1] mux: Add driver for Renesas RZ/V2H USB VBENCTL VBUS_SEL mux
2026-07-15 10:12 ` [PATCH v12 1/1] mux: Add driver for Renesas RZ/V2H USB VBENCTL VBUS_SEL mux Tommaso Merciai
2026-07-15 13:53 ` Alvin Šipraga
@ 2026-08-06 15:20 ` Lad, Prabhakar
2026-08-07 6:23 ` Peter Rosin
2 siblings, 0 replies; 7+ messages in thread
From: Lad, Prabhakar @ 2026-08-06 15:20 UTC (permalink / raw)
To: Tommaso Merciai
Cc: tomm.merciai, peda, prabhakar.mahadev-lad.rj, peda, p.zabel,
ulf.hansson, linux-renesas-soc, biju.das.jz, Ulf Hansson,
Josua Mayer, linux-kernel
On Wed, Jul 15, 2026 at 11:19 AM Tommaso Merciai
<tommaso.merciai.xr@bp.renesas.com> 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@pengutronix.de>
> Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
> ---
> v11->v12
> - No changes, just rebased on top of next-20260714
>
> 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
>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Cheers,
Prabhakar
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v12 1/1] mux: Add driver for Renesas RZ/V2H USB VBENCTL VBUS_SEL mux
2026-07-15 10:12 ` [PATCH v12 1/1] mux: Add driver for Renesas RZ/V2H USB VBENCTL VBUS_SEL mux Tommaso Merciai
2026-07-15 13:53 ` Alvin Šipraga
2026-08-06 15:20 ` Lad, Prabhakar
@ 2026-08-07 6:23 ` Peter Rosin
2026-08-07 10:05 ` Tommaso Merciai
2 siblings, 1 reply; 7+ messages in thread
From: Peter Rosin @ 2026-08-07 6:23 UTC (permalink / raw)
To: Tommaso Merciai, tomm.merciai, prabhakar.mahadev-lad.rj, peda,
p.zabel, ulf.hansson
Cc: linux-renesas-soc, biju.das.jz, Ulf Hansson, Josua Mayer,
linux-kernel
Hi!
Sorry for the late reply.
On 2026-07-15 12:12, 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@pengutronix.de>
> Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
> ---
> v11->v12
> - No changes, just rebased on top of next-20260714
>
> 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
Do we really need such a long name? Can we skip at least some part
of it, e.g. "USB_"? I see little in this driver that relates to
USB. And then propagate the shorter name to the file name and
various identifiers of course. Please?
> + tristate "Renesas RZ/V2H USB VBENCTL VBUS_SEL mux driver"
> + depends on RESET_RZV2H_USB2PHY || COMPILE_TEST
> + depends on OF
Why OF?
> + select REGMAP
> + select AUXILIARY_BUS
> + default RESET_RZV2H_USB2PHY
> + help
> + Support for USB VBENCTL VBUS_SEL mux implemented on Renesas
> + RZ/V2H SoCs.
All the other drivers have a boilerplate "module paragraph" here:
To compile the driver as a module, choose M here: the module will
be called mux-<gazonk>.
I see no reason to exclude it here.
> +
> 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,
> + };
Perhaps
struct reg_field reg_field = REG_FIELD(RZV2H_VBENCTL, 0, 0);
> + int ret;
> +
> + regmap = dev_get_regmap(adev->dev.parent, NULL);
Perhaps
regmap = dev_get_regmap(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);
> +
I'm not previously familiar with the auxiliary bus. When I read about
it I find this:
"A key requirement for utilizing the auxiliary bus is that
there is no dependency on a physical bus, device, register
accesses or regmap support."
That seems to contradict this driver with its dependency on regmap,
thus violating the above key requirement?
Cheers,
Peter
> +MODULE_DESCRIPTION("RZ/V2H USB VBENCTL VBUS_SEL mux driver");
> +MODULE_AUTHOR("Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>");
> +MODULE_LICENSE("GPL");
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v12 1/1] mux: Add driver for Renesas RZ/V2H USB VBENCTL VBUS_SEL mux
2026-08-07 6:23 ` Peter Rosin
@ 2026-08-07 10:05 ` Tommaso Merciai
2026-08-07 14:56 ` Peter Rosin
0 siblings, 1 reply; 7+ messages in thread
From: Tommaso Merciai @ 2026-08-07 10:05 UTC (permalink / raw)
To: Peter Rosin
Cc: tomm.merciai, prabhakar.mahadev-lad.rj, peda, p.zabel,
ulf.hansson, linux-renesas-soc, biju.das.jz, Ulf Hansson,
Josua Mayer, linux-kernel
Hi Peter,
Thanks for your review.
On Fri, Aug 07, 2026 at 08:23:13AM +0200, Peter Rosin wrote:
> Hi!
>
> Sorry for the late reply.
>
> On 2026-07-15 12:12, 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@pengutronix.de>
> > Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
> > ---
> > v11->v12
> > - No changes, just rebased on top of next-20260714
> >
> > 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
>
> Do we really need such a long name? Can we skip at least some part
> of it, e.g. "USB_"? I see little in this driver that relates to
> USB. And then propagate the shorter name to the file name and
> various identifiers of course. Please?
Ok we can go with:
MUX_RZV2H_VBENCTL
Then propagating:
rzv2h-vbenctl.c
And functions prefix:
mux_rzv2h_vbenctl_*
I will do this in v13.
>
> > + tristate "Renesas RZ/V2H USB VBENCTL VBUS_SEL mux driver"
> > + depends on RESET_RZV2H_USB2PHY || COMPILE_TEST
> > + depends on OF
>
> Why OF?
Good catch, will drop this in v13.
>
> > + select REGMAP
> > + select AUXILIARY_BUS
> > + default RESET_RZV2H_USB2PHY
> > + help
> > + Support for USB VBENCTL VBUS_SEL mux implemented on Renesas
> > + RZ/V2H SoCs.
>
> All the other drivers have a boilerplate "module paragraph" here:
>
> To compile the driver as a module, choose M here: the module will
> be called mux-<gazonk>.
>
> I see no reason to exclude it here.
Will add this section in v13.
>
> > +
> > 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,
> > + };
>
> Perhaps
>
> struct reg_field reg_field = REG_FIELD(RZV2H_VBENCTL, 0, 0);
Ok will use this in v13.
>
> > + int ret;
> > +
> > + regmap = dev_get_regmap(adev->dev.parent, NULL);
>
> Perhaps
>
> regmap = dev_get_regmap(dev->parent, NULL);
Ok, will use this in v13.
>
> > + 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);
> > +
>
> I'm not previously familiar with the auxiliary bus. When I read about
> it I find this:
>
> "A key requirement for utilizing the auxiliary bus is that
> there is no dependency on a physical bus, device, register
> accesses or regmap support."
>
> That seems to contradict this driver with its dependency on regmap,
> thus violating the above key requirement?
I'm seeing a very close pattern in [1]. clk-imx8ulp-sim-lpav.c create a
regmap for its auxiliary reset and mux driver.
The parent driver is creating the axuiliary device in [2], this create
"clk_imx8ulp_sim_lpav.reset".
Then later reset-imx8mp-audiomix.c into
imx8mp_audiomix_reset_get_regmap() [3] take the rgmap from the parent.
Also reset-meson-aux.c [4] is aux device and is taking the regmap
from the parent.
IMHO the doc paragraph share why such a device can't be a platform
device or an MFD, matching on the auxiliary bus is a plain
string compare, so no register access is involved in match or bind.
[1] https://elixir.bootlin.com/linux/v7.2-rc6/source/drivers/clk/imx/clk-imx8ulp-sim-lpav.c#L95
[2] https://elixir.bootlin.com/linux/v7.2-rc6/source/drivers/clk/imx/clk-imx8ulp-sim-lpav.c#L123
[3] https://elixir.bootlin.com/linux/v7.2-rc6/source/drivers/reset/reset-imx8mp-audiomix.c#L162
[4] https://elixir.bootlin.com/linux/v7.2-rc6/source/drivers/reset/amlogic/reset-meson-aux.c#L65
Kind regards,
Tommaso
>
> Cheers,
> Peter
>
> > +MODULE_DESCRIPTION("RZ/V2H USB VBENCTL VBUS_SEL mux driver");
> > +MODULE_AUTHOR("Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>");
> > +MODULE_LICENSE("GPL");
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v12 1/1] mux: Add driver for Renesas RZ/V2H USB VBENCTL VBUS_SEL mux
2026-08-07 10:05 ` Tommaso Merciai
@ 2026-08-07 14:56 ` Peter Rosin
0 siblings, 0 replies; 7+ messages in thread
From: Peter Rosin @ 2026-08-07 14:56 UTC (permalink / raw)
To: Tommaso Merciai
Cc: tomm.merciai, prabhakar.mahadev-lad.rj, p.zabel,
linux-renesas-soc, biju.das.jz, Ulf Hansson, Josua Mayer,
linux-kernel
On 2026-08-07 12:05, Tommaso Merciai wrote:
> On Fri, Aug 07, 2026 at 08:23:13AM +0200, Peter Rosin wrote:
>> I'm not previously familiar with the auxiliary bus. When I read about
>> it I find this:
>>
>> "A key requirement for utilizing the auxiliary bus is that
>> there is no dependency on a physical bus, device, register
>> accesses or regmap support."
>>
>> That seems to contradict this driver with its dependency on regmap,
>> thus violating the above key requirement?
>
> I'm seeing a very close pattern in [1]. clk-imx8ulp-sim-lpav.c create a
> regmap for its auxiliary reset and mux driver.
>
> The parent driver is creating the axuiliary device in [2], this create
> "clk_imx8ulp_sim_lpav.reset".
>
> Then later reset-imx8mp-audiomix.c into
> imx8mp_audiomix_reset_get_regmap() [3] take the rgmap from the parent.
>
> Also reset-meson-aux.c [4] is aux device and is taking the regmap
> from the parent.
>
> IMHO the doc paragraph share why such a device can't be a platform
> device or an MFD, matching on the auxiliary bus is a plain
> string compare, so no register access is involved in match or bind.
>
> [1] https://elixir.bootlin.com/linux/v7.2-rc6/source/drivers/clk/imx/clk-imx8ulp-sim-lpav.c#L95
> [2] https://elixir.bootlin.com/linux/v7.2-rc6/source/drivers/clk/imx/clk-imx8ulp-sim-lpav.c#L123
> [3] https://elixir.bootlin.com/linux/v7.2-rc6/source/drivers/reset/reset-imx8mp-audiomix.c#L162
> [4] https://elixir.bootlin.com/linux/v7.2-rc6/source/drivers/reset/amlogic/reset-meson-aux.c#L65
Yes, agreed, regmap usage from the aux bus seem pretty widespread, and
not being allowed to touch regmap would be quite odd...
Looking forward to v13, thanks!
Cheers,
Peter
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-08-07 14:56 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-15 10:12 [PATCH v12 0/1] Add USB2.0 VBUS mux driver for RZ/G3E Tommaso Merciai
2026-07-15 10:12 ` [PATCH v12 1/1] mux: Add driver for Renesas RZ/V2H USB VBENCTL VBUS_SEL mux Tommaso Merciai
2026-07-15 13:53 ` Alvin Šipraga
2026-08-06 15:20 ` Lad, Prabhakar
2026-08-07 6:23 ` Peter Rosin
2026-08-07 10:05 ` Tommaso Merciai
2026-08-07 14:56 ` Peter Rosin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox