From patchwork Sat Aug 6 12:55:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 9266135 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 4E26B6075A for ; Sat, 6 Aug 2016 23:08:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 418CE2837F for ; Sat, 6 Aug 2016 23:08:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3521328414; Sat, 6 Aug 2016 23:08:20 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable 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 D92FD2837F for ; Sat, 6 Aug 2016 23:08:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751699AbcHFXIS (ORCPT ); Sat, 6 Aug 2016 19:08:18 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:50834 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751672AbcHFXIR (ORCPT ); Sat, 6 Aug 2016 19:08:17 -0400 Received: from localhost.localdomain ([95.91.40.150]) by mrelayeu.kundenserver.de (mreue104) with ESMTPSA (Nemesis) id 0Lr24R-1b1L683cjj-00eanM; Sat, 06 Aug 2016 14:56:12 +0200 From: Stefan Wahren To: Fabio Estevam , Ulf Hansson , Rob Herring , Mark Rutland Cc: Dong Aisheng , Otavio Salvador , Holger Schurig , Shawn Guo , Marek Vasut , Sascha Hauer , linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, Stefan Wahren Subject: [PATCH RFC 2/3] mmc: core: add new cap for 3.3V only DDR MMCs Date: Sat, 6 Aug 2016 12:55:39 +0000 Message-Id: <1470488140-10104-3-git-send-email-stefan.wahren@i2se.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1470488140-10104-1-git-send-email-stefan.wahren@i2se.com> References: <1470488140-10104-1-git-send-email-stefan.wahren@i2se.com> X-Provags-ID: V03:K0:gOmcc+NYBz2QiBq7mfp11TlHFyM8ET/r2PqQMt92cCO2BgqqnMU TtxpV2DseBJi1eKEKOFI57sEW4Y4TbntzBNGEBcGhUCqyP7nt/58S+7tR39ME2wM9uGGacl bAJX9889vZsn1yK+5DsNyB4SjRJedMU05LoDx+eAV8O2KdbKRDke0rmNqTrLE4zRsKWV+LQ cwl+FNrLgJ2d3INJaPmGw== X-UI-Out-Filterresults: notjunk:1; V01:K0:LxEVeciaAY0=:LzPFLtAAgx1Wgw47NzR8j5 aYPqu1vlrTbjLiALOcNJpRTGIGNgDeZaXABGM0obH/H8c68BnPdVDsRFLeDI6/4H92Bc8Se12 feWNNel8W1/5pCoBMivamTBW2P4ZKiSatV+QedYEZdKts/3iGtr3JAzd5+LlcOIAc/w1dQ9Ly sHefu7vsWgR66yL9+Hr7iGFZJzhESDZDk2Do34qcxqYFYUw555r/SoIgbg6qEqbfgfq+/C1cL zFFL6OKMUN+dYTR7zT/hvHHnis0ht1K2HdtV8O0thgtkKmCY60h4IEriWG8SfGQd3MXB04+P1 Yz/mkKTD4NX5Bfmq2wUTJZmU8VIOAwCn/EGeLy758eaGEEytgfqjxb8AUjH+8EcF2rYTc7ZlW zdOo6vaU4g598F5YgX4jeTyUB/ng3cEVta/D4hmOgA6ilIgOTJr/8+eOpMrOeVepIuDQ9vcwU Cpdj5jmuO8ysyngOBHiIqvduGLPx4xBAVULjlg7PTQ5cNMXmtAalrg24uaL18kuihrUdLJ2Q+ v2LyWfYVnUgN6YlEei7IM4g0O6PGQwGzHyA+E38rhDbBU5sV6YcyVgF36Ik/kGG+bOabooPo1 kku7ZMyFK8986XtasDpDtjUl0p1ovwQqpZWYtxN6XjvvTyQTiHSsnEFw23oPsLuBF1R1jURhb xTS60l/HNqjiScoKyBaY8GqnZgZK+0HoWpJVouJXcpDmyTV2nnZZ+MDYiW/i/cGVHU3A= 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 This patch based on the work of Fabio Estevam: "[PATCH v2] mmc: core: Do not set mmc voltage to 1.8V when 'no-1-8-v' is present" It adds the support for 3.3V only DDR MMC hosts. Signed-off-by: Stefan Wahren --- drivers/mmc/core/host.c | 2 ++ drivers/mmc/core/mmc.c | 6 ++++++ include/linux/mmc/host.h | 1 + 3 files changed, 9 insertions(+) Changes to Fabio's patch: - rebase to current linux-next - rename DT property to mmc-ddr-3_3v - use EXT_CSD_CARD_TYPE_DDR_52 instead of new define diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index 98f25ff..4c971de 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c @@ -301,6 +301,8 @@ int mmc_of_parse(struct mmc_host *host) if (of_property_read_bool(np, "wakeup-source") || of_property_read_bool(np, "enable-sdio-wakeup")) /* legacy */ host->pm_caps |= MMC_PM_WAKE_SDIO_IRQ; + if (of_property_read_bool(np, "mmc-ddr-3_3v")) + host->caps2 |= MMC_CAP2_3_3V_ONLY_DDR; if (of_property_read_bool(np, "mmc-ddr-1_8v")) host->caps |= MMC_CAP_1_8V_DDR; if (of_property_read_bool(np, "mmc-ddr-1_2v")) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index f2d185c..8a933d5 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -210,6 +210,12 @@ static void mmc_select_card_type(struct mmc_card *card) avail_type |= EXT_CSD_CARD_TYPE_HS_52; } + if (caps2 & MMC_CAP2_3_3V_ONLY_DDR && + card_type & EXT_CSD_CARD_TYPE_DDR_1_8V) { + hs_max_dtr = MMC_HIGH_DDR_MAX_DTR; + avail_type |= EXT_CSD_CARD_TYPE_DDR_52; + } + if (caps & MMC_CAP_1_8V_DDR && card_type & EXT_CSD_CARD_TYPE_DDR_1_8V) { hs_max_dtr = MMC_HIGH_DDR_MAX_DTR; diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index aa4bfbf..db0775d 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -311,6 +311,7 @@ struct mmc_host { #define MMC_CAP2_HS400_ES (1 << 20) /* Host supports enhanced strobe */ #define MMC_CAP2_NO_SD (1 << 21) /* Do not send SD commands during initialization */ #define MMC_CAP2_NO_MMC (1 << 22) /* Do not send (e)MMC commands during initialization */ +#define MMC_CAP2_3_3V_ONLY_DDR (1 << 23) /* Only supports 3.3V DDR */ mmc_pm_flag_t pm_caps; /* supported pm features */