All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/1] dwc2 USB controller hangs with lan78xx
@ 2018-06-18 18:56 Andrew Thomas
  2018-06-18 18:56 ` [U-Boot] [PATCH 1/1] " Andrew Thomas
  0 siblings, 1 reply; 16+ messages in thread
From: Andrew Thomas @ 2018-06-18 18:56 UTC (permalink / raw)
  To: u-boot

In testing networking with EFI/u-boot, there is an issue where the dwc2
USB controller will hang -- requiring an USB reset. The issue appears to
be the programming of the "Bulk-In Empty Response" in the lan78xx
controller. The patch is a suggested fix.

However, I am not familiar enough with neither the lan78xx nor the
dwc2 to know whether this is the best, or even most appropriate,
fix.

The issue arises readily with EFI/u-boot programs, such
as grub: the uboot EFI code will periodically poll the network adapter
to see if it has received a packet. Generally speaking no packet has
arrived and the attempt to receive will immediatly hang the dwc2
controller. The console will show this message:

Rx: failed to receive: -5

Interestingly, the issue will not arise with request/response protocols,
such as u-boot's dhcp command.


Andrew Thomas (1):
  dwc2 USB controller hangs with lan78xx

 drivers/usb/eth/lan78xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 1/1] dwc2 USB controller hangs with lan78xx
  2018-06-18 18:56 [U-Boot] [PATCH 0/1] dwc2 USB controller hangs with lan78xx Andrew Thomas
@ 2018-06-18 18:56 ` Andrew Thomas
  2018-06-21  8:37   ` Peter Robinson
                     ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Andrew Thomas @ 2018-06-18 18:56 UTC (permalink / raw)
  To: u-boot

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(-)

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

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 1/1] dwc2 USB controller hangs with lan78xx
  2018-06-18 18:56 ` [U-Boot] [PATCH 1/1] " Andrew Thomas
@ 2018-06-21  8:37   ` Peter Robinson
  2018-06-21 23:05     ` andrew thomas
  2018-06-26 12:34     ` Alexander Graf
  2018-06-26 11:36   ` Alexander Graf
  2018-06-28 12:49   ` [U-Boot] [U-Boot,1/1] " Tom Rini
  2 siblings, 2 replies; 16+ messages in thread
From: Peter Robinson @ 2018-06-21  8:37 UTC (permalink / raw)
  To: u-boot

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 at lists.denx.de
> https://lists.denx.de/listinfo/u-boot

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 1/1] dwc2 USB controller hangs with lan78xx
  2018-06-21  8:37   ` Peter Robinson
@ 2018-06-21 23:05     ` andrew thomas
  2018-06-22  6:37       ` Peter Robinson
  2018-06-26 12:34     ` Alexander Graf
  1 sibling, 1 reply; 16+ messages in thread
From: andrew thomas @ 2018-06-21 23:05 UTC (permalink / raw)
  To: u-boot

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 at lists.denx.de
>> https://lists.denx.de/listinfo/u-boot

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 1/1] dwc2 USB controller hangs with lan78xx
  2018-06-21 23:05     ` andrew thomas
@ 2018-06-22  6:37       ` Peter Robinson
  0 siblings, 0 replies; 16+ messages in thread
From: Peter Robinson @ 2018-06-22  6:37 UTC (permalink / raw)
  To: u-boot

>>> 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 at lists.denx.de
>>> https://lists.denx.de/listinfo/u-boot
>
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 1/1] dwc2 USB controller hangs with lan78xx
  2018-06-18 18:56 ` [U-Boot] [PATCH 1/1] " Andrew Thomas
  2018-06-21  8:37   ` Peter Robinson
@ 2018-06-26 11:36   ` Alexander Graf
  2018-06-26 18:28     ` andrew thomas
  2018-06-28 12:49   ` [U-Boot] [U-Boot,1/1] " Tom Rini
  2 siblings, 1 reply; 16+ messages in thread
From: Alexander Graf @ 2018-06-26 11:36 UTC (permalink / raw)
  To: u-boot

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);
>   }
>   

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 1/1] dwc2 USB controller hangs with lan78xx
  2018-06-21  8:37   ` Peter Robinson
  2018-06-21 23:05     ` andrew thomas
@ 2018-06-26 12:34     ` Alexander Graf
  2018-06-26 12:47       ` Peter Robinson
  2018-06-26 18:57       ` andrew thomas
  1 sibling, 2 replies; 16+ messages in thread
From: Alexander Graf @ 2018-06-26 12:34 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 1/1] dwc2 USB controller hangs with lan78xx
  2018-06-26 12:34     ` Alexander Graf
