[PATCH] usb: dwc3: Add support to reset usb ULPI phy
Michal Simek
michal.simek at xilinx.com
Fri Mar 4 16:10:26 CET 2022
On 3/4/22 15:45, Bin Meng wrote:
> On Fri, Mar 4, 2022 at 7:36 PM T Karthik Reddy <tkarthik at xilinx.com> wrote:
>>
>> Hi Bin Meng,
>>
>>> -----Original Message-----
>>> From: Bin Meng <bmeng.cn at gmail.com>
>>> Sent: Thursday, March 3, 2022 2:18 PM
>>> To: Michal Simek <michals at xilinx.com>
>>> Cc: U-Boot Mailing List <u-boot at lists.denx.de>; git <git at xilinx.com>; T
>>> Karthik Reddy <tkarthik at xilinx.com>; Angus Ainslie <angus at akkea.ca>;
>>> Kunihiko Hayashi <hayashi.kunihiko at socionext.com>; Marek Vasut
>>> <marex at denx.de>; Michael Walle <michael at walle.cc>; Priyanka Jain
>>> <priyanka.jain at nxp.com>; Simon Glass <sjg at chromium.org>
>>> Subject: Re: [PATCH] usb: dwc3: Add support to reset usb ULPI phy
>>>
>>> On Wed, Feb 23, 2022 at 11:07 PM Michal Simek <michal.simek at xilinx.com>
>>> wrote:
>>>>
>>>> From: T Karthik Reddy <t.karthik.reddy at xilinx.com>
>>>>
>>>> When usb PHY initialization is done, the PHY need to be reset.
>>>>
>>>> Signed-off-by: T Karthik Reddy <t.karthik.reddy at xilinx.com>
>>>> Signed-off-by: Michal Simek <michal.simek at xilinx.com>
>>>> ---
>>>>
>>>> drivers/usb/dwc3/Kconfig | 2 +-
>>>> drivers/usb/dwc3/dwc3-generic.c | 28
>>> ++++++++++++++++++++++++++++
>>>> 2 files changed, 29 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig index
>>>> 62aa65bf0cd2..685bda3729e5 100644
>>>> --- a/drivers/usb/dwc3/Kconfig
>>>> +++ b/drivers/usb/dwc3/Kconfig
>>>> @@ -25,7 +25,7 @@ config USB_DWC3_OMAP
>>>>
>>>> config USB_DWC3_GENERIC
>>>> bool "Generic implementation of a DWC3 wrapper (aka dwc3 glue)"
>>>> - depends on DM_USB && USB_DWC3 && MISC
>>>> + depends on DM_USB && USB_DWC3 && MISC && DM_GPIO
>>>> help
>>>> Select this for Xilinx ZynqMP and similar Platforms.
>>>> This wrapper supports Host and Peripheral operation modes.
>>>> diff --git a/drivers/usb/dwc3/dwc3-generic.c
>>>> b/drivers/usb/dwc3/dwc3-generic.c index b1e019b5b91a..17d35a6dc60c
>>>> 100644
>>>> --- a/drivers/usb/dwc3/dwc3-generic.c
>>>> +++ b/drivers/usb/dwc3/dwc3-generic.c
>>>> @@ -25,6 +25,7 @@
>>>> #include <reset.h>
>>>> #include <clk.h>
>>>> #include <usb/xhci.h>
>>>> +#include <asm/gpio.h>
>>>>
>>>> struct dwc3_glue_data {
>>>> struct clk_bulk clks;
>>>> @@ -42,6 +43,7 @@ struct dwc3_generic_priv {
>>>> void *base;
>>>> struct dwc3 dwc3;
>>>> struct phy_bulk phys;
>>>> + struct gpio_desc ulpi_reset;
>>>> };
>>>>
>>>> struct dwc3_generic_host_priv {
>>>> @@ -77,6 +79,26 @@ static int dwc3_generic_probe(struct udevice *dev,
>>>> if (rc && rc != -ENOTSUPP)
>>>> return rc;
>>>>
>>>> + if (device_is_compatible(dev->parent, "xlnx,zynqmp-dwc3")) {
>>>> + rc = gpio_request_by_name(dev->parent, "reset-gpios", 0,
>>>> + &priv->ulpi_reset, GPIOD_ACTIVE_LOW);
>>>> + if (rc != -EBUSY && rc)
>>>> + return rc;
>>>
>>> What happens if rc == -EBUSY?
>>
>> Every time we do usb reset, gpio is requested again and returns EBUSY.
>> We want to avoid returning probe with error, if rc == -EBUSY.
>>
>
> What about the very first time it returns EBUSY?
Was chatting with Karthik. We have free gpio in remove function that this stayed
there and we forget to remove it. It is not needed when you free gpio.
I sent v2 already.
Thanks,
Michal
More information about the U-Boot
mailing list