Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1195783ybx; Fri, 1 Nov 2019 18:23:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqxkmHa/qIRm5Y72qLOEkI8O/gEAMv8dSpaqvZqWi2iy8amN+x/AAWJmMXWam539DqnGee1p X-Received: by 2002:aa7:c954:: with SMTP id h20mr15877224edt.159.1572657814228; Fri, 01 Nov 2019 18:23:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572657814; cv=none; d=google.com; s=arc-20160816; b=tKtOv9hK9OTSSuuuT6QY82E41Xo1v5mBUynJHhirEfjoWCyLyBtEJINshRA6DHvo/C jVQvFd3s5Us9R53v9KpkkzR4M66+AGLIwk0LEs8tGXsiJDWgULnM2F+f/79nGZfBfQdG tsIfvmeDoRskDxN7B1V8Jhl68iZ8/IMRODwpy0iHsBOO9stUMKchNvjRzxqLjM0C4tpA fW5R5rGQwGbzf82v+XFA1M0K0CXqjIsxy4W+ELRq8lrDP37KMbHaPSj+oMrvO6VqR4mC EbO/blC7xERAkIy3F1RKqSORciTunEa+gRrR9KuDEr/bOT6OjvZUsG6ap9cSisM2D+MZ jDPQ== 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; bh=A1ZHsOtD4lsQ3WmfsL3C2MnJmbIMU4C10RWWWtW0uR4=; b=t3zFpjMn9mklpMFoTbuy9xBC/i2k2mGEtj5vMdS6i0smZ2pihPDiITijyBmialmXjB i4VNI+5Chb1sVEfVFgE8oKJ9+Ul4M3fB0qOXow5yNd6ymzuXuD8Yk49UV4Yy1vlVWbOR gXe1hL/An2CbYodrliY8Ggk9VsckVag7TPcscqfLnViGA1b24msX/lFhq0hmtsAiK/GZ FTna/Ty0nEzj4W44pGfVHCkz2iKJf3eWWKY3QJAjE5Y7sC+lkO8IjThspS/GW/WWK+2E vvDsAOGZ5lMYxcMC9T8pnAX6QctqI81M3YOohNc4MAOFAIwiv0oHKBViV/ybndXMA7vx J3Ng== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=qti.qualcomm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p11si6777190ejx.107.2019.11.01.18.23.11; Fri, 01 Nov 2019 18:23:34 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=qti.qualcomm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728473AbfKBBVE (ORCPT + 99 others); Fri, 1 Nov 2019 21:21:04 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:33958 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726892AbfKBBVD (ORCPT ); Fri, 1 Nov 2019 21:21:03 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 9B0DA6161B; Sat, 2 Nov 2019 01:21:02 +0000 (UTC) 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.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 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: cang@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 62FD960FB8; Sat, 2 Nov 2019 01:21:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 62FD960FB8 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=pass (p=none dis=none) header.from=qti.qualcomm.com Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=pass smtp.mailfrom=cang@qti.qualcomm.com From: Can Guo To: asutoshd@codeaurora.org, nguyenb@codeaurora.org, rnayak@codeaurora.org, linux-scsi@vger.kernel.org, kernel-team@android.com, saravanak@google.com, salyzyn@google.com, cang@codeaurora.org Cc: Alim Akhtar , Avri Altman , Pedro Sousa , "James E.J. Bottomley" , "Martin K. Petersen" , Stanley Chu , Bean Huo , Tomas Winkler , Subhash Jadavani , Greg Kroah-Hartman , Allison Randal , Thomas Gleixner , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v3 4/5] scsi: ufs: Do not clear the DL layer timers Date: Fri, 1 Nov 2019 18:20:29 -0700 Message-Id: <1572657631-25749-5-git-send-email-cang@qti.qualcomm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1572657631-25749-1-git-send-email-cang@qti.qualcomm.com> References: <1572657631-25749-1-git-send-email-cang@qti.qualcomm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Can Guo During power mode change, PACP_PWR_Req frame sends PAPowerModeUserData parameters (and they are considered valid by device if Flags[4] - UserDataValid bit is set in the same frame). Currently we don't set these PAPowerModeUserData parameters and hardware always sets UserDataValid bit which would clear all the DL layer timeout values of the peer device after the power mode change. This change sets the PAPowerModeUserData[0..5] to UniPro specification recommended default values, in addition we are also setting the relevant DME_LOCAL_* timer attributes as required by UFS HCI specification. Signed-off-by: Can Guo --- drivers/scsi/ufs/ufshcd.c | 20 ++++++++++++++++++++ drivers/scsi/ufs/unipro.h | 11 +++++++++++ 2 files changed, 31 insertions(+) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 979b161..d6e52b3 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -4108,6 +4108,26 @@ static int ufshcd_change_power_mode(struct ufs_hba *hba, ufshcd_dme_set(hba, UIC_ARG_MIB(PA_HSSERIES), pwr_mode->hs_rate); + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_PWRMODEUSERDATA0), + DL_FC0ProtectionTimeOutVal_Default); + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_PWRMODEUSERDATA1), + DL_TC0ReplayTimeOutVal_Default); + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_PWRMODEUSERDATA2), + DL_AFC0ReqTimeOutVal_Default); + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_PWRMODEUSERDATA3), + DL_FC1ProtectionTimeOutVal_Default); + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_PWRMODEUSERDATA4), + DL_TC1ReplayTimeOutVal_Default); + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_PWRMODEUSERDATA5), + DL_AFC1ReqTimeOutVal_Default); + + ufshcd_dme_set(hba, UIC_ARG_MIB(DME_LocalFC0ProtectionTimeOutVal), + DL_FC0ProtectionTimeOutVal_Default); + ufshcd_dme_set(hba, UIC_ARG_MIB(DME_LocalTC0ReplayTimeOutVal), + DL_TC0ReplayTimeOutVal_Default); + ufshcd_dme_set(hba, UIC_ARG_MIB(DME_LocalAFC0ReqTimeOutVal), + DL_AFC0ReqTimeOutVal_Default); + ret = ufshcd_uic_change_pwr_mode(hba, pwr_mode->pwr_rx << 4 | pwr_mode->pwr_tx); diff --git a/drivers/scsi/ufs/unipro.h b/drivers/scsi/ufs/unipro.h index f539f87..3dc4d8b 100644 --- a/drivers/scsi/ufs/unipro.h +++ b/drivers/scsi/ufs/unipro.h @@ -161,6 +161,17 @@ /* PHY Adapter Protocol Constants */ #define PA_MAXDATALANES 4 +#define DL_FC0ProtectionTimeOutVal_Default 8191 +#define DL_TC0ReplayTimeOutVal_Default 65535 +#define DL_AFC0ReqTimeOutVal_Default 32767 +#define DL_FC1ProtectionTimeOutVal_Default 8191 +#define DL_TC1ReplayTimeOutVal_Default 65535 +#define DL_AFC1ReqTimeOutVal_Default 32767 + +#define DME_LocalFC0ProtectionTimeOutVal 0xD041 +#define DME_LocalTC0ReplayTimeOutVal 0xD042 +#define DME_LocalAFC0ReqTimeOutVal 0xD043 + /* PA power modes */ enum { FAST_MODE = 1, -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project