From patchwork Wed Jul 8 15:57:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 50892 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0CEB622A03 for ; Wed, 8 Jul 2015 15:58:06 +0000 (UTC) Received: by laer2 with SMTP id r2sf67649307lae.3 for ; Wed, 08 Jul 2015 08:58:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=0M6TCV7OrXncTsuoJ0pOk8P8tav00Q/MhqJd2TJNgwc=; b=B7fLSK1paemmdYkrLZ2ZyEwDGT+4HtETWgniOnyIJq7+2ywJLl9XrQnhS153woa+5r DhhbWkm3lFndSsBgoD9D7Tplttfo6MU66wjEKeG+ODdKqrU1JQtTjYMhGZIg3idsdvBC qVdNAZtvnbXvPxFq7I6DZG3Lcm+ZKmwFdl3yRLCcJkcmzelC8z3eg+7dicayBNkivzmy Zi9/UMoftgrIAipcqsSrSvJegggm5VbXEkO7HG0IFcl2WdrRE2yA/p9kaZv1RiFLgIF+ MlzTVFrSh8ZaBcnwiIx+1xYHCYoHIphozqOP5yHydx2lQir6gXyu3J0Fv3bFGl7zStGc jkrg== X-Gm-Message-State: ALoCoQmWlephNLCCvJ8yQcugeWTvcszWcQsVTeDj0a5sRqs91tZQ+4Dn5y4maX0pAJ637bQimz8v X-Received: by 10.112.122.12 with SMTP id lo12mr5274759lbb.5.1436371085048; Wed, 08 Jul 2015 08:58:05 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.25.134 with SMTP id c6ls972263lag.54.gmail; Wed, 08 Jul 2015 08:58:04 -0700 (PDT) X-Received: by 10.112.201.199 with SMTP id kc7mr10323450lbc.25.1436371084907; Wed, 08 Jul 2015 08:58:04 -0700 (PDT) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com. [209.85.217.181]) by mx.google.com with ESMTPS id da2si1866149lac.117.2015.07.08.08.58.04 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Jul 2015 08:58:04 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) client-ip=209.85.217.181; Received: by lbnk3 with SMTP id k3so59011818lbn.1 for ; Wed, 08 Jul 2015 08:58:04 -0700 (PDT) X-Received: by 10.112.166.2 with SMTP id zc2mr10172518lbb.29.1436371084786; Wed, 08 Jul 2015 08:58:04 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp50987lbb; Wed, 8 Jul 2015 08:58:04 -0700 (PDT) X-Received: by 10.180.99.132 with SMTP id eq4mr83984410wib.88.1436371058982; Wed, 08 Jul 2015 08:57:38 -0700 (PDT) Received: from mail-wi0-f176.google.com (mail-wi0-f176.google.com. [209.85.212.176]) by mx.google.com with ESMTPS id m6si4041416wif.81.2015.07.08.08.57.38 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Jul 2015 08:57:38 -0700 (PDT) Received-SPF: pass (google.com: domain of peter.griffin@linaro.org designates 209.85.212.176 as permitted sender) client-ip=209.85.212.176; Received: by wibdq8 with SMTP id dq8so217205505wib.1 for ; Wed, 08 Jul 2015 08:57:38 -0700 (PDT) X-Received: by 10.194.97.196 with SMTP id ec4mr21219346wjb.3.1436371058687; Wed, 08 Jul 2015 08:57:38 -0700 (PDT) Received: from localhost.localdomain (cpc14-aztw22-2-0-cust189.18-1.cable.virginm.net. [82.45.1.190]) by smtp.gmail.com with ESMTPSA id o6sm3595044wiz.16.2015.07.08.08.57.37 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Jul 2015 08:57:37 -0700 (PDT) From: Peter Griffin To: u-boot@lists.denx.de, trini@konsulko.com, panto@antoniou-consulting.com, albert.u.boot@aribaud.net, sjg@chromium.org, marex@denx.de, robherring2@gmail.com Cc: Peter Griffin Subject: [PATCH v2 4/6] mmc: hi6220_dw_mmc: Add hi6220 glue code for dw_mmc controller. Date: Wed, 8 Jul 2015 16:57:18 +0100 Message-Id: <1436371040-26620-5-git-send-email-peter.griffin@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1436371040-26620-1-git-send-email-peter.griffin@linaro.org> References: <1436371040-26620-1-git-send-email-peter.griffin@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.griffin@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This patch adds the glue code for hi6220 SoC which has 2x synopsis dw_mmc controllers. This will be used by the hikey board support in subsequent patches. Signed-off-by: Peter Griffin --- arch/arm/include/asm/arch-hi6220/dwmmc.h | 8 +++++ drivers/mmc/Makefile | 1 + drivers/mmc/hi6220_dw_mmc.c | 56 ++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 arch/arm/include/asm/arch-hi6220/dwmmc.h create mode 100644 drivers/mmc/hi6220_dw_mmc.c diff --git a/arch/arm/include/asm/arch-hi6220/dwmmc.h b/arch/arm/include/asm/arch-hi6220/dwmmc.h new file mode 100644 index 0000000..c747383 --- /dev/null +++ b/arch/arm/include/asm/arch-hi6220/dwmmc.h @@ -0,0 +1,8 @@ +/* + * (C) Copyright 2015 Linaro + * Peter Griffin + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +int hi6220_dwmci_add_port(int index, u32 regbase, int bus_width); diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile index ed73687..81a1a8f 100644 --- a/drivers/mmc/Makefile +++ b/drivers/mmc/Makefile @@ -11,6 +11,7 @@ obj-$(CONFIG_BFIN_SDH) += bfin_sdh.o obj-$(CONFIG_DAVINCI_MMC) += davinci_mmc.o obj-$(CONFIG_DWMMC) += dw_mmc.o obj-$(CONFIG_EXYNOS_DWMMC) += exynos_dw_mmc.o +obj-$(CONFIG_HIKEY_DWMMC) += hi6220_dw_mmc.o obj-$(CONFIG_FSL_ESDHC) += fsl_esdhc.o obj-$(CONFIG_FTSDC010) += ftsdc010_mci.o obj-$(CONFIG_FTSDC021) += ftsdc021_sdhci.o diff --git a/drivers/mmc/hi6220_dw_mmc.c b/drivers/mmc/hi6220_dw_mmc.c new file mode 100644 index 0000000..106f673 --- /dev/null +++ b/drivers/mmc/hi6220_dw_mmc.c @@ -0,0 +1,56 @@ +/* + * (C) Copyright 2015 Linaro + * peter.griffin + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include +#include +#include +#include + +#define DWMMC_MAX_CH_NUM 4 + +#define DWMMC_MAX_FREQ 50000000 +#define DWMMC_MIN_FREQ 378000 + +/* Source clock is configured to 100Mhz by ATF bl1*/ +#define MMC0_DEFAULT_FREQ 100000000 + +static int hi6220_dwmci_core_init(struct dwmci_host *host, int index) +{ + host->name = "HiKey DWMMC"; + + host->dev_index = index; + + /* Add the mmc channel to be registered with mmc core */ + if (add_dwmci(host, DWMMC_MAX_FREQ, DWMMC_MIN_FREQ)) { + printf("DWMMC%d registration failed\n", index); + return -1; + } + return 0; +} + +/* + * This function adds the mmc channel to be registered with mmc core. + * index - mmc channel number. + * regbase - register base address of mmc channel specified in 'index'. + * bus_width - operating bus width of mmc channel specified in 'index'. + */ +int hi6220_dwmci_add_port(int index, u32 regbase, int bus_width) +{ + struct dwmci_host *host = NULL; + + host = calloc(1, sizeof(struct dwmci_host)); + if (!host) { + error("dwmci_host malloc fail!\n"); + return -ENOMEM; + } + + host->ioaddr = (void *)regbase; + host->buswidth = bus_width; + host->bus_hz = MMC0_DEFAULT_FREQ; + + return hi6220_dwmci_core_init(host, index); +}