diff mbox series

[U-Boot,1/1] dwc2 USB controller hangs with lan78xx

Message ID 1529348166-130059-2-git-send-email-andrew.thomas@oracle.com
State Accepted
Commit af15946aa081dbcd0bec7d507a2b2db4e6b6cda5
Delegated to: Tom Rini
Headers show
Series dwc2 USB controller hangs with lan78xx | expand

Commit Message

andrew thomas June 18, 2018, 6:56 p.m. UTC
This bug is the combination of dwc2 USB controller and lan78xx
USB ethernet controller, which is the combination in use on
the Raspberry Pi Model 3 B+.

When the host attempts to receive a packet, but a packet has not
arrived, the lan78xx controller responds by setting BIR
(Bulk-In Empty Response) to NAK. Unfortunately, this hangs
the USB controller and requires the USB controller to
be reset.

The fix proposed is to have the lan78xx controller respond
by setting BIR to ZLP.

Signed-off-by: Andrew Thomas <andrew.thomas@oracle.com>
---
 drivers/usb/eth/lan78xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Peter Robinson June 21, 2018, 8:37 a.m. UTC | #1
On Mon, Jun 18, 2018 at 7:56 PM, Andrew Thomas <andrew.thomas@oracle.com> wrote:
> This bug is the combination of dwc2 USB controller and lan78xx
> USB ethernet controller, which is the combination in use on
> the Raspberry Pi Model 3 B+.
>
> When the host attempts to receive a packet, but a packet has not
> arrived, the lan78xx controller responds by setting BIR
> (Bulk-In Empty Response) to NAK. Unfortunately, this hangs
> the USB controller and requires the USB controller to
> be reset.
>
> The fix proposed is to have the lan78xx controller respond
> by setting BIR to ZLP.
>
> Signed-off-by: Andrew Thomas <andrew.thomas@oracle.com>
Tested-by: Peter Robinson <pbrobinson@gmail.com>

Tested on the RPi 3B+ and certainly improves this situation a number
of Fedora users have seen.

> ---
>  drivers/usb/eth/lan78xx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/eth/lan78xx.c b/drivers/usb/eth/lan78xx.c
> index c5ff379..e8ee665 100644
> --- a/drivers/usb/eth/lan78xx.c
> +++ b/drivers/usb/eth/lan78xx.c
> @@ -296,7 +296,7 @@ static int lan78xx_basic_reset(struct usb_device *udev,
>         ret = lan7x_read_reg(udev, LAN78XX_USB_CFG0, &val);
>         if (ret)
>                 return ret;
> -       val |= LAN78XX_USB_CFG0_BIR;
> +       val &= ~LAN78XX_USB_CFG0_BIR;
>         return lan7x_write_reg(udev, LAN78XX_USB_CFG0, val);
>  }
>
> --
> 1.8.3.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
andrew thomas June 21, 2018, 11:05 p.m. UTC | #2
On 06/21/2018 01:37 AM, Peter Robinson wrote:
> On Mon, Jun 18, 2018 at 7:56 PM, Andrew Thomas <andrew.thomas@oracle.com> wrote:
>> This bug is the combination of dwc2 USB controller and lan78xx
>> USB ethernet controller, which is the combination in use on
>> the Raspberry Pi Model 3 B+.
>>
>> When the host attempts to receive a packet, but a packet has not
>> arrived, the lan78xx controller responds by setting BIR
>> (Bulk-In Empty Response) to NAK. Unfortunately, this hangs
>> the USB controller and requires the USB controller to
>> be reset.
>>
>> The fix proposed is to have the lan78xx controller respond
>> by setting BIR to ZLP.
>>
>> Signed-off-by: Andrew Thomas <andrew.thomas@oracle.com>
> Tested-by: Peter Robinson <pbrobinson@gmail.com>
>
> Tested on the RPi 3B+ and certainly improves this situation a number
> of Fedora users have seen.

Thanks for testing!

One odd, and inexplicable, issue I have encountered is that
some VGA monitors will cause the dwc2/lan78xx combination to fail.

I have a DVI based monitor, which causes the failure.
Whereas an HDMI monitor works fine. I hesitate to
guess why this is.

For the monitor which causes problems, I am using a config
file with:

hdmi_ignore_edid=0xa5000080
hdmi_group=2
hdmi_mode=85

With this config, I see no issues with the troublesome monitor.

It's just bizzarre :-)

