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: 9265907 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 BC67E60839 for ; Sat, 6 Aug 2016 12:58:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD31A28365 for ; Sat, 6 Aug 2016 12:58:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A15F928462; Sat, 6 Aug 2016 12:58:44 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3024A28365 for ; Sat, 6 Aug 2016 12:58:44 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bW1AK-0005Mt-4P; Sat, 06 Aug 2016 12:57:24 +0000 Received: from mout.kundenserver.de ([212.227.17.24]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bW19h-0005DN-Hc for linux-arm-kernel@lists.infradead.org; Sat, 06 Aug 2016 12:56:47 +0000 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 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:Kwwm5V7J+xA=:GQHmROcWsrlnkJNu425AH3 6+RAvvICSA8o9N6Crh3i67nS8xE2OeoB0dRFCOb5D8m72xJnFp3jqnlikGtRFqlKrXCGB5hUR a12NEc17c7LlJd/Q+4Vt8RLeUweXYbksizrxOnoH0EZZAVJRiNmy1boAAtDlLBmrsQ/925BvT T5XXApwmHm/IJ64F3sHBRvqfH+vn1zLprm9wxiR0oV5dAUHuqalg4mUlO6SkxM3ntrMImRFNP U2XDSeVV2hu6ONasw7F4C4WbcD+pDaAqKze6OSGdlVxmqHHC1zo/uPWTPtEIDqMuCnVsNH08M Ix/LnDELb3kq+m/hrASj9cKa28p/pE6Gb6RoA5iRpM5iDNtvppAx4jTbNi6sHNgCJMzEZfoKE fLn2xsrvwHGwuU5+ii2SFelNIxJ8Xnn+LEdHI5ctl710nOoSMy71NCXrsmRlm2munPBlAFxs1 Tl26RYlW5rrnv6m/T/boEOTGFgVWnSsT6nr4XvNCELh+E3C4bTFSrrlYs67wKCl+lXalvv4yu ntkis7CCVWv4Ph1iVgiNF6ria2Oh2xO/p07Hrx3YP2NwHVSapY3CoYmGmEuNz74AyYykfd11R x5xbOqEiGG3cOA8J/W43g1ZdmDgZbxz2lGUPb64GyMiTt2/7auw++M5pNSF63Sk03Zk1l5oOJ PD1qG6/fbRBLFouhyRBd5QaUg/DKpLwuS6Kkw+KtKa/eERzsc9C9QitbnQRALjSaw9yE= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160806_055645_988400_AB63F3C4 X-CRM114-Status: GOOD ( 10.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dong Aisheng , Marek Vasut , Otavio Salvador , devicetree@vger.kernel.org, Holger Schurig , Stefan Wahren , linux-mmc@vger.kernel.org, Sascha Hauer , Shawn Guo , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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 */