@ 2018-06-26 12:47       ` Peter Robinson
  2018-06-26 15:55         ` Alexander Graf
  2018-06-26 18:57       ` andrew thomas
  1 sibling, 1 reply; 16+ messages in thread
From: Peter Robinson @ 2018-06-26 12:47 UTC (permalink / raw)
  To: u-boot

>>> 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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 1/1] dwc2 USB controller hangs with lan78xx
  2018-06-26 12:47       ` Peter Robinson
@ 2018-06-26 15:55         ` Alexander Graf
  2018-06-26 16:09           ` Peter Robinson
  0 siblings, 1 reply; 16+ messages in thread
From: Alexander Graf @ 2018-06-26 15:55 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 1/1] dwc2 USB controller hangs with lan78xx
  2018-06-26 15:55         ` Alexander Graf
@ 2018-06-26 16:09           ` Peter Robinson
  0 siblings, 0 replies; 16+ messages in thread
From: Peter Robinson @ 2018-06-26 16:09 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 1/1] dwc2 USB controller hangs with lan78xx
  2018-06-26 11:36   ` Alexander Graf
@ 2018-06-26 18:28     ` andrew thomas
  0 siblings, 0 replies; 16+ messages in thread
From: andrew thomas @ 2018-06-26 18:28 UTC (permalink / raw)
  To: u-boot

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);
>>   }
>
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 1/1] dwc2 USB controller hangs with lan78xx
  2018-06-26 12:34     ` Alexander Graf
  2018-06-26 12:47       ` Peter Robinson
@ 2018-06-26 18:57       ` andrew thomas
  2018-06-27 16:45         ` Alexander Graf
  1 sibling, 1 reply; 16+ messages in thread
From: andrew thomas @ 2018-06-26 18:57 UTC (permalink / raw)
  To: u-boot

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...

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 1/1] dwc2 USB controller hangs with lan78xx
  2018-06-26 18:57       ` andrew thomas
@ 2018-06-27 16:45         ` Alexander Graf
  2018-06-27 17:07           ` Tom Rini
  0 siblings, 1 reply; 16+ messages in thread
From: Alexander Graf @ 2018-06-27 16:45 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 1/1] dwc2 USB controller hangs with lan78xx
  2018-06-27 16:45         ` Alexander Graf
@ 2018-06-27 17:07           ` Tom Rini
  2018-06-27 22:47             ` Alexander Graf
  0 siblings, 1 reply; 16+ messages in thread
From: Tom Rini @ 2018-06-27 17:07 UTC (permalink / raw)
  To: u-boot

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!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180627/5dee0f77/attachment.sig>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 1/1] dwc2 USB controller hangs with lan78xx
  2018-06-27 17:07           ` Tom Rini
@ 2018-06-27 22:47             ` Alexander Graf
  0 siblings, 0 replies; 16+ messages in thread
From: Alexander Graf @ 2018-06-27 22:47 UTC (permalink / raw)
  To: u-boot



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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [U-Boot,1/1] dwc2 USB controller hangs with lan78xx
  2018-06-18 18:56 ` [U-Boot] [PATCH 1/1] " Andrew Thomas
  2018-06-21  8:37   ` Peter Robinson
  2018-06-26 11:36   ` Alexander Graf
@ 2018-06-28 12:49   ` Tom Rini
  2 siblings, 0 replies; 16+ messages in thread
From: Tom Rini @ 2018-06-28 12:49 UTC (permalink / raw)
  To: u-boot

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!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180628/82ee4dba/attachment.sig>

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2018-06-28 12:49 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-18 18:56 [U-Boot] [PATCH 0/1] dwc2 USB controller hangs with lan78xx Andrew Thomas
2018-06-18 18:56 ` [U-Boot] [PATCH 1/1] " Andrew Thomas
2018-06-21  8:37   ` Peter Robinson
2018-06-21 23:05     ` andrew thomas
2018-06-22  6:37       ` Peter Robinson
2018-06-26 12:34     ` Alexander Graf
2018-06-26 12:47       ` Peter Robinson
2018-06-26 15:55         ` Alexander Graf
2018-06-26 16:09           ` Peter Robinson
2018-06-26 18:57       ` andrew thomas
2018-06-27 16:45         ` Alexander Graf
2018-06-27 17:07           ` Tom Rini
2018-06-27 22:47             ` Alexander Graf
2018-06-26 11:36   ` Alexander Graf
2018-06-26 18:28     ` andrew thomas
2018-06-28 12:49   ` [U-Boot] [U-Boot,1/1] " Tom Rini

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.