>
>> ---
>>   drivers/usb/eth/lan78xx.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/eth/lan78xx.c b/drivers/usb/eth/lan78xx.c
>> index c5ff379..e8ee665 100644
>> --- a/drivers/usb/eth/lan78xx.c
>> +++ b/drivers/usb/eth/lan78xx.c
>> @@ -296,7 +296,7 @@ static int lan78xx_basic_reset(struct usb_device *udev,
>>          ret = lan7x_read_reg(udev, LAN78XX_USB_CFG0, &val);
>>          if (ret)
>>                  return ret;
>> -       val |= LAN78XX_USB_CFG0_BIR;
>> +       val &= ~LAN78XX_USB_CFG0_BIR;
>>          return lan7x_write_reg(udev, LAN78XX_USB_CFG0, val);
>>   }
>>
>> --
>> 1.8.3.1
>>
>> _______________________________________________
>> U-Boot mailing list
>> U-Boot@lists.denx.de
>> https://lists.denx.de/listinfo/u-boot
Peter Robinson June 22, 2018, 6:37 a.m. UTC | #3
>>> This bug is the combination of dwc2 USB controller and lan78xx
>>> USB ethernet controller, which is the combination in use on
>>> the Raspberry Pi Model 3 B+.
>>>
>>> When the host attempts to receive a packet, but a packet has not
>>> arrived, the lan78xx controller responds by setting BIR
>>> (Bulk-In Empty Response) to NAK. Unfortunately, this hangs
>>> the USB controller and requires the USB controller to
>>> be reset.
>>>
>>> The fix proposed is to have the lan78xx controller respond
>>> by setting BIR to ZLP.
>>>
>>> Signed-off-by: Andrew Thomas <andrew.thomas@oracle.com>
>>
>> Tested-by: Peter Robinson <pbrobinson@gmail.com>
>>
>> Tested on the RPi 3B+ and certainly improves this situation a number
>> of Fedora users have seen.
>
>
> Thanks for testing!
>
> One odd, and inexplicable, issue I have encountered is that
> some VGA monitors will cause the dwc2/lan78xx combination to fail.
>
> I have a DVI based monitor, which causes the failure.
> Whereas an HDMI monitor works fine. I hesitate to
> guess why this is.

I have neither a DVI or VGA monitor, my guess with the later some
issue with the converter, from the little experience I've had they all
seem to be terrible. It's also likely to be a different problem to
this.

> For the monitor which causes problems, I am using a config
> file with:
>
> hdmi_ignore_edid=0xa5000080
> hdmi_group=2
> hdmi_mode=85
>
> With this config, I see no issues with the troublesome monitor.
>
> It's just bizzarre :-)
>
>
>>
>>> ---
>>>   drivers/usb/eth/lan78xx.c | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/usb/eth/lan78xx.c b/drivers/usb/eth/lan78xx.c
>>> index c5ff379..e8ee665 100644
>>> --- a/drivers/usb/eth/lan78xx.c
>>> +++ b/drivers/usb/eth/lan78xx.c
>>> @@ -296,7 +296,7 @@ static int lan78xx_basic_reset(struct usb_device
>>> *udev,
>>>          ret = lan7x_read_reg(udev, LAN78XX_USB_CFG0, &val);
>>>          if (ret)
>>>                  return ret;
>>> -       val |= LAN78XX_USB_CFG0_BIR;
>>> +       val &= ~LAN78XX_USB_CFG0_BIR;
>>>          return lan7x_write_reg(udev, LAN78XX_USB_CFG0, val);
>>>   }
>>>
>>> --
>>> 1.8.3.1
>>>
>>> _______________________________________________
>>> U-Boot mailing list
>>> U-Boot@lists.denx.de
>>> https://lists.denx.de/listinfo/u-boot
>
>
Alexander Graf June 26, 2018, 11:36 a.m. UTC | #4
On 06/18/2018 08:56 PM, Andrew Thomas wrote:
> This bug is the combination of dwc2 USB controller and lan78xx
> USB ethernet controller, which is the combination in use on
> the Raspberry Pi Model 3 B+.
>
> When the host attempts to receive a packet, but a packet has not
> arrived, the lan78xx controller responds by setting BIR
> (Bulk-In Empty Response) to NAK. Unfortunately, this hangs
> the USB controller and requires the USB controller to
> be reset.
>
> The fix proposed is to have the lan78xx controller respond
> by setting BIR to ZLP.
>
> Signed-off-by: Andrew Thomas <andrew.thomas@oracle.com>

