From patchwork Fri Jun 8 08:18:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Zhang X-Patchwork-Id: 10453967 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F196A60467 for ; Fri, 8 Jun 2018 08:27:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DEF5429298 for ; Fri, 8 Jun 2018 08:27:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D3A9A292BD; Fri, 8 Jun 2018 08:27:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7341B29298 for ; Fri, 8 Jun 2018 08:27:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752328AbeFHI0n (ORCPT ); Fri, 8 Jun 2018 04:26:43 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:36484 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751843AbeFHITE (ORCPT ); Fri, 8 Jun 2018 04:19:04 -0400 Received: by mail-pl0-f66.google.com with SMTP id a7-v6so5363730plp.3 for ; Fri, 08 Jun 2018 01:19:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3FkQjw0tnznQzkqhNl9915wjCXW19DdBddES+/u0pdI=; b=D7A11XC9NRb0A18pNGJQ+MUULMWZ24DD87PMtK1ouKTtEaJlz5CzywJQni4Xxm2vIS uwCkhELfoXJm29QE7Z3ZpglaARof5Vj4hGciCM/MY1teWI+as2nPpms2bkyrOc2hAT1y njLfAxMsQ90LE+oE64Gghv8Nf1B47XSxJn7AM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3FkQjw0tnznQzkqhNl9915wjCXW19DdBddES+/u0pdI=; b=po+R/1Tmbx2R1mjJ8FyidkMG+y+oLTZYTytfbgHij/2B8HVkHTlZCdBqJwegnlIPqp oThDfffz422bnG28j92PMBU7cCxlpL2QM23oVK1njMZbOEczViWw24YrrTqeF55zrkq2 iZz0iSkvFhjKksYH7Wb2toGmD94mOsLlB46v1PxQgCbtvGna7aGoeZRe9zjjmbTzSqor F8qYhWJ5gmMk9g4MUSmnI0MTmuiH0gemTq4MiHf66zFTIY8N5VieJUBE8KPinfcbdFxC ayVk2Qo6GVV/FunMq2GiuZ6+PmBeICiXsSjb5ujxLYk2YfMRgzmiFNw4fMY4EttUYZ96 PHjQ== X-Gm-Message-State: APt69E2ejCSJlrWvPisbiS9XD2o2RwpAewN9FjXLViuMfcLtpELImuAi ZV/TJ2LKkvGzsW3dTe8EU8SbCg== X-Google-Smtp-Source: ADUXVKI99syxtAJwXcZFCSY3fTAlvL/yV4bhYCf+Q/uvMwvLmApHsCbWxIQZDMQaIOR1npSEk0h0LQ== X-Received: by 2002:a17:902:6e4:: with SMTP id 91-v6mr5528041plh.63.1528445944162; Fri, 08 Jun 2018 01:19:04 -0700 (PDT) Received: from ubt.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id s4-v6sm72243947pgp.35.2018.06.08.01.19.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 08 Jun 2018 01:19:03 -0700 (PDT) From: Chunyan Zhang To: Ulf Hansson , Adrian Hunter Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Orson Zhai , Baolin Wang , Billows Wu , zhang.lyra@gmail.com Subject: [PATCH 1/6] mmc: sdhci: add sd host v4 mode Date: Fri, 8 Jun 2018 16:18:08 +0800 Message-Id: <1528445893-14530-2-git-send-email-zhang.chunyan@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1528445893-14530-1-git-send-email-zhang.chunyan@linaro.org> References: <1528445893-14530-1-git-send-email-zhang.chunyan@linaro.org> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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; + } + 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 {