[Letux-kernel] [PATCH 2/5] DTS: MIPS: JZ4780: add USB PHY&OTG

H. Nikolaus Schaller hns at goldelico.com
Sun Sep 20 18:05:31 CEST 2020


> Am 20.09.2020 um 17:55 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
> 
> Hi,
> 
>> Am 20.09.2020 um 17:47 schrieb Zhou Yanjie <zhouyanjie at wanyeetech.com>:
>> 
>> Hi Nikolaus,
>> 
>> 在 2020/9/20 下午8:45, H. Nikolaus Schaller 写道:
>>> 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.
>> 
>> 
>> This is weird, which version of the kernel are you using?
> 
> v5.9-rc5.
> 
>> 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.
> 
> Or is there a newer version I have missed? Would explain most issues :)

Apparently yes... After doing a look into original v5.9-rc5, there is "jz4780-phy":

	https://elixir.bootlin.com/linux/v5.9-rc5/source/drivers/usb/phy/phy-jz4770.c#L281

So I may have *removed* it by applying your "usb: phy: add driver for Ingenic XBurst SoCs.".

And, I have indeed configured USB_INGENIC_PHY for phy-ingenic-usb.c. Which is confusing since there is also phy-jz4780.

Looks as if I'll need a little time to analyse and fix and test. And then we will see what happens.

BR and thanks,
Nikolaus

> 
>> 
>> In addition, CI20 has two USB ports, one is HOST and the other is OTG. The current driver can only support the OTG one.
> 
> Yes, This doesn't matter for the problem since I do not see any PHY...

Anyways, what would we have to do for the HOST (only) port? Make EHCI + OHCI work?

BR and thanks,
Nikolaus

> 
>> 
>> Thanks and best regards!
> 
> Same as well,
> Nikolaus
> 
>> 
>> 
>>> 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>
> 
> _______________________________________________
> 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