So why does this work for Linux? I can see that Linux also sets the BIR 
flag, so why don't we see the hang there?


Alex

> ---
>   drivers/usb/eth/lan78xx.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/eth/lan78xx.c b/drivers/usb/eth/lan78xx.c
> index c5ff379..e8ee665 100644
> --- a/drivers/usb/eth/lan78xx.c
> +++ b/drivers/usb/eth/lan78xx.c
> @@ -296,7 +296,7 @@ static int lan78xx_basic_reset(struct usb_device *udev,
>   	ret = lan7x_read_reg(udev, LAN78XX_USB_CFG0, &val);
>   	if (ret)
>   		return ret;
> -	val |= LAN78XX_USB_CFG0_BIR;
> +	val &= ~LAN78XX_USB_CFG0_BIR;
>   	return lan7x_write_reg(udev, LAN78XX_USB_CFG0, val);
>   }
>
Alexander Graf June 26, 2018, 12:34 p.m. UTC | #5
On 06/21/2018 10:37 AM, Peter Robinson wrote:
> On Mon, Jun 18, 2018 at 7:56 PM, Andrew Thomas <andrew.thomas@oracle.com> wrote:
>> This bug is the combination of dwc2 USB controller and lan78xx
>> USB ethernet controller, which is the combination in use on
>> the Raspberry Pi Model 3 B+.
>>
>> When the host attempts to receive a packet, but a packet has not
>> arrived, the lan78xx controller responds by setting BIR
>> (Bulk-In Empty Response) to NAK. Unfortunately, this hangs
>> the USB controller and requires the USB controller to
>> be reset.
>>
>> The fix proposed is to have the lan78xx controller respond
>> by setting BIR to ZLP.
>>
>> Signed-off-by: Andrew Thomas <andrew.thomas@oracle.com>
> Tested-by: Peter Robinson <pbrobinson@gmail.com>
>
> Tested on the RPi 3B+ and certainly improves this situation a number
> of Fedora users have seen.


What exactly have you tested?

Even with this patch, I am not reliably to reliably boot into grub. It 
almost seems as if the packet buffer keeps getting overwritten by newer 
packets so that by the time we process the old ones, the ones we wanted 
to see are gone.


Alex
Peter Robinson June 26, 2018, 12:47 p.m. UTC | #6
>>> This bug is the combination of dwc2 USB controller and lan78xx
>>> USB ethernet controller, which is the combination in use on
>>> the Raspberry Pi Model 3 B+.
>>>
>>> When the host attempts to receive a packet, but a packet has not
>>> arrived, the lan78xx controller responds by setting BIR
>>> (Bulk-In Empty Response) to NAK. Unfortunately, this hangs
>>> the USB controller and requires the USB controller to
>>> be reset.
>>>
>>> The fix proposed is to have the lan78xx controller respond
>>> by setting BIR to ZLP.
>>>
>>> Signed-off-by: Andrew Thomas <andrew.thomas@oracle.com>
>>
>> Tested-by: Peter Robinson <pbrobinson@gmail.com>
>>
>> Tested on the RPi 3B+ and certainly improves this situation a number
>> of Fedora users have seen.
>
>
>
> What exactly have you tested?
>
> Even with this patch, I am not reliably to reliably boot into grub. It
> almost seems as if the packet buffer keeps getting overwritten by newer
> packets so that by the time we process the old ones, the ones we wanted to
> see are gone.

Booting to grub and then a local system, it's seemed improved in terms
of stability for me and a few other users, at least was more
consistent in getting to grub without "Rx: failed to receive: -5" but
then from the various testing different Fedora users have seen prior
to this patch it seems that the issue is very
network/cable/environment specific. I'm fairly certain that this patch
doesn't fix the problem but it at least appears from current reports
to improve the situation for some users.

Peter
Alexander Graf June 26, 2018, 3:55 p.m. UTC | #7
On 06/26/2018 02:47 PM, Peter Robinson wrote:
>>>> This bug is the combination of dwc2 USB controller and lan78xx
>>>> USB ethernet controller, which is the combination in use on
>>>> the Raspberry Pi Model 3 B+.
>>>>
>>>> When the host attempts to receive a packet, but a packet has not
>>>> arrived, the lan78xx controller responds by setting BIR
>>>> (Bulk-In Empty Response) to NAK. Unfortunately, this hangs
>>>> the USB controller and requires the USB controller to
>>>> be reset.
>>>>
>>>> The fix proposed is to have the lan78xx controller respond
>>>> by setting BIR to ZLP.
>>>>
>>>> Signed-off-by: Andrew Thomas <andrew.thomas@oracle.com>
>>> Tested-by: Peter Robinson <pbrobinson@gmail.com>
>>>
>>> Tested on the RPi 3B+ and certainly improves this situation a number
>>> of Fedora users have seen.
>>
>>
>> What exactly have you tested?
>>
>> Even with this patch, I am not reliably to reliably boot into grub. It
>> almost seems as if the packet buffer keeps getting overwritten by newer
>> packets so that by the time we process the old ones, the ones we wanted to
>> see are gone.
> Booting to grub and then a local system, it's seemed improved in terms
> of stability for me and a few other users, at least was more
> consistent in getting to grub without "Rx: failed to receive: -5" but
> then from the various testing different Fedora users have seen prior
> to this patch it seems that the issue is very
> network/cable/environment specific. I'm fairly certain that this patch
> doesn't fix the problem but it at least appears from current reports
> to improve the situation for some users.

Improve, yes, but not solve it to a point where it's fully usable. And I 
don't think we have a full grasp on what's broken yet.

What I'm seeing here is that booting grub stalls within early bootup 
(where it loads modules) until I press any key on serial. Pressing a key 
on a USB keyboard does not help.

Given that there are no interrupts enabled on the RPi at this point, I 
can only think of caches as the culprit for this breakage. But why did 
it work with the normal 3B then?


Alex
Peter Robinson June 26, 2018, 4:09 p.m. UTC | #8
On Tue, Jun 26, 2018 at 4:55 PM, Alexander Graf <agraf@suse.de> wrote:
> On 06/26/2018 02:47 PM, Peter Robinson wrote:
>>>>>
>>>>> This bug is the combination of dwc2 USB controller and lan78xx
>>>>> USB ethernet controller, which is the combination in use on
>>>>> the Raspberry Pi Model 3 B+.
>>>>>
>>>>> When the host attempts to receive a packet, but a packet has not
>>>>> arrived, the lan78xx controller responds by setting BIR
>>>>> (Bulk-In Empty Response) to NAK. Unfortunately, this hangs
>>>>> the USB controller and requires the USB controller to
>>>>> be reset.
>>>>>
>>>>> The fix proposed is to have the lan78xx controller respond
>>>>> by setting BIR to ZLP.
>>>>>
>>>>> Signed-off-by: Andrew Thomas <andrew.thomas@oracle.com>
>>>>
>>>> Tested-by: Peter Robinson <pbrobinson@gmail.com>
>>>>
>>>> Tested on the RPi 3B+ and certainly improves this situation a number
>>>> of Fedora users have seen.
>>>
>>>
>>>
>>> What exactly have you tested?
>>>
>>> Even with this patch, I am not reliably to reliably boot into grub. It
>>> almost seems as if the packet buffer keeps getting overwritten by newer
>>> packets so that by the time we process the old ones, the ones we wanted
>>> to
>>> see are gone.
>>
>> Booting to grub and then a local system, it's seemed improved in terms
>> of stability for me and a few other users, at least was more
>> consistent in getting to grub without "Rx: failed to receive: -5" but
>> then from the various testing different Fedora users have seen prior
>> to this patch it seems that the issue is very
>> network/cable/environment specific. I'm fairly certain that this patch
>> doesn't fix the problem but it at least appears from current reports
>> to improve the situation for some users.
>
>
> Improve, yes, but not solve it to a point where it's fully usable. And I
> don't think we have a full grasp on what's broken yet.

I completely agree, it makes the problem go away for a number of users
so it's not completely terrible and less people bothering me is a good
start IMO even if it's not the final fix.

> What I'm seeing here is that booting grub stalls within early bootup (where
> it loads modules) until I press any key on serial. Pressing a key on a USB
> keyboard does not help.
>
> Given that there are no interrupts enabled on the RPi at this point, I can
> only think of caches as the culprit for this breakage. But why did it work
> with the normal 3B then?

