Re: [PATCH v4 4/6] regulator: Add Renesas RZ/G2L USB VBUS regulator driver

Geert Uytterhoeven
2024-07-11T15:14:31Z

Hi Biju,

On Thu, Jul 11, 2024 at 4:58 PM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> > -----Original Message-----
> > From: Geert Uytterhoeven <geert@linux-m68k.org>
> > Sent: Thursday, July 11, 2024 3:40 PM
> > Subject: Re: [PATCH v4 4/6] regulator: Add Renesas RZ/G2L USB VBUS regulator driver
> >
> > Hi Biju,
> >
> > On Sun, Jun 16, 2024 at 12:54 PM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> > > As per the RZ/G2L HW manual, VBUSEN can be controlled by the VBOUT bit
> > > of the VBUS Control Register. This register is mapped in the reset
> > > framework. The reset driver expose this register as regmap and
> > > instantiates this driver. The consumer will use the regulator API to
> > > control the VBOUT bit as the control need to be done in the atomic context.
> > >
> > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> >
> > Thanks for your patch, which is now commit 84fbd6198766336f
> > ("regulator: Add Renesas RZ/G2L USB VBUS regulator driver") in regulator/for-next.

> > > --- a/drivers/regulator/Kconfig
> > > +++ b/drivers/regulator/Kconfig
> > > @@ -1634,6 +1634,15 @@ config REGULATOR_UNIPHIER
> > > help
> > > Support for regulators implemented on Socionext UniPhier SoCs.
> > >
> > > +config REGULATOR_RZG2L_VBCTRL
> > > + tristate "Renesas RZ/G2L USB VBUS regulator driver"
> > > + depends on ARCH_RZG2L || COMPILE_TEST
> > > + depends on OF
> > > + select REGMAP_MMIO
> > > + default ARCH_RZG2L
> >
> > As the "rzg2l-usb-vbus-regulator" platform device is only created by drivers/reset/reset-rzg2l-
> > usbphy-ctrl.c, perhaps this should be made stricter by using "default RESET_RZG2L_USBPHY_CTRL"?
>
> OK.
> >
> > Alternatively, RESET_RZG2L_USBPHY_CTRL could select RESET_RZG2L_USBPHY_CTRL if REGULATOR. Can
> > RESET_RZG2L_USBPHY_CTRL work without REGULATOR_RZG2L_VBCTRL? If not, RESET_RZG2L_USBPHY_CTRL should
> > depend on REGULATOR, too.
>
> Yes, from functionality point it works for both host and device mode without REGULATOR_RZG2L_VBCTRL.
> From specification point, some customers reported on device mode, VBUS is showing 5V.
> So, by adding vbus regulator, I am controlling this voltage and forcing to 0 for device mode
> and 5V for host mode.
>
> Please share your input how to proceed.

As it works without, I think changing the default of
REGULATOR_RZG2L_VBCTRL from ARCH_RZG2L to RESET_RZG2L_USBPHY_CTRL is
the most appropriate option.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds