From patchwork Mon May 25 07:10:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 11568159 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 5BCAC15E4 for ; Mon, 25 May 2020 07:11:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2AEB62071A for ; Mon, 25 May 2020 07:11:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="VUMKauIJ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388981AbgEYHLI (ORCPT ); Mon, 25 May 2020 03:11:08 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:34058 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388979AbgEYHLH (ORCPT ); Mon, 25 May 2020 03:11:07 -0400 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 04P7AstL068652; Mon, 25 May 2020 02:10:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1590390654; bh=95hvA0bQAWwkvQo1S9cy4RYDGWSfQiEBjR10x+N8Vlg=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=VUMKauIJ5AVBKrvPjxWVdxS+9sbZOHjMeEbmZQ/ntDEUlKhtyXKAer4BpTRJRc0CW LaceH7B+0rXUW6pSKGYTmcCf1lvdUeI1Al6PyWYBPPJAcjZviz+Lp6/zLLZSkbjimF KLpk3YEwoO0X9HtthIlHREcrixdJ0/ccdNadNgVw= Received: from DLEE112.ent.ti.com (dlee112.ent.ti.com [157.170.170.23]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 04P7AspA091515 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 25 May 2020 02:10:54 -0500 Received: from DLEE109.ent.ti.com (157.170.170.41) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Mon, 25 May 2020 02:10:54 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE109.ent.ti.com (157.170.170.41) 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; Mon, 25 May 2020 02:10:54 -0500 Received: from lta0400828a.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 04P7AohV077897; Mon, 25 May 2020 02:10:52 -0500 From: Roger Quadros To: CC: , , , , Roger Quadros Subject: [PATCH v2 1/2] dt-bindings: usb: ti,keystone-dwc3.yaml: Add USB3.0 PHY property Date: Mon, 25 May 2020 10:10:47 +0300 Message-ID: <20200525071048.7738-2-rogerq@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200525071048.7738-1-rogerq@ti.com> References: <20200525071048.7738-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 --- .../devicetree/bindings/usb/ti,keystone-dwc3.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml b/Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml index 14d2fe329b93..f127535feb0b 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 From patchwork Mon May 25 07:10:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 11568161 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 C2D4090 for ; Mon, 25 May 2020 07:11:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AA200207FB for ; Mon, 25 May 2020 07:11:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="MBcWhj2i" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388993AbgEYHLL (ORCPT ); Mon, 25 May 2020 03:11:11 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:36076 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388979AbgEYHLK (ORCPT ); Mon, 25 May 2020 03:11:10 -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 04P7Auql042631; Mon, 25 May 2020 02:10:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1590390656; bh=FoaDS57l9HZ38RVGEQeLkyX++9L0ZXthsJfhk8G2VPE=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=MBcWhj2ijDYRhXyGiEGnCMKftWtheqxkPTkkZ5AaeyJFlFEDraZAh12u3DhPmGwyX scNd19w8S1T+W59D4x7wmeW7DP0XYd9Pl5zmyDUDLCpS3+Qln7vbTnG+zTKE96o8rt drdxB3dsg5T7awls5HCn2+zi2PT1z08Liw0hOAGs= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 04P7Au53091528 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 25 May 2020 02:10:56 -0500 Received: from DLEE100.ent.ti.com (157.170.170.30) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Mon, 25 May 2020 02:10:55 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE100.ent.ti.com (157.170.170.30) 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; Mon, 25 May 2020 02:10:55 -0500 Received: from lta0400828a.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 04P7AohW077897; Mon, 25 May 2020 02:10:54 -0500 From: Roger Quadros To: CC: , , , , Roger Quadros Subject: [PATCH v2 2/2] usb: dwc3: keystone: Turn on USB3 PHY before controller Date: Mon, 25 May 2020 10:10:48 +0300 Message-ID: <20200525071048.7738-3-rogerq@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200525071048.7738-1-rogerq@ti.com> References: <20200525071048.7738-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 | 41 +++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/dwc3-keystone.c b/drivers/usb/dwc3/dwc3-keystone.c index 1e14a6f4884b..6505f7bd69e2 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,38 @@ 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_optional_get(dev, "usb3-phy"); + if (IS_ERR(kdwc->usb3_phy)) { + error = PTR_ERR(kdwc->usb3_phy); + 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 +170,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 +198,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;