Received: by 10.213.65.68 with SMTP id h4csp222886imn; Tue, 20 Mar 2018 01:38:26 -0700 (PDT) X-Google-Smtp-Source: AG47ELs/954MZ7xAax6TM4n9QyDxeThQQHG0o2evGcyhotaWPkWBXgvgu+6x8VeHQvEhxEwTi8/i X-Received: by 10.98.155.137 with SMTP id e9mr3308364pfk.109.1521535106068; Tue, 20 Mar 2018 01:38:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521535106; cv=none; d=google.com; s=arc-20160816; b=EA9jUgDMrRdn5Dqv0pJwLDnKyTinRRonuLUQoNxVgUyk9GVwhGbKHXDAmj2p0uYxGC ew9uLN0N5y+mv1Adph21Wb2SLxVA/36S0oEpth7w5l8tn6NNOzc3WmUI6GBFnZha7TSP 3rY5HCHygIZ/jVGstGyKzHodQ9V0dpMaUf5TDA95IIFka1Y1cCWigREj+6EDtJryy49J TPwqWtVtjnrip3P39BDtNr/QkJXk/mTnwGmDQkFTaS9MY5IkcAaMrbJx9teOsTIYWCwU sbnCoeYufLwr0QcHloh3VSLxkerqARRjqlTvwGMEvPIBcIcOC8YxHb8PUX2uwtSaSJFU Im0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=6pLv/ZEEGj3Egz5P3wvQC154jeCusay4stgycogIkLo=; b=qmzUggOQLjqvfvwupViSEMO96j0o49S7PDFtY05OuKwAmuuJsYM252QzOw9eF6bgNH dpR0pFaE6PGXujDkLbO/UqrdOnriDogxcfeKk9+lc9MjICJFbbQsGoFlLVZ92kP/kcNS an7vlH05EtSzJ3QK/9+zGfh+EpBvosN3R34POckQU/tY41CZ7I2MM6Srza5FygV1E4uH SkIpCnAThJnWhZEV/3sNJp8TRYcPmvwpv66xQzP2azPz93/OXXSHtGPrs7W+VpJXNefo njhdz/5i1rWNqrZJterVumu12y9QGTY1G/HQM/agFoeLSe5wytbu31SWsl9wrrB5BiQS DnrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BHgQ1j69; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l128si896038pgl.248.2018.03.20.01.38.09; Tue, 20 Mar 2018 01:38:26 -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=@linaro.org header.s=google header.b=BHgQ1j69; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752289AbeCTIgw (ORCPT + 99 others); Tue, 20 Mar 2018 04:36:52 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:42325 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752254AbeCTIgr (ORCPT ); Tue, 20 Mar 2018 04:36:47 -0400 Received: by mail-pg0-f65.google.com with SMTP id f10so196612pgs.9 for ; Tue, 20 Mar 2018 01:36:47 -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=6pLv/ZEEGj3Egz5P3wvQC154jeCusay4stgycogIkLo=; b=BHgQ1j69RoA3fDFkmVXsjBnX4DO6Hgp1O3t9+E5R/MwXIGSSKPx3pu1p7dqaPHTyPA xaZ1+p2IgL2HWsbFtX1F73G49l3A0x70h9nGfvaO5dbAjEEN07VK4BSIPQtpIl6+J+Zp 2cj8/ckCWN45Bpg/ns4ooeEsZeIaeY+Uml6X0= 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=6pLv/ZEEGj3Egz5P3wvQC154jeCusay4stgycogIkLo=; b=U308WD0cFyicf3LHtSFDSo2Y20Wh/gh50/uhWfh2EJB/BpvalYXwbk8vCH+98IQ+hs ru/CzxqXIC/BR2cBY1MirjbwB2iLbOsrDDvxVhN9685HHj9gUvWOqvCuertXB0excGty MnhEYHlGQ3h4likiT5qxpo68RadcDR83c9/bAKi1eAqDLHQr8q1vDGbtwzq674BfsTM9 KT1Cv4E8rADszdiM+9KPNyAPQDEoOWMaxgps93GhBBF8hiDBNbeszx2QyY/U8KUv8nfG 8FuF43wK2w+qmlGrUBR4tLorn2CLCd+JsBVGXsuzNv4XIuGw4w5PY3aD1Fe6qAdQOwdP 8ekw== X-Gm-Message-State: AElRT7FiwQ3X7BXRT3cVW7h+2Ez13tg4RbL7yw1FcS31vA/o7o3SXYb/ GVmG4I13p2L9qkg8vFxJjX3X8DKAPVI= X-Received: by 10.98.74.143 with SMTP id c15mr12955219pfj.83.1521535006787; Tue, 20 Mar 2018 01:36:46 -0700 (PDT) Received: from ubt.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id q62sm2590048pfd.61.2018.03.20.01.36.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Mar 2018 01:36:46 -0700 (PDT) From: Chunyan Zhang To: Ulf Hansson , Adrian Hunter Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann , Mark Brown , Billows Wu , Chunyan Zhang Subject: [PATCH 1/3] mmc: sdhci: add sd host v4 mode Date: Tue, 20 Mar 2018 16:36:24 +0800 Message-Id: <1521534986-21907-2-git-send-email-zhang.chunyan@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521534986-21907-1-git-send-email-zhang.chunyan@linaro.org> References: <1521534986-21907-1-git-send-email-zhang.chunyan@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 2020e57..da4d91e 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -3289,6 +3289,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 { -- 2.7.4