From patchwork Wed May 13 13:07:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 11546057 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 15E8F81 for ; Wed, 13 May 2020 13:07:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F0E9B206CC for ; Wed, 13 May 2020 13:07:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="nKZEzBBg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733123AbgEMNHS (ORCPT ); Wed, 13 May 2020 09:07:18 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:38514 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725925AbgEMNHS (ORCPT ); Wed, 13 May 2020 09:07:18 -0400 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 04DD7GTd114155; Wed, 13 May 2020 08:07:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1589375236; bh=f4nG1Z0UcuxYUN06zcx+hh4NnFLdEFqFG1jkKWOQn60=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=nKZEzBBgxwTvSaPxjwoPYlYmcvcMqTEx8zF7x/apNyhpFMbGU13FCJRfDVuaDRKRT fkXpmWM0GfsST6JAT2MvPMQrtsNt2eXXhfWNZxwBNkGwiwQABEqvaCkgnVHRAgRYxQ jR58l/ZHz/fxHKFP8fJKa6vRsYlJQ7GaaOG41zsE= Received: from DFLE111.ent.ti.com (dfle111.ent.ti.com [10.64.6.32]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 04DD7GDt123458 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 13 May 2020 08:07:16 -0500 Received: from DFLE103.ent.ti.com (10.64.6.24) by DFLE111.ent.ti.com (10.64.6.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Wed, 13 May 2020 08:07:16 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE103.ent.ti.com (10.64.6.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Wed, 13 May 2020 08:07:16 -0500 Received: from lta0400828a.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 04DD7B2R074071; Wed, 13 May 2020 08:07:14 -0500 From: Roger Quadros To: CC: , , , , , Roger Quadros Subject: [PATCH 1/3] dt-bindings: usb: convert keystone-usb.txt to YAML Date: Wed, 13 May 2020 16:07:07 +0300 Message-ID: <20200513130709.10239-2-rogerq@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200513130709.10239-1-rogerq@ti.com> References: <20200513130709.10239-1-rogerq@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Convert keystone-usb documentation to YAML format. Signed-off-by: Roger Quadros --- .../devicetree/bindings/usb/keystone-usb.txt | 56 ---------------- .../bindings/usb/ti,keystone-dwc3.yaml | 67 +++++++++++++++++++ 2 files changed, 67 insertions(+), 56 deletions(-) delete mode 100644 Documentation/devicetree/bindings/usb/keystone-usb.txt create mode 100644 Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml diff --git a/Documentation/devicetree/bindings/usb/keystone-usb.txt b/Documentation/devicetree/bindings/usb/keystone-usb.txt deleted file mode 100644 index 77df82e36138..000000000000 --- a/Documentation/devicetree/bindings/usb/keystone-usb.txt +++ /dev/null @@ -1,56 +0,0 @@ -TI Keystone Soc USB Controller - -DWC3 GLUE - -Required properties: - - compatible: should be - "ti,keystone-dwc3" for Keystone 2 SoCs - "ti,am654-dwc3" for AM654 SoC - - #address-cells, #size-cells : should be '1' if the device has sub-nodes - with 'reg' property. - - reg : Address and length of the register set for the USB subsystem on - the SOC. - - interrupts : The irq number of this device that is used to interrupt the - MPU. - - ranges: allows valid 1:1 translation between child's address space and - parent's address space. - -SoC-specific Required Properties: -The following are mandatory properties for Keystone 2 66AK2HK, 66AK2L and 66AK2E -SoCs only: - -- clocks: Clock ID for USB functional clock. -- clock-names: Must be "usb". - - -The following are mandatory properties for 66AK2G and AM654: - -- power-domains: Should contain a phandle to a PM domain provider node - and an args specifier containing the USB device id - value. This property is as per the binding, - Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt - -Sub-nodes: -The dwc3 core should be added as subnode to Keystone DWC3 glue. -- dwc3 : - The binding details of dwc3 can be found in: - Documentation/devicetree/bindings/usb/dwc3.txt - -Example: - usb: usb@2680000 { - compatible = "ti,keystone-dwc3"; - #address-cells = <1>; - #size-cells = <1>; - reg = <0x2680000 0x10000>; - clocks = <&clkusb>; - clock-names = "usb"; - interrupts = ; - ranges; - - dwc3@2690000 { - compatible = "synopsys,dwc3"; - reg = <0x2690000 0x70000>; - interrupts = ; - usb-phy = <&usb_phy>, <&usb_phy>; - }; - }; diff --git a/Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml b/Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml new file mode 100644 index 000000000000..14d2fe329b93 --- /dev/null +++ b/Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml @@ -0,0 +1,67 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/usb/ti,keystone-dwc3.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: TI Keystone Soc USB Controller + +maintainers: + - Roger Quadros + +properties: + compatible: + oneOf: + - const: "ti,keystone-dwc3" + - const: "ti,am654-dwc3" + + reg: + maxItems: 1 + description: Address and length of the register set for the USB subsystem on + the SOC. + + interrupts: + maxItems: 1 + description: The irq number of this device that is used to interrupt the MPU. + + + clocks: + description: Clock ID for USB functional clock. + + power-domains: + description: Should contain a phandle to a PM domain provider node + and an args specifier containing the USB device id + value. This property is as per the binding, + Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt + + dwc3: + description: This is the node representing the DWC3 controller instance + Documentation/devicetree/bindings/usb/dwc3.txt + +required: + - compatible + - reg + - interrupts + - clocks + +examples: + - | + #include + + usb: usb@2680000 { + compatible = "ti,keystone-dwc3"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0x2680000 0x10000>; + clocks = <&clkusb>; + clock-names = "usb"; + interrupts = ; + ranges; + + dwc3@2690000 { + compatible = "synopsys,dwc3"; + reg = <0x2690000 0x70000>; + interrupts = ; + usb-phy = <&usb_phy>, <&usb_phy>; + }; + }; From patchwork Wed May 13 13:07:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 11546059 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7762F90 for ; Wed, 13 May 2020 13:07:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5C5D120673 for ; Wed, 13 May 2020 13:07:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="ThRcLeZH" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733167AbgEMNHV (ORCPT ); Wed, 13 May 2020 09:07:21 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:54104 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725967AbgEMNHU (ORCPT ); Wed, 13 May 2020 09:07:20 -0400 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 04DD7IPT043989; Wed, 13 May 2020 08:07:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1589375238; bh=C9IeA+VMqNp11foyocZyx6XO16F5Fon6CjEx0Vpeqlw=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=ThRcLeZHPxW5EQF4qTKczrAeOQFd3XVkHRAUvYvS3F9qIx9S72bPROkFO5VwdoxZJ +nwnpe6UnYif6zfdadSyRHl1R4sBZuBsCJ5ocHjmSfTj/u8M+B6rxR1HCu8V7vQ1dD ho4MHM3e9+lsazOECfrON+I4DCN3WFznH2AeT5Pg= Received: from DFLE110.ent.ti.com (dfle110.ent.ti.com [10.64.6.31]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 04DD7I90010782 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 13 May 2020 08:07:18 -0500 Received: from DFLE100.ent.ti.com (10.64.6.21) by DFLE110.ent.ti.com (10.64.6.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Wed, 13 May 2020 08:07:18 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Wed, 13 May 2020 08:07:18 -0500 Received: from lta0400828a.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 04DD7B2S074071; Wed, 13 May 2020 08:07:16 -0500 From: Roger Quadros To: CC: , , , , , Roger Quadros Subject: [PATCH 2/3] dt-bindings: usb: ti,keystone-dwc3.yaml: Add USB3.0 PHY property Date: Wed, 13 May 2020 16:07:08 +0300 Message-ID: <20200513130709.10239-3-rogerq@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200513130709.10239-1-rogerq@ti.com> References: <20200513130709.10239-1-rogerq@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org AM654 SoC requires USB3.0 PHY to be turned on before the USB controller. For this SoC, the 'phys' property is used to provide the USB3.0 reference. Signed-off-by: Roger Quadros --- .../bindings/usb/ti,keystone-dwc3.yaml | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml b/Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml index 14d2fe329b93..51c0ab01b0bc 100644 --- a/Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml +++ b/Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml @@ -34,6 +34,16 @@ properties: value. This property is as per the binding, Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt + phys: + description: + PHY specifier for the USB3.0 PHY. Some SoCs need the USB3.0 PHY + to be turned on before the controller. + Documentation/devicetree/bindings/phy/phy-bindings.txt + + phy-names: + items: + - const: "usb3-phy" + dwc3: description: This is the node representing the DWC3 controller instance Documentation/devicetree/bindings/usb/dwc3.txt @@ -44,6 +54,17 @@ required: - interrupts - clocks +if: + properties: + compatible: + contains: + const: "ti,am654-dwc3" + +then: + required: + - phys + - phy-names + examples: - | #include From patchwork Wed May 13 13:07:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 11546061 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B3AEB81 for ; Wed, 13 May 2020 13:07:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9A918206CC for ; Wed, 13 May 2020 13:07:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="kAkiwK4g" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733218AbgEMNHY (ORCPT ); Wed, 13 May 2020 09:07:24 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:48950 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733182AbgEMNHW (ORCPT ); Wed, 13 May 2020 09:07:22 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 04DD7Kf1043033; Wed, 13 May 2020 08:07:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1589375240; bh=5K+SEGQeU5EpeWcccdRNrdDbsnRedKCXOuo8mbwS6a8=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=kAkiwK4gmsI3IObS1d0pMN20fNxEMri/JnVKQUZSxRrdRJ4Ti26pmFqU36POHxXfo E8KFX8wHpOT8VkNt17Pken/mDV67dsN8bgkfsI1kux/BxfHZ7zxBqda8mrOzX+Bu4x y9UHvlME7SVHJTPIKTb2Faly+ukq9GeaTUglQA+E= Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id 04DD7KLm068039; Wed, 13 May 2020 08:07:20 -0500 Received: from DFLE104.ent.ti.com (10.64.6.25) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Wed, 13 May 2020 08:07:20 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Wed, 13 May 2020 08:07:20 -0500 Received: from lta0400828a.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 04DD7B2T074071; Wed, 13 May 2020 08:07:18 -0500 From: Roger Quadros To: CC: , , , , , Roger Quadros Subject: [PATCH 3/3] usb: dwc3: keystone: Turn on USB3 PHY before controller Date: Wed, 13 May 2020 16:07:09 +0300 Message-ID: <20200513130709.10239-4-rogerq@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200513130709.10239-1-rogerq@ti.com> References: <20200513130709.10239-1-rogerq@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org The Local Power Sleep Controller (LPSC) dependency on AM65 requires SERDES0 to be powered on before USB. We need to power up SERDES0 power domain and hold it on throughout the reset, init, power on sequence. Signed-off-by: Roger Quadros --- drivers/usb/dwc3/dwc3-keystone.c | 47 +++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/dwc3-keystone.c b/drivers/usb/dwc3/dwc3-keystone.c index 1e14a6f4884b..46d46f3507fc 100644 --- a/drivers/usb/dwc3/dwc3-keystone.c +++ b/drivers/usb/dwc3/dwc3-keystone.c @@ -14,6 +14,7 @@ #include #include #include +#include #include /* USBSS register offsets */ @@ -34,6 +35,7 @@ struct dwc3_keystone { struct device *dev; void __iomem *usbss; + struct phy *usb3_phy; }; static inline u32 kdwc3_readl(void __iomem *base, u32 offset) @@ -95,8 +97,44 @@ static int kdwc3_probe(struct platform_device *pdev) if (IS_ERR(kdwc->usbss)) return PTR_ERR(kdwc->usbss); - pm_runtime_enable(kdwc->dev); + /* PSC dependency on AM65 needs SERDES0 to be powered before USB0 */ + kdwc->usb3_phy = devm_phy_get(dev, "usb3-phy"); + if (IS_ERR(kdwc->usb3_phy)) { + error = PTR_ERR(kdwc->usb3_phy); + if (error == -ENOSYS || error == -ENODEV) { + kdwc->usb3_phy = NULL; + } else { + if (error != -EPROBE_DEFER) { + dev_err(dev, "couldn't get usb3 phy: %d\n", + error); + } + + return error; + } + } + + phy_pm_runtime_get_sync(kdwc->usb3_phy); + + error = phy_reset(kdwc->usb3_phy); + if (error < 0) { + dev_err(dev, "usb3 phy reset failed: %d\n", error); + return error; + } + + error = phy_init(kdwc->usb3_phy); + if (error < 0) { + dev_err(dev, "usb3 phy init failed: %d\n", error); + return error; + } + error = phy_power_on(kdwc->usb3_phy); + if (error < 0) { + dev_err(dev, "usb3 phy power on failed: %d\n", error); + phy_exit(kdwc->usb3_phy); + return error; + } + + pm_runtime_enable(kdwc->dev); error = pm_runtime_get_sync(kdwc->dev); if (error < 0) { dev_err(kdwc->dev, "pm_runtime_get_sync failed, error %d\n", @@ -138,6 +176,9 @@ static int kdwc3_probe(struct platform_device *pdev) err_irq: pm_runtime_put_sync(kdwc->dev); pm_runtime_disable(kdwc->dev); + phy_power_off(kdwc->usb3_phy); + phy_exit(kdwc->usb3_phy); + phy_pm_runtime_put_sync(kdwc->usb3_phy); return error; } @@ -163,6 +204,10 @@ static int kdwc3_remove(struct platform_device *pdev) pm_runtime_put_sync(kdwc->dev); pm_runtime_disable(kdwc->dev); + phy_power_off(kdwc->usb3_phy); + phy_exit(kdwc->usb3_phy); + phy_pm_runtime_put_sync(kdwc->usb3_phy); + platform_set_drvdata(pdev, NULL); return 0;