All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Wahren <stefan.wahren@i2se.com>
To: Matthias Kaehlcke <mka@chromium.org>
Cc: Fabrice Gasnier <fabrice.gasnier@foss.st.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, regressions@lists.linux.dev,
	Florian Fainelli <f.fainelli@gmail.com>
Subject: Re: Regression: onboard-usb-hub breaks USB on RPi 3
Date: Tue, 20 Dec 2022 17:19:34 +0100	[thread overview]
Message-ID: <db6f59bf-33a1-776e-b52c-4818ff9114e3@i2se.com> (raw)
In-Reply-To: <Y6ECMZeh7G9bH8Fi@google.com>

Hi Matthias,

Am 20.12.22 um 01:30 schrieb Matthias Kaehlcke:
> On Mon, Dec 19, 2022 at 11:32:58PM +0100, Stefan Wahren wrote:
>> Hi Matthias,
>>
>> Am 19.12.22 um 18:44 schrieb Matthias Kaehlcke:
>>> Hi Stefan,
>>>
>>> Sorry for the regression.
>>>
>>> What seems to happen is this:
>>>
>>> arch/arm/boot/dts/bcm283x-rpi-lan7515.dtsi specifies device nodes for the
>>> two (nested) USB hubs (which is done rarely since USB devices (including
>>> hubs) are autodetected). The DT nodes were most likely only added to be
>>> able to configure the LED modes of the USB to Ethernet adapter. With
>>> 43993626de00 ("usb: misc: onboard-hub: add support for Microchip USB2514B
>>> USB 2.0 hub") the onboard_usb_hub driver gained support for the hubs on
>>> the RPi3. The onboard_usb_hub driver expects a regulator ("vdd") in the DT
>>> node of the USB hub, which isn't present for the RPi3 (this isn't an error
>>> per se). Without the regulator the onboard_hub platform driver fails to
>>> probe, when the USB driver of the hub is probed (onboard_hub_usbdev_probe())
>>> it doesn't find the corresponding platform driver instance
>>> (_find_onboard_hub()) and defers probing. When the deferred probe runs it
>>> encounters the same situation, rinse and repeat.
>> I forgot to mention that in error case /sys/kernel/debug/devices_deferred
>> was empty.
>>> One possible fix would be to specify the 'missing' "vdd" property, however
>>> that wouln't fix the issue for other boards with a similar configurations.
>>> Instead the driver could check if "vdd" exists in the DT node of the hub,
>>> and not defer probing if it doesn't.
>>>
>>> Could you please try if the below patch fixes the issue on the Rpi 3?
>> Yes, this prevents probing of onboard-usb-hub and the issue.
> Thanks for the confirmation, I'll send out a proper patch to get this fixed
> upstream.

sorry, i accidentally disabled this driver during testing of the patch. 
So i erroneously assumed the patch is working, but it's not. I seems 
that the change is never reached (add dev_info around your change).

The following worked on my Raspberry Pi 3 B+

diff --git a/drivers/usb/misc/onboard_usb_hub.c 
b/drivers/usb/misc/onboard_usb_hub.c
index de3627af3c84..570e9f3d2d89 100644
--- a/drivers/usb/misc/onboard_usb_hub.c
+++ b/drivers/usb/misc/onboard_usb_hub.c
@@ -227,6 +227,9 @@ static int onboard_hub_probe(struct platform_device 
*pdev)
      if (!hub)
          return -ENOMEM;

+    if (!of_get_property(dev->of_node, "vdd", NULL))
+        return -ENODEV;
+
      hub->vdd = devm_regulator_get(dev, "vdd");
      if (IS_ERR(hub->vdd))
          return PTR_ERR(hub->vdd);
@@ -340,6 +343,15 @@ static struct onboard_hub *_find_onboard_hub(struct 
device *dev)
      hub = dev_get_drvdata(&pdev->dev);
      put_device(&pdev->dev);

+    /*
+     * Some boards have device tree nodes for USB hubs supported by this
+     * driver, but the nodes don't have all properties needed for the 
driver
+     * to work properly. Use the absence of the "vdd" regulator as an
+     * indicator of such nodes.
+     */
+    if (!of_get_property(pdev->dev.of_node, "vdd", NULL))
+        return ERR_PTR(-ENODEV);
+
      /*
       * The presence of drvdata ('hub') indicates that the platform driver
       * finished probing. This handles the case where (conceivably) we 
couldThe following changes worked for me:



  reply	other threads:[~2022-12-20 16:19 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-18 13:35 Regression: onboard-usb-hub breaks USB on RPi 3 Stefan Wahren
2022-12-19 10:41 ` Regression: onboard-usb-hub breaks USB on RPi 3 #forregzbot Thorsten Leemhuis
2022-12-19 17:44 ` Regression: onboard-usb-hub breaks USB on RPi 3 Matthias Kaehlcke
2022-12-19 22:32   ` Stefan Wahren
2022-12-20  0:30     ` Matthias Kaehlcke
2022-12-20 16:19       ` Stefan Wahren [this message]
2022-12-20 22:50         ` Matthias Kaehlcke
2022-12-21 12:29           ` Stefan Wahren
2022-12-21 16:50             ` Matthias Kaehlcke
2022-12-21 18:00               ` Stefan Wahren
2022-12-21 19:02                 ` Matthias Kaehlcke
2022-12-21 21:31                   ` Stefan Wahren
2022-12-22  0:55                     ` Matthias Kaehlcke
2022-12-22 11:19                       ` Stefan Wahren
2022-12-27 13:15                     ` Stefan Wahren

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=db6f59bf-33a1-776e-b52c-4818ff9114e3@i2se.com \
    --to=stefan.wahren@i2se.com \
    --cc=f.fainelli@gmail.com \
    --cc=fabrice.gasnier@foss.st.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mka@chromium.org \
    --cc=regressions@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.