Different USB NIC, maybe the usb3 interface has a different impact on
the dwc2 interface. The lan78xx driver seemed to have had little use
in general before it landed in the 3B+ and had numerous issues in the
Linux driver that have been quickly addressed so I figured that the
u-boot driver is probably just as terrible. Due to other commitments
I've had little time to investigate that theory further though as my
understanding of low level usb isn't huge.

Peter
andrew thomas June 26, 2018, 6:28 p.m. UTC | #9
On 06/26/2018 04:36 AM, Alexander Graf wrote:
> On 06/18/2018 08:56 PM, Andrew Thomas wrote:
>> This bug is the combination of dwc2 USB controller and lan78xx
>> USB ethernet controller, which is the combination in use on
>> the Raspberry Pi Model 3 B+.
>>
>> When the host attempts to receive a packet, but a packet has not
>> arrived, the lan78xx controller responds by setting BIR
>> (Bulk-In Empty Response) to NAK. Unfortunately, this hangs
>> the USB controller and requires the USB controller to
>> be reset.
>>
>> The fix proposed is to have the lan78xx controller respond
>> by setting BIR to ZLP.
>>
>> Signed-off-by: Andrew Thomas <andrew.thomas@oracle.com>
>
> So why does this work for Linux? I can see that Linux also sets the 
> BIR flag, so why don't we see the hang there?

Although I proposed a fix to the lan78xx controller, I didn't mean to
identify it as the culprit :-)

I don't understand the interaction of the dwc2 and lan78xx controller.

Maybe BIR works for linux, because the dwc2 controller sets up the USB
host interface "differently"? It's just a guess...

Maybe we can coax the lan78xx driver writer into looking into this issue?
[CCing Yuiko Oshino.]

Andrew


>
>
> Alex
>
>> ---
>>   drivers/usb/eth/lan78xx.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/eth/lan78xx.c b/drivers/usb/eth/lan78xx.c
>> index c5ff379..e8ee665 100644
>> --- a/drivers/usb/eth/lan78xx.c
>> +++ b/drivers/usb/eth/lan78xx.c
>> @@ -296,7 +296,7 @@ static int lan78xx_basic_reset(struct usb_device 
>> *udev,
>>       ret = lan7x_read_reg(udev, LAN78XX_USB_CFG0, &val);
>>       if (ret)
>>           return ret;
>> -    val |= LAN78XX_USB_CFG0_BIR;
>> +    val &= ~LAN78XX_USB_CFG0_BIR;
>>       return lan7x_write_reg(udev, LAN78XX_USB_CFG0, val);
>>   }
>
>
andrew thomas June 26, 2018, 6:57 p.m. UTC | #10
On 06/26/2018 05:34 AM, Alexander Graf wrote:
> On 06/21/2018 10:37 AM, Peter Robinson wrote:
>> On Mon, Jun 18, 2018 at 7:56 PM, Andrew Thomas 
>> <andrew.thomas@oracle.com> wrote:
>>> This bug is the combination of dwc2 USB controller and lan78xx
>>> USB ethernet controller, which is the combination in use on
>>> the Raspberry Pi Model 3 B+.
>>>
>>> When the host attempts to receive a packet, but a packet has not
>>> arrived, the lan78xx controller responds by setting BIR
>>> (Bulk-In Empty Response) to NAK. Unfortunately, this hangs
>>> the USB controller and requires the USB controller to
>>> be reset.
>>>
>>> The fix proposed is to have the lan78xx controller respond
>>> by setting BIR to ZLP.
>>>
>>> Signed-off-by: Andrew Thomas <andrew.thomas@oracle.com>
>> Tested-by: Peter Robinson <pbrobinson@gmail.com>
>>
>> Tested on the RPi 3B+ and certainly improves this situation a number
>> of Fedora users have seen.
>
>
> What exactly have you tested?
>
> Even with this patch, I am not reliably to reliably boot into grub.

Can you say which version of grub? I am using the gcdaa64.efi binary in this
RPM:

http://yum.oracle.com/repo/OracleLinux/OL7/latest/aarch64/getPackage/grub2-efi-aa64-cdboot-2.02-0.65.0.8.el7_4.2.aarch64.rpm

The same binary is named EFI/BOOT/grubaa64.efi on the "ISO" CD/DVD
install image -- the point, for me, of getting the lan controller 
"functioning"
is to allow network kickstart install.

I have had a peculiar USB/lan problem with a DVI monitor attached; while 
a different brand
HDMI monitor worked OK.

FWIW: I use fairly recent "firmware":

