Message ID | 20230420110052.3182-8-minda.chen@starfivetech.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp253679vqo; Thu, 20 Apr 2023 04:18:44 -0700 (PDT) X-Google-Smtp-Source: AKy350Zc9VOBBzoXtsPpP0KcHZRIV6Gfge2J3JkbKvs32hISooiHI/Ia3OTZ9vwDXdn9aJaR0OVq X-Received: by 2002:a05:6a21:3387:b0:f0:9f97:fc42 with SMTP id yy7-20020a056a21338700b000f09f97fc42mr2443967pzb.18.1681989524275; Thu, 20 Apr 2023 04:18:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681989524; cv=none; d=google.com; s=arc-20160816; b=k9A5Uz1WqZy6mCPNNnAx+i7Q4DiqT/g2Zs3BWqrTZyOX5zW6k/Gd/io/xMyKLnZYyH xFSwkJjSIqj0vPsgbtdxB30AbC3Ew4aHEDoH1DHdYzribq+IULSOH2IJtjQUov0CvXU/ g4EolW3K+R0LpyUeYCJFB+F7qehdOp4+5jI5RdQNGWIMfZQhkZyH9Ah7MhrQC3FJCGd+ ZHYf61F7qZ6iYLJuWAb8xVnlDdvBZh6gluPALSY404yDhSe8pphq2YqdUB8PBBVtmOOP 3V8CH7oWKNRIr2b7u6FbtUO0CueBLeXNNneIWbtVCKVdz2GAqwxWSIEr2S0ndoQqJ+L+ B9nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=NvExCeHuWhYbDuYAubgjCeIP1W3cf3d+Bii/bEGbeHc=; b=XumCjbe2vTzeUWuWvmP5xqoH14LduwDQw+rUH6hbpCS/071mbW8GRmTPJy8aVZ9De0 djupRles9dk+zM1Ec+5DVgcF7/eeAEmNA+fcalXVJIKcurv4lkwykvpGjwHNqdYhO6q1 WVpWrt/C4U8FfJWS5XfVYWqL6wRPN25sJQTRELYOn+ga+LWoEt4MeX+1wSXfStdyDiNj G0JlgUvl4fbWe7889eU8jGVu+jOOxXyqHQCy3/FlSyWAuLs1rg8NAufpRgtEds00mYuD 9B6I+jUDATx7oDgnZQyobtTo8diVgue/KZOcUVKocLoy4oZhNklDjitCFEAHvQuD/Z6J 19Dg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h191-20020a6383c8000000b00513f9dbbdb9si1480525pge.275.2023.04.20.04.18.30; Thu, 20 Apr 2023 04:18:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234346AbjDTLGE (ORCPT <rfc822;cjcooper78@gmail.com> + 99 others); Thu, 20 Apr 2023 07:06:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235358AbjDTLEx (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 20 Apr 2023 07:04:53 -0400 Received: from ex01.ufhost.com (ex01.ufhost.com [61.152.239.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D4501B4; Thu, 20 Apr 2023 04:03:29 -0700 (PDT) Received: from EXMBX166.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX166", Issuer "EXMBX166" (not verified)) by ex01.ufhost.com (Postfix) with ESMTP id E4AFE24E2AB; Thu, 20 Apr 2023 19:01:00 +0800 (CST) Received: from EXMBX171.cuchost.com (172.16.6.91) by EXMBX166.cuchost.com (172.16.6.76) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Thu, 20 Apr 2023 19:01:00 +0800 Received: from ubuntu.localdomain (113.72.144.253) by EXMBX171.cuchost.com (172.16.6.91) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Thu, 20 Apr 2023 19:00:59 +0800 From: Minda Chen <minda.chen@starfivetech.com> To: 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>, Roger Quadros <rogerq@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>, "Minda Chen" <minda.chen@starfivetech.com>, Mason Huo <mason.huo@starfivetech.com> Subject: [PATCH v5 7/7] riscv: dts: starfive: Add USB dts configuration for JH7110 Date: Thu, 20 Apr 2023 19:00:52 +0800 Message-ID: <20230420110052.3182-8-minda.chen@starfivetech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230420110052.3182-1-minda.chen@starfivetech.com> References: <20230420110052.3182-1-minda.chen@starfivetech.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [113.72.144.253] X-ClientProxiedBy: EXCAS066.cuchost.com (172.16.6.26) To EXMBX171.cuchost.com (172.16.6.91) X-YovoleRuleAgent: yovoleflag X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763693847382779805?= X-GMAIL-MSGID: =?utf-8?q?1763693847382779805?= |
Series |
Add JH7110 USB and USB PHY driver support
|
|
Commit Message
Minda Chen
April 20, 2023, 11 a.m. UTC
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(+)
Comments
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. > + 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. > + }; > + > + usbphy0: phy@10200000 { > + compatible = "starfive,jh7110-usb-phy"; > + reg = <0x0 0x10200000 0x0 0x10000>; > + clocks = <&syscrg JH7110_SYSCLK_USB_125M>, > + <&stgcrg JH7110_STGCLK_USB0_APP_125>; > + clock-names = "125m", "app_125m"; > + #phy-cells = <0>; > + }; > + > + pciephy0: phy@10210000 { > + compatible = "starfive,jh7110-pcie-phy"; > + reg = <0x0 0x10210000 0x0 0x10000>; > + #phy-cells = <0>; > + }; > + > + pciephy1: phy@10220000 { > + compatible = "starfive,jh7110-pcie-phy"; > + reg = <0x0 0x10220000 0x0 0x10000>; > + #phy-cells = <0>; > + }; > + > stgcrg: clock-controller@10230000 { > compatible = "starfive,jh7110-stgcrg"; > reg = <0x0 0x10230000 0x0 0x10000>; cheers, -roger
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. 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. >> + }; >> + >> + usbphy0: phy@10200000 { >> + compatible = "starfive,jh7110-usb-phy"; >> + reg = <0x0 0x10200000 0x0 0x10000>; >> + clocks = <&syscrg JH7110_SYSCLK_USB_125M>, >> + <&stgcrg JH7110_STGCLK_USB0_APP_125>; >> + clock-names = "125m", "app_125m"; >> + #phy-cells = <0>; >> + }; >> + >> + pciephy0: phy@10210000 { >> + compatible = "starfive,jh7110-pcie-phy"; >> + reg = <0x0 0x10210000 0x0 0x10000>; >> + #phy-cells = <0>; >> + }; >> + >> + pciephy1: phy@10220000 { >> + compatible = "starfive,jh7110-pcie-phy"; >> + reg = <0x0 0x10220000 0x0 0x10000>; >> + #phy-cells = <0>; >> + }; >> + >> stgcrg: clock-controller@10230000 { >> compatible = "starfive,jh7110-stgcrg"; >> reg = <0x0 0x10230000 0x0 0x10000>; > > cheers, > -roger
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
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"; + starfive,stg-syscon = <&stg_syscon 0x4>; + status = "disabled"; + }; + + usbphy0: phy@10200000 { + compatible = "starfive,jh7110-usb-phy"; + reg = <0x0 0x10200000 0x0 0x10000>; + clocks = <&syscrg JH7110_SYSCLK_USB_125M>, + <&stgcrg JH7110_STGCLK_USB0_APP_125>; + clock-names = "125m", "app_125m"; + #phy-cells = <0>; + }; + + pciephy0: phy@10210000 { + compatible = "starfive,jh7110-pcie-phy"; + reg = <0x0 0x10210000 0x0 0x10000>; + #phy-cells = <0>; + }; + + pciephy1: phy@10220000 { + compatible = "starfive,jh7110-pcie-phy"; + reg = <0x0 0x10220000 0x0 0x10000>; + #phy-cells = <0>; + }; + stgcrg: clock-controller@10230000 { compatible = "starfive,jh7110-stgcrg"; reg = <0x0 0x10230000 0x0 0x10000>;