From: Lee Jones <lee@kernel.org>
To: Thomas Richard <thomas.richard@bootlin.com>
Cc: Aaro Koskinen <aaro.koskinen@iki.fi>,
Andreas Kemnade <andreas@kemnade.info>,
Kevin Hilman <khilman@baylibre.com>,
Roger Quadros <rogerq@kernel.org>,
Tony Lindgren <tony@atomide.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org
Subject: Re: [PATCH 7/8] mfd: omap-usb-host: Add pbias regulator support
Date: Tue, 31 Mar 2026 17:55:37 +0100 [thread overview]
Message-ID: <20260331165537.GJ3795166@google.com> (raw)
In-Reply-To: <20260323-omap4-fix-usb-support-v1-7-b668132124ac@bootlin.com>
On Mon, 23 Mar 2026, Thomas Richard wrote:
> Add pbias regulator support to enable SIM_VDDS supply and unlock USB I/O
> cell. Previously, this was handled by the bootloader, now the kernel can
> take responsibility for managing the PBIAS regulator, ensuring correct
> operation regardless of the bootloader.
>
> Signed-off-by: Thomas Richard <thomas.richard@bootlin.com>
> ---
> drivers/mfd/omap-usb-host.c | 41 ++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 40 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
> index ac974285be341fa579ef198d1893b77af428b5f8..9e254e00183e940b775d5bde6e891f0d26af27b0 100644
> --- a/drivers/mfd/omap-usb-host.c
> +++ b/drivers/mfd/omap-usb-host.c
> @@ -15,6 +15,9 @@
> #include <linux/pm_runtime.h>
> #include <linux/of.h>
> #include <linux/of_platform.h>
> +#include <linux/regulator/consumer.h>
> +#include <linux/string_choices.h>
> +
?
>
> #include "omap-usb.h"
>
> @@ -95,6 +98,8 @@ struct usbhs_hcd_omap {
> struct usbhs_omap_platform_data *pdata;
>
> u32 usbhs_rev;
> +
> + struct regulator *pbias;
> };
> /*-------------------------------------------------------------------------*/
>
> @@ -270,6 +275,25 @@ static bool is_ohci_port(enum usbhs_omap_port_mode pmode)
> }
> }
>
> +static int omap_usbhs_set_pbias(struct device *dev, bool power_on)
> +{
> + struct usbhs_hcd_omap *omap = dev_get_drvdata(dev);
> + int ret;
> +
> + if (!omap->pbias)
> + return 0;
> +
> + if (power_on)
> + ret = regulator_enable(omap->pbias);
> + else
> + ret = regulator_disable(omap->pbias);
> +
> + if (ret)
> + dev_err(dev, "pbias reg %s failed\n", str_enable_disable(power_on));
> +
> + return ret;
> +}
> +
> static int usbhs_runtime_resume(struct device *dev)
> {
> struct usbhs_hcd_omap *omap = dev_get_drvdata(dev);
> @@ -278,6 +302,10 @@ static int usbhs_runtime_resume(struct device *dev)
>
> dev_dbg(dev, "usbhs_runtime_resume\n");
>
> + r = omap_usbhs_set_pbias(dev, true);
> + if (r)
> + return r;
> +
> omap_tll_enable(pdata);
>
> if (!IS_ERR(omap->ehci_logic_fck))
> @@ -355,7 +383,7 @@ static int usbhs_runtime_suspend(struct device *dev)
>
> omap_tll_disable(pdata);
>
> - return 0;
> + return omap_usbhs_set_pbias(dev, false);
> }
>
> static unsigned omap_usbhs_rev1_hostconfig(struct usbhs_hcd_omap *omap,
> @@ -564,6 +592,11 @@ static int usbhs_omap_probe(struct platform_device *pdev)
>
> omap->pdata = pdata;
>
> + omap->pbias = devm_regulator_get_optional(dev, "pbias");
> + if (IS_ERR(omap->pbias))
> + return dev_err_probe(dev, PTR_ERR(omap->pbias),
> + "unable to get pbias regulator\n");
You need to check for '-ENODEV' here or you are ignoring the optional part.
> +
> /* Initialize the TLL subsystem */
> omap_tll_init(pdata);
>
> @@ -759,6 +792,10 @@ static int usbhs_omap_probe(struct platform_device *pdev)
> }
>
> initialize:
> + ret = omap_usbhs_set_pbias(dev, true);
> + if (ret)
> + goto err_mem;
Since this regulator is also managed by 'usbhs_runtime_resume' and
'usbhs_runtime_suspend', could manually enabling it here in probe and
disabling it in remove interfere with the reference counting during runtime
PM transitions? Should we consider relying entirely on runtime PM to manage
its state?
> +
> omap_usbhs_init(dev);
>
> if (dev->of_node) {
> @@ -806,6 +843,8 @@ static void usbhs_omap_remove(struct platform_device *pdev)
> of_platform_depopulate(&pdev->dev);
> else
> device_for_each_child(&pdev->dev, NULL, usbhs_omap_remove_child);
> +
> + omap_usbhs_set_pbias(&pdev->dev, false);
> }
>
> static const struct dev_pm_ops usbhsomap_dev_pm_ops = {
>
> --
> 2.53.0
>
--
Lee Jones [李琼斯]
next prev parent reply other threads:[~2026-03-31 16:55 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-23 15:02 [PATCH 0/8] Add SIM pbias regulator support for USB on OMAP4 Thomas Richard
2026-03-23 15:02 ` [PATCH 1/8] regulator: pbias: Add pbias SIM regulator for OMAP4 Thomas Richard
2026-03-23 17:29 ` Mark Brown
2026-03-27 12:36 ` Andreas Kemnade
2026-03-27 13:18 ` Thomas Richard
2026-03-23 15:02 ` [PATCH 2/8] ARM: dts: ti: omap4: Add pbias SIM regulator Thomas Richard
2026-03-23 15:02 ` [PATCH 3/8] mfd: omap-usb-host: Cleanup header includes Thomas Richard
2026-03-31 15:45 ` Lee Jones
2026-03-23 15:02 ` [PATCH 4/8] mfd: omap-usb-host: Sanitize error path in the probe() Thomas Richard
2026-03-23 15:02 ` [PATCH 5/8] dt-bindings: mfd: ti,omap-usb-host: Convert to DT schema Thomas Richard
2026-03-23 19:55 ` Conor Dooley
2026-03-23 15:02 ` [PATCH 6/8] dt-bindings: mfd: ti,omap-usb-host: Add 'pbias-supply' property Thomas Richard
2026-03-23 15:02 ` [PATCH 7/8] mfd: omap-usb-host: Add pbias regulator support Thomas Richard
2026-03-31 16:55 ` Lee Jones [this message]
2026-03-31 18:19 ` Thomas Richard
2026-03-23 15:02 ` [PATCH 8/8] ARM: dts: ti: omap4: Add pbias regulator to the HS USB Host Thomas Richard
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=20260331165537.GJ3795166@google.com \
--to=lee@kernel.org \
--cc=aaro.koskinen@iki.fi \
--cc=andreas@kemnade.info \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=khilman@baylibre.com \
--cc=krzk+dt@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=robh@kernel.org \
--cc=rogerq@kernel.org \
--cc=thomas.petazzoni@bootlin.com \
--cc=thomas.richard@bootlin.com \
--cc=tony@atomide.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