https://github.com/raspberrypi/firmware
eeaaf5e2b5aee29f31e989c0dddd186fb68b2144

And in the u-boot configuration I have:

CONFIG_OF_BOARD=y
# CONFIG_OF_EMBED is not set

As an aside, I did post [to this list] a related fix ARP for efi 
networking...

> It almost seems as if the packet buffer keeps getting overwritten by 
> newer packets so that by the time we process the old ones, the ones we 
> wanted to see are gone.
>

 From the polling structure of the EFI networking code, it seems
inevitable that some packets would be lost on a busy network??

I have to admit that I had both the Pi and dhcp/tftp server on a
"silent" lan.

I should also mention that while trying to debug this issue, the lan
driver would occasionally receive what appeared to be bogus frames -- 
with packet
sizes which made absolutely no sense as jumbo frames are not enabled
on the switch to which the PI is attached...
Alexander Graf June 27, 2018, 4:45 p.m. UTC | #11
On 06/26/2018 08:57 PM, andrew thomas wrote:
> On 06/26/2018 05:34 AM, Alexander Graf wrote:
>> On 06/21/2018 10:37 AM, Peter Robinson wrote:
>>> On Mon, Jun 18, 2018 at 7:56 PM, Andrew Thomas 
>>> <andrew.thomas@oracle.com> wrote:
>>>> This bug is the combination of dwc2 USB controller and lan78xx
>>>> USB ethernet controller, which is the combination in use on
>>>> the Raspberry Pi Model 3 B+.
>>>>
>>>> When the host attempts to receive a packet, but a packet has not
>>>> arrived, the lan78xx controller responds by setting BIR
>>>> (Bulk-In Empty Response) to NAK. Unfortunately, this hangs
>>>> the USB controller and requires the USB controller to
>>>> be reset.
>>>>
>>>> The fix proposed is to have the lan78xx controller respond
>>>> by setting BIR to ZLP.
>>>>
>>>> Signed-off-by: Andrew Thomas <andrew.thomas@oracle.com>
>>> Tested-by: Peter Robinson <pbrobinson@gmail.com>
>>>
>>> Tested on the RPi 3B+ and certainly improves this situation a number
>>> of Fedora users have seen.
>>
>>
>> What exactly have you tested?
>>
>> Even with this patch, I am not reliably to reliably boot into grub.
>
> Can you say which version of grub? 

I actually see the same effect on an old RPi3 B, so it's not lan7x 
specific. We also have the exact same fix for the old 100Mbit/s LAN 
adapter, so I think this fix is certainly moving us into the right 
direction.

Reviewed-by: Alexander Graf <agraf@suse.de>

Tom, can you please pull it in for 2018.07 still?


Thanks!

Alex
Tom Rini June 27, 2018, 5:07 p.m. UTC | #12
On Wed, Jun 27, 2018 at 06:45:39PM +0200, Alexander Graf wrote:
> On 06/26/2018 08:57 PM, andrew thomas wrote:
> >On 06/26/2018 05:34 AM, Alexander Graf wrote:
> >>On 06/21/2018 10:37 AM, Peter Robinson wrote:
> >>>On Mon, Jun 18, 2018 at 7:56 PM, Andrew Thomas
> >>><andrew.thomas@oracle.com> wrote:
> >>>>This bug is the combination of dwc2 USB controller and lan78xx
> >>>>USB ethernet controller, which is the combination in use on
> >>>>the Raspberry Pi Model 3 B+.
> >>>>
> >>>>When the host attempts to receive a packet, but a packet has not
> >>>>arrived, the lan78xx controller responds by setting BIR
> >>>>(Bulk-In Empty Response) to NAK. Unfortunately, this hangs
> >>>>the USB controller and requires the USB controller to
> >>>>be reset.
> >>>>
> >>>>The fix proposed is to have the lan78xx controller respond
> >>>>by setting BIR to ZLP.
> >>>>
> >>>>Signed-off-by: Andrew Thomas <andrew.thomas@oracle.com>
> >>>Tested-by: Peter Robinson <pbrobinson@gmail.com>
> >>>
> >>>Tested on the RPi 3B+ and certainly improves this situation a number
> >>>of Fedora users have seen.
> >>
> >>
> >>What exactly have you tested?
> >>
> >>Even with this patch, I am not reliably to reliably boot into grub.
> >
> >Can you say which version of grub?
> 
> I actually see the same effect on an old RPi3 B, so it's not lan7x specific.
> We also have the exact same fix for the old 100Mbit/s LAN adapter, so I
> think this fix is certainly moving us into the right direction.
> 
> Reviewed-by: Alexander Graf <agraf@suse.de>
> 
> Tom, can you please pull it in for 2018.07 still?

