[Letux-kernel] [PATCH 0/3] MIPS: CI20: USB EHCI/OHCI
H. Nikolaus Schaller
hns at goldelico.com
Sat Sep 26 10:41:44 CEST 2020
Hi Paul,
> Am 26.09.2020 um 10:27 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
>
>
>> Am 26.09.2020 um 10:10 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
>>
>>>
>>> Am 26.09.2020 um 08:21 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
>>>
>>>
>>>> Am 25.09.2020 um 22:55 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
>>>>
>>>>
>>>>> Am 25.09.2020 um 22:53 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
>>>>>
>>>>> I still get the problem with "usb usb2-port1: Cannot enable. Maybe the USB cable is bad?".
>>>>>
>>>>> Some analysis shows that this code returns -EBUSY:
>>>>>
>>>>> https://elixir.bootlin.com/linux/latest/source/drivers/usb/core/hub.c#L2825
>>>>>
>>>>> which means the port is not enabled (portstatus == 0x101).
>>>>>
>>>>> Since this is coming from some USB communication message
>>>>> (https://elixir.bootlin.com/linux/latest/source/drivers/usb/core/hub.c#L566),
>>>>> I think it is not related to our drivers.
>>>>>
>>>>> Could it be that the EHCI/OHCI do not have the clock running? This could
>>>>> IMHO result in no response or the module not being enabled.
>>>>
>>>> Or is it not allowed to share the phy between ehci and ohci?
>>>> This is something which may be tested easily by disabling either one.
>>>
>>> Ok, if I have EHCI only, the message is gone. But EHCI alone doesn't show a connected device.
>>> If I have OHCI only, the message is back.
>>
>> I have found something by comparing jz4740.dtsi. This also has
>>
>> assigned-clocks = <&cgu JZ4740_CLK_UHC>;
>> assigned-clock-rates = <48000000>;
>>
>> Unfortunately adding this (with JZ4780_CLK_UHC) makes no difference:
>>
>> root at letux:~# dmesg|fgrep 'usb usb1-port1'
>> [ 11.115855] usb usb1-port1: Cannot enable. Maybe the USB cable is bad?
>> [ 12.666946] usb usb1-port1: Cannot enable. Maybe the USB cable is bad?
>> [ 12.719847] usb usb1-port1: attempt power cycle
>> [ 14.883641] usb usb1-port1: Cannot enable. Maybe the USB cable is bad?
>> [ 17.270381] usb usb1-port1: Cannot enable. Maybe the USB cable is bad?
>> [ 17.334813] usb usb1-port1: unable to enumerate USB device
>> root at letux:~# lsusb
>> Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
>> Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
>> root at letux:~#
>>
>> So to summarise what we know:
>> * error message comes from OHCI driver after several attempts (incl. power cycle)
>> * specifically from get_port_status() [which sends some URB]
>> * portstatus = 0x101 and therefore USB_PORT_STAT_ENABLE (0x0002) is false
>> * does not depend on EHCI "okay" or "disabled"
>> * assigned-clocks does not help
>> * phy-names doesn't seem to have an influence
>> * 1.1 root hub is initialized
>> * power is on (I have my LCD panel/touch screen connected and would expect to see the touch device)
> * hub_port_connect() is called when plugging/unplugging the device
>
> This means that the USB-PHY is almost working and detecting plug events. Only communication to enumerate the device is failing.
> This seems to be a positive effect of using the assigned-clocks. Have to cross-check. No. Doesn't matter.
>
> Theoretically my board hardware could be broken... I can verify this by booting the NAND kernel. Yes, works there.
>
> So we are missing just one bit in portstatus...
>
>>
>> Ideas and suggestions are welcome :)
If you find a little time to experiment with my code on your CI20:
https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/work-jz4780%2Busb
Please use letux_defconfig.
BR and thanks,
Nikolaus
More information about the Letux-kernel
mailing list