Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1894897imm; Thu, 21 Jun 2018 04:16:36 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIw6xHhXtfx9dddWdUFqjedJmfSNLrDQo8brmfSknw1Dqbd0vbklQDRYF/rkROv+GDzjvnw X-Received: by 2002:a62:a60e:: with SMTP id t14-v6mr26919833pfe.241.1529579796720; Thu, 21 Jun 2018 04:16:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529579796; cv=none; d=google.com; s=arc-20160816; b=WfGlpToG1JtLO2rh+xO8FDVBR+MjlcozEWn7nYSMe/xcGdmFd5OTVFEvYs+TDobuhs dQP/iBJGdqjzNW6X0xfsgQ6Vz4wQGHGr6tK1OieGhqeWjnp0b4fLh4pn60WEhvg81eHJ FXRC5msyBUWi+VFy89ApZtooQtHbJZyjrXGFopLJ7XMvBWabHfwPkIIpgHgqkCI6XWbO gtP8VjmtNUNug9JQGhCbA6Rk0EZY5dnHhID1xhb7va6lWLlkr537JeqILDfrZHwtMa8d VqE3h4oe+T4ArzF3L4HSYATbIzQGi4me5pu4RZvFm4mgYxyTHOLEjOE00orQ7uhvKUwz 3k/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=xzemGuB2W+Ou6JWk4IiOFnFFJIvVVZ48ROthMTcNlo8=; b=t9ymouyP8IOfnYWOl11PXBXm7vJaMeON0iPctT5J+9DFmv264tEKnS/MIL/WVpjzc8 4bYSBSg4+DTuuOrJ9usfkwiuruRT4iqTZuANHTrSCkKfghcFf6O96/gwZqQlwElF0JBu YgPsJPKeqw8shoed44gLZTp5OZbKJ6UnpdI/EooFmitO7DOKAqFDxejS0AcGVQ2WFy1x rJEyQoZcGc5YlEetF9hmjAqX1UPggOgwNNPqSMjW3IaUwQ2SO3Tk9d2tEYKLytR4kev2 4QoxZCSra6h/uOBgRp6+zNDjvmUltFciEhJvOpXSa4aaI/SNcM+NMQLXpvgURTl4GKow Jrmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="MODlPu/s"; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u30-v6si3610818pgo.678.2018.06.21.04.16.06; Thu, 21 Jun 2018 04:16:36 -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=@gmail.com header.s=20161025 header.b="MODlPu/s"; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754290AbeFULPY (ORCPT + 99 others); Thu, 21 Jun 2018 07:15:24 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:34344 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753906AbeFULPX (ORCPT ); Thu, 21 Jun 2018 07:15:23 -0400 Received: by mail-lf0-f65.google.com with SMTP id e13-v6so4212811lfc.1; Thu, 21 Jun 2018 04:15:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=xzemGuB2W+Ou6JWk4IiOFnFFJIvVVZ48ROthMTcNlo8=; b=MODlPu/sRb/Ax7PcKGhTTqBiK8m7fZXao2y2hydYg8uZca0R+kx0M5SaZBPopS56lc TVI+2c3dvzR1jhEPRbV+ULWysurfejBfiCeR62NJIRR3Xb5Bw574t6qv76VFMY7JKAox OU7Qyh6GRc7Yg2tqKkbARoVZ8CI+zcn7FQSw+Kwx+axrPs/93wuuTG3gasqtMGEXRKYb nsd35tRuZkablUYOE/iBPpvTBbxMik56t/NwUebRtCAKB1pLJB4YDZbTplMJEjjf7yp8 6KkF6JvlyMz/ahI4vK9cHX8jEkCbxF4GXSJOxXG1zLmW3Ryaubm3JET3zjshOPMbhRHr QtuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=xzemGuB2W+Ou6JWk4IiOFnFFJIvVVZ48ROthMTcNlo8=; b=cgTAu8F7WItm3k2QoYrgffMUTRKp5rwl2YYKJnD5E9/HvGnXXdxDXrG61nMS8kqL4s uiJcyOChW9i9uFbiXLq8ihdkbu+Etck0buxicP8BuIeZQs4p06ydDi1ssFULgU3yJdqU V+dRCiSM8i4idN2KEldI3Pu5OULR781C7T3PpDdu8lNqWgcl3vPKw+K5L5fjkH9UHOFM w8ycCStlGZrSrMo92ZDH/PunmvNI4Rt6CqLECCfWhB2HPkZT4b09rxXKF5gJ1CH+5vdu lDkuO3730MUCHx4+P7Lm3kktZ6ygadp8a7M3EQ51ZHqSMygFj1kG2RXest48CsczwkkZ en/w== X-Gm-Message-State: APt69E2VqnyUOV6tjKpj1mA7EjVUSD/Ss4zH22JKPTHNwGMxeYdYs3xN v4QGP70NRjcoC/MJHnwMnuySGOTNWDWlNU+jLBSC1w== X-Received: by 2002:a2e:5d5d:: with SMTP id r90-v6mr16508814ljb.125.1529579721476; Thu, 21 Jun 2018 04:15:21 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ab3:548b:0:0:0:0:0 with HTTP; Thu, 21 Jun 2018 04:14:41 -0700 (PDT) In-Reply-To: <1f3e7e87-be4e-37ab-af46-1c4e5dd79a1d@intel.com> References: <1529028255-6022-1-git-send-email-zhang.chunyan@linaro.org> <1529028255-6022-2-git-send-email-zhang.chunyan@linaro.org> <1f3e7e87-be4e-37ab-af46-1c4e5dd79a1d@intel.com> From: Chunyan Zhang Date: Thu, 21 Jun 2018 19:14:41 +0800 Message-ID: Subject: Re: [PATCH V2 1/7] mmc: sdhci: add sd host v4 mode To: Adrian Hunter Cc: Chunyan Zhang , Ulf Hansson , linux-mmc@vger.kernel.org, Linux Kernel Mailing List , Orson Zhai , Baolin Wang , Billows Wu Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21 June 2018 at 18:49, Adrian Hunter wrote: > 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. Why is it version 3 mode at this point? I've tested this code on the sd host controller which was introduced in 6/7 in this patch-set, the result showed that it was v4_mode. Moreover without this patch, the Spreadtrum's sdhci driver in patch 6/7 couldn't work. Am I missing something here? Best, Chunyan > >> + >> 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 { >> >