Do you have anything else Pi-related to go in?  If not, I'll grab it
directly, otherwise send me a PR, thanks!
Alexander Graf June 27, 2018, 10:47 p.m. UTC | #13
On 27.06.18 19:07, Tom Rini wrote:
> On Wed, Jun 27, 2018 at 06:45:39PM +0200, Alexander Graf wrote:
>> On 06/26/2018 08:57 PM, andrew thomas wrote:
>>> On 06/26/2018 05:34 AM, Alexander Graf wrote:
>>>> On 06/21/2018 10:37 AM, Peter Robinson wrote:
>>>>> On Mon, Jun 18, 2018 at 7:56 PM, Andrew Thomas
>>>>> <andrew.thomas@oracle.com> wrote:
>>>>>> This bug is the combination of dwc2 USB controller and lan78xx
>>>>>> USB ethernet controller, which is the combination in use on
>>>>>> the Raspberry Pi Model 3 B+.
>>>>>>
>>>>>> When the host attempts to receive a packet, but a packet has not
>>>>>> arrived, the lan78xx controller responds by setting BIR
>>>>>> (Bulk-In Empty Response) to NAK. Unfortunately, this hangs
>>>>>> the USB controller and requires the USB controller to
>>>>>> be reset.
>>>>>>
>>>>>> The fix proposed is to have the lan78xx controller respond
>>>>>> by setting BIR to ZLP.
>>>>>>
>>>>>> Signed-off-by: Andrew Thomas <andrew.thomas@oracle.com>
>>>>> Tested-by: Peter Robinson <pbrobinson@gmail.com>
>>>>>
>>>>> Tested on the RPi 3B+ and certainly improves this situation a number
>>>>> of Fedora users have seen.
>>>>
>>>>
>>>> What exactly have you tested?
>>>>
>>>> Even with this patch, I am not reliably to reliably boot into grub.
>>>
>>> Can you say which version of grub?
>>
>> I actually see the same effect on an old RPi3 B, so it's not lan7x specific.
>> We also have the exact same fix for the old 100Mbit/s LAN adapter, so I
>> think this fix is certainly moving us into the right direction.
>>
>> Reviewed-by: Alexander Graf <agraf@suse.de>
>>
>> Tom, can you please pull it in for 2018.07 still?
> 
> Do you have anything else Pi-related to go in?  If not, I'll grab it
> directly, otherwise send me a PR, thanks!

It's the only patch I'd have left for this release. Please just apply it
directly.


Thanks!

Alex
Tom Rini June 28, 2018, 12:49 p.m. UTC | #14
On Mon, Jun 18, 2018 at 11:56:06AM -0700, Andrew Thomas wrote:

> This bug is the combination of dwc2 USB controller and lan78xx
> USB ethernet controller, which is the combination in use on
> the Raspberry Pi Model 3 B+.
> 
> When the host attempts to receive a packet, but a packet has not
> arrived, the lan78xx controller responds by setting BIR
> (Bulk-In Empty Response) to NAK. Unfortunately, this hangs
> the USB controller and requires the USB controller to
> be reset.
> 
> The fix proposed is to have the lan78xx controller respond
> by setting BIR to ZLP.
> 
> Signed-off-by: Andrew Thomas <andrew.thomas@oracle.com>
> Tested-by: Peter Robinson <pbrobinson@gmail.com>
> Reviewed-by: Alexander Graf <agraf@suse.de>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/drivers/usb/eth/lan78xx.c b/drivers/usb/eth/lan78xx.c
index c5ff379..e8ee665 100644
--- a/drivers/usb/eth/lan78xx.c
+++ b/drivers/usb/eth/lan78xx.c
@@ -296,7 +296,7 @@  static int lan78xx_basic_reset(struct usb_device *udev,
 	ret = lan7x_read_reg(udev, LAN78XX_USB_CFG0, &val);
 	if (ret)
 		return ret;
-	val |= LAN78XX_USB_CFG0_BIR;
+	val &= ~LAN78XX_USB_CFG0_BIR;
 	return lan7x_write_reg(udev, LAN78XX_USB_CFG0, val);
 }