From patchwork Thu Mar 22 08:50:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manu Gautam X-Patchwork-Id: 10301001 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B0EF560349 for ; Thu, 22 Mar 2018 08:53:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A3EC528FE8 for ; Thu, 22 Mar 2018 08:53:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 97D272997B; Thu, 22 Mar 2018 08:53:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ECBC828FE8 for ; Thu, 22 Mar 2018 08:53:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752819AbeCVIvT (ORCPT ); Thu, 22 Mar 2018 04:51:19 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:38436 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752629AbeCVIvN (ORCPT ); Thu, 22 Mar 2018 04:51:13 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 9C1BD60F78; Thu, 22 Mar 2018 08:51:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521708672; bh=d0DSq3IC0+IuU0ffAly76bKtfCAz+AR2QK0L/32QsQ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OwWrYJHOCMM5wEmaRXp4ZwBXkx38XqG1Dr5zCVoUunpETSqoZBMYraVi9gV99oEIe H+OLnNaXHsDN191ltPTCiux25N4L2OBEfBT6ea/TddgUwys1IDN9yuC++JADGIqCFP zcZTW+gpjYwGH7l7Gye5neevnrQXmSwFmx7yrKK0= 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 DBB7660314; Thu, 22 Mar 2018 08:51:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521708671; bh=d0DSq3IC0+IuU0ffAly76bKtfCAz+AR2QK0L/32QsQ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jFkyvSG7wSQ2HzMTTVXvgL4fEq6qLB20T8Te8oWBWJE9SQDAoqYrSuTZN0qeCBt5F PRkLEQuIpRr8qmn4qlb8u/EtbUI5pYjAtW8uMNV8WIf5ISRNdRN2zS07SJN3mxwwdR oLJMCAzU4r35qAQ7HlR5ukEr49sWhqiVgnnvO0rg= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org DBB7660314 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 Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Rob Herring , linux-arm-msm@vger.kernel.org, Manu Gautam , Vivek Gautam , Varadarajan Narayanan , smuthayy , Wei Yongjun , Fengguang Wu Subject: [PATCH v2 1/6] phy: qcom-qmp: Enable pipe_clk before checking USB3 PHY_STATUS Date: Thu, 22 Mar 2018 14:20:41 +0530 Message-Id: <1521708646-5379-2-git-send-email-mgautam@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1521708646-5379-1-git-send-email-mgautam@codeaurora.org> References: <1521708646-5379-1-git-send-email-mgautam@codeaurora.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP QMP PHY for USB mode requires pipe_clk for calibration and PLL lock to take place. This lock is output from PHY to GCC clock_ctl and then fed back to QMP PHY and is output from PHY only after PHY is reset and initialized, hence it can't be enabled too early in initialization sequence. Signed-off-by: Manu Gautam --- drivers/phy/qualcomm/phy-qcom-qmp.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c b/drivers/phy/qualcomm/phy-qcom-qmp.c index 6470c5d..73aa282 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp.c @@ -797,8 +797,13 @@ static int qcom_qmp_phy_poweron(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 ret; + /* Not needed for USB3 PHY as pipe_clk is enabled from phy_init */ + if (cfg->type == PHY_TYPE_USB3) + return 0; + ret = clk_prepare_enable(qphy->pipe_clk); if (ret) dev_err(qmp->dev, "pipe_clk enable failed, err=%d\n", ret); @@ -1008,6 +1013,19 @@ static int qcom_qmp_phy_init(struct phy *phy) status = pcs + cfg->regs[QPHY_PCS_READY_STATUS]; mask = cfg->mask_pcs_ready; + /* USB3 PHY requires pipe_clk for PLL lock and calibration */ + if (cfg->type == PHY_TYPE_USB3) { + ret = clk_prepare_enable(qphy->pipe_clk); + if (ret) + dev_err(qmp->dev, "pipe_clk enable err=%d\n", ret); + /* + * Ignore this error as pipe_clk might take some time to get + * enabled. In any case following check for PHY PLL lock would + * timeout below if there is a fatal error and clock is not fed + * to PHY + */ + } + ret = readl_poll_timeout(status, val, !(val & mask), 1, PHY_INIT_COMPLETE_TIMEOUT); if (ret) {