From: Roger Quadros <rogerq@kernel.org>
To: Minda Chen <minda.chen@starfivetech.com>,
Emil Renner Berthing <emil.renner.berthing@canonical.com>,
Conor Dooley <conor@kernel.org>, Vinod Koul <vkoul@kernel.org>,
Kishon Vijay Abraham I <kishon@kernel.org>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Pawel Laszczak <pawell@cadence.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Peter Chen <peter.chen@kernel.org>,
Philipp Zabel <p.zabel@pengutronix.de>
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-phy@lists.infradead.org, linux-usb@vger.kernel.org,
linux-riscv@lists.infradead.org,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Mason Huo <mason.huo@starfivetech.com>
Subject: Re: [PATCH v5 7/7] riscv: dts: starfive: Add USB dts configuration for JH7110
Date: Wed, 26 Apr 2023 15:46:04 +0300 [thread overview]
Message-ID: <d1051856-1177-b5b8-6761-28da80a3cb7c@kernel.org> (raw)
In-Reply-To: <4b0220ac-23bf-4206-eba2-2842a216bb24@starfivetech.com>
Hi Minda,
On 26/04/2023 14:05, Minda Chen wrote:
>
>
> On 2023/4/24 22:53, Roger Quadros wrote:
>>
>>
>> On 20/04/2023 14:00, Minda Chen wrote:
>>> Add USB wrapper layer and Cadence USB3 controller dts
>>> configuration for StarFive JH7110 SoC and VisionFive2
>>> Board.
>>> USB controller connect to PHY, The PHY dts configuration
>>> are also added.
>>>
>>> Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
>>> ---
>>> .../jh7110-starfive-visionfive-2.dtsi | 7 +++
>>> arch/riscv/boot/dts/starfive/jh7110.dtsi | 44 +++++++++++++++++++
>>> 2 files changed, 51 insertions(+)
>>>
>>> diff --git a/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi b/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi
>>> index 1155b97b593d..fa97ebfd93ad 100644
>>> --- a/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi
>>> +++ b/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi
>>> @@ -221,3 +221,10 @@
>>> pinctrl-0 = <&uart0_pins>;
>>> status = "okay";
>>> };
>>> +
>>> +&usb0 {
>>> + phys = <&usbphy0>;
>>> + phy-names = "usb2";
>>> + dr_mode = "peripheral";
>>> + status = "okay";
>>> +};
>>> diff --git a/arch/riscv/boot/dts/starfive/jh7110.dtsi b/arch/riscv/boot/dts/starfive/jh7110.dtsi
>>> index 29cd798b6732..eee395e19cdb 100644
>>> --- a/arch/riscv/boot/dts/starfive/jh7110.dtsi
>>> +++ b/arch/riscv/boot/dts/starfive/jh7110.dtsi
>>> @@ -366,6 +366,50 @@
>>> status = "disabled";
>>> };
>>>
>>> + usb0: usb@10100000 {
>>> + compatible = "starfive,jh7110-usb";
>>> + reg = <0x0 0x10100000 0x0 0x10000>,
>>> + <0x0 0x10110000 0x0 0x10000>,
>>> + <0x0 0x10120000 0x0 0x10000>;
>>> + reg-names = "otg", "xhci", "dev";
>>> + interrupts = <100>, <108>, <110>;
>>> + interrupt-names = "host", "peripheral", "otg";
>>> + clocks = <&stgcrg JH7110_STGCLK_USB0_LPM>,
>>> + <&stgcrg JH7110_STGCLK_USB0_STB>,
>>> + <&stgcrg JH7110_STGCLK_USB0_APB>,
>>> + <&stgcrg JH7110_STGCLK_USB0_AXI>,
>>> + <&stgcrg JH7110_STGCLK_USB0_UTMI_APB>;
>>> + clock-names = "lpm", "stb", "apb", "axi", "utmi_apb";
>>> + resets = <&stgcrg JH7110_STGRST_USB0_PWRUP>,
>>> + <&stgcrg JH7110_STGRST_USB0_APB>,
>>> + <&stgcrg JH7110_STGRST_USB0_AXI>,
>>> + <&stgcrg JH7110_STGRST_USB0_UTMI_APB>;
>>> + reset-names = "pwrup", "apb", "axi", "utmi_apb";
>>
>> All this can really be "cdns,usb3" node. The cdns,usb3 driver should
>> do reset and clocks init as it is generic.
>>
> But I can't find clock and reset init in Cadence codes while dwc usb3 can find.
> It looks only if clocks and reset generic init codes required to be added in Cadence codes to support generic clock and reset init.
>>> + starfive,stg-syscon = <&stg_syscon 0x4>;
>>> + status = "disabled";
>>
>> Only the syscon handling looks starfive specific so only that handling
>> should be done in starfive USB driver.
>>
>> This node should look like this
>>
>>
>> starfive-usb@4 {
>> compatible = "starfive,jh7110-usb";
>> starfive,stg-syscon = <&stg_syscon 0x4>;
>>
>> usb0: usb@10100000 {
>> compatible = "cdns,usb3";
>> reg = <0x0 0x10100000 0x0 0x10000>,
>> <0x0 0x10110000 0x0 0x10000>,
>> <0x0 0x10120000 0x0 0x10000>;
>> reg-names = "otg", "xhci", "dev";
>> interrupts = <100>, <108>, <110>;
>> interrupt-names = "host", "peripheral", "otg";
>> clocks = <&stgcrg JH7110_STGCLK_USB0_LPM>,
>> <&stgcrg JH7110_STGCLK_USB0_STB>,
>> <&stgcrg JH7110_STGCLK_USB0_APB>,
>> <&stgcrg JH7110_STGCLK_USB0_AXI>,
>> <&stgcrg JH7110_STGCLK_USB0_UTMI_APB>;
>> clock-names = "lpm", "stb", "apb", "axi", "utmi_apb";
>> resets = <&stgcrg JH7110_STGRST_USB0_PWRUP>,
>> <&stgcrg JH7110_STGRST_USB0_APB>,
>> <&stgcrg JH7110_STGRST_USB0_AXI>,
>> <&stgcrg JH7110_STGRST_USB0_UTMI_APB>;
>> reset-names = "pwrup", "apb", "axi", "utmi_apb";
>> starfive,stg-syscon = <&stg_syscon 0x4>;
>> status = "disabled";
>> };
>> }
>>> In starfife-usb driver you can use of_platform_default_populate()
>> to create the cdns,usb3 child for you.
>>
> But actually the the syscon is not belong to USB. Below is Rob's previous comments. I am follow Rob's comments to change this.
Managing these syscon registers cannot be done in cdns,usb3 driver.
So you definitely need a wrapper driver for that.
>
> This pattern of USB wrapper and then a "generic" IP node is discouraged if it is just clocks, resets, power-domains, etc. IOW, unless there's an actual wrapper h/w block with its own registers, then don't do this split.
> Merge it all into a single node.
>
> Rob and Rogers
> Could you design whether merge the usb nodes?
> dt-binding,USB codes are different in two case.
>
There should ideally be only one USB node and that should use "cdns,usb3" compatible.
Clocks, resets and power-domain handling should be done in cdns,usb3 driver.
But since you also need to manage some syscon registers "cdsn,usb3" driver is not
sufficient for you.
I will leave the DT-binding question for this case to Rob.
cheers,
-roger
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
prev parent reply other threads:[~2023-04-26 12:46 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-20 11:00 [PATCH v5 0/7] Add JH7110 USB and USB PHY driver support Minda Chen
2023-04-20 11:00 ` [PATCH v5 1/7] dt-bindings: phy: Add StarFive JH7110 USB PHY Minda Chen
2023-04-21 21:23 ` Rob Herring
2023-04-20 11:00 ` [PATCH v5 2/7] dt-bindings: phy: Add StarFive JH7110 PCIe PHY Minda Chen
2023-04-21 21:23 ` Rob Herring
2023-04-20 11:00 ` [PATCH v5 3/7] phy: starfive: Add JH7110 USB 2.0 PHY driver Minda Chen
2023-04-24 8:46 ` Roger Quadros
2023-04-24 10:59 ` Minda Chen
2023-04-20 11:00 ` [PATCH v5 4/7] phy: starfive: Add JH7110 PCIE " Minda Chen
2023-04-24 9:23 ` Roger Quadros
2023-04-24 11:14 ` Minda Chen
2023-04-20 11:00 ` [PATCH v5 5/7] dt-bindings: usb: Add StarFive JH7110 USB controller Minda Chen
2023-04-20 12:32 ` Rob Herring
2023-04-20 11:00 ` [PATCH v5 6/7] usb: cdns3: Add StarFive JH7110 USB driver Minda Chen
2023-04-23 3:37 ` Peter Chen
2023-04-24 13:41 ` Roger Quadros
2023-04-20 11:00 ` [PATCH v5 7/7] riscv: dts: starfive: Add USB dts configuration for JH7110 Minda Chen
2023-04-24 14:53 ` Roger Quadros
2023-04-26 11:05 ` Minda Chen
2023-04-26 12:46 ` Roger Quadros [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d1051856-1177-b5b8-6761-28da80a3cb7c@kernel.org \
--to=rogerq@kernel.org \
--cc=aou@eecs.berkeley.edu \
--cc=conor@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=emil.renner.berthing@canonical.com \
--cc=gregkh@linuxfoundation.org \
--cc=kishon@kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-usb@vger.kernel.org \
--cc=mason.huo@starfivetech.com \
--cc=minda.chen@starfivetech.com \
--cc=p.zabel@pengutronix.de \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=pawell@cadence.com \
--cc=peter.chen@kernel.org \
--cc=robh+dt@kernel.org \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox