public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Mattijs Korpershoek <mkorpershoek@baylibre.com>
To: Caleb Connolly <caleb.connolly@linaro.org>,
	Marek Vasut <marex@denx.de>, Tom Rini <trini@konsulko.com>,
	Lukasz Majewski <lukma@denx.de>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Sumit Garg <sumit.garg@linaro.org>
Cc: u-boot@lists.denx.de
Subject: Re: [PATCH 1/5] usb: dwc3-generic: implement Qualcomm wrapper
Date: Thu, 21 Mar 2024 15:14:48 +0100	[thread overview]
Message-ID: <87edc3llif.fsf@baylibre.com> (raw)
In-Reply-To: <f3940b9b-e5a0-447d-a6a8-447fdd21e17b@linaro.org>

On jeu., mars 21, 2024 at 11:34, Caleb Connolly <caleb.connolly@linaro.org> wrote:

> Hi,
>
> On 21/03/2024 09:25, Mattijs Korpershoek wrote:
>> Hi Caleb, Marek,
>> 
>> On jeu., mars 21, 2024 at 06:34, Marek Vasut <marex@denx.de> wrote:
>> 
>>> On 3/13/24 7:22 PM, Caleb Connolly wrote:
>>>
>>> [...]
>>>
>>>>>> +static inline void dwc3_qcom_setbits(void __iomem *base, u32 offset,
>>>>>> u32 val)
>>>>>> +{
>>>>>> +    u32 reg;
>>>>>> +
>>>>>> +    reg = readl(base + offset);
>>>>>> +    reg |= val;
>>>>>> +    writel(reg, base + offset);
>>>>>
>>>>> Use setbits_le32() .
>>>>>
>>>>>> +    /* ensure that above write is through */
>>>>>> +    readl(base + offset);
>>>>>
>>>>> Is this needed ?
>>>>
>>>> I honestly don't know, this is copied from the Linux driver and it seems
>>>> to be very defensively written. I doubt it's strictly necessary.
>>>
>>> Does git log indicate anything ?
>
> Nope :/ it's there from when the driver was first added.
>>>
>>> I suspect this is some sort of barrier .
>>>
>>> [...]
>>>
>>>>>> +/* For controllers running without superspeed PHYs */
>>>>>> +static void dwc3_qcom_select_utmi_clk(void __iomem *qscratch_base)
>>>>>> +{
>>>>>> +    /* Configure dwc3 to use UTMI clock as PIPE clock not present */
>>>>>> +    dwc3_qcom_setbits(qscratch_base, QSCRATCH_GENERAL_CFG,
>>>>>> +              PIPE_UTMI_CLK_DIS);
>>>>>> +
>>>>>> +    udelay(500);
>>>>>
>>>>> Isn't there some possibility to poll for completion instead of fixed
>>>>> delay ? If so, use wait_for_bit or some such .
>>>>
>>>> Not that I'm aware of, no. I think this hardware just has a blanket
>>>> "writes take X bus cycles to complete" rule or something. It's totally
>>>> possible that this code was originally written this way to work around
>>>> some issues on an FPGA prototype or something. Everything seems to still
>>>> work if I remove the delays so I'll drop them...
>>>
>>> Could you possibly ask someone ?
>
> Yeah I'll ask around, I'm not confident I'll find an answer though.
>>>
>>> [...]
>>>
>>>>>>    static int dwc3_rk_glue_get_ctrl_dev(struct udevice *dev, ofnode *node)
>>>>>>    {
>>>>>>        *node = dev_ofnode(dev);
>>>>>> @@ -506,6 +599,10 @@ static int dwc3_glue_reset_init(struct udevice *dev,
>>>>>>        else if (ret)
>>>>>>            return ret;
>>>>>>    +    if (device_is_compatible(dev, "qcom,dwc3")) {
>>>>>> +        reset_assert_bulk(&glue->resets);
>>>>>> +        udelay(500);
>>>>>
>>>>> Why this delay here ?
>>>>
>>>> According to the docs, the reset should be asserted for at least 6 sleep
>>>> clock cycles, that's ~200us on sdm845, but it can vary by platform.
>>>
>>> A comment in the code would be nice.
>>>
>>> Sorry for the abysmal delay in replies.
>>>
>>> btw. the new version of this series is still OK to go in, unless you 
>>> want to fill in the comments. They can also go in in separate follow up 
>>> patch.
>> 
>> I'm interested by the answers above as well. As I took in the series [1] (to
>> avoid delaying it too much), please consider a follow up patch to add a
>> comment.
>
> The v4 you picked up has a comment explaining this.

Right, sorry I missed that. Thanks for pointing it out to me!

>> 
>> [1] https://lore.kernel.org/r/all/171101299073.1017001.16411913317437946645.b4-ty@baylibre.com/
>> 
>
> -- 
> // Caleb (they/them)

  reply	other threads:[~2024-03-21 14:14 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-31 14:57 [PATCH 0/5] Qualcomm DWC3 USB support Caleb Connolly
2024-01-31 14:57 ` [PATCH 1/5] usb: dwc3-generic: implement Qualcomm wrapper Caleb Connolly
2024-02-01  9:34   ` Mattijs Korpershoek
2024-02-01 14:24     ` Caleb Connolly
2024-02-02  9:16       ` Mattijs Korpershoek
2024-02-06 20:36   ` Marek Vasut
2024-03-13 18:22     ` Caleb Connolly
2024-03-21  5:34       ` Marek Vasut
2024-03-21  9:25         ` Mattijs Korpershoek
2024-03-21 11:34           ` Caleb Connolly
2024-03-21 14:14             ` Mattijs Korpershoek [this message]
2024-01-31 14:57 ` [PATCH 2/5] usb: dwc3: select DM_USB_GADGET Caleb Connolly
2024-02-01 13:25   ` Mattijs Korpershoek
2024-01-31 14:57 ` [PATCH 3/5] usb: gadget: CDC ACM: call usb_gadget_initialize Caleb Connolly
2024-02-01 13:37   ` Mattijs Korpershoek
2024-01-31 14:57 ` [PATCH 4/5] usb: gadget: UMS: support multiple sector sizes Caleb Connolly
2024-02-01 13:49   ` Mattijs Korpershoek
2024-01-31 14:57 ` [PATCH 5/5] iommu: qcom-smmu: fix debugging Caleb Connolly
2024-02-01 13:51   ` Mattijs Korpershoek

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=87edc3llif.fsf@baylibre.com \
    --to=mkorpershoek@baylibre.com \
    --cc=caleb.connolly@linaro.org \
    --cc=lukma@denx.de \
    --cc=marex@denx.de \
    --cc=neil.armstrong@linaro.org \
    --cc=sumit.garg@linaro.org \
    --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