From: Marek Vasut Date: Thu, 9 Aug 2018 14:27:26 +0200 Subject: [U-Boot] [PATCH v2] usb: ehci-generic: Add vbus-supply regulator support In-Reply-To: <2decb6e5-47d0-d542-6bd6-f39997ea10d3@st.com> References: <1533798844-17189-1-git-send-email-patrice.chotard@st.com> <2decb6e5-47d0-d542-6bd6-f39997ea10d3@st.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 08/09/2018 02:25 PM, Patrice CHOTARD wrote: > Hi Marek > > On 08/09/2018 10:02 AM, Marek Vasut wrote: >> On 08/09/2018 09:14 AM, Patrice Chotard wrote: >>> Add vbus-supply regulator support. >>> On some board vbus is not controlled by the phy but by >>> an external regulator. >>> >>> Signed-off-by: Patrice Chotard >>> --- >>> >>> Changes in v2: >>> - Add test on device_get_supply_regulator() call >>> >>> drivers/usb/host/ehci-generic.c | 39 ++++++++++++++++++++++++++++++++++++++- >>> 1 file changed, 38 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/usb/host/ehci-generic.c b/drivers/usb/host/ehci-generic.c >>> index 5a56f66cfaa6..ad926d05ac3e 100644 >>> --- a/drivers/usb/host/ehci-generic.c >>> +++ b/drivers/usb/host/ehci-generic.c >>> @@ -11,6 +11,7 @@ >>> #include >>> #include >>> #include "ehci.h" >>> +#include >>> >>> /* >>> * Even though here we don't explicitly use "struct ehci_ctrl" >>> @@ -22,6 +23,9 @@ struct generic_ehci { >>> struct clk *clocks; >>> struct reset_ctl *resets; >>> struct phy phy; >>> +#ifdef CONFIG_DM_REGULATOR >>> + struct udevice *vbus_supply; >>> +#endif >>> int clock_count; >>> int reset_count; >>> }; >>> @@ -145,10 +149,27 @@ static int ehci_usb_probe(struct udevice *dev) >>> } >>> } >>> >>> - err = ehci_setup_phy(dev, 0); >>> +#ifdef CONFIG_DM_REGULATOR >>> + err = device_get_supply_regulator(dev, "vbus-supply", >>> + &priv->vbus_supply); >>> if (err) >>> goto reset_err; >> What if there is no regulator, what does this return , probably a >> negative return value ? > > Argh yes, good catch, i will update the test. Wait a few days before resending v3 so people can review the patches ... -- Best regards, Marek Vasut