From: Marek Vasut <marex@denx.de>
To: Junhui Liu <junhui.liu@pigmoral.tech>,
Tom Rini <trini@konsulko.com>, Lukasz Majewski <lukma@denx.de>,
Mattijs Korpershoek <mkorpershoek@baylibre.com>
Cc: u-boot@lists.denx.de, seashell11234455@gmail.com, pbrobinson@gmail.com
Subject: Re: [PATCH v3 7/8] usb: dwc2: Unify flush and reset logic with v4.20a support
Date: Tue, 7 Jan 2025 13:57:23 +0100 [thread overview]
Message-ID: <1a76b8af-e476-4f70-b482-1076bae91e6e@denx.de> (raw)
In-Reply-To: <1818696fe57acd78.91ad175705e34eaa.3d66e6a504061c82@Mac>
On 1/7/25 1:39 PM, Junhui Liu wrote:
>
>
> On 06/01/2025 16:37, Marek Vasut wrote:
>> On 1/6/25 10:14 AM, Junhui Liu wrote:
>>> Hi Marek,
>>>
>>> On 05/01/2025 20:19, Marek Vasut wrote:
>>>> On 1/4/25 4:37 AM, Junhui Liu wrote:
>>>>> From: Kongyang Liu <seashell11234455@gmail.com>
>>>>>
>>>>> This patch merges flush and reset logic for both host and gadget code
>>>>> into a common set of functions, reducing duplication. It also adds support
>>>>> for the updated reset logic to compatible with core version since v4.20a.
>>>>>
>>>>> This patch mainly refers to the patch in the kernel.
>>>>> link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=65dc2e725286106f99c6f6b78e3d9c52c15f3a9c
>>>>
>>>> [...]
>>>>
>>>>> +++ b/drivers/usb/common/dwc2_core.c
>>>>> @@ -0,0 +1,115 @@
>>>>> +// SPDX-License-Identifier: GPL-2.0+
>>>>> +/*
>>>>> + * Copyright (c) 2024, Kongyang Liu <seashell11234455@gmail.com>
>>>>
>>>> 2025 now .
>>>
>>> You're right. It should be 2024-2025.
>>>
>>>>
>>>> [...]
>>>>
>>>>> +int dwc2_flush_rx_fifo(struct dwc2_core_regs *regs)
>>>>> +{
>>>>> + int ret;
>>>>> +
>>>>> + log_debug("Flush Rx FIFO\n");
>>>>> +
>>>>> + /* Wait for AHB master IDLE state */
>>>>> + ret = wait_for_bit_le32(®s->global_regs.grstctl, GRSTCTL_AHBIDLE, true, 1000, false);
>>>>> + if (ret) {
>>>>> + log_warning("%s: Waiting for GRSTCTL_AHBIDLE timeout\n", __func__);
>>>>> + return ret;
>>>>> + }
>>>>> +
>>>>> + writel(GRSTCTL_RXFFLSH, ®s->global_regs.grstctl);
>>>>> +
>>>>> + ret = wait_for_bit_le32(®s->global_regs.grstctl, GRSTCTL_RXFFLSH, false, 1000, false);
>>>>> + if (ret) {
>>>>> + log_warning("%s: Waiting for GRSTCTL_RXFFLSH timeout\n", __func__);
>>>>> + return ret;
>>>>> + }
>>>>> +
>>>>> + /* Wait for at least 3 PHY Clocks */
>>>>> + udelay(1);
>>>> Shouldn't this delay be derived from the PHY clock frequency somehow ?
>>>> Are we sure 1us is always sufficient ?
>>>
>>> According to the datasheet, the PHY clock can be selected to 6/30/48/60
>>> MHz depending on the speed mode. And 1us is sufficient even for 6MHz
>>> (twice the 3 PHY clock at 6MHz), so I think 1us is acceptable here.
>>
>> Please add a code comment like that ^ .
>
> OK, I will add comments in the next version.
Thank you
next prev parent reply other threads:[~2025-01-07 12:59 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-04 3:37 [PATCH v3 0/8] usb: dwc2: Refactor and update USB DWC2 driver Junhui Liu
2025-01-04 3:37 ` [PATCH v3 1/8] usb: dwc2: Extract register definitions to common header file Junhui Liu
2025-01-07 9:03 ` Mattijs Korpershoek
2025-01-04 3:37 ` [PATCH v3 2/8] usb: dwc2: Fix incorrect ULPI_UTMI_SEL bit setting Junhui Liu
2025-01-07 9:11 ` Mattijs Korpershoek
2025-01-04 3:37 ` [PATCH v3 3/8] USB: dwc2: Fix HBstLen setting for external DMA mode Junhui Liu
2025-01-07 9:16 ` Mattijs Korpershoek
2025-01-04 3:37 ` [PATCH v3 4/8] usb: dwc2: Clean up with bitfield macros Junhui Liu
2025-01-05 19:14 ` Marek Vasut
2025-01-07 9:22 ` Mattijs Korpershoek
2025-01-04 3:37 ` [PATCH v3 5/8] usb: dwc2: Align macros with Linux kernel definitions Junhui Liu
2025-01-07 9:26 ` Mattijs Korpershoek
2025-01-04 3:37 ` [PATCH v3 6/8] usb: dwc2: Extract macro definitions to common header Junhui Liu
2025-01-07 9:55 ` Mattijs Korpershoek
2025-01-07 12:52 ` Junhui Liu
2025-01-04 3:37 ` [PATCH v3 7/8] usb: dwc2: Unify flush and reset logic with v4.20a support Junhui Liu
2025-01-05 19:19 ` Marek Vasut
2025-01-06 9:14 ` Junhui Liu
2025-01-06 15:37 ` Marek Vasut
2025-01-07 12:39 ` Junhui Liu
2025-01-07 12:57 ` Marek Vasut [this message]
2025-01-04 3:37 ` [PATCH v3 8/8] usb: dwc2: Replace uint<x>_t types with u<x> Junhui Liu
2025-01-07 9:47 ` [PATCH v3 0/8] usb: dwc2: Refactor and update USB DWC2 driver Mattijs Korpershoek
2025-01-07 12:44 ` Junhui Liu
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=1a76b8af-e476-4f70-b482-1076bae91e6e@denx.de \
--to=marex@denx.de \
--cc=junhui.liu@pigmoral.tech \
--cc=lukma@denx.de \
--cc=mkorpershoek@baylibre.com \
--cc=pbrobinson@gmail.com \
--cc=seashell11234455@gmail.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/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