[Letux-kernel] [PATCH 2/5] DTS: MIPS: JZ4780: add USB PHY&OTG
Zhou Yanjie
zhouyanjie at wanyeetech.com
Mon Sep 21 18:36:22 CEST 2020
Hi Nikolaus,
在 2020/9/21 下午3:26, H. Nikolaus Schaller 写道:
>> Am 21.09.2020 um 07:39 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
>>
>> Hi Zhou,
>>
>>> Am 20.09.2020 um 18:08 schrieb Zhou Yanjie <zhouyanjie at wanyeetech.com>:
>>>
>>> Hi,
>>>
>>>>> There should be a jz4780-phy in the kernel 5.9.
>>>> I have merged your patch "usb: phy: add driver for Ingenic XBurst SoCs." from the e-mail Wed, 27 May 2020 16:24:29 +0800.
>>>> This one only defines ingenic,jz4770-phy, ingenic,x1000-phy and ingenic,x1830-phy in ingenic_usb_phy_of_matches.
>>>
>>> Ah, you don't need to do this. This patch has already been merged into 5.9. It should be used directly in 5.9-rc5, but the name of this driver has changed to jz4770-phy, because Paul had done some work in advance before I submitting my patch. So the new patch continues to use the filename of his driver.
>> I have now switched to the upstream driver but still no difference:
>>
>> root at letux:~# lsmod|fgrep phy
>> phy_jz4770 4865 0
>> root at letux:~# ls -l /sys/class/phy
>> total 0
>> root at letux:~#
>>
>> What I wonder is how it should work if the driver does a usb_add_phy()
>> while dwc2 doesn't seem to use it.
>>
>> Ah, I have an idea. There is a comment in dwc2_lowlevel_hw_init():
>>
>> /*
>> * Attempt to find a generic PHY, then look for an old style
>> * USB PHY and then fall back to pdata
>> */
>>
>> Obviously we have an "old style USB PHY" driver.
>>
>> And what I found is that the generic phy lookup returns EPROBE_DEFER
>> because it is waiting for a generic PHY, which makes dwc2 also defer.
>> IMHO the logic isn't perfect for the probe deferral case...
>>
>> So the bug seem to be that we define a generic phy for dwc2 but have an old
>> style PHY driver.
>>
>> Indeed, removing phy-names from DT changes the boot log to fail somewhere
>> else:
>>
>> [ 15.327775] dwc2 13500000.usb: dwc2_hcd_init() FAILED, returning -517
> This seems to come from
>
> https://elixir.bootlin.com/linux/v5.9-rc5/source/drivers/usb/core/phy.c#L49
>
> in usb_phy_roothub_alloc() where again the code looks for the "phys" property
> and waits for successful probe.
>
> IMHO we should think about making it a "generic PHY" driver.
>
> So maybe disabling "phy-names" is not enough and "phys" must also be removed.
> AND the old style phy driver must probably be loaded before dwc2.
>
> Indeed:
>
> root at letux:~# lsusb
> Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> root at letux:~#
> root at letux:~# ls -l /sys/bus/usb
> total 0
> drwxr-xr-x 2 root root 0 Aug 17 20:28 devices
> drwxr-xr-x 7 root root 0 Aug 17 20:28 drivers
> -rw-r--r-- 1 root root 4096 Sep 21 07:14 drivers_autoprobe
> --w------- 1 root root 4096 Sep 21 07:14 drivers_probe
> --w------- 1 root root 4096 Aug 17 20:28 uevent
> root at letux:~# ls -l /sys/bus/usb/devices/
> total 0
> lrwxrwxrwx 1 root root 0 Sep 21 07:04 1-0:1.0 -> ../../../devices/platform/13500000.usb/usb1/1-0:1.0
> lrwxrwxrwx 1 root root 0 Sep 21 07:11 usb1 -> ../../../devices/platform/13500000.usb/usb1
> root at letux:~# ls -l /sys/bus/usb/devices/1-0\:1.0/
> total 0
> -rw-r--r-- 1 root root 4096 Sep 21 07:14 authorized
> -r--r--r-- 1 root root 4096 Sep 21 07:14 bAlternateSetting
> -r--r--r-- 1 root root 4096 Sep 21 07:04 bInterfaceClass
> -r--r--r-- 1 root root 4096 Sep 21 07:14 bInterfaceNumber
> -r--r--r-- 1 root root 4096 Sep 21 07:14 bInterfaceProtocol
> -r--r--r-- 1 root root 4096 Sep 21 07:14 bInterfaceSubClass
> -r--r--r-- 1 root root 4096 Sep 21 07:14 bNumEndpoints
> lrwxrwxrwx 1 root root 0 Sep 21 07:14 driver -> ../../../../../bus/usb/drivers/hub
> drwxr-xr-x 3 root root 0 Sep 21 07:13 ep_81
> -r--r--r-- 1 root root 4096 Sep 21 07:14 modalias
> lrwxrwxrwx 1 root root 0 Sep 21 07:14 of_node -> ../../../../../firmware/devicetree/base/usb at 13500000
> drwxr-xr-x 2 root root 0 Sep 21 07:04 power
> lrwxrwxrwx 1 root root 0 Sep 21 07:04 subsystem -> ../../../../../bus/usb
> -r--r--r-- 1 root root 4096 Sep 21 07:14 supports_autosuspend
> -rw-r--r-- 1 root root 4096 Sep 21 07:04 uevent
> drwxr-xr-x 3 root root 0 Sep 21 07:13 usb1-port1
> root at letux:~#
>
> But no activity when plugging a device. Maybe there is no host power
> for the memory stick.
>
> What *is* working is connecting the USB port to a host PC and running
> the CI20 in client mode (e.g. g_ether).
>
> That is already good progress!
Maybe you can try this patch. I tested it on CU1000-Neo and CU1830-Neo,
and it can works in host mode, but I haven't tested it on CI20. My CI20
won't be able to come back to me until the weekend.
Thanks and best regards!
>
> BR and thanks,
> Nikolaus
>
>
>> Still no /sys/class/phy record.
>>
>> BR,
>> Nikolaus
>>
>>
>> root at letux:~# dmesg|fgrep dwc2
>> [ 12.319785] dwc2_lowlevel_hw_init: 5
>> [ 12.323421] dwc2_lowlevel_hw_init: 6
>> [ 12.327067] dwc2 13500000.usb: Looking up vusb_d-supply from device tree
>> [ 12.333859] dwc2 13500000.usb: Looking up vusb_d-supply property in node /usb at 13500000 failed
>> [ 12.342510] dwc2 13500000.usb: supply vusb_d not found, using dummy regulator
>> [ 12.350049] dwc2 13500000.usb: Looking up vusb_a-supply from device tree
>> [ 12.356858] dwc2 13500000.usb: Looking up vusb_a-supply property in node /usb at 13500000 failed
>> [ 12.365497] dwc2 13500000.usb: supply vusb_a not found, using dummy regulator
>> [ 12.372839] dwc2_lowlevel_hw_init: 8
>> [ 12.289074] dwc2_driver_probe: 2
>> [ 12.292363] dwc2_driver_probe: 3
>> [ 12.295630] dwc2 13500000.usb: registering common handler for irq21
>> [ 12.301981] dwc2_driver_probe: 4
>> [ 12.305379] dwc2 13500000.usb: Looking up vbus-supply from device tree
>> [ 12.311969] dwc2 13500000.usb: Looking up vbus-supply property in node /usb at 13500000 failed
>> [ 12.320486] dwc2_driver_probe: 5
>> [ 12.338146] dwc2_driver_probe: 6
>> [ 12.341534] dwc2 13500000.usb: Core Release: 3.00a (snpsid=4f54300a)
>> [ 12.624737] dwc2 13500000.usb: EPs: 9, dedicated fifos, 3576 entries in SPRAM
>> [ 12.655942] dwc2 13500000.usb: dwc2_hcd_init() FAILED, returning -517
>> [ 12.662502] dwc2_driver_probe: error=-517
>> [ 12.667122] platform 13500000.usb: Driver dwc2 requests probe deferral
>> [ 12.678289] bus: 'platform': driver_probe_device: matched device 13500000.usb with driver dwc2
>> [ 12.730166] really_probe: driver dwc2
>> [ 12.747762] bus: 'platform': really_probe: probing driver dwc2 with device 13500000.usb
>> [ 12.794195] dwc2_driver_probe:
>> [ 12.797511] dwc2_driver_probe: 1
>> [ 12.814455] dwc2 13500000.usb: mapped PA 13500000 to VA 0c8ed106
>> [ 12.844477] dwc2_lowlevel_hw_init: 1
>> [ 12.864726] dwc2_lowlevel_hw_init: 2
>> [ 12.868363] dwc2_lowlevel_hw_init: 3
>> [ 13.027101] dwc2_lowlevel_hw_init: 5
>> [ 13.052951] dwc2_lowlevel_hw_init: 6
>> [ 13.056687] dwc2 13500000.usb: Looking up vusb_d-supply from device tree
>> [ 13.063483] dwc2 13500000.usb: Looking up vusb_d-supply property in node /usb at 13500000 failed
>> [ 13.072173] dwc2 13500000.usb: supply vusb_d not found, using dummy regulator
>> [ 12.992338] dwc2 13500000.usb: Looking up vusb_a-supply from device tree
>> [ 12.999197] dwc2 13500000.usb: Looking up vusb_a-supply property in node /usb at 13500000 failed
>> [ 13.007838] dwc2 13500000.usb: supply vusb_a not found, using dummy regulator
>> [ 13.015167] dwc2_lowlevel_hw_init: 8
>> [ 13.018966] dwc2_driver_probe: 2
>> [ 13.022394] dwc2_driver_probe: 3
>> [ 13.026045] dwc2 13500000.usb: registering common handler for irq21
>> [ 13.032517] dwc2_driver_probe: 4
>> [ 13.036225] dwc2 13500000.usb: Looking up vbus-supply from device tree
>> [ 13.043149] dwc2 13500000.usb: Looking up vbus-supply property in node /usb at 13500000 failed
>> [ 13.051747] dwc2_driver_probe: 5
>> [ 13.057754] dwc2_driver_probe: 6
>> [ 13.061199] dwc2 13500000.usb: Core Release: 3.00a (snpsid=4f54300a)
>> [ 13.234647] dwc2 13500000.usb: EPs: 9, dedicated fifos, 3576 entries in SPRAM
>> [ 13.270437] dwc2 13500000.usb: dwc2_hcd_init() FAILED, returning -517
>> [ 13.277959] dwc2_driver_probe: error=-517
>> [ 13.283002] platform 13500000.usb: Driver dwc2 requests probe deferral
>> [ 13.329910] bus: 'platform': driver_probe_device: matched device 13500000.usb with driver dwc2
>> [ 13.357786] really_probe: driver dwc2
>> [ 13.380354] bus: 'platform': really_probe: probing driver dwc2 with device 13500000.usb
>> [ 13.321334] dwc2_driver_probe:
>> [ 13.344235] dwc2_driver_probe: 1
>> [ 13.366395] dwc2 13500000.usb: mapped PA 13500000 to VA 0c8ed106
>> [ 13.420601] dwc2_lowlevel_hw_init: 1
>> [ 13.443810] dwc2_lowlevel_hw_init: 2
>> [ 13.466305] dwc2_lowlevel_hw_init: 3
>> [ 13.490111] dwc2_lowlevel_hw_init: 5
>> [ 13.424146] dwc2_lowlevel_hw_init: 6
>> [ 13.445866] dwc2 13500000.usb: Looking up vusb_d-supply from device tree
>> [ 13.470457] dwc2 13500000.usb: Looking up vusb_d-supply property in node /usb at 13500000 failed
>> [ 13.497089] dwc2 13500000.usb: supply vusb_d not found, using dummy regulator
>> [ 13.440366] dwc2 13500000.usb: Looking up vusb_a-supply from device tree
>> [ 13.465743] dwc2 13500000.usb: Looking up vusb_a-supply property in node /usb at 13500000 failed
>> [ 13.493701] dwc2 13500000.usb: supply vusb_a not found, using dummy regulator
>> [ 13.432199] dwc2_lowlevel_hw_init: 8
>> [ 13.469887] dwc2_driver_probe: 2
>> [ 13.490845] dwc2_driver_probe: 3
>> [ 13.510897] dwc2 13500000.usb: registering common handler for irq21
>> [ 13.534218] dwc2_driver_probe: 4
>> [ 13.554566] dwc2 13500000.usb: Looking up vbus-supply from device tree
>> [ 13.579086] dwc2 13500000.usb: Looking up vbus-supply property in node /usb at 13500000 failed
>> [ 13.518375] dwc2_driver_probe: 5
>> [ 13.543158] dwc2_driver_probe: 6
>> [ 13.564634] dwc2 13500000.usb: Core Release: 3.00a (snpsid=4f54300a)
>> [ 13.824711] dwc2 13500000.usb: EPs: 9, dedicated fifos, 3576 entries in SPRAM
>> [ 13.995787] dwc2 13500000.usb: dwc2_hcd_init() FAILED, returning -517
>> [ 13.931327] dwc2_driver_probe: error=-517
>> [ 13.952453] platform 13500000.usb: Driver dwc2 requests probe deferral
>> [ 13.994167] bus: 'platform': driver_probe_device: matched device 13500000.usb with driver dwc2
>> [ 14.020093] really_probe: driver dwc2
>> [ 14.040717] bus: 'platform': really_probe: probing driver dwc2 with device 13500000.usb
>> [ 14.068366] dwc2_driver_probe:
>> [ 14.089646] dwc2_driver_probe: 1
>> [ 14.111115] dwc2 13500000.usb: mapped PA 13500000 to VA 0c8ed106
>> [ 14.135690] dwc2_lowlevel_hw_init: 1
>> [ 14.158553] dwc2_lowlevel_hw_init: 2
>> [ 14.180690] dwc2_lowlevel_hw_init: 3
>> [ 14.285437] dwc2_lowlevel_hw_init: 5
>> [ 14.305514] dwc2_lowlevel_hw_init: 6
>> [ 14.325209] dwc2 13500000.usb: Looking up vusb_d-supply from device tree
>> [ 14.348674] dwc2 13500000.usb: Looking up vusb_d-supply property in node /usb at 13500000 failed
>> [ 14.374623] dwc2 13500000.usb: supply vusb_d not found, using dummy regulator
>> [ 14.402245] dwc2 13500000.usb: Looking up vusb_a-supply from device tree
>> [ 14.426670] dwc2 13500000.usb: Looking up vusb_a-supply property in node /usb at 13500000 failed
>> [ 14.452473] dwc2 13500000.usb: supply vusb_a not found, using dummy regulator
>> [ 14.478071] dwc2_lowlevel_hw_init: 8
>> [ 14.498389] dwc2_driver_probe: 2
>> [ 14.518643] dwc2_driver_probe: 3
>> [ 14.538327] dwc2 13500000.usb: registering common handler for irq21
>> [ 14.561523] dwc2_driver_probe: 4
>> [ 14.588397] dwc2 13500000.usb: Looking up vbus-supply from device tree
>> [ 14.614695] dwc2 13500000.usb: Looking up vbus-supply property in node /usb at 13500000 failed
>> [ 14.640757] dwc2_driver_probe: 5
>> [ 14.663117] dwc2_driver_probe: 6
>> [ 14.683577] dwc2 13500000.usb: Core Release: 3.00a (snpsid=4f54300a)
>> [ 14.818763] dwc2 13500000.usb: dwc2_wait_for_mode: Couldn't set host mode
>> [ 15.164614] dwc2 13500000.usb: EPs: 9, dedicated fifos, 3576 entries in SPRAM
>> [ 15.327775] dwc2 13500000.usb: dwc2_hcd_init() FAILED, returning -517
>> [ 15.349669] dwc2_driver_probe: error=-517
>> [ 15.369425] platform 13500000.usb: Driver dwc2 requests probe deferral
>> root at letux:~#
>> _______________________________________________
>> https://projects.goldelico.com/p/gta04-kernel/
>> Letux-kernel mailing list
>> Letux-kernel at openphoenux.org
>> http://lists.goldelico.com/mailman/listinfo.cgi/letux-kernel
More information about the Letux-kernel
mailing list