From patchwork Tue Dec 13 19:51:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: subhashj@codeaurora.org X-Patchwork-Id: 9473047 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 DC539607EE for ; Tue, 13 Dec 2016 19:52:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D63022864C for ; Tue, 13 Dec 2016 19:52:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CA2662868D; Tue, 13 Dec 2016 19:52:24 +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 3B9EC2864C for ; Tue, 13 Dec 2016 19:52:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935064AbcLMTvy (ORCPT ); Tue, 13 Dec 2016 14:51:54 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:32952 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935019AbcLMTvv (ORCPT ); Tue, 13 Dec 2016 14:51:51 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 63EDC614FD; Tue, 13 Dec 2016 19:51:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1481658710; bh=XW4papRv9xNjKu9gTAD8GzwSnQmPb83Jn6yo+Ur1w9Q=; h=From:To:Cc:Subject:Date:From; b=ZtZX4jrrOY35Sm7brpbUeAlnoI6GnVic8izNDgk554Gi1lHcHDcELGgmbjdg8r8xZ SUREfnX4ekgWn/ao7bvHf9G3veVFeV7fSSuyNQi0h/KtIZq+dmk4gfgqXvPmT0PEQ3 kRDsTWedunvtj/O4tuZnH8fq0hatuRFyMuehWmq8= Received: from pacamara-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: subhashj@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id CE5CA6145F; Tue, 13 Dec 2016 19:51:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1481658710; bh=XW4papRv9xNjKu9gTAD8GzwSnQmPb83Jn6yo+Ur1w9Q=; h=From:To:Cc:Subject:Date:From; b=ZtZX4jrrOY35Sm7brpbUeAlnoI6GnVic8izNDgk554Gi1lHcHDcELGgmbjdg8r8xZ SUREfnX4ekgWn/ao7bvHf9G3veVFeV7fSSuyNQi0h/KtIZq+dmk4gfgqXvPmT0PEQ3 kRDsTWedunvtj/O4tuZnH8fq0hatuRFyMuehWmq8= DMARC-Filter: OpenDMARC Filter v1.3.1 smtp.codeaurora.org CE5CA6145F Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=pass smtp.mailfrom=subhashj@codeaurora.org From: Subhash Jadavani To: vinholikatti@gmail.com, jejb@linux.vnet.ibm.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, Subhash Jadavani , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v2 09/12] scsi: ufs: fix setting init power mode Date: Tue, 13 Dec 2016 11:51:41 -0800 Message-Id: <1481658701-32211-1-git-send-email-subhashj@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Immediately after successful UFS link startup, UFS link power mode would be in PWM-G1, 1-lane, SLOW-AUTO mode. But currently we are doing few of the DME local/peer attributes access before setting the "hba->pwr_info" to default power mode. If we are doing link startup as part of error recovery then old power mode might be set to FAST mode and doing DME peer access (after link startup but before updating "hba->pwr_info" to default power mode) unintentionally tries to switch from FAST to FAST_AUTO mode (if UFSHCD_QUIRK_DME_PEER_ACCESS_AUTO_MODE quirk is enabled). Above issue is fixed by setting the default power mode immediately after successful link startup. Reviewed-by: Sahitya Tummala Signed-off-by: Subhash Jadavani --- drivers/scsi/ufs/ufshcd.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 9745215..70742f9 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -3539,6 +3539,10 @@ static int ufshcd_link_startup(struct ufs_hba *hba) goto link_startup; } + /* Mark that link is up in PWM-G1, 1-lane, SLOW-AUTO mode */ + ufshcd_init_pwr_info(hba); + ufshcd_print_pwr_info(hba); + if (hba->quirks & UFSHCD_QUIRK_BROKEN_LCC) { ret = ufshcd_disable_device_tx_lcc(hba); if (ret) @@ -5574,9 +5578,6 @@ static int ufshcd_probe_hba(struct ufs_hba *hba) if (ret) goto out; - ufshcd_init_pwr_info(hba); - ufshcd_print_pwr_info(hba); - /* set the default level for urgent bkops */ hba->urgent_bkops_lvl = BKOPS_STATUS_PERF_IMPACT; hba->is_urgent_bkops_lvl_checked = false;