mirror of https://lore.kernel.org/linux-amlogic/
 help / color / mirror / Atom feed
From: Otto Meier <gf435@gmx.net>
To: Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
	Anand Moon <linux.amoon@gmail.com>
Cc: U-Boot Mailing List <u-boot@lists.denx.de>,
	linux-amlogic@lists.infradead.org, u-boot-amlogic@groups.io,
	Neil Armstrong <narmstrong@baylibre.com>
Subject: Re: [BUG]odroid-c2 does not hotplug usb-devices
Date: Sun, 20 Dec 2020 11:28:23 +0100	[thread overview]
Message-ID: <0844051e-c44c-c2b7-dcb3-2e16b6b27e99@gmx.net> (raw)
In-Reply-To: <CAFBinCDaT_z_+bbQ-LaSc56wuWLPmr6kz-2aYowCnQwN9VNqUw@mail.gmail.com>

Hi Martin,

i think the the u-boot fix made the new u-boot for me usable.
Because i boot from emmc it fixes a long standing problem since 2020.04
in not booting from emmc.
The latest uboot, booting from emmc before the fix was 2020.04, but this 
old uboot does not funktion well
(hotpluging and others) with newer kernel (5.8.10 was the latest i new 
of). Therefore
the latest Uboot initialized the kernel in a way that new kernels work 
again.

I haven't run kernel in between, with newer uboots like 2020.07 or 
2020.10, because they din't boot
from emmc.

so if the uboot patch is the real reason, i don't think.

best regrads

Otto

Am 19.12.20 um 23:31 schrieb Martin Blumenstingl:
> Hi Anand,
>
> On Sat, Dec 19, 2020 at 8:53 PM Anand Moon <linux.amoon@gmail.com> wrote:
> [...]
>> I was also looking into this issue so I made some changes in the
>> phy driver to resolve the issue. Plz share your thoughts on the changes below.
> first I have some questions :-)
> 1. do you see the same problem that Otto sees? this means: a) USB
> hotplug works as long as at least one device is plugged in at boot b)
> (if I understand Otto correctly then) it breaks once all USB devices
> have been removed
> 2. does the mainline u-boot patch mentioned by Otto fix the problem
> for you? according to him it fixes the problem and he did not have to
> modify the USB PHY driver
>
>> amoon@ThinkPad-T440s:~/mainline/linux-aml-5.y-devel$ git diff
>> diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
>> b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
>> index 7c029f552a23..363dd2ac17e6 100644
>> --- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
>> +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
>> @@ -20,6 +20,7 @@ usb0_phy: phy@c0000000 {
>>                          #phy-cells = <0>;
>>                          reg = <0x0 0xc0000000 0x0 0x20>;
>>                          resets = <&reset RESET_USB_OTG>;
>> +                       reset-names = "phy-reset";
>>                          clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB0>;
>>                          clock-names = "usb_general", "usb";
>>                          status = "disabled";
>> @@ -30,6 +31,7 @@ usb1_phy: phy@c0000020 {
>>                          #phy-cells = <0>;
>>                          reg = <0x0 0xc0000020 0x0 0x20>;
>>                          resets = <&reset RESET_USB_OTG>;
>> +                       reset-names = "phy-reset";
>>                          clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB1>;
>>                          clock-names = "usb_general", "usb";
>>                          status = "disabled";
> I don't see why the above two changes are needed
> see my comment about of_reset_control_get_shared below
>
>> diff --git a/drivers/phy/amlogic/phy-meson8b-usb2.c
>> b/drivers/phy/amlogic/phy-meson8b-usb2.c
>> index 03c061dd5f0d..31523becc878 100644
>> --- a/drivers/phy/amlogic/phy-meson8b-usb2.c
>> +++ b/drivers/phy/amlogic/phy-meson8b-usb2.c
>> @@ -143,14 +143,6 @@ static int phy_meson8b_usb2_power_on(struct phy *phy)
>>          u32 reg;
>>          int ret;
>>
>> -       if (!IS_ERR_OR_NULL(priv->reset)) {
>> -               ret = reset_control_reset(priv->reset);
>> -               if (ret) {
>> -                       dev_err(&phy->dev, "Failed to trigger USB reset\n");
>> -                       return ret;
>> -               }
>> -       }
>> -
>>          ret = clk_prepare_enable(priv->clk_usb_general);
>>          if (ret) {
>>                  dev_err(&phy->dev, "Failed to enable USB general clock\n");
>> @@ -222,9 +214,23 @@ static int phy_meson8b_usb2_power_off(struct phy *phy)
>>          return 0;
>>   }
>>
>> +static int phy_meson8b_usb2_reset(struct phy *phy)
>> +{
>> +       struct phy_meson8b_usb2_priv *priv = phy_get_drvdata(phy);
>> +
>> +       if (priv->reset) {
>> +               reset_control_assert(priv->reset);
>> +               udelay(10);
>> +               reset_control_deassert(priv->reset);
>> +       }
>> +
>> +       return 0;
>> +}
>> +
>>   static const struct phy_ops phy_meson8b_usb2_ops = {
>>          .power_on       = phy_meson8b_usb2_power_on,
>>          .power_off      = phy_meson8b_usb2_power_off,
>> +       .reset          = phy_meson8b_usb2_reset,
>>          .owner          = THIS_MODULE,
>>   };
> I tested this on my Odroid-C1: phy_meson8b_usb2_reset is never called
> after checking the dwc2 code this is expected: only in one very
> specific case the dwc2 driver calls phy_reset
> can you please find out how phy_meson8b_usb2_reset is called in your kernel?
>
>> @@ -271,6 +277,10 @@ static int phy_meson8b_usb2_probe(struct
>> platform_device *pdev)
>>                  return -EINVAL;
>>          }
>>
>> +       priv->reset = of_reset_control_get_shared(pdev->dev.of_node,
>> "phy-reset");
> this causes a memory-leak upon driver removal
> also a few lines above we are already getting the reset line, so why
> is this needed?
>
>
> Best regards,
> Martin
>


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

  reply	other threads:[~2020-12-20 10:28 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-28 17:09 Otto Meier
2020-12-05 11:54 ` Martin Blumenstingl
2020-12-05 17:40   ` Otto Meier
2020-12-05 19:55     ` Martin Blumenstingl
2020-12-07 12:19       ` Otto Meier
2020-12-07 12:29         ` Neil Armstrong
2020-12-07 12:43           ` Otto Meier
2020-12-13 18:46             ` Martin Blumenstingl
2020-12-14 19:33               ` Otto Meier
2020-12-19 13:58                 ` Martin Blumenstingl
2020-12-19 18:41                   ` Otto Meier
2020-12-19 19:53                   ` Anand Moon
2020-12-19 22:31                     ` Martin Blumenstingl
2020-12-20 10:28                       ` Otto Meier [this message]
2020-12-20 13:46                       ` Anand Moon
2020-12-20 14:33                         ` Martin Blumenstingl
2020-12-21 14:15                           ` Anand Moon

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=0844051e-c44c-c2b7-dcb3-2e16b6b27e99@gmx.net \
    --to=gf435@gmx.net \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux.amoon@gmail.com \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=narmstrong@baylibre.com \
    --cc=u-boot-amlogic@groups.io \
    --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

all inboxes | Powered by JetHome®