Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751849AbdHQHJ7 (ORCPT ); Thu, 17 Aug 2017 03:09:59 -0400 Received: from fllnx209.ext.ti.com ([198.47.19.16]:64131 "EHLO fllnx209.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750943AbdHQHJ4 (ORCPT ); Thu, 17 Aug 2017 03:09:56 -0400 Subject: Re: [PATCH v2 1/2] usb: dwc3: keystone: Add PM_RUNTIME Support to DWC3 Keystone USB driver To: Franklin S Cooper Jr , , , , , , , , , , References: <20170816215408.13076-1-fcooper@ti.com> <20170816215408.13076-2-fcooper@ti.com> From: Roger Quadros Message-ID: <6c96175e-3624-0921-8e2f-00378a270b59@ti.com> Date: Thu, 17 Aug 2017 10:08:22 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170816215408.13076-2-fcooper@ti.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-GB X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by nfs id v7H7A3nN016175 Content-Length: 2724 Lines: 94  Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki On 17/08/17 00:54, Franklin S Cooper Jr wrote: > For 66AK2Gx there is a requirement to use PM Runtime to properly manage > clocks and the power domains. Therefore, add PM runtime support. Remove > legacy clock api's calls since other users of this driver worked without > these clock apis calls. > > Signed-off-by: Franklin S Cooper Jr Acked-by: Roger Quadros > --- > drivers/usb/dwc3/dwc3-keystone.c | 22 ++++++++++------------ > 1 file changed, 10 insertions(+), 12 deletions(-) > > diff --git a/drivers/usb/dwc3/dwc3-keystone.c b/drivers/usb/dwc3/dwc3-keystone.c > index 12ee23f..d2ed952 100644 > --- a/drivers/usb/dwc3/dwc3-keystone.c > +++ b/drivers/usb/dwc3/dwc3-keystone.c > @@ -15,7 +15,6 @@ > * GNU General Public License for more details. > */ > > -#include > #include > #include > #include > @@ -23,6 +22,7 @@ > #include > #include > #include > +#include > > /* USBSS register offsets */ > #define USBSS_REVISION 0x0000 > @@ -41,7 +41,6 @@ > > struct dwc3_keystone { > struct device *dev; > - struct clk *clk; > void __iomem *usbss; > }; > > @@ -106,17 +105,13 @@ static int kdwc3_probe(struct platform_device *pdev) > if (IS_ERR(kdwc->usbss)) > return PTR_ERR(kdwc->usbss); > > - kdwc->clk = devm_clk_get(kdwc->dev, "usb"); > - if (IS_ERR(kdwc->clk)) { > - dev_err(kdwc->dev, "unable to get usb clock\n"); > - return PTR_ERR(kdwc->clk); > - } > + pm_runtime_enable(kdwc->dev); > > - error = clk_prepare_enable(kdwc->clk); > + error = pm_runtime_get_sync(kdwc->dev); > if (error < 0) { > - dev_err(kdwc->dev, "unable to enable usb clock, error %d\n", > + dev_err(kdwc->dev, "pm_runtime_get_sync failed, error %d\n", > error); > - return error; > + goto err_irq; > } > > irq = platform_get_irq(pdev, 0); > @@ -147,7 +142,8 @@ static int kdwc3_probe(struct platform_device *pdev) > err_core: > kdwc3_disable_irqs(kdwc); > err_irq: > - clk_disable_unprepare(kdwc->clk); > + pm_runtime_put_sync(kdwc->dev); > + pm_runtime_disable(kdwc->dev); > > return error; > } > @@ -167,7 +163,9 @@ static int kdwc3_remove(struct platform_device *pdev) > > kdwc3_disable_irqs(kdwc); > device_for_each_child(&pdev->dev, NULL, kdwc3_remove_core); > - clk_disable_unprepare(kdwc->clk); > + pm_runtime_put_sync(kdwc->dev); > + pm_runtime_disable(kdwc->dev); > + > platform_set_drvdata(pdev, NULL); > > return 0; > -- cheers, -roger