[Letux-kernel] [PATCH 2/5] DTS: MIPS: JZ4780: add USB PHY&OTG
H. Nikolaus Schaller
hns at goldelico.com
Sun Sep 20 14:45:26 CEST 2020
Hi Zhou,
> Am 19.09.2020 um 11:16 schrieb Zhou Yanjie <zhouyanjie at wanyeetech.com>:
>
> Hi Nikolaus,
>
> Attached is the mode patch that should work normally, could you help test it?
It applies fine and looks better than my attempt, but I still see no sign of USB activity.
Maybe I am missing some CONFIG?
I have
CONFIG_USB_INGENIC_PHY=m
CONFIG_USB_DWC2=m
CONFIG_USB_DWC2_DUAL_ROLE=y
It appears as if the dwc2 driver requests probe deferral forever. And the
phy_ingenic_usb isn't automatically loaded. After modprobe phy_ingenic_usb
also nothing happens and there is no /sys/class/phy registered.
I have improved that a little by changing the jt4780.dtsi to
compatible = "ingenic,jz4770-phy" which makes the phy driver load (without errors)
but I have still no progress and there is no entry in /sys/class/phy.
After studying the code through inserted printk() it appears as if dwc2 is looking
for an entry in phy_provider_list through of_phy_provider_lookup() while the
ingenic-phy registers itself through usb_add_phy() in phy_list. There is no
call to __of_phy_provider_register().
So the dwc2 probe doesn't find the phy.
Any ideas? Should we call devm_of_phy_provider_register() in the ingenic-phy driver?
And shouldn't the phy driver reside in drivers/phy instead of drivers/usb/phy (which
seems to have only some remaining, unconverted drivers)?
BTW, I have found no driver matching ingenic,jz4780-otg. I am not sure is this
important since the snps,dwc2 is found?
BR and thanks,
Nikolaus
>
> Thanks and best regards!
>
> 在 2020/9/17 上午1:29, H. Nikolaus Schaller 写道:
>> Hi Zhou,
>> yes, I assumed that there is a problem...
>>
>> If you do not want to write a full patch, just let me know what I should change.
>>
>> BR and thanks,
>> Nikolaus
>>
>>
>>> Am 16.09.2020 um 18:30 schrieb Zhou Yanjie <zhouyanjie at wanyeetech.com>:
>>>
>>> Hi Nikolaus,
>>>
>>> The otg and phy nodes should be adjusted, I will send you a new patch as soon as possible.
>>>
>>> 在 2020/9/16 下午4:11, H. Nikolaus Schaller 写道:
>>>> Signed-off-by: H. Nikolaus Schaller <hns at goldelico.com>
>>>> ---
>>>> arch/mips/boot/dts/ingenic/jz4780.dtsi | 28 ++++++++++++++++++++++++++
>>>> 1 file changed, 28 insertions(+)
>>>>
>>>> diff --git a/arch/mips/boot/dts/ingenic/jz4780.dtsi b/arch/mips/boot/dts/ingenic/jz4780.dtsi
>>>> index ce0260a69e7dbb..7cffdc8b70be68 100644
>>>> --- a/arch/mips/boot/dts/ingenic/jz4780.dtsi
>>>> +++ b/arch/mips/boot/dts/ingenic/jz4780.dtsi
>>>> @@ -72,6 +72,16 @@ cgu: jz4780-cgu at 10000000 {
>>>> #clock-cells = <1>;
>>>> };
>>>> + usb_phy: otg_phy at 10000000 {
>>>> + compatible = "ingenic,jz4770-phy";
>>>> + reg = <0x10000000 0x100>;
>>>> +
>>>> + clocks = <&cgu JZ4780_CLK_OTG1>;
>>>> + clock-names = "usb_phy";
>>>> +
>>>> + #phy-cells = <0>;
>>>> + };
>>>> +
>>>> tcu: timer at 10002000 {
>>>> compatible = "ingenic,jz4780-tcu",
>>>> "ingenic,jz4770-tcu",
>>>> @@ -610,4 +620,22 @@ lcdc1: lcdc1 at 130a0000 {
>>>> status = "disabled";
>>>> };
>>>> + usb_otg: otg at 0x13500000 {
>>>> + compatible = "ingenic,jz4770-otg", "snps,dwc2";
>>>> + reg = <0x13500000 0x40000>;
>>>> +
>>>> + interrupt-parent = <&intc>;
>>>> + interrupts = <21>;
>>>> +
>>>> + phys = <&usb_phy>;
>>>> + phy-names = "usb2-phy";
>>>> +
>>>> + // clocks & clock-names?
>>>> + // clocks = ?;
>>>> + // clock-names = "otg";
>>>> +
>>>> + g-rx-fifo-size = <256>;
>>>> + g-np-tx-fifo-size = <256>;
>>>> + g-tx-fifo-size = <256 256 256 256 256 256 256 512>;
>>>> + };
>>>> };
> <0001-DTS-MIPS-JZ4780-add-USB-PHY-OTG.patch>
More information about the Letux-kernel
mailing list