From patchwork Mon Jul 9 03:19:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Zhang X-Patchwork-Id: 141359 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2166620ljj; Sun, 8 Jul 2018 20:21:15 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeth0kRjn74W64shXfVT58IqXe/KWeMqJoHThhxT3gKSHrS5C6ngxj6s5mvnACVXQkGAN45 X-Received: by 2002:a65:6699:: with SMTP id b25-v6mr12830491pgw.426.1531106475849; Sun, 08 Jul 2018 20:21:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531106475; cv=none; d=google.com; s=arc-20160816; b=HzX4Xv6aJyd0y2IGqkyJ+kT6etTx/rzmBvOFb9JbTxIdkBPrpxjPTkWT5FGi6BRuf7 gyErtpWFmn1zdZW9HZIraoTSb3khaqq6zyRaRRcHrbCQeKxblfAeqe0voeFAZzyOICwU Wk/V/Xz7WfamNJzOE0bCwsxLqBpT9wfWIesvnlyxmdmTDyVtDHCXqKZ/u7H01vqG7A6e zgr5tEDRrG9DVee1Klex31EGqhVAhP/jDMBBuo1EL52kOJCEY3peIH+hgLosgESVUW+A wgyJwd+Wy6HybRx41g1BLqlNZ+99Fjw7y0DDaQnhyGOiQULstsgLFFuXnS7lGKsqMXgo n9YA== 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=BBJFPB65rkJWoNmat+DoaMMdrx+TsZwzg6yOlUtiJro=; b=IJrQ8jnTyPKYwnFl7EPVpgOK4a6aK+0VBobWgOZLZ4BviR6JkXTyNz1Fbw8Z5HvNup SogLHlYzoYAxbc0JhJHSKAB8jolgW5nhtvq7u5zjNrrZNqwE8+DYMDzrmywxtyf6He4M /HRTSfDVKwrrLbUEoUA5PmY7jWYTfw3Kflltt5zjcL6jHxU7xDa7VJSI60/wdRXGV4KR Q8h+h3q3/0qsjjHaLyv2pw5yl+NLMcpX6sbfT+iTes3Jg0UdFmLzQp8V5kM0jCDZo3jP CNrHHgYYVxj+xRqHhyo6H5fX6eOJC6aDFjAcrPzKHxJMaBPBFo1NTo0VihyJQIpvhcAt rKqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=SnDeB14O; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-owner@vger.kernel.org; dmarc=fail (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 b59-v6si13998654plb.107.2018.07.08.20.21.15; Sun, 08 Jul 2018 20:21:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=SnDeB14O; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933057AbeGIDVO (ORCPT + 6 others); Sun, 8 Jul 2018 23:21:14 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:46495 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932720AbeGIDVN (ORCPT ); Sun, 8 Jul 2018 23:21:13 -0400 Received: by mail-pl0-f66.google.com with SMTP id 30-v6so5337999pld.13 for ; Sun, 08 Jul 2018 20:21:13 -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=m8EGOwYzbAaIOxZaEvnUYFUSYffN46UUlc+QT9vs7J0=; b=SnDeB14O4ouu5FqBo7ZA6JwLGffg1pBsdrCcsOZKb+5AUdmAmtItFbIWWm1ARuQy+0 Y+JwbECOQRn8SikMb7kBQtTxuJFuGs33ZLQ5yrEWWVuFg8lGD53ncXevzAiHwO59483l 280KN37WNutY8dBL7Cci/QzL3X8gHXTQkXZ7k= 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=m8EGOwYzbAaIOxZaEvnUYFUSYffN46UUlc+QT9vs7J0=; b=qvHXhc9ugd3LO4W5l2rpHAYqVNqRIwGUZkpUCzsJzvDKKDkNAXUA4gLHW1hjQtxB5B BZNhZGTGStQy7yEywS/oWtEtVq53Qy/Cm78BVbQlNxiVd25dQ2HLeWiPFc0MD0IRyJR5 sUXmVDLjA0ya7hKow7lst3aR4bhkQuDc4OC1g6S+oAyYv1vtyR+tXNXZzful4DYJ5n0Q bFpRfCudTys5KeM0sTWVBTjQ4x96OdxDMnpD1U+BNj0DQdB6robj8O7PX/+Ki6rxD8qZ saN6SWqwbo3R8EFgId0X+KNvlzo4BGmfKeAS1TDngL84wyiwa9G2A6vYwrOd7I6vgSsg 6Urg== X-Gm-Message-State: APt69E1vpBaBw247zFCdECkXj3pd4M4cvsIQygmIY/Bk708ZWqd3t5NF G7ikeYxzmzFvGiWdHgLIAURUlA== X-Received: by 2002:a17:902:294a:: with SMTP id g68-v6mr19351024plb.58.1531106473171; Sun, 08 Jul 2018 20:21:13 -0700 (PDT) Received: from ubt.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id e82-v6sm41458950pfk.87.2018.07.08.20.20.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 08 Jul 2018 20:21:12 -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 V3 1/7] mmc: sdhci: add sd host v4 mode Date: Mon, 9 Jul 2018 11:19:52 +0800 Message-Id: <1531106398-14062-2-git-send-email-zhang.chunyan@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531106398-14062-1-git-send-email-zhang.chunyan@linaro.org> References: <1531106398-14062-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 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 introduced an interface to enable v4 mode. Signed-off-by: Chunyan Zhang --- drivers/mmc/host/sdhci.c | 11 +++++++++++ drivers/mmc/host/sdhci.h | 5 +++++ 2 files changed, 16 insertions(+) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 1c828e0..525862f 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -3321,6 +3321,17 @@ struct sdhci_host *sdhci_alloc_host(struct device *dev, EXPORT_SYMBOL_GPL(sdhci_alloc_host); +/* + * Vendor's Host Controller which supports v4 mode can call + * this function to enable v4 mode before calling + * __sdhci_add_host(). + */ +void sdhci_enable_v4_mode(struct sdhci_host *host) +{ + host->v4_mode = true; +} +EXPORT_SYMBOL_GPL(sdhci_enable_v4_mode); + static int sdhci_set_dma_mask(struct sdhci_host *host) { struct mmc_host *mmc = host->mmc; diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 23966f8..e98249b 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 @@ -566,6 +567,9 @@ struct sdhci_host { u64 data_timeout; unsigned long private[0] ____cacheline_aligned; + + /* Host Version 4 Enable */ + bool v4_mode; }; struct sdhci_ops { @@ -747,5 +751,6 @@ bool sdhci_cqe_irq(struct sdhci_host *host, u32 intmask, int *cmd_error, int *data_error); void sdhci_dumpregs(struct sdhci_host *host); +void sdhci_enable_v4_mode(struct sdhci_host *host); #endif /* __SDHCI_HW_H */