linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthias Kaehlcke <mka@chromium.org>
To: Stefan Wahren <stefan.wahren@i2se.com>
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: Wed, 21 Dec 2022 16:50:16 +0000	[thread overview]
Message-ID: <Y6M5SPBpp/xMzUz7@google.com> (raw)
In-Reply-To: <dde8b5e1-fbce-dd6c-6047-09e03ff2c00d@i2se.com>

On Wed, Dec 21, 2022 at 01:29:25PM +0100, Stefan Wahren wrote:
> Hi Matthias,
> 
> Am 20.12.22 um 23:50 schrieb Matthias Kaehlcke:
> > 
> > Today I learned that regulator_get() doesn't return an error when the regulator
> > isn't specified, but the 'dummy regulator'. With that the platform driver is
> > instantiated, which is not intended. The proper fix is probably to skip the
> > creation of the 'raw' platform device in onboard_hub_create_pdevs() when the
> > 'vdd-supply' does not exist.
> 
> Yes, i can confirm this by debugfs:
> 
>  regulator                      use open bypass  opmode voltage current    
> min     max
> ---------------------------------------------------------------------------------------
>  regulator-dummy                  8    7      0 unknown 0mV     0mA    
> 0mV     0mV
>     serial0-0-vddio 1                                 0mA     0mV     0mV
>     serial0-0-vbat 1                                 0mA     0mV     0mV
>     3f980000.usb:usb-port@1:usb-port@1-vdd 1                                
> 0mA     0mV     0mV
>     3f980000.usb:usb-port@1-vdd 1                                 0mA    
> 0mV     0mV
>     3f980000.usb-vusb_a 1                                 0mA     0mV    
> 0mV
>     3f980000.usb-vusb_d 1                                 0mA     0mV    
> 0mV
>     phy-vcc 1                                 0mA     0mV     0mV
> 
> > 
> > I tried to repro the Rpi 3 case by adjusting sc7280-herobrine.dtsi to look
> > somewhat similar to the Rpi 3 hub config, but so far I wasn't 'successful'
> > with breaking USB by deleting 'vdd-supply' (and 'peer-hub'). So I don't fully
> > understand your scenario, but I'm relatively confident that not creating the
> > platform devices should fix it.
> 
> I just played a little bit with arch/arm/boot/dts/bcm283x-rpi-lan7515.dtsi
> and removed only the second hub node (including ethernet chip). After this
> the issue also doesn't occur without any modification to onboard-usb-hub. So
> it seems to me that the real issue is caused by the cascade of 2x Microchip
> USB2514B USB 2.0 hubs.

Thanks for your debugging efforts.

