From patchwork Tue Jul 31 10:09:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Can Guo X-Patchwork-Id: 10550569 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C47AE157D for ; Tue, 31 Jul 2018 10:09:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A8F852A6DD for ; Tue, 31 Jul 2018 10:09:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D4722A6FF; Tue, 31 Jul 2018 10:09:44 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,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 44B9F2A6DD for ; Tue, 31 Jul 2018 10:09:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732136AbeGaLtR (ORCPT ); Tue, 31 Jul 2018 07:49:17 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:48492 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732045AbeGaLtQ (ORCPT ); Tue, 31 Jul 2018 07:49:16 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 20F6E60B1A; Tue, 31 Jul 2018 10:09:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1533031781; bh=BW0gx5Ym457x+FGMA3bD2LdtsHlaXGggxSw9ve8l0FA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LTkI5OleTQFQ08RM4+Y/T79d9u6zMgtbQsLPdoh6LuM82RrIMTeG1XwK9qJ85ybLB y0nuVzrOAhNvp4FlnY1CjAO2Ry6RgBcNLdq19d0BUQQtO+71TWjzfB65H5Dtj+nnp7 GvHVu23JnTJPoDh+1igIQ8MYYPVTpRHbfquSO9bs= Received: from CANG02.ap.qualcomm.com (unknown [180.166.53.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: cang@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 2BB4060275; Tue, 31 Jul 2018 10:09:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1533031780; bh=BW0gx5Ym457x+FGMA3bD2LdtsHlaXGggxSw9ve8l0FA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=envMuXCe4eKkFVd8tef/RGV4r/FmVOzE4mWEufsFlmbW56KP4yFqvUOvMSGT5mZTx 1VmsGWMPDZ54TvlDr61S0Yj+kDHdCZokx6f8IiB03E1BBsLMHD7tZ9YYhV+P3WzY4K kBW7BKqCWBG5wFP0ut0R6Zkh5ZkrWzChAw7iPo+k= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 2BB4060275 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=cang@codeaurora.org From: Can Guo To: subhashj@codeaurora.org, asutoshd@codeaurora.org, vivek.gautam@codeaurora.org, mgautam@codeaurora.org, kishon@ti.com, robh+dt@kernel.org, mark.rutland@arm.com Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, Can Guo Subject: [PATCH v8 4/5] scsi: ufs: Power on phy after it is initialized Date: Tue, 31 Jul 2018 18:09:13 +0800 Message-Id: <20180731100914.19856-5-cang@codeaurora.org> X-Mailer: git-send-email 2.15.0.windows.1 In-Reply-To: <20180731100914.19856-1-cang@codeaurora.org> References: <20180731100914.19856-1-cang@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 Before UFS PHY is initialized, powering on it has no effect but increases the PHY's power on count. Then when power on PHY to enable it after phy initialization where it is really needed, as PHY's power on count is not zero, again it would do nothing but directly return and leaves the PHY disabled. This change adds condition checks to phy power on calls which happen before phy initialization. Signed-off-by: Can Guo Reviewed-by: Evan Green --- drivers/scsi/ufs/ufs-qcom.c | 4 +++- drivers/scsi/ufs/ufs-qcom.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c index 2b38db2..4e9d526 100644 --- a/drivers/scsi/ufs/ufs-qcom.c +++ b/drivers/scsi/ufs/ufs-qcom.c @@ -288,6 +288,7 @@ static int ufs_qcom_power_up_sequence(struct ufs_hba *hba) __func__, ret); goto out; } + host->is_phy_init = true; /* De-assert PHY reset and start serdes */ ufs_qcom_deassert_reset(hba); @@ -1147,7 +1148,8 @@ static int ufs_qcom_setup_clocks(struct ufs_hba *hba, bool on, return 0; if (on && (status == POST_CHANGE)) { - phy_power_on(host->generic_phy); + if (host->is_phy_init) + phy_power_on(host->generic_phy); /* enable the device ref clock for HS mode*/ if (ufshcd_is_hs_mode(&hba->pwr_info)) diff --git a/drivers/scsi/ufs/ufs-qcom.h b/drivers/scsi/ufs/ufs-qcom.h index 295f4be..5747aa3 100644 --- a/drivers/scsi/ufs/ufs-qcom.h +++ b/drivers/scsi/ufs/ufs-qcom.h @@ -242,6 +242,7 @@ struct ufs_qcom_host { /* Bitmask for enabling debug prints */ u32 dbg_print_en; struct ufs_qcom_testbus testbus; + bool is_phy_init; }; static inline u32