Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp5878379imb; Fri, 8 Mar 2019 04:33:18 -0800 (PST) X-Google-Smtp-Source: APXvYqzwYYF7+HytBTffUPifa+73gmv6cy6yk19F4AqjjxUlt8WegXRO7k364nKKgd2/HqEowldK X-Received: by 2002:a17:902:bb90:: with SMTP id m16mr19109992pls.49.1552048398310; Fri, 08 Mar 2019 04:33:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552048398; cv=none; d=google.com; s=arc-20160816; b=epYvdBWk6DzWReN/J3Tahg/WHCvwaETvjL810OgYylm+0OZzpNte0GvHlgwMoh05DX iMAy9/bYZAiVek6PaS22403iG1HV09c15meIuhl1sr9N3sBVUZsz4zZPlGEnxcAirzOL bmIJZeO5hQE/wDWKGxYfAYgA1PXMuGZcb+DuSAbtiqRai8+m1emCNNYp8Ch1smLGqc9H /HZDcGEXsMwm29Ypk8u8LFLGIzphAEj7oEWyJxyM/I2KUXN/rReKuhZFc4c160UWE/+F ktXjTbXsFHS8ChXfa3T496KDH22RauCi0B4odQLZtwwzF1DSv6T4CEIdB6+iVGbPjnQq 5PKg== 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:organization:from:references:cc:to:subject; bh=nXAvr0FxUVBgrg3f/GlxH1fv2AXuweOu9vxEPXDcVX8=; b=Yxd0ubZ9u76dWBgA7aeYsnSuIUsNXnQoATBu8wa4m9KVIYleS02w7PmtsX2Yyr8xls SnJgM+H/9nvd8nCHZY0Z+/waus2rei7Odux0wCyB7/frcJWmbs8UjoBnBfzOxtrrGHOG oNyOpCXrhdB5LD6puT2XGoDGKTJSWIrE+3BISQgSmVcXjW06AD7O9ocTS/xmIWIawBz3 NBjk7gabQWahwX+QJqvNVZjPsxAxKW3rG84h5WN7Y4qnRb7htCQ/UnvW8W2iz7CmZv8d 7KSX8OVqobgmlJ7lAZPYZbjIfCXRz+2g3/99f+WljOFSkLk6ZIy+luL3UCgMom8zCsTI hTYA== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c24si6351714pgg.534.2019.03.08.04.33.02; Fri, 08 Mar 2019 04:33:18 -0800 (PST) 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726429AbfCHMbK (ORCPT + 99 others); Fri, 8 Mar 2019 07:31:10 -0500 Received: from mga03.intel.com ([134.134.136.65]:63683 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726249AbfCHMbK (ORCPT ); Fri, 8 Mar 2019 07:31:10 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Mar 2019 04:31:08 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,455,1544515200"; d="scan'208";a="129920879" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.56]) ([10.237.72.56]) by fmsmga008.fm.intel.com with ESMTP; 08 Mar 2019 04:31:05 -0800 Subject: Re: [PATCH V1 07/11] mmc: cqhci: add quirk for setting DCMD CMD_TIMING To: Sowjanya Komatineni , Ritesh Harjani , "ulf.hansson@linaro.org" , "robh+dt@kernel.org" , "mark.rutland@arm.com" , Asutosh Das Cc: "thierry.reding@gmail.com" , Jonathan Hunter , Aniruddha Tvs Rao , "linux-tegra@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-mmc@vger.kernel.org" , "devicetree@vger.kernel.org" References: <1551504025-3541-1-git-send-email-skomatineni@nvidia.com> <1551504025-3541-7-git-send-email-skomatineni@nvidia.com> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: <1fa6f529-2cb8-0108-2041-99ad9b39498f@intel.com> Date: Fri, 8 Mar 2019 14:29:32 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/03/19 8:16 PM, Sowjanya Komatineni wrote: > >> On 3/6/2019 6:30 PM, Adrian Hunter wrote: >>> On 2/03/19 7:20 AM, Sowjanya Komatineni wrote: >>>> This patch adds a quirk for setting CMD_TIMING to 1 in descriptor for >>>> DCMD with R1B response type to allow the command to be sent to device >>>> during data activity or busy time. >>>> >>>> Tegra186 CQHCI host has bug where it selects DATA_PRESENT_SELECT to 1 >>>> by CQHCI controller for DCMDs with R1B response type and since DCMD >>>> does not trigger any data transfer, DCMD task complete happens >>>> leaving the DATA FSM of host controller in wait state for data. >>>> >>>> This effects the data transfer task issued after R1B DCMD task and no >>>> interrupt is generated for the data transfer task. >>>> >>>> SW WAR for this issue is to set CMD_TIMING bit to 1 in DCMD task >>>> descriptor and as DCMD task descriptor preparation is done by cqhci >>>> driver, this patch adds cqequirk to handle this. >>>> >>>> Signed-off-by: Sowjanya Komatineni >>>> --- >>>> drivers/mmc/host/cqhci.c | 5 ++++- >>>> drivers/mmc/host/cqhci.h | 1 + >>>> 2 files changed, 5 insertions(+), 1 deletion(-) >>>> >>>> diff --git a/drivers/mmc/host/cqhci.c b/drivers/mmc/host/cqhci.c >>>> index a8af682a9182..b34c07125f32 100644 >>>> --- a/drivers/mmc/host/cqhci.c >>>> +++ b/drivers/mmc/host/cqhci.c >>>> @@ -521,7 +521,10 @@ static void cqhci_prep_dcmd_desc(struct mmc_host *mmc, >>>> } else { >>>> if (mrq->cmd->flags & MMC_RSP_R1B) { >>>> resp_type = 0x3; >>>> - timing = 0x0; >>>> + if (cq_host->quirks & CQHCI_QUIRK_CMD_TIMING_R1B_DCMD) >>>> + timing = 0x1; >>>> + else >>>> + timing = 0x0; >>> I was thinking it would be nice if there was a generic way for drivers >>> to make changes to descriptors before a task is started. Currently >>> there is >>> host->ops->write_l() which would make it possible by checking for >>> host->ops->CQHCI_TDBR >>> register and, in this case, the DCMD tag. We would need to export >>> get_desc(), perhaps rename it cqhci_get_desc() and put it in cqhci.h >>> since it is an inline function. >> >> We take spin_lock_irqsave after the descriptor is prepared and before writing to TDBR. >> Not sure but tomorrow this may become a limitation for drivers to make changes to descriptors if they edit descriptors in host->ops->write_l() call. >> Though in this case it is not required here. >> >>> >>> Alternatively we could add host->ops for descriptor preparation. >> >> Both ways sounds good to me. >> But maybe adding a host->ops for descriptor preparation is better way to go, >> since that will be the right interface exposed to make changes to >> descriptors. >> > > DCMD descriptor attributes remain same for any host and also task parameters as QBR need to be enabled with DCMD. > So I believe it should be ok if we just add callback to allow hosts to update command parameters of DCMD descriptor only thru cqhci_host_ops. That sounds fine to me. Maybe do that for the next version of this patchset. > > Also, don’t see any requirement for host specific Task parameter updates in Task descriptor so not sure if there is any need to provide callback for task descriptor data preparation to hosts. > Please confirm. > >>> >>> What do people think? >>> >>>> } else { >>>> resp_type = 0x2; >>>> timing = 0x1; >>>> diff --git a/drivers/mmc/host/cqhci.h b/drivers/mmc/host/cqhci.h >>>> index 9e68286a07b4..f96d8565cc07 100644 >>>> --- a/drivers/mmc/host/cqhci.h >>>> +++ b/drivers/mmc/host/cqhci.h >>>> @@ -170,6 +170,7 @@ struct cqhci_host { >>>> >>>> u32 quirks; >>>> #define CQHCI_QUIRK_SHORT_TXFR_DESC_SZ 0x1 >>>> +#define CQHCI_QUIRK_CMD_TIMING_R1B_DCMD 0x2 >>>> >>>> bool enabled; >>>> bool halted; >>>>