Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp5707304rwr; Mon, 24 Apr 2023 07:58:57 -0700 (PDT) X-Google-Smtp-Source: AKy350ZFiD0699OExk54hf/OK/H3aUmzEMypcETNuBO4ABPCaJTDnlAx/0RkBaZ2ho+4rcNEvgfm X-Received: by 2002:a05:6a20:8f29:b0:f2:813b:ac5c with SMTP id b41-20020a056a208f2900b000f2813bac5cmr14910632pzk.21.1682348336742; Mon, 24 Apr 2023 07:58:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682348336; cv=none; d=google.com; s=arc-20160816; b=CBcNUka5AjHVKVEt5jRHdGwT0Tsn369uo2N3FdVi3g9Xdfg6FpH6+8BXydOHYy2A8A eDEdyT9LoU8z4bBK96KrVQzGh64jzjUgHDFmeQHiwzNTfar0vySE/h5W8FjKcsJLGla2 Po8wZU1qAe7CJDxXonnCttsWgdzSwUl10TSPkOL6K2/kzwvqHJCkuud7u5PU9cGDWhBY rdo88gfsKIjk1etIV7GzLsjyMtxd9cHNvH7AEfWT6KuLlh3PioRvlFa6Dax0C0FnVcJk +2MkTCPdkY3z2u0QKMyJjIXYDaPybBmCpZfVuXC+Lt+3yrw9SiSNhvyutl2YNO8dXPlf EEwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=D9MU1a9I0kEf3Mc2+74bNp09l9Ycn/ftj06x4bgNX1I=; b=QDJEk3ucIZTCkX1AaA6cIE2I0wtXRkqi8MaE6FNM0aMXlw/aRirJYOv5YC/ekIxaE9 UiBFGFOqqLSQw/rdIefruzG4oxZsx9f7QW1b7wAaxiK6Af5p80c3SLIXRT2Rn2Egffdx K8o3dCduNvURA6/gsaJ36j1sc52j3FEX0MHFCCTd9BcjiusH9NATMVmXUiJxXdWA4PBq D+13NfoLvcJIyMc4LNWTx6Qr/ynVQRAPK46r46S2SDTcWIc5EJEcuAnfbtQlLrqGXLX7 w+ouG7qLDwTlFdYMj+Tvl44gkXUzn7SCiycYPXvLzaPRToOEJHx4CrtxmaqY3eBCFpKx 65oA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TBFPs1eW; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bv125-20020a632e83000000b005285dfbfeb1si757598pgb.592.2023.04.24.07.58.43; Mon, 24 Apr 2023 07:58:56 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TBFPs1eW; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231415AbjDXOxg (ORCPT + 99 others); Mon, 24 Apr 2023 10:53:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231228AbjDXOxe (ORCPT ); Mon, 24 Apr 2023 10:53:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A7B26580; Mon, 24 Apr 2023 07:53:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EF98C613E9; Mon, 24 Apr 2023 14:53:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B466DC433EF; Mon, 24 Apr 2023 14:53:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1682348007; bh=9CwJJUrhNP6wOsORyqwvzaE9qMKm02sq+6yuG+Ev91U=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=TBFPs1eWvgDreKyP2z4H6q2ZZgTj7aEde/gln69W0CfM1jNYwm2ZOwXv2yaa6XSZL ztShbHl41Mc4mpHTmfQu2bddwtSgvi5v4WdqtnWbnTo0ps12xIf1Xcdpe4Yq6mxI2U Yn+El8B1UF43LNtRukJgvLHEi9vqyaGHCHbS9mR2UbwCoT9TBC50+0et1CttRAW/3V xeYYEAoBZd3upWJ/U4xW5tiDzxA18r2RFlLxw1yew0gVPMBJ/LwAGhU2ZQcRQWCG1k hb2WvoqBSq/pfAfIRHr5Fb9NdhMvH/52K3owwrVA78IjFCjAnpzm3H02CBPH5duf2c L+osQEwIwu17Q== Message-ID: <3f2baded-c5d6-7d94-00f3-6d8fb24262c4@kernel.org> Date: Mon, 24 Apr 2023 17:53:19 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH v5 7/7] riscv: dts: starfive: Add USB dts configuration for JH7110 Content-Language: en-US To: Minda Chen , Emil Renner Berthing , Conor Dooley , Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Pawel Laszczak , Greg Kroah-Hartman , Peter Chen , Philipp Zabel 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 , Palmer Dabbelt , Albert Ou , Mason Huo References: <20230420110052.3182-1-minda.chen@starfivetech.com> <20230420110052.3182-8-minda.chen@starfivetech.com> From: Roger Quadros In-Reply-To: <20230420110052.3182-8-minda.chen@starfivetech.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_MED,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: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > .../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