From patchwork Sat Aug 6 12:55:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 9265909 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 EA29E60839 for ; Sat, 6 Aug 2016 12:58:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA65128365 for ; Sat, 6 Aug 2016 12:58:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CEAEB28462; Sat, 6 Aug 2016 12:58:48 +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 8539628365 for ; Sat, 6 Aug 2016 12:58:48 +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 1bW1A3-0005Hf-GN; Sat, 06 Aug 2016 12:57:07 +0000 Received: from mout.kundenserver.de ([217.72.192.74]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bW19h-0005DG-BB for linux-arm-kernel@lists.infradead.org; Sat, 06 Aug 2016 12:56:46 +0000 Received: from localhost.localdomain ([95.91.40.150]) by mrelayeu.kundenserver.de (mreue104) with ESMTPSA (Nemesis) id 0LdVQI-1aoSv02xW6-00ijXZ; Sat, 06 Aug 2016 14:56:12 +0200 From: Stefan Wahren To: Fabio Estevam , Ulf Hansson , Rob Herring , Mark Rutland Subject: [PATCH RFC 3/3] mmc: mxs-mmc: Implement DDR support Date: Sat, 6 Aug 2016 12:55:40 +0000 Message-Id: <1470488140-10104-4-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:4UBw4h8wpIWAo2LAyzxJmsmlVzKY0uo+0f5Fu4+QBPyQiFloM1Z V3gJ5Js+2CDiII83z78wPSnfsptEsnrrX3JSvxVkpFIZMC50SOHNu0N721XvJlNWi00nkKW 7woxFELKs+krxyZMH/NFeYRBAxLH24fwHb4C9DZENSRg9js5QbF2LQqYrRzRCDDkqbli8G0 vyWduzJ8n3f3sgNDLo29Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:Gj1Ae/dqwYM=:Xs1/awbn+eCtL+4MKfJZ+j Vc/fgLM4xi8b7RHSPwGKjAdh/cMKm0FAaxwFlWnrmyRbHdgzacU8SY8olbPZUy1D4doqmeUDz vPxBPdB+rUwNAZckdKhkFfMiWZ57MpISjO2PQDgLBBy94anRvWNztaMAHz9U18slk6MB9tHWu PkF4fguYQh4YeS4hU/+Hh5tCZublxTEp2L8uwYz9HX1GaH6Lbj3V/+Ovnb3FlTE5o241j9cSG RgWn7CCtwg216FdqueEk0FwN2nROvJA3SNEjEsitEVlT797dcfz5CA0VBMmWbxcNpFmFC1w5m ZYIwdqnT+kAkR03X8O57q8wkhov+2/G7fHYsewFE43jofT2rzWJv+jN+c3HnNXmNB2+s0abjN TZQjZfvoPzV13i3Tw3axD4ZtsQQRf+gE2c8NpmDyyLIB1GXwZGjwj0f+hgOq3SEUZDP1l1NqB hEjRIFzsro/ZxO4+6Dug74rGS0JfnbpK94izIgc1eUWUlNSgtLd4j4O69QnDY98ttaA+M4Yy+ mIAT8DdR8LN9XAKkhV971sWDb7dAvMWDdQZCrL73f7D5vrOmSZeF/c8mqUIBkXML/BhyTPDn2 zxxqJSklJHDOpV7uoYrdZ6pQKIFlRvBW94jiU7X9MZBkUjQP8XPU4ccl6H3Fg2EUvMMAA6vtk bQhb7b6l9vmWqB5kyKlHu0ZM9zDwE2vC/skDFHE1mFLGhr9IXtiOGmQwWEDpAKJ3E274= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160806_055645_835396_ED853611 X-CRM114-Status: GOOD ( 12.44 ) 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 implements driver support for 3.3V DDR eMMCs. Signed-off-by: Stefan Wahren --- drivers/mmc/host/mxs-mmc.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c index d839147..84019d5 100644 --- a/drivers/mmc/host/mxs-mmc.c +++ b/drivers/mmc/host/mxs-mmc.c @@ -71,6 +71,7 @@ struct mxs_mmc_host { spinlock_t lock; int sdio_irq_en; bool broken_cd; + bool is_ddr; }; static int mxs_mmc_get_cd(struct mmc_host *mmc) @@ -411,6 +412,9 @@ static void mxs_mmc_adtc(struct mxs_mmc_host *host) cmd0 |= BF_SSP(log2_blksz, CMD0_BLOCK_SIZE) | BF_SSP(blocks - 1, CMD0_BLOCK_COUNT); } else { + if (host->is_ddr) + cmd0 |= BM_SSP_CMD0_DBL_DATA_RATE_EN; + writel(data_size, ssp->base + HW_SSP_XFER_SIZE); writel(BF_SSP(log2_blksz, BLOCK_SIZE_BLOCK_SIZE) | BF_SSP(blocks - 1, BLOCK_SIZE_BLOCK_COUNT), @@ -499,6 +503,7 @@ static void mxs_mmc_request(struct mmc_host *mmc, struct mmc_request *mrq) static void mxs_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) { struct mxs_mmc_host *host = mmc_priv(mmc); + struct mxs_ssp *ssp = &host->ssp; if (ios->bus_width == MMC_BUS_WIDTH_8) host->bus_width = 2; @@ -509,6 +514,23 @@ static void mxs_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) if (ios->clock) mxs_ssp_set_clk_rate(&host->ssp, ios->clock); + + if (ssp_is_old(ssp)) + return; + + if (ios->timing == MMC_TIMING_MMC_DDR52) { + /* + * ENGR00133481-1: In DDR mode the host send the data at + * negative edge and the MMC receive the data at positive edge. + */ + host->is_ddr = true; + writel(BM_SSP_CTRL1_POLARITY, ssp->base + + HW_SSP_CTRL1(ssp) + STMP_OFFSET_REG_CLR); + } else { + host->is_ddr = false; + writel(BM_SSP_CTRL1_POLARITY, ssp->base + HW_SSP_CTRL1(ssp) + + STMP_OFFSET_REG_SET); + } } static void mxs_mmc_enable_sdio_irq(struct mmc_host *mmc, int enable)