Received: by 10.192.165.148 with SMTP id m20csp1100001imm; Wed, 2 May 2018 14:09:57 -0700 (PDT) X-Google-Smtp-Source: AB8JxZq8GnC60ceKBI5m8ozfn2aSXN2wPY8y5PklsKznIE4jNbruO13XVFZynKTt6q/J8obYccHB X-Received: by 2002:a17:902:380c:: with SMTP id l12-v6mr9770991plc.19.1525295397477; Wed, 02 May 2018 14:09:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525295397; cv=none; d=google.com; s=arc-20160816; b=E3bqtd15qb5pSuCfA4e6Q04ZjtQQ/AneHi9E7m4uEQZlO/coMANyD8vrfC53r8juG6 BAVnEdphYMPMRFZihnMuZ4qlMl6y7KC2PU0MU9B+Bk5M8Sh/hrg8P1hOVRPytafH5K9v rHeyYZ00HIa/VHEjM6PmDcIbxnG6Z6DSvP0z5wZdpNLlW2twyy9f/yVJBPxRuNUrOq9x +TQWKZIskfYW92FiI/5cjs0BGLsK5MmZzjmMQzWUEziBwHucbTTEfyROcywUQkX/pRkm ZGPLW67Cdo4GrDBqe4eVHe8tFeB0G9LedTc3x7ypZMAxl6o87VlngHqNM4CbMhUxRrBN Cr4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=IhSH246unSlSm2y52+36x+Ya3NE3ADHEmH3ghkVYEHI=; b=pg606YK8j+hh5RPGQUIZcej2JaMdv2FCMLquu4MTTIDzT3dV37WfoC4X5ghDIJRWRv WSP5pJjMkpSaNCgB2N/f5YyXObqqRKyyEV/xoJqKieX8Gad3orsODc7GCGIKhh8qyp2t CDbJc9duR3qQlFKC5X21Vc8miKzs/YcqinDn2MKdVsOMNOnTZTVwdK8DI2UIuBowWNc9 M4tTWPrDF7ASslUfeVgEYQJT6Jn4FdkKO77Aqv3uGrZWWV7/vPSiQQxu6kXybihumB/i 7HttLUXDQps4uU1jkv0AcN5wC2DOtJRf0cHXoCTW4zNRgZS1gay81KGcQ9nzeTivVCFj gWMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=Nj2+i6tJ; dkim=pass header.i=@codeaurora.org header.s=default header.b=JIvW9BIl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 6si12116983pft.35.2018.05.02.14.09.41; Wed, 02 May 2018 14:09:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=Nj2+i6tJ; dkim=pass header.i=@codeaurora.org header.s=default header.b=JIvW9BIl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751805AbeEBVGt (ORCPT + 99 others); Wed, 2 May 2018 17:06:49 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:59568 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750945AbeEBVGl (ORCPT ); Wed, 2 May 2018 17:06:41 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 1EFCD60AD4; Wed, 2 May 2018 21:06:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1525295200; bh=+wsU8sPexnHjC0GzZJAdrFRq+pQh2CLo8QB4Lr940Hg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nj2+i6tJMlC9FfBc0zqvQgYTMQvY8dpPBWMxvKSJeJ9pdEPr0ANaSPsKl77fvOz6T WLMZZVgRnDvsu0LmcN3eS4Lk3HCwk2X5wzek6Fm9VunRiK7ckwwrlzwiuUqVADir1/ uZ6x9slNNlJKCXcGkbW1YJkz+eyH+BSeIqel2q/Y= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from mgautam-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mgautam@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id C626F607E1; Wed, 2 May 2018 21:06:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1525295199; bh=+wsU8sPexnHjC0GzZJAdrFRq+pQh2CLo8QB4Lr940Hg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JIvW9BIl+r1Ul4IQdI1jqyGkb0WeLWVH1ql5W13mQC6Qubmv/qeQ07mbs1QlD1FAJ 7FAvvOJasr57hFMAH5Es09rYjvSQWmF/MDykn8MQSbfgtOwDKE3C7hzgLHznWjL2Rh GkMCu5QzXIjxg0yLp5iaFgJ+hFiyyJhqNWW37q+Q= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org C626F607E1 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 From: Manu Gautam To: Kishon Vijay Abraham I , robh@kernel.org, sboyd@kernel.org Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dianders@chromium.org, evgreen@chromium.org, Vivek Gautam , linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, Manu Gautam Subject: [PATCH v5 2/7] phy: qcom-qmp: Enable pipe_clk before PHY initialization Date: Thu, 3 May 2018 02:36:09 +0530 Message-Id: <1525295174-15995-3-git-send-email-mgautam@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1525295174-15995-1-git-send-email-mgautam@codeaurora.org> References: <1525295174-15995-1-git-send-email-mgautam@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org QMP PHY for USB/PCIE requires pipe_clk for locking of retime buffers at the pipe interface. Driver checks for PHY_STATUS without enabling pipe_clk due to which phy_init() fails with initialization timeout. Though pipe_clk is output from PHY (after PLL is programmed during initialization sequence) to GCC clock_ctl and then fed back to PHY but for PHY_STATUS register to reflect successful initialization pipe_clk from GCC must be present. Since, clock driver now ignores status_check for pipe_clk on clk_enable/disable, driver can safely enable/disable pipe_clk from phy_init/exit. Signed-off-by: Manu Gautam --- drivers/phy/qualcomm/phy-qcom-qmp.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c b/drivers/phy/qualcomm/phy-qcom-qmp.c index 6470c5d..fddb1c9 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp.c @@ -793,19 +793,6 @@ static void qcom_qmp_phy_configure(void __iomem *base, } } -static int qcom_qmp_phy_poweron(struct phy *phy) -{ - struct qmp_phy *qphy = phy_get_drvdata(phy); - struct qcom_qmp *qmp = qphy->qmp; - int ret; - - ret = clk_prepare_enable(qphy->pipe_clk); - if (ret) - dev_err(qmp->dev, "pipe_clk enable failed, err=%d\n", ret); - - return ret; -} - static int qcom_qmp_phy_com_init(struct qcom_qmp *qmp) { const struct qmp_phy_cfg *cfg = qmp->cfg; @@ -974,6 +961,12 @@ static int qcom_qmp_phy_init(struct phy *phy) } } + ret = clk_prepare_enable(qphy->pipe_clk); + if (ret) { + dev_err(qmp->dev, "pipe_clk enable failed err=%d\n", ret); + goto err_clk_enable; + } + /* Tx, Rx, and PCS configurations */ qcom_qmp_phy_configure(tx, cfg->regs, cfg->tx_tbl, cfg->tx_tbl_num); /* Configuration for other LANE for USB-DP combo PHY */ @@ -1019,6 +1012,8 @@ static int qcom_qmp_phy_init(struct phy *phy) return ret; err_pcs_ready: + clk_disable_unprepare(qphy->pipe_clk); +err_clk_enable: if (cfg->has_lane_rst) reset_control_assert(qphy->lane_rst); err_lane_rst: @@ -1283,7 +1278,6 @@ static int phy_pipe_clk_register(struct qcom_qmp *qmp, struct device_node *np) 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, .set_mode = qcom_qmp_phy_set_mode, .owner = THIS_MODULE, }; -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project