From patchwork Thu May 15 08:57:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaehoon Chung X-Patchwork-Id: 349132 X-Patchwork-Delegate: promsoft@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 7D0A5140083 for ; Thu, 15 May 2014 18:59:12 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8EFADA742C; Thu, 15 May 2014 10:58:46 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kkh6vIwkcRsv; Thu, 15 May 2014 10:58:46 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7DD464BE24; Thu, 15 May 2014 10:57:54 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 698A44BDBB for ; Thu, 15 May 2014 10:57:44 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aGCvVTMf6MnX for ; Thu, 15 May 2014 10:57:44 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by theia.denx.de (Postfix) with ESMTPS id 50D274BD96 for ; Thu, 15 May 2014 10:57:27 +0200 (CEST) Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N5L00BJ2Y7DGE20@mailout3.samsung.com> for u-boot@lists.denx.de; Thu, 15 May 2014 17:57:13 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.114]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id A1.87.11120.86184735; Thu, 15 May 2014 17:57:12 +0900 (KST) X-AuditID: cbfee68f-b7eff6d000002b70-60-53748168ea2b Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 90.A1.25708.86184735; Thu, 15 May 2014 17:57:12 +0900 (KST) Received: from localhost.localdomain ([10.252.81.186]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N5L00D1IY7B2MH0@mmp1.samsung.com>; Thu, 15 May 2014 17:57:12 +0900 (KST) From: Jaehoon Chung To: u-boot@lists.denx.de Date: Thu, 15 May 2014 17:57:06 +0900 Message-id: <1400144230-9829-11-git-send-email-jh80.chung@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1400144230-9829-1-git-send-email-jh80.chung@samsung.com> References: <1400144230-9829-1-git-send-email-jh80.chung@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrGLMWRmVeSWpSXmKPExsWyRsSkSDejsSTY4FqrhcXpT9vYLW78amO1 ePNwM6NFx5EWRot1T9ayWuy6PZnF4u3eTnaLc5d2sTpweMz7OZHJo39TB7PH2Ts7GD36tqxi DGCJ4rJJSc3JLEst0rdL4MqYtOU6Y8E0nooL646xNDD+4uxi5OSQEDCRmH3xNSOELSZx4d56 ti5GLg4hgaWMEvPuPmaBKZq+dQkrRGIRo8TrzYfYQRJCAm1MEjt2loHYbAI6Etu/HWcCsUUE JCR+9V9lBGlgFtjPKPFrbwszSEJYwFFi7eObYEUsAqoSy571gG3gFXCTuHv1OVADB9A2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3YKt1oJBAemJJanZq akFqEcwWJg5OqQZGGYlvE/rPJwUtVd586m2iadKjM/aKoQkW9pZ/1kj8M9p6VHyygVhzTXFg wlKl49873BulVT9tmHJ56QMh8ULFbSnHu969r4s7cfGz7VW+Np/N2W/f7qvjC/x0wJ3v/guX +PgZvWEvOxObzi6fvMBmSeT0cIsLbp0lH/fV5qxf4i0pKr22a7G+EktxRqKhFnNRcSIAeDYB 5uYCAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Cc: p.wilczek@samsung.com, panto@antoniou-consulting.com, Jaehoon Chung , vanbaren@cideas.com Subject: [U-Boot] [RESEND PATCHv4 10/14] mmc: dw_mmc: support the DDR mode X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Support the DDR mode at dw-mmc controller Signed-off-by: Jaehoon Chung Tested-by: Lukasz Majewski Acked-by: Lukasz Majewski --- drivers/mmc/dw_mmc.c | 12 ++++++++++-- include/dwmmc.h | 3 +++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c index eb4e2be..5bf36a0 100644 --- a/drivers/mmc/dw_mmc.c +++ b/drivers/mmc/dw_mmc.c @@ -284,8 +284,8 @@ static int dwmci_setup_bus(struct dwmci_host *host, u32 freq) static void dwmci_set_ios(struct mmc *mmc) { - struct dwmci_host *host = mmc->priv; - u32 ctype; + struct dwmci_host *host = (struct dwmci_host *)mmc->priv; + u32 ctype, regs; debug("Buswidth = %d, clock: %d\n",mmc->bus_width, mmc->clock); @@ -304,6 +304,14 @@ static void dwmci_set_ios(struct mmc *mmc) dwmci_writel(host, DWMCI_CTYPE, ctype); + regs = dwmci_readl(host, DWMCI_UHS_REG); + if (mmc->card_caps & MMC_MODE_DDR_52MHz) + regs |= DWMCI_DDR_MODE; + else + regs &= DWMCI_DDR_MODE; + + dwmci_writel(host, DWMCI_UHS_REG, regs); + if (host->clksel) host->clksel(host); } diff --git a/include/dwmmc.h b/include/dwmmc.h index 14c7db8..b67f11b 100644 --- a/include/dwmmc.h +++ b/include/dwmmc.h @@ -123,6 +123,9 @@ #define DWMCI_BMOD_IDMAC_FB (1 << 1) #define DWMCI_BMOD_IDMAC_EN (1 << 7) +/* UHS register */ +#define DWMCI_DDR_MODE (1 << 16) + /* quirks */ #define DWMCI_QUIRK_DISABLE_SMU (1 << 0)