From patchwork Tue Jul 3 07:58:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaehoon Chung X-Patchwork-Id: 168724 X-Patchwork-Delegate: afleming@freescale.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 C85392C00F4 for ; Tue, 3 Jul 2012 17:59:15 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C40DE28096; Tue, 3 Jul 2012 09:58:59 +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 MGClRtm7vItV; Tue, 3 Jul 2012 09:58:59 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A3DF5280B4; Tue, 3 Jul 2012 09:58:39 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 21BFE28097 for ; Tue, 3 Jul 2012 09:58:31 +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 XxmRcSQN3RSL for ; Tue, 3 Jul 2012 09:58:30 +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 mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by theia.denx.de (Postfix) with ESMTP id D734128099 for ; Tue, 3 Jul 2012 09:58:17 +0200 (CEST) Received: from epcpsbgm2.samsung.com (mailout4.samsung.com [203.254.224.34]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0M6K0068CRF152H0@mailout4.samsung.com> for u-boot@lists.denx.de; Tue, 03 Jul 2012 16:58:09 +0900 (KST) X-AuditID: cbfee61b-b7f776d000002f3f-a2-4ff2a611b434 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 9A.63.12095.116A2FF4; Tue, 03 Jul 2012 16:58:09 +0900 (KST) Received: from [10.90.51.55] by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0M6K0030ORGSQR00@mmp1.samsung.com> for u-boot@lists.denx.de; Tue, 03 Jul 2012 16:58:09 +0900 (KST) Message-id: <4FF2A60C.4090703@samsung.com> Date: Tue, 03 Jul 2012 16:58:04 +0900 From: Jaehoon Chung User-Agent: Mozilla/5.0 (X11; Linux i686; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 MIME-version: 1.0 To: "u-boot@lists.denx.de" X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprELMWRmVeSWpSXmKPExsVy+t9jAV3BZZ/8DWa85rN4u7eT3YHR4+yd HYwBjFFcNimpOZllqUX6dglcGT+ufmQtWKJQcenkK+YGxtNSXYycHBICJhKXFixkg7DFJC7c Ww9kc3EICSxilJh8bj8zSEJIoIlJYuFXbRCbV0BLYk/PQbAGFgFViSV3uphAbDYBHYnt346D 2aICYRKvpxxigagXlPgx+R6YLSJgKPF3924wm1ngCaPEujUmILawQIhE78w5rBBxHYn9rdPY IGx5ic1r3jJPYOSbhWTULCRls5CULWBkXsUomlqQXFCclJ5rpFecmFtcmpeul5yfu4kRHFLP pHcwrmqwOMQowMGoxMOrMPeTvxBrYllxZe4hRgkOZiUR3rgjH/2FeFMSK6tSi/Lji0pzUosP MUpzsCiJ8zZZX/AXEkhPLEnNTk0tSC2CyTJxcEo1MM4/vKwlwVKI7Xqhzf57RnI9Mr98VcKF uYXu/5ieE6V/8e1lgRlPZrf4bmCIu1L287mE47s94Yn8Mu88kyMteyTva3Y8WHZ0KuucuUmL rh/7saOksrfueMLEz+0WaQdkaw6++iX/ZmahNqczm4GijQFP78wg4XnqcZcZGAtThHeJuunt fHbeU4mlOCPRUIu5qDgRAFrGBDclAgAA X-TM-AS-MML: No Cc: Andy Fleming , Kyungmin Park , Rajeshwari Shinde Subject: [U-Boot] [PATCH v2 3/4] EXYNOS: mmc: support DesignWare Controller for Samsung-SoC 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: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Support DesignWare MMC Controller for Samsung Specific. Signed-off-by: Jaehoon Chung Signed-off-by: Kyungmin Park Signed-off-by: Rajeshawari Shinde --- arch/arm/include/asm/arch-exynos/dwmmc.h | 36 ++++++++++++++++++ drivers/mmc/exynos_dw_mmc.c | 58 ++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+), 0 deletions(-) create mode 100644 arch/arm/include/asm/arch-exynos/dwmmc.h create mode 100644 drivers/mmc/exynos_dw_mmc.c diff --git a/arch/arm/include/asm/arch-exynos/dwmmc.h b/arch/arm/include/asm/arch-exynos/dwmmc.h new file mode 100644 index 0000000..8acdf9b --- /dev/null +++ b/arch/arm/include/asm/arch-exynos/dwmmc.h @@ -0,0 +1,36 @@ +/* + * (C) Copyright 2012 SAMSUNG Electronics + * Jaehoon Chung + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#define DWMCI_CLKSEL 0x09C +#define DWMCI_SHIFT_0 0x0 +#define DWMCI_SHIFT_1 0x1 +#define DWMCI_SHIFT_2 0x2 +#define DWMCI_SHIFT_3 0x3 +#define DWMCI_SET_SAMPLE_CLK(x) (x) +#define DWMCI_SET_DRV_CLK(x) ((x) << 16) +#define DWMCI_SET_DIV_RATIO(x) ((x) << 24) + +int exynos_dwmci_init(u32 regbase, int bus_width, int index); + +static inline unsigned int exynos_dwmmc_init(int index, int bus_width) +{ + unsigned int base = samsung_get_base_mmc() + (0x10000 * index); + return exynos_dwmci_init(base, bus_width, index); +} diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c new file mode 100644 index 0000000..286a7df --- /dev/null +++ b/drivers/mmc/exynos_dw_mmc.c @@ -0,0 +1,58 @@ +/* + * (C) Copyright 2012 SAMSUNG Electronics + * Jaehoon Chung + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include +#include +#include +#include +#include + +static char *EXYNOS_NAME = "EXYNOS DWMMC"; + +static void exynos_dwmci_clksel(struct dwmci_host *host) +{ + u32 val; + val = DWMCI_SET_SAMPLE_CLK(DWMCI_SHIFT_0) | + DWMCI_SET_DRV_CLK(DWMCI_SHIFT_0) | DWMCI_SET_DIV_RATIO(0); + + dwmci_writel(host, DWMCI_CLKSEL, val); +} + +int exynos_dwmci_init(u32 regbase, int bus_width, int index) +{ + struct dwmci_host *host = NULL; + host = (struct dwmci_host *)malloc(sizeof(struct dwmci_host)); + if (!host) { + printf("dwmci_host malloc fail!\n"); + return 1; + } + + host->name = EXYNOS_NAME; + host->ioaddr = (void *)regbase; + host->buswidth = bus_width; + host->clksel = exynos_dwmci_clksel; + host->dev_index = index; + host->mmc_clk = get_mmc_clk; + + add_dwmci(host, 52000000, 400000, index); + + return 0; +} +