Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752199AbdHIKv3 (ORCPT ); Wed, 9 Aug 2017 06:51:29 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:57810 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751890AbdHIKv1 (ORCPT ); Wed, 9 Aug 2017 06:51:27 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org B15EC600C9 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=mgautam@codeaurora.org Subject: Re: [PATCH v1 2/6] phy: qcom-qmp: Power-on PHY before initialization To: Kishon Vijay Abraham I , Felipe Balbi Cc: linux-arm-msm@vger.kernel.org, Vivek Gautam , Jaehoon Chung , Wei Yongjun , Fengguang Wu , "open list:GENERIC PHY FRAMEWORK" References: <1500634921-25914-1-git-send-email-mgautam@codeaurora.org> <1500634921-25914-3-git-send-email-mgautam@codeaurora.org> From: Manu Gautam Message-ID: <3c9e0734-b103-b763-b209-49b3718e6493@codeaurora.org> Date: Wed, 9 Aug 2017 16:21:21 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <1500634921-25914-3-git-send-email-mgautam@codeaurora.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2418 Lines: 86 On 7/21/2017 4:31 PM, Manu Gautam wrote: > } > @@ -729,19 +771,17 @@ static int qcom_qmp_phy_init(struct phy *phy) > void __iomem *pcs = qphy->pcs; > void __iomem *status; > unsigned int mask, val; > - int ret, i; > + int ret; > > dev_vdbg(qmp->dev, "Initializing QMP phy\n"); > > - for (i = 0; i < qmp->cfg->num_clks; i++) { > - ret = clk_prepare_enable(qmp->clks[i]); > - if (ret) { > - dev_err(qmp->dev, "failed to enable %s clk, err=%d\n", > - qmp->cfg->clk_list[i], ret); > - while (--i >= 0) > - clk_disable_unprepare(qmp->clks[i]); > - } > - } > + ret = qcom_qmp_phy_poweron(qmp); > + if (ret) > + return ret; > + > + ret = qcom_qmp_phy_enable_clocks(qmp); > + if (ret) > + goto err_clk_enable; > > ret = qcom_qmp_phy_com_init(qmp); In next version I will move poweron and clock_enable to com_init as PCI QMP PHY might use multiple PHY instances (for each lane) each of them will call phy_init/exit. qcom_qmp_phy_com_init executed only once, hence better suited for turning ON clocks/regulators. > if (ret) > @@ -801,8 +841,9 @@ static int qcom_qmp_phy_init(struct phy *phy) > err_lane_rst: > qcom_qmp_phy_com_exit(qmp); > err_com_init: > - while (--i >= 0) > - clk_disable_unprepare(qmp->clks[i]); > + qcom_qmp_phy_disable_clocks(qmp); > +err_clk_enable: > + qcom_qmp_phy_poweroff(qmp); > > return ret; > } > @@ -812,7 +853,6 @@ static int qcom_qmp_phy_exit(struct phy *phy) > struct qmp_phy *qphy = phy_get_drvdata(phy); > struct qcom_qmp *qmp = qphy->qmp; > const struct qmp_phy_cfg *cfg = qmp->cfg; > - int i = cfg->num_clks; > > clk_disable_unprepare(qphy->pipe_clk); > > @@ -830,8 +870,9 @@ static int qcom_qmp_phy_exit(struct phy *phy) > > qcom_qmp_phy_com_exit(qmp); > > - while (--i >= 0) > - clk_disable_unprepare(qmp->clks[i]); > + qcom_qmp_phy_disable_clocks(qmp); > + > + qcom_qmp_phy_poweroff(qmp); On similar lines will be moving these to qcom_qmp_phy_com_exit(). > > return 0; > } > @@ -958,8 +999,6 @@ static int phy_pipe_clk_register(struct qcom_qmp *qmp, int id) > static const struct phy_ops qcom_qmp_phy_gen_ops = { > .init = qcom_qmp_phy_init, > .exit = qcom_qmp_phy_exit, > - .power_on = qcom_qmp_phy_poweron, > - .power_off = qcom_qmp_phy_poweroff, > .owner = THIS_MODULE, > }; > -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project