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: 10513431 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 BF4C7603D7 for ; Mon, 9 Jul 2018 03:21:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF61A28B20 for ; Mon, 9 Jul 2018 03:21:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ADB4328B53; Mon, 9 Jul 2018 03:21:15 +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 4E41A28B52 for ; Mon, 9 Jul 2018 03:21:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933057AbeGIDVO (ORCPT ); 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-Google-Smtp-Source: AAOMgpcvIZqF1XmIZ2qrJ5YamTpfMyvmW08M/BfvtGwM9KhW0Q8A8R/0+QbZ1ytyo96XFazHgT080A== 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 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 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(+) 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 */