Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2511628imm; Wed, 16 May 2018 14:12:14 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr/2bPQg8f2eRb+RorUNofUt34LGO8QlU9YcWYtCojwhqgZshhgt0K1uupzQN2Ox0kjGYZI X-Received: by 2002:a63:63c5:: with SMTP id x188-v6mr1907281pgb.302.1526505134306; Wed, 16 May 2018 14:12:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526505134; cv=none; d=google.com; s=arc-20160816; b=Zs5He+IFTe6EJeBCpoutIGnbTNMIAQOe1fTqGn/aJT9SxQ0BostFkAy+90Sv0Bo/ta iPJdJRHZwxdwpa7l+wUhzf8okxCuPuU7pyq8idcc9E/c5qdIk7qtN0RnCDbb3d/KxpV9 tdYg2D9gOezw3ie0qj6ir9lHOugeMQqiVmntLHDSCcKV297I+e7uhe5hRZLo55vrgbiX PgIRw6u07EpVwnAkiNRgOWc9lkvg0/qjqcoZciAVMLOwfQEh91D5BOI/GDja0bqFFHam Gv7W3d5TIs2S8DzySM9t1UiTdZsKobR0TMhz5f2430AEKnjeKIEROfg1YnQqmABoX3FG dbIw== 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:dkim-signature :arc-authentication-results; bh=7Ip1/cP8Nlu6qKu1exyosP2oVGMiVxd5usroVNM0c+4=; b=eKIke+1FfXhd8k5GnOTWjRY9L5BFoxwWd37waMrDD+CTBuzJ3Cz84xIOjAJRwjoncd JcyC3s+MIiBBBo583f1YK254GXfWPYSUrv48AZl3cVqUSar6eGoz4x6ex8c66kF4N3SD 7ikSeHnFChhHG6fJvfVl6gXNm9RNwgG2vwal0UPfDzWVKwHaoRzeMOFsoqqLvenoEmes Km+OrmR5ZqarWiBDQaVVELDKhZpTM3fP2fevkuHHiKlB4YuxyoqOzNjPmYkj5XgwLPxS GIDYPoWaFl5WCKOEuXTxUPtfcjy55m8eq1ayVzYNCMAlbjOhGeWrtDpGh3R1CYy757tq VrVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=YxfPxFL2; dkim=pass header.i=@codeaurora.org header.s=default header.b=TGZ5SNdU; 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 a1-v6si3461662plt.39.2018.05.16.14.12.00; Wed, 16 May 2018 14:12:14 -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=YxfPxFL2; dkim=pass header.i=@codeaurora.org header.s=default header.b=TGZ5SNdU; 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 S1752417AbeEPVLW (ORCPT + 99 others); Wed, 16 May 2018 17:11:22 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:53870 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752276AbeEPVLT (ORCPT ); Wed, 16 May 2018 17:11:19 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 8C2B5609D1; Wed, 16 May 2018 21:11:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1526505078; bh=hXOqZKvD30K1FCs8A8GH6iDpym76OdVyXmVQhI4j1Gw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=YxfPxFL22jWBJBswUqCOsrJad2NA23QGtSjA/NPDE1k7tNC62hv+tC335eqDBEOuw JKAegQVt/otX7w2KIhKmwR799c1YlUbx3ovDifcSYuF32SW+XNw+ZkZAn7VE1kcNFm LsYBiNHrzB4wnKpKngLkDgTkKDW4fXfzhaIfIU9I= 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 mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id B563C60209; Wed, 16 May 2018 21:11:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1526505077; bh=hXOqZKvD30K1FCs8A8GH6iDpym76OdVyXmVQhI4j1Gw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=TGZ5SNdUrgbURWieHPAwPg4MHNRZAd63pQJ2J+LxBs/I7b04C1SOIMJPBwaKei7AM BuMbYY27OxV/RjS8RyLmTiQHjUjzCsp2Ux3urDRwRyqXxQlVxGTTZ6N7+tzj3Um2rI U+B/BaXyXDtodu9BtAuNqRg/y9q+w8KxEXOI1qTY= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 16 May 2018 14:11:17 -0700 From: Subhash Jadavani To: Asutosh Das Cc: cang@codeaurora.org, vivek.gautam@codeaurora.org, rnayak@codeaurora.org, vinholikatti@gmail.com, jejb@linux.vnet.ibm.com, martin.petersen@oracle.com, linux-mmc@vger.kernel.org, linux-scsi@vger.kernel.org, linux-arm-msm@vger.kernel.org, Venkat Gopalakrishnan , linux-kernel@vger.kernel.org, linux-scsi-owner@vger.kernel.org Subject: Re: [PATCH v2 03/10] scsi: ufs: Add LCC quirk for host and device In-Reply-To: <0aa7ff1ff67e0c01d6347b932cfe7ce801ef09fc.1525343531.git.asutoshd@codeaurora.org> References: <0aa7ff1ff67e0c01d6347b932cfe7ce801ef09fc.1525343531.git.asutoshd@codeaurora.org> Message-ID: X-Sender: subhashj@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-05-03 04:07, Asutosh Das wrote: > LCC (Line Control Command) is being used for communication between > UFS host and UFS device. But some hosts might have the issue with > issuing the LCC commands to UFS device and in this case LCC could be > explicitly disabled. > > But there could be a need where we don't want to disable the LCC > on both host & device; hence this change splits the quirk in 2 parts > one for host and one for device. > > Signed-off-by: Subhash Jadavani > Signed-off-by: Venkat Gopalakrishnan > Signed-off-by: Can Guo > Signed-off-by: Asutosh Das > --- > drivers/scsi/ufs/ufshcd.c | 16 ++++++++++++++++ > drivers/scsi/ufs/ufshcd.h | 12 ++++++++++++ > 2 files changed, 28 insertions(+) > > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c > index f3083fe..6dabce8 100644 > --- a/drivers/scsi/ufs/ufshcd.c > +++ b/drivers/scsi/ufs/ufshcd.c > @@ -4116,6 +4116,11 @@ static int ufshcd_disable_tx_lcc(struct ufs_hba > *hba, bool peer) > return err; > } > > +static inline int ufshcd_disable_host_tx_lcc(struct ufs_hba *hba) > +{ > + return ufshcd_disable_tx_lcc(hba, false); > +} > + > static inline int ufshcd_disable_device_tx_lcc(struct ufs_hba *hba) > { > return ufshcd_disable_tx_lcc(hba, true); > @@ -4172,6 +4177,17 @@ static int ufshcd_link_startup(struct ufs_hba > *hba) > ufshcd_dme_set(hba, UIC_ARG_MIB(TX_LCC_ENABLE), 1); > } > > + if (hba->quirks & UFSHCD_BROKEN_LCC_PROCESSING_ON_HOST) { > + ret = ufshcd_disable_device_tx_lcc(hba); > + if (ret) > + goto out; > + } > + > + if (hba->quirks & UFSHCD_BROKEN_LCC_PROCESSING_ON_DEVICE) { > + ret = ufshcd_disable_host_tx_lcc(hba); > + if (ret) > + goto out; > + } > if (link_startup_again) { > link_startup_again = false; > retries = DME_LINKSTARTUP_RETRIES; > diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h > index bb4ecfb..0417c42 100644 > --- a/drivers/scsi/ufs/ufshcd.h > +++ b/drivers/scsi/ufs/ufshcd.h > @@ -598,6 +598,18 @@ struct ufs_hba { > * TX_LCC. > */ > #define UFSHCD_QUIRK_BROKEN_PWR_MODE_CHANGE UFS_BIT(8) > + > + /* > + * If UFS device is having issue in processing LCC (Line Control > + * Command) coming from UFS host controller then enable this quirk. > + * When this quirk is enabled, host controller driver should disable > + * the LCC transmission on UFS host controller (by clearing > + * TX_LCC_ENABLE attribute of host to 0). > + */ > + #define UFSHCD_BROKEN_LCC_PROCESSING_ON_DEVICE 0x100 > + > + #define UFSHCD_BROKEN_LCC_PROCESSING_ON_HOST 0x200 > + > unsigned int quirks; /* Deviations from standard UFSHCI spec. */ > > /* Device deviations from standard UFS device spec. */ Please check if these quirks are really needed for commercial version of UFS host controllers. -- The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project