I did some limited testing with nested hubs during development of the
driver, using an external hub as alleged 2nd level onboard hub. I went
back to such a configuration, unfortunately I still can't repro what
you are seeing :(

> Here are the relevant kernel log entries:
> 
> [    4.025150] dwc2 3f980000.usb: supply vusb_d not found, using dummy
> regulator
> [    4.038776] dwc2 3f980000.usb: supply vusb_a not found, using dummy
> regulator
> [    4.104207] dwc2 3f980000.usb: DWC OTG Controller
> [    4.115852] dwc2 3f980000.usb: new USB bus registered, assigned bus
> number 1
> [    4.129921] dwc2 3f980000.usb: irq 66, io mem 0x3f980000
> [    4.513217] usb 1-1: new high-speed USB device number 2 using dwc2
> [    5.123296] usb 1-1.1: new high-speed USB device number 3 using dwc2
> [    5.623217] usb 1-1.3: new low-speed USB device number 4 using dwc2
> [    5.785049] input: HID 046a:0011 as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.3/1-1.3:1.0/0003:046A:0011.0001/input/input0
> [    5.863240] usb 1-1.1.2: new low-speed USB device number 5 using dwc2
> [    5.868998] hid-generic 0003:046A:0011.0001: input: USB HID v1.11
> Keyboard [HID 046a:0011] on usb-3f980000.usb-1.3/input0
> [    6.031327] input: PixArt Microsoft USB Optical Mouse as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1.2/1-1.1.2:1.0/0003:045E:00CB.0002/input/input1
> [    6.031490] hid-generic 0003:045E:00CB.0002: input: USB HID v1.11 Mouse
> [PixArt Microsoft USB Optical Mouse] on usb-3f980000.usb-1.1.2/input0
> [    6.333278] usb 1-1.1.1: new high-speed USB device number 6 using dwc2
> [   24.165633] usbcore: registered new interface driver lan78xx
> [   24.423801] onboard-usb-hub 3f980000.usb:usb-port@1: supply vdd not
> found, using dummy regulator
> [   24.424202] usbcore: registered new device driver onboard-usb-hub
> [   24.424376] usb 1-1.1: USB disconnect, device number 3
> [   24.424385] usb 1-1.1.1: USB disconnect, device number 6
> [   24.564921] usb 1-1.1.2: USB disconnect, device number 5
> [   24.624696] usb 1-1.3: USB disconnect, device number 4
> [   25.523236] usb 1-1.1: new high-speed USB device number 7 using dwc2
> [   26.143248] usb 1-1.3: new low-speed USB device number 8 using dwc2
> [   26.305673] input: HID 046a:0011 as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.3/1-1.3:1.0/0003:046A:0011.0003/input/input2
> [   26.374840] hid-generic 0003:046A:0011.0003: input: USB HID v1.11
> Keyboard [HID 046a:0011] on usb-3f980000.usb-1.3/input0
> [   26.383241] usb 1-1.1.2: new low-speed USB device number 9 using dwc2
> [   26.521526] input: PixArt Microsoft USB Optical Mouse as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1.2/1-1.1.2:1.0/0003:045E:00CB.0004/input/input3
> [   26.522241] hid-generic 0003:045E:00CB.0004: input: USB HID v1.11 Mouse
> [PixArt Microsoft USB Optical Mouse] on usb-3f980000.usb-1.1.2/input0
> [   26.833251] usb 1-1.1.1: new high-speed USB device number 10 using dwc2
> 
> As you can see the input devices are deregistered after probing of
> onboard-usb-hub and then registered again.

It looks like the onboard_usb_hub driver is built as a module, which
is the cause of the de- and re-registration. On a system that actually
intends to use the onboard_hub driver I would recommand to make it a
builtin driver to avoid this, but a module driver should still work.

I changed my kernel config to use a onboard_hub module, but that didn't
help either with reproducing the issue.

Which kernel version are you running on the Rpi 3?

> The re-registering doesn't happen in the error case (as in my first email).

Could you add logs to onboard_hub_usbdev_probe() to see whether it is called
at all and how far it gets? Confirming whether onboard_hub_probe() completes
successfully might also help.

> Also in error case i noticed an unusual high load on the Rpi board, which
> doesn't occur in good case. Is it possible that both onboard-usb-hub
> instances are in some kind of deadlock?

Possibly. The driver itself uses a mutex for locking, which shouldn't result
in a high load in case of a deadlock, in any case the high load you are
observing seems to be related with the issue if it is only seen in the error
case.

Do things work properly when of_is_onboard_usb_hub() returns always false?
That would be similar to the fix I have in mind for configs that shouldn't
use the onboard_hub driver.

  reply	other threads:[~2022-12-21 16:50 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
2022-12-20 22:50         ` Matthias Kaehlcke
2022-12-21 12:29           ` Stefan Wahren
2022-12-21 16:50             ` Matthias Kaehlcke [this message]
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=Y6M5SPBpp/xMzUz7@google.com \
    --to=mka@chromium.org \
    --cc=f.fainelli@gmail.com \
    --cc=fabrice.gasnier@foss.st.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=regressions@lists.linux.dev \
    --cc=stefan.wahren@i2se.com \
    /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;
as well as URLs for NNTP newsgroup(s).