Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp4389822ybz; Mon, 20 Apr 2020 22:56:03 -0700 (PDT) X-Google-Smtp-Source: APiQypJUkkCK8fFX9uo4NHYhmBjyCAli3Scz+76jMj1cWltY68Q9fnm1l/EndXpMb6iaRzMd2Je1 X-Received: by 2002:a17:906:cf8a:: with SMTP id um10mr19061442ejb.60.1587448563273; Mon, 20 Apr 2020 22:56:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587448563; cv=none; d=google.com; s=arc-20160816; b=UvhAk0itPjPwlF9E06+Tk09i5gac1E6aN3+InVnJyvPi0ZpE+HKt7CRASBW1KLAIaQ aC3F2Rf7z16Bz72VOBTm2cexSdolf4M3qQP5R3rx1RUCfHhKc4Cw3ic7tZu8qzR9wnFh ZUke+4htnjn+GvehRY20LUnbRol6tdwxZK4JHQg2524dYpNuaZ3ZNM9YKNJ9M3w3cZIf cUH9LvRR+0094QEYn8SWs5obuzsOMQdegaeG9CcbDhBO9htapEmGV2uv2CRZTYjmGUhS RG71ZRp6/lHHl6bZIk5y3xiUVVbjevmb2JkkvlG5nseMifBdOF3ulJ37cvY+VzGCmtyH LDDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature; bh=1Jww1SPgDxhs8SrKwoOjrf0hHGMsbbkuAez4BNaNiOk=; b=R7/QTa9hkivOmGM+hGt4lFwBjwNpDcfOPOULKBTmp70tZAfOLHPuVbOE3NvCGuRed4 4Rluc8XdEF2OU3Yw5Rh1q0bK7eTanSk323q5dRK0ox96tNhTOex5J9rsRaWapPxslQyn skz/qU9GHCVc23B7apez58KpI6IAfygphbFnLUhrivtkfDES6OkIWbr/aU1ypfMJ5U0t mT9KlQTF3DCc1HCsyi8aRTmrSilTsFgDOqCVHHSqaNLSka4GvtyXBoEwbPBXMOMp/8R/ 4hZCaqQVR7KFiI83JqakwyC7WmCg2yLwReoJZIgFjOlELLTJ/qK87s+ZD3lapviGvJ8z l0EQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b="DdI/gKeu"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id do15si944819ejc.95.2020.04.20.22.55.39; Mon, 20 Apr 2020 22:56:03 -0700 (PDT) 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=fail header.i=@mg.codeaurora.org header.s=smtp header.b="DdI/gKeu"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725989AbgDUFwd (ORCPT + 99 others); Tue, 21 Apr 2020 01:52:33 -0400 Received: from mail27.static.mailgun.info ([104.130.122.27]:12962 "EHLO mail27.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725881AbgDUFwc (ORCPT ); Tue, 21 Apr 2020 01:52:32 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1587448352; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=1Jww1SPgDxhs8SrKwoOjrf0hHGMsbbkuAez4BNaNiOk=; b=DdI/gKeuVLUTAZpPxUwVYBkIvvggrR2SN+kb2AfLnHO7C26Cw+fs1BtAIMfSQ7Q168gt23W7 5KO0uI/gTyS27DAZd70MYFjcmXVbutPhq4JJj2ZHudMrzFZC5+kwPcuMnXF1JhWSd3XTO2hB SFhXnliJfhDcEIG0F9eauud9H5M= X-Mailgun-Sending-Ip: 104.130.122.27 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5e9e8a17.7f7ecd7a95e0-smtp-out-n01; Tue, 21 Apr 2020 05:52:23 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 8943AC432C2; Tue, 21 Apr 2020 05:52:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: cang) by smtp.codeaurora.org (Postfix) with ESMTPSA id A85C2C433CB; Tue, 21 Apr 2020 05:52:21 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 21 Apr 2020 13:52:21 +0800 From: Can Guo To: Alim Akhtar Cc: robh@kernel.org, devicetree@vger.kernel.org, linux-scsi@vger.kernel.org, krzk@kernel.org, avri.altman@wdc.com, martin.petersen@oracle.com, kwmad.kim@samsung.com, stanley.chu@mediatek.com, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v6 01/10] scsi: ufs: add quirk to fix mishandling utrlclr/utmrlclr In-Reply-To: <20200417175944.47189-2-alim.akhtar@samsung.com> References: <20200417175944.47189-1-alim.akhtar@samsung.com> <20200417175944.47189-2-alim.akhtar@samsung.com> Message-ID: X-Sender: cang@codeaurora.org User-Agent: Roundcube Webmail/1.3.9 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-04-18 01:59, Alim Akhtar wrote: > In the right behavior, setting the bit to '0' indicates clear and '1' > indicates no change. If host controller handles this the other way, > UFSHCI_QUIRK_BROKEN_REQ_LIST_CLR can be used. > > Signed-off-by: Seungwon Jeon > Signed-off-by: Alim Akhtar Reviewed-by: Can Guo > --- > drivers/scsi/ufs/ufshcd.c | 11 +++++++++-- > drivers/scsi/ufs/ufshcd.h | 5 +++++ > 2 files changed, 14 insertions(+), 2 deletions(-) > > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c > index 698e8d20b4ba..3655b88fc862 100644 > --- a/drivers/scsi/ufs/ufshcd.c > +++ b/drivers/scsi/ufs/ufshcd.c > @@ -645,7 +645,11 @@ static inline int ufshcd_get_tr_ocs(struct > ufshcd_lrb *lrbp) > */ > static inline void ufshcd_utrl_clear(struct ufs_hba *hba, u32 pos) > { > - ufshcd_writel(hba, ~(1 << pos), REG_UTP_TRANSFER_REQ_LIST_CLEAR); > + if (hba->quirks & UFSHCI_QUIRK_BROKEN_REQ_LIST_CLR) > + ufshcd_writel(hba, (1 << pos), REG_UTP_TRANSFER_REQ_LIST_CLEAR); > + else > + ufshcd_writel(hba, ~(1 << pos), > + REG_UTP_TRANSFER_REQ_LIST_CLEAR); > } > > /** > @@ -655,7 +659,10 @@ static inline void ufshcd_utrl_clear(struct > ufs_hba *hba, u32 pos) > */ > static inline void ufshcd_utmrl_clear(struct ufs_hba *hba, u32 pos) > { > - ufshcd_writel(hba, ~(1 << pos), REG_UTP_TASK_REQ_LIST_CLEAR); > + if (hba->quirks & UFSHCI_QUIRK_BROKEN_REQ_LIST_CLR) > + ufshcd_writel(hba, (1 << pos), REG_UTP_TASK_REQ_LIST_CLEAR); > + else > + ufshcd_writel(hba, ~(1 << pos), REG_UTP_TASK_REQ_LIST_CLEAR); > } > > /** > diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h > index 6ffc08ad85f6..071f0edf3f64 100644 > --- a/drivers/scsi/ufs/ufshcd.h > +++ b/drivers/scsi/ufs/ufshcd.h > @@ -518,6 +518,11 @@ enum ufshcd_quirks { > * ops (get_ufs_hci_version) to get the correct version. > */ > UFSHCD_QUIRK_BROKEN_UFS_HCI_VERSION = 1 << 5, > + > + /* > + * Clear handling for transfer/task request list is just opposite. > + */ > + UFSHCI_QUIRK_BROKEN_REQ_LIST_CLR = 1 << 6, > }; > > enum ufshcd_caps { > > base-commit: 8f3d9f354286745c751374f5f1fcafee6b3f3136