[PATCH] usb: host: ehci-generic: Handle DM_RESET=n case
Patrice CHOTARD
patrice.chotard at foss.st.com
Tue Jan 24 14:10:05 CET 2023
Hi Xavier
On 1/24/23 09:32, Xavier Drudis Ferran wrote:
> El Tue, Jan 24, 2023 at 09:07:58AM +0100, Patrice CHOTARD deia:
>> Hi Marek
>>
>> On 1/23/23 23:32, Marek Vasut wrote:
>>> In case CONFIG_DM_RESET=n, reset_get_bulk() returns -ENOTSUPP.
>>> Do not fail in that case either. This is a valid use case, e.g.
>>> in case the reset driver is a no-op and would only waste space
>>> in the build.
>>>
>>> Fixes: 81755b8c20f ("usb: host: ehci-generic: Make resets and clocks optional")
>>> Signed-off-by: Marek Vasut <marek.vasut+renesas at mailbox.org>
>>> ---
>>> Cc: Andre Przywara <andre.przywara at arm.com>
>>> Cc: Patrice Chotard <patrice.chotard at foss.st.com>
>>> ---
>>> drivers/usb/host/ehci-generic.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/usb/host/ehci-generic.c b/drivers/usb/host/ehci-generic.c
>>> index a765a307a32..83fe701ff67 100644
>>> --- a/drivers/usb/host/ehci-generic.c
>>> +++ b/drivers/usb/host/ehci-generic.c
>>> @@ -81,7 +81,7 @@ static int ehci_usb_probe(struct udevice *dev)
>>> }
>>>
>>> err = reset_get_bulk(dev, &priv->resets);
>>> - if (err && err != -ENOENT) {
>>> + if (err && err != -ENOENT && err != -ENOTSUPP) {
>>> dev_err(dev, "Failed to get resets (err=%d)\n", err);
>>> goto clk_err;
>>> }
>>
>> A similar patch can be applied for testing return value of clk_get_bulk() ?
>> In case CONFIG_CLK is not set, clk_get_bulk() can return -ENOSYS.
>>
>
> I thought without CONFIG_CLK the USB port wouldn't work in general ?
> Is there a case where it works ? (a board with the clocks enabled
Yes it's the case for stih410-b2260 board. All clocks are enabled by default by bootrom.
I have just noticed that CONFIG_CLK is enabled for this board, but it shouldn't as there is no
clock driver implemented for it.
I made a quick test on stih410-b2260 (i haven't test this board for a while) with CONFIG_CLK
disable as it should be, and the following patch is needed :
err = 0;
ret = clk_get_bulk(dev, &priv->clocks);
- if (ret && ret != -ENOENT) {
+ if (ret && ret != -ENOENT && ret != -ENOSYS) {
dev_err(dev, "Failed to get clocks (ret=%d)\n", ret);
return ret;
> before U-Boot or something?) I once sent a patch[1] allowing some of
> the clocks to fail to be got, but it still returned error if they all
> failed.
>
> [1] https://patchwork.ozlabs.org/project/uboot/patch/Y44+ayJfUlI08ptM@localhost/
>
This patch is superseeded and v3 [1] doesn't update ehci_generic.c anymore ?
[1] https://patchwork.ozlabs.org/project/uboot/patch/Y5IWpjYLB4aXMy9o@localhost/
Patrice
More information about the U-Boot
mailing list