Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2813182imm; Wed, 16 May 2018 21:07:25 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpghUaumVMwYsMs/uBnDCeQ+S1ZbqvTfzC5cikLLz9RIeYwVs0Fh91BM4tQMcUAJhbqvNas X-Received: by 2002:a65:4d8a:: with SMTP id p10-v6mr2876149pgq.21.1526530045507; Wed, 16 May 2018 21:07:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526530045; cv=none; d=google.com; s=arc-20160816; b=OWJWe4nDfs2+KFa5gVj8AbyJb4Kd+k+Pw7GQ/Z2E8mgogw7bQQ+5SxjdYkaIsBshn+ 0FfQnElP5iBf9vamouMhlDJmoXSUch03UCKCDOADZe1yXX2ojMCv9aWUBCB8xfQYhya0 5a2Z0HoniPn9UdkX8VZaoCdDCnqxe37wHDocHK0dw1Q74m9nIstgkQO2GFX3DjWGeLaG UT/VsDTL2glkSDgO149q9y33vRmvO9Qyhn3dOacN0aut4Q+ft2+BmOZH4oXGrizBXcjn s+7UV1rdoP+45Efmn389VOReMCJz0urtFuLYGrlXIei1+ugsmrZhTJwcEIkBRwClAqLq U/6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature:dkim-signature:arc-authentication-results; bh=MNggxZXTbjoUhv0JEoAAxqkdRS9SW25KA2glLDBuUnc=; b=rxDN8R7jq9Omp2N2cXdhoWjQDxaips5dXpVJFlukW7FkAVsPRIZL8u7WIzU8FtqNR6 j8PFCYuuiA7pzWOkJvU69VBwkXaakzvyDHYFgkVeWgPAZPHqg6GJySWlIFPg7EZ38GCa 16sg0PsqIPMCbMBY66+K1I32759Rv6bXqxSEj73Wp2PJq4LwsVxhHsYRObEjQUxtCeJg b4MVZu/WSdrq1nw7/c56KaZp7UVDrOhMT97KWVuOnmJe0Y+RLWNgKc4UWkcWkZduw172 vsT5oOdr8/SfIDzEblJvZ7L39fpiU7o10o/pe/yuOXFcCL0T/Z0K5zAx2UzfSNLyczRF +Xsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=olCOp5wF; dkim=pass header.i=@codeaurora.org header.s=default header.b=RKno1dCs; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v9-v6si4308780plg.124.2018.05.16.21.07.11; Wed, 16 May 2018 21:07:25 -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; dkim=pass header.i=@codeaurora.org header.s=default header.b=olCOp5wF; dkim=pass header.i=@codeaurora.org header.s=default header.b=RKno1dCs; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751322AbeEQEGu (ORCPT + 99 others); Thu, 17 May 2018 00:06:50 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:39642 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750723AbeEQEGs (ORCPT ); Thu, 17 May 2018 00:06:48 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 0FD0B60C65; Thu, 17 May 2018 04:06:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1526530008; bh=XwaQ3yCL8DZFSsdoGD0cJyKAzFyASnJA5Q8S+uhSYcE=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=olCOp5wFEWM20d9phGkOE1eMUm0gVsQGsNbl+MdVYJzKMDFitHbzdCcMuTJzZSe2h MussVTByCjyvVwkubUK4vTfaIVYjgE1r0rJi1gawzuj3IR8fw+oyd5KWS5La16OHjt U5h8PFUoZbzdsGGgAeg4gs6+GplCoiUcTCImWOYk= 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.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from [10.206.25.163] (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: asutoshd@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 7B2E7601D7; Thu, 17 May 2018 04:06:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1526530007; bh=XwaQ3yCL8DZFSsdoGD0cJyKAzFyASnJA5Q8S+uhSYcE=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=RKno1dCsmfGevqcgJxBMYu3laGhHcupB0YuqrFrpqUKFTrx18m2dSYb96vnPyhHuZ C2eXAf2ZP8UZ9+MirOc9qVlxxtk86e6DpOyrRvbi4Y6hAsZ54jQcvRvaKDgz9ivAN0 FURH3azJ52iPYfHlqoMyIJMADEHRIIOv4MMju07A= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 7B2E7601D7 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=asutoshd@codeaurora.org Subject: Re: [PATCH 1/4] scsi: ufs: add quirk to fix mishandling utrlclr/utmrlclr To: Alim Akhtar , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: jejb@linux.vnet.ibm.com, martin.petersen@oracle.com, vivek.gautam@codeaurora.org, subhashj@codeaurora.org, vinholikatti@gmail.com, olof@lixom.net References: <1525601658-31989-1-git-send-email-alim.akhtar@samsung.com> <1525601658-31989-2-git-send-email-alim.akhtar@samsung.com> From: "Asutosh Das (asd)" Message-ID: Date: Thu, 17 May 2018 09:36:42 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <1525601658-31989-2-git-send-email-alim.akhtar@samsung.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/6/2018 3:44 PM, 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 > --- > drivers/scsi/ufs/ufshcd.c | 21 +++++++++++++++++++-- > drivers/scsi/ufs/ufshcd.h | 5 +++++ > 2 files changed, 24 insertions(+), 2 deletions(-) > > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c > index 00e7905..9898ce5 100644 > --- a/drivers/scsi/ufs/ufshcd.c > +++ b/drivers/scsi/ufs/ufshcd.c > @@ -675,7 +675,24 @@ static inline void ufshcd_put_tm_slot(struct ufs_hba *hba, int slot) > */ > 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); > +} > + > +/** > + * ufshcd_utmrl_clear - Clear a bit in UTRMLCLR register > + * @hba: per adapter instance > + * @pos: position of the bit to be cleared > + */ > +static inline void ufshcd_utmrl_clear(struct ufs_hba *hba, u32 pos) > +{ > + 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); > } > > /** > @@ -5398,7 +5415,7 @@ static int ufshcd_clear_tm_cmd(struct ufs_hba *hba, int tag) > goto out; > > spin_lock_irqsave(hba->host->host_lock, flags); > - ufshcd_writel(hba, ~(1 << tag), REG_UTP_TASK_REQ_LIST_CLEAR); > + ufshcd_utmrl_clear(hba, tag); > spin_unlock_irqrestore(hba->host->host_lock, flags); > > /* poll for max. 1 sec to clear door bell register by h/w */ > diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h > index 8110dcd..43035f8 100644 > --- a/drivers/scsi/ufs/ufshcd.h > +++ b/drivers/scsi/ufs/ufshcd.h > @@ -595,6 +595,11 @@ struct ufs_hba { > */ > #define UFSHCD_QUIRK_PRDT_BYTE_GRAN 0x80 > > + /* > + * Cleaer handling for transfer/task request list is just opposite. > + */ Spell check - should be 'Clear' > + #define UFSHCI_QUIRK_BROKEN_REQ_LIST_CLR 0x100 > + > unsigned int quirks; /* Deviations from standard UFSHCI spec. */ > > /* Device deviations from standard UFS device spec. */ > Looks good to me, except the spell-check. -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project