From patchwork Wed Jul 31 20:18:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 13749176 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 77D71C3DA64 for ; Wed, 31 Jul 2024 20:19:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9k7Y7uffhHeXI6uJpk6LVkCDwjiIWa8RQbNc7lKQeCA=; b=MqpclhKIq1ZCQs OroD4H164Rf2sTXRBJFNBIHSOvGLcCiEVD2sJWDWOUJiGQ4wNCD1T4XaNmJsm7uLvcjSigy99XUwY 0tPwj1P9Xayl/T2IHRPrtq/9Neso9wKsC6vEC9KJ7iTMONqRytYTkHNS0zm39w4Wem+r5H6GwZTdq O8+izzYt+c2KdaGDAwfu8EL69U9d3ok21BIoi6NaZVB/L4FPalJZPXReTPxpXHhwqGwXsTxaI7/TJ BBSQEKPlCJ8OCPPRkuqlFLF3ptlz7HISjAeVLisNwElVfETWMCQHT9wrC/E6dZg8G6r607UHo1tzm ohBeorve90kM73FReNFg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZFmh-00000002QzK-2PAA; Wed, 31 Jul 2024 20:18:55 +0000 Received: from mta-65-225.siemens.flowmailer.net ([185.136.65.225]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZFmb-00000002QvZ-3JRx for linux-riscv@lists.infradead.org; Wed, 31 Jul 2024 20:18:53 +0000 Received: by mta-65-225.siemens.flowmailer.net with ESMTPSA id 20240731201844c23c98f9c18a957b20 for ; Wed, 31 Jul 2024 22:18:44 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=jan.kiszka@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=XuWSafTJqaueVcFk2YDwRANMa4TvCIZ5dW42gSq/JL0=; b=ReTkS81ClDctxkCCZdavcnAnLidOLfLpzOsuB6CsAwphoN6ZuOp21ev3CsshrA/EACYX/v cfiUoDHenQEhL47UhvxNR2LWyTski6jTWUP4rM+5I9u4pL/b8qRfiSgiE8ZNk8wFxf0MVKt/ wnRqMnYgspm7OaaPBneal4JEDjmJlk/8aUx97Q/2q2IaDHgNxc9rFDDMSmbP+Mys9B9vp/SF JObj/OW8MMe05ZXHgjc7XI9oEIp9qQwVDdhSCpvoIh1LsARZEdVZPyAYHHKRSXgZzBHmN0fY kxKB+04cgGK9NE0N7O93TgM/2/as9S3jLTJcsAVR4/VPdgB5MN49EtsQ==; From: Jan Kiszka To: Minda Chen , Vinod Koul , Kishon Vijay Abraham I Cc: linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Rob Herring , Krzysztof Kozlowski , Conor Dooley Subject: [PATCH 1/3] dt-bindings: phy: jh7110-usb-phy: Add sys-syscon property Date: Wed, 31 Jul 2024 22:18:41 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-294854:519-21489:flowmailer X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240731_131850_574457_A1B4224E X-CRM114-Status: UNSURE ( 7.13 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org From: Jan Kiszka Analogously to the PCI PHY, access to sys_syscon is needed to connect the USB PHY to its controller. Signed-off-by: Jan Kiszka Reviewed-by: Rob Herring (Arm) --- CC: Rob Herring CC: Krzysztof Kozlowski CC: Conor Dooley --- .../bindings/phy/starfive,jh7110-usb-phy.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml b/Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml index 269e9f9f12b6..eaf0050c6f17 100644 --- a/Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml +++ b/Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml @@ -19,6 +19,16 @@ properties: "#phy-cells": const: 0 + starfive,sys-syscon: + $ref: /schemas/types.yaml#/definitions/phandle-array + items: + - items: + - description: phandle to System Register Controller sys_syscon node. + - description: PHY connect offset of SYS_SYSCONSAIF__SYSCFG register for USB PHY. + description: + The phandle to System Register Controller syscon node and the PHY connect offset + of SYS_SYSCONSAIF__SYSCFG register. Connect PHY to USB controller. + clocks: items: - description: PHY 125m @@ -47,4 +57,5 @@ examples: <&stgcrg 6>; clock-names = "125m", "app_125m"; #phy-cells = <0>; + starfive,sys-syscon = <&sys_syscon 0x18>; }; From patchwork Wed Jul 31 20:18:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 13749178 X-Patchwork-Delegate: mail@conchuod.ie Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9AFD4C52D6D for ; Wed, 31 Jul 2024 20:19:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jTEAwEcKr33Lb/sgPRJm5gsKJ4URu3UeBZR0ARckfeI=; b=3y/3Vevn3SXJkR Shb1DLSvOrOqaQjvBbIOYrAoJcogd5L2VaaR0TDDH9TOjCvcGZd/rfMyEEmQaBdCD4Ncd3qwan9mf bYYKam+0u5psokHsvQQYeKTe+KBAPr4xdwH0Ax3CymCGGFgLgkLCAvs3qUe3mOKObG9PMKtejh+Wv At6uvGubh5t0zlZtgbvKDG32DYHT91I4tFrmCs/4T7Ue4Y+qcfx16lWnxIJjMIgvTzrPi2j7FUPuH +UNcQVRrqyMW+PJfwUXo7cKSj82h6niboKRscYm5NsoAtgmB5QWKhuUhjpF861bLymppZWz7+D9Gs IQn+s/0kFhajAfZW6bpA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZFmm-00000002R16-0UQ0; Wed, 31 Jul 2024 20:19:00 +0000 Received: from mta-65-226.siemens.flowmailer.net ([185.136.65.226]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZFmb-00000002QvV-37Hv for linux-riscv@lists.infradead.org; Wed, 31 Jul 2024 20:18:54 +0000 Received: by mta-65-226.siemens.flowmailer.net with ESMTPSA id 2024073120184492126371be6c419b5f for ; Wed, 31 Jul 2024 22:18:44 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=jan.kiszka@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=SUxmYkjU52Zd0l8Y+msbh0zC3Tc3jd+DyqARUfWiOQo=; b=ehxxPX1xzA9T8723XVnod+NinDAChb6AKCoh/gobgoervllzp78zfY4sy620NTZorpjUSj CwlLIyzkh7mcqpZj2KLEnv1mrpPjTRK9NaOgRfxrP/KGKfr79gshk7+/QxiQqWyfY9qWsKmH ZoUtIVrshF+04vzSSXPTCkA3GH+kKUoNcy0Yrqh+/3PFuSW6+aHAoQE7JTh9FJ1kHRitjSyz mhU7vRNeNEYg1n0A+sBw0Ov1Abxe78WvlS4NCCzV1p0OdGwbPhK0G4VNUXzkJpEWCiwfuIQU 1G/+n/vTjP8qPaj91iA9Awuim7xbu1hnx84bGW9eXTDnUNNyM6yAoweA==; From: Jan Kiszka To: Minda Chen , Vinod Koul , Kishon Vijay Abraham I Cc: linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Rob Herring , Krzysztof Kozlowski , Conor Dooley Subject: [PATCH 2/3] riscv: dts: starfive: jh7110: Add sys-syscon property to usbphy0 Date: Wed, 31 Jul 2024 22:18:42 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-294854:519-21489:flowmailer X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240731_131850_581461_445B297A X-CRM114-Status: UNSURE ( 6.45 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org From: Jan Kiszka Allows the PHY to connect to its USB controller. Signed-off-by: Jan Kiszka --- CC: Rob Herring CC: Krzysztof Kozlowski CC: Conor Dooley --- arch/riscv/boot/dts/starfive/jh7110.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/riscv/boot/dts/starfive/jh7110.dtsi b/arch/riscv/boot/dts/starfive/jh7110.dtsi index 0d8339357bad..0c0b66a69065 100644 --- a/arch/riscv/boot/dts/starfive/jh7110.dtsi +++ b/arch/riscv/boot/dts/starfive/jh7110.dtsi @@ -606,6 +606,7 @@ usbphy0: phy@10200000 { <&stgcrg JH7110_STGCLK_USB0_APP_125>; clock-names = "125m", "app_125m"; #phy-cells = <0>; + starfive,sys-syscon = <&sys_syscon 0x18>; }; pciephy0: phy@10210000 { From patchwork Wed Jul 31 20:18:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 13749179 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 412AAC52D54 for ; Wed, 31 Jul 2024 20:19:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=OaHEq4U2aV0CSBlohzKaeVQfRIlksc4sK5qBSaeWgeY=; b=P0hhhojLUVMN7y Uk6Yu5sts8EzlufwX3c0icpk+jU2Niw+qWDnb/hWk/wT4xJgLhuaujUN8J9BSO4yejBr/Vv6Fy9/D Amm0vCHFhl7Vc86uW1gnCdXc0Bl+JasIpoGLLVhYINmzuJYgKWKI42+924AX8iRJ27atrfHuY6gAj JT2MfKcFjR2etzKznm/+wstAx/cA8NRtyZezRJJ+eC2hiyyvdwOjf5FC/nLs6ew2FqYY7o/rKZHET fc1V+tT5MjMsG/w0TpqHoc3ZaT0zfdfc39oT76sDZ/z9aeHS/LZO7F2B2IuyXOeVj6nix4//nSakb vRWZUSXlK3RC/7Wu3iEQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZFmm-00000002R1M-3hPK; Wed, 31 Jul 2024 20:19:00 +0000 Received: from mta-65-227.siemens.flowmailer.net ([185.136.65.227]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZFmb-00000002Qvc-3Ym4 for linux-riscv@lists.infradead.org; Wed, 31 Jul 2024 20:18:54 +0000 Received: by mta-65-227.siemens.flowmailer.net with ESMTPSA id 202407312018443d458dd4adb772febf for ; Wed, 31 Jul 2024 22:18:44 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=jan.kiszka@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=vBctEd0EBAVuykEtLPkNt5gMseKAAGuW/tXEMcwX2Jw=; b=X7JYrtIwSjqeVXmd4PS5mDy7hnjlGD6SGINF2KrSX0a47Tr9YYK+1zABETg2h2yHTqRLjj IDRW1OQWqT0zSBR9nXEDCx7BTztqmCH0qPBudRDQq0NB80xP81UD4RJdpW6Y0W6Cz/r53oLS J8D3spRnA8HfiZwnYbk1xaPM2cDzTUmXKbWC4ucGeXro+wkBokugcupZ11OJ1aB/37lncKhw LW56z15e2cDLR0iWAvuZjdlm0KWcXq3svKupuVeVVHmoG+fGNmMddLSMnZJKBcWq9fZ3wJlU l2HVfrlXivoDlGwJKYLwekZ0WJSF7VqSrQg54Z9vTQie3iqLoi2jjJYQ==; From: Jan Kiszka To: Minda Chen , Vinod Koul , Kishon Vijay Abraham I Cc: linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] phy: starfive: jh7110-usb: Fix link configuration to controller Date: Wed, 31 Jul 2024 22:18:43 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-294854:519-21489:flowmailer X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240731_131850_573485_8941B115 X-CRM114-Status: GOOD ( 12.38 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org From: Jan Kiszka In order to connect the USB 2.0 PHY to its controller, we also need to set "u0_pdrstn_split_sw_usbpipe_plugen" [1]. Some downstream U-Boot versions did that, but upstream firmware does not, and the kernel must not rely on such behavior anyway. Failing to set this left the USB gadget port invisible to connected hosts behind. Link: https://doc-en.rvspace.org/JH7110/TRM/JH7110_TRM/sys_syscon.html#sys_syscon__section_b3l_fqs_wsb [1] Fixes: 16d3a71c20cf ("phy: starfive: Add JH7110 USB 2.0 PHY driver") Signed-off-by: Jan Kiszka Reviewed-by: Minda Chen --- drivers/phy/starfive/phy-jh7110-usb.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/phy/starfive/phy-jh7110-usb.c b/drivers/phy/starfive/phy-jh7110-usb.c index 633912f8a05d..67882bc4cebc 100644 --- a/drivers/phy/starfive/phy-jh7110-usb.c +++ b/drivers/phy/starfive/phy-jh7110-usb.c @@ -10,18 +10,24 @@ #include #include #include +#include #include #include #include +#include #include #define USB_125M_CLK_RATE 125000000 #define USB_LS_KEEPALIVE_OFF 0x4 #define USB_LS_KEEPALIVE_ENABLE BIT(4) +#define USB_PDRSTN_SPLIT BIT(17) + struct jh7110_usb2_phy { struct phy *phy; void __iomem *regs; + struct regmap *sys_syscon; + u32 sys_phy_connect; struct clk *usb_125m_clk; struct clk *app_125m; enum phy_mode mode; @@ -61,6 +67,10 @@ static int usb2_phy_set_mode(struct phy *_phy, usb2_set_ls_keepalive(phy, (mode != PHY_MODE_USB_DEVICE)); } + /* Connect usb 2.0 phy mode */ + regmap_update_bits(phy->sys_syscon, phy->sys_phy_connect, + USB_PDRSTN_SPLIT, USB_PDRSTN_SPLIT); + return 0; } @@ -101,6 +111,7 @@ static int jh7110_usb_phy_probe(struct platform_device *pdev) struct jh7110_usb2_phy *phy; struct device *dev = &pdev->dev; struct phy_provider *phy_provider; + u32 args[1]; phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); if (!phy) @@ -129,6 +140,15 @@ static int jh7110_usb_phy_probe(struct platform_device *pdev) phy_set_drvdata(phy->phy, phy); phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); + phy->sys_syscon = + syscon_regmap_lookup_by_phandle_args(pdev->dev.of_node, + "starfive,sys-syscon", + 1, args); + if (IS_ERR(phy->sys_syscon)) + return dev_err_probe(dev, PTR_ERR(phy->phy), + "Failed to get sys-syscon\n"); + phy->sys_phy_connect = args[0]; + return PTR_ERR_OR_ZERO(phy_provider); }