Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp242189pxf; Wed, 10 Mar 2021 05:29:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJwkCu1nQRiKSRFxSrrvMAtHEEgWVyu5WXO2zqNiEXyUi8OTtefd9TneiQ5rEFxF/PbVDSyu X-Received: by 2002:a05:6402:512:: with SMTP id m18mr3228783edv.372.1615382949411; Wed, 10 Mar 2021 05:29:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615382949; cv=none; d=google.com; s=arc-20160816; b=jVlqCwnvjB3xFKDOB6jQgCxB8OLB+lmeCw/IYmIKsIRZipHpFXvOkHTUBPOqDXjfLI mygVQQ7FWtWZ3VeBmNzg7lqGJRHclo51PXSQEd7Lmqh0/RQpwSVFTGCL4wLibm/h4Qzt T120Fb4D4BNf5/cRuN1nGG7sj/pw99Fu458RO1KZuAjxxisN5WvWhWdC0DRJb7nyiPwB QWOlD8OAFlLfnoqsfFO3Jk8cL2w79J6KwfG+7Hmgv4mp48rUF7k5+7NSFBgCLjffV2Q8 QzcsTa/pbtF2nLTkd/gvqPLu1t8STN85VJiumOqKh9UqxEDRritJyKNVwpvZ34o3frOP QC+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bZok8IMN4KLLI9dIBTaEVNbbpdvHCorHk0phFvWIAvk=; b=BBgqab/0OX7XwQD51LxQp7FuGH1cXuN2rrTnzVyoQcwkZdfuHnYobW1uKhBPBHb+yD H1u4rz4FGlSfQp1NO0b5f2tBovURg83Le+Md1SsQ0HEnrpxF3MThFgLp3p0IR+4X1gZs XdBjWxA2b7ZiGwuV9MzUeP5ML4xPl4iwWYv/ttgBmZ9x1VbtXPU3L7ia+1qx+EmtTxgi OxWI0wX7TYMFC15uE2fxp+bJbfnbuiUYCdzdEMK/KkSZVcxpxEbwzh2eQdFUKCkPfXZ9 FCPgnfq+/6rjWBcWSwtRlDtKYHTy3OwW9GUp+EcoD52w9cjfHiTV4KOP+9g6zrvh0VFp NqyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=G3Wilhdp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ce13si13507124edb.43.2021.03.10.05.28.46; Wed, 10 Mar 2021 05:29:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=G3Wilhdp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233215AbhCJN1w (ORCPT + 99 others); Wed, 10 Mar 2021 08:27:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:46654 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232808AbhCJNZG (ORCPT ); Wed, 10 Mar 2021 08:25:06 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6A26B64FDC; Wed, 10 Mar 2021 13:25:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615382705; bh=10Bonuk5UnU056ZHl/EWIiNUlawTYt4Gx81Q/r1iu8U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G3Wilhdpp9YO141GNetOzayNmTMZCPPkSgjg33bhc/ytUFDjqOZ4tKubIH6yaNRyp J6y8Dw/KpeS+SiKrDiunbtYRDLwhvhZ2cYI0vV1Btl1S+ysRvPwBwtjXKHEE9mtH7M Z5XbTcS8WZIjjePriqUv382fpN7bCjs6qTlWS77o= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Avri Altman , Kiwoong Kim , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.10 33/49] scsi: ufs: Add a quirk to permit overriding UniPro defaults Date: Wed, 10 Mar 2021 14:23:44 +0100 Message-Id: <20210310132322.985472646@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210310132321.948258062@linuxfoundation.org> References: <20210310132321.948258062@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Kroah-Hartman From: Kiwoong Kim [ Upstream commit b1d0d2eb89d4e3a25b212a9d836587503537067e ] The UniPro specification states that attribute IDs of the following parameters are vendor-specific so some SoCs could have no regions at the defined addresses: - DME_LocalFC0ProtectionTimeOutVal - DME_LocalTC0ReplayTimeOutVal - DME_LocalAFC0ReqTimeOutVal In addition, the following parameters should be set considering the compatibility between host and device. - PA_PWRMODEUSERDATA0 - PA_PWRMODEUSERDATA1 - PA_PWRMODEUSERDATA2 - PA_PWRMODEUSERDATA3 - PA_PWRMODEUSERDATA4 - PA_PWRMODEUSERDATA5 Introduce a quirk to allow vendor drivers to override the UniPro defaults. Link: https://lore.kernel.org/r/1fedd3dea0ccc980913a5995a10510d86a5b01b9.1608513782.git.kwmad.kim@samsung.com Acked-by: Avri Altman Signed-off-by: Kiwoong Kim Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/ufs/ufshcd.c | 40 ++++++++++++++++++++------------------- drivers/scsi/ufs/ufshcd.h | 6 ++++++ 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 813289328467..379d44d6b9eb 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -4153,25 +4153,27 @@ 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); + if (!(hba->quirks & UFSHCD_QUIRK_SKIP_DEF_UNIPRO_TIMEOUT_SETTING)) { + 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/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 6c62a281c863..fcca4e15c8cd 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -544,6 +544,12 @@ enum ufshcd_quirks { */ UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL = 1 << 12, + /* + * This quirk needs to disable unipro timeout values + * before power mode change + */ + UFSHCD_QUIRK_SKIP_DEF_UNIPRO_TIMEOUT_SETTING = 1 << 13, + }; enum ufshcd_caps { -- 2.30.1