Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1869756imm; Thu, 21 Jun 2018 03:51:57 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJfjvoDln9ucFxMcZil5TzqWKfut/klQAsioRH/dV/zyi40bCNmoqceUbki/8U6Xe5LpC0g X-Received: by 2002:a62:9f16:: with SMTP id g22-v6mr26385348pfe.207.1529578317797; Thu, 21 Jun 2018 03:51:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529578317; cv=none; d=google.com; s=arc-20160816; b=ZC5C1kLNx3ldRcPCUC7oZO+M+1fHrV/HcaAvxruw8R1pHtDrNKfrTHcNs+HX30q0Il e/OixWYA+V51vMak7NjKg5YSo106OUFbAIVF0xzLe5ip7Ur3b6qNtDaSFIFXkphCCXD5 jn9Jge2dp4DRk0iEpuQ3utKZW2TXEnzd1ZYHWWaPVB+89zLrnBt9aPTIqFCvqHoaSqXC q8y0/HHoXKXRqb41V2h/cVmxbqbIAupfEteqqPwLj5NmZOJSYCN8kGZ0kJE90M6Nxu5G 7egzq6LAtA5XfTvOa5daI2tOR34/BJi4nuJZQ/gcnovz9eo3h+9mORFQGAVh6aEFMmdr LcPA== 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 :arc-authentication-results; bh=R6uk9PEpFAqjUawDgJcJ4sMxnGngcQ98c8qgeT+zMF8=; b=q6vp1Jo8IevgWNmGUHlX88QmmXrAqyoUAung1aASFAE3Uk4Byr1NGB4/D9BtsSUuJa SJesBWUxtuZq4SaomUVjGCtbt6sUbYAW12nPRMXfs9uRIH2oeoq2gA+2/FLGhitCKMQ2 X1hiZM3Rn2N/bpGsSVlo0BUeFaYwkqrl19LRjvNgdriP3ln53EshxdH+9ERKg1ZAF6zH Arx/ZSAa0Z1nJP6bgIMnpvRJWyKQzkVpEkNtmtwsiZ7xEwrnh1ZKml65T4RNQghzawTz 4maPGBa5hkuKz06oR3Yjwx7DQasM8WheMgFaXYwctalOXKalIgUlbpJCyBVRL16Z3/SP 9H2w== 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 y20-v6si4258016pfm.186.2018.06.21.03.51.41; Thu, 21 Jun 2018 03:51:57 -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; 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 S1754259AbeFUKu7 (ORCPT + 99 others); Thu, 21 Jun 2018 06:50:59 -0400 Received: from mga11.intel.com ([192.55.52.93]:13445 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750991AbeFUKu6 (ORCPT ); Thu, 21 Jun 2018 06:50:58 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Jun 2018 03:50:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,251,1526367600"; d="scan'208";a="48783698" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.168]) ([10.237.72.168]) by fmsmga007.fm.intel.com with ESMTP; 21 Jun 2018 03:50:55 -0700 Subject: Re: [PATCH V2 1/7] mmc: sdhci: add sd host v4 mode To: Chunyan Zhang , Ulf Hansson Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Orson Zhai , Baolin Wang , Billows Wu , zhang.lyra@gmail.com References: <1529028255-6022-1-git-send-email-zhang.chunyan@linaro.org> <1529028255-6022-2-git-send-email-zhang.chunyan@linaro.org> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: <1f3e7e87-be4e-37ab-af46-1c4e5dd79a1d@intel.com> Date: Thu, 21 Jun 2018 13:49:32 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <1529028255-6022-2-git-send-email-zhang.chunyan@linaro.org> Content-Type: text/plain; charset=utf-8 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 15/06/18 05:04, Chunyan Zhang wrote: > For SD host controller version 4.00 or later ones, there're two > modes of implementation - Version 3.00 compatible mode or > Version 4 mode. This patch introduces a flag to record this. > > Signed-off-by: Chunyan Zhang > --- > drivers/mmc/host/sdhci.c | 6 ++++++ > drivers/mmc/host/sdhci.h | 6 ++++++ > 2 files changed, 12 insertions(+) > > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c > index 2ededa7f..cf5695f 100644 > --- a/drivers/mmc/host/sdhci.c > +++ b/drivers/mmc/host/sdhci.c > @@ -3302,6 +3302,12 @@ void __sdhci_read_caps(struct sdhci_host *host, u16 *ver, u32 *caps, u32 *caps1) > v = ver ? *ver : sdhci_readw(host, SDHCI_HOST_VERSION); > host->version = (v & SDHCI_SPEC_VER_MASK) >> SDHCI_SPEC_VER_SHIFT; > > + if (host->version >= SDHCI_SPEC_400) { > + if (sdhci_readw(host, SDHCI_HOST_CONTROL2) & > + SDHCI_CTRL_V4_MODE) > + host->v4_mode = true; > + } At this point the host controller has just been reset which would mean it must be in version 3 compatibility mode, which would mean this code doesn't do anything. > + > if (host->quirks & SDHCI_QUIRK_MISSING_CAPS) > return; > > diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h > index c95b0a4..128b0ba 100644 > --- a/drivers/mmc/host/sdhci.h > +++ b/drivers/mmc/host/sdhci.h > @@ -184,6 +184,7 @@ > #define SDHCI_CTRL_DRV_TYPE_D 0x0030 > #define SDHCI_CTRL_EXEC_TUNING 0x0040 > #define SDHCI_CTRL_TUNED_CLK 0x0080 > +#define SDHCI_CTRL_V4_MODE 0x1000 > #define SDHCI_CTRL_PRESET_VAL_ENABLE 0x8000 > > #define SDHCI_CAPABILITIES 0x40 > @@ -270,6 +271,8 @@ > #define SDHCI_SPEC_100 0 > #define SDHCI_SPEC_200 1 > #define SDHCI_SPEC_300 2 > +#define SDHCI_SPEC_400 3 > +#define SDHCI_SPEC_410 4 > > /* > * End of controller registers. > @@ -551,6 +554,9 @@ struct sdhci_host { > u32 sdma_boundary; > > unsigned long private[0] ____cacheline_aligned; > + > + /* Host Version 4 Enable */ > + bool v4_mode; > }; > > struct sdhci_ops { >