From patchwork Wed Jul 29 21:39:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 51673 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by patches.linaro.org (Postfix) with ESMTPS id 0FF9B22DB5 for ; Wed, 29 Jul 2015 21:39:57 +0000 (UTC) Received: by lafd3 with SMTP id d3sf7856247laf.1 for ; Wed, 29 Jul 2015 14:39:56 -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=CRdDWz/jO4UsT6kgsW88Y5L/y0xwSS6jhthohXH84ow=; b=drypuPVAbrEJqcg3SdgOY6dF/bXCZqa8HUNfHTgC5f2c+2wglzQjFfSFjzB6puBDh6 j7G2rOAodDsm0fjGOlidF+L582qjg2sFPr52qIAzRGWNrNcNMMs9WnfLLUzoHdsyWWby hLrGKE4tRZZ/fPWxngYbjkbdhsE9sqsfN8+kJaiiYOibORlpS9gQ9DcIO0+vsBmL7imX HjLaYaWEVCuPgAsHGNF9eNoeF/mRdOCzLm9qbipejhKY8m3FsQkggZARVPM8ay+C0JQ4 LlAsRcs34p0CHGkfT7gK+20HcGBw0fFW3WbQ5C9AFSQw0M6fj1e2ALhrjkVHh6MsMPzR gvCg== X-Gm-Message-State: ALoCoQmamO/+42pnf8D+d3XQEqidWX/smErZR8r/KgXhr1G00Lqj4f9hoJzIHKxrwuefJheJguEv X-Received: by 10.112.28.111 with SMTP id a15mr16515046lbh.21.1438205995975; Wed, 29 Jul 2015 14:39:55 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.1 with SMTP id o1ls103288lao.12.gmail; Wed, 29 Jul 2015 14:39:55 -0700 (PDT) X-Received: by 10.152.203.134 with SMTP id kq6mr41078255lac.106.1438205995709; Wed, 29 Jul 2015 14:39:55 -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 p10si22580567lae.91.2015.07.29.14.39.55 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Jul 2015 14:39:55 -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 lbbst4 with SMTP id st4so15188159lbb.1 for ; Wed, 29 Jul 2015 14:39:55 -0700 (PDT) X-Received: by 10.112.145.169 with SMTP id sv9mr27765809lbb.73.1438205995614; Wed, 29 Jul 2015 14:39:55 -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.7.198 with SMTP id l6csp120018lba; Wed, 29 Jul 2015 14:39:54 -0700 (PDT) X-Received: by 10.194.100.42 with SMTP id ev10mr77411403wjb.50.1438205991779; Wed, 29 Jul 2015 14:39:51 -0700 (PDT) Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com. [209.85.212.181]) by mx.google.com with ESMTPS id md9si29485398wic.10.2015.07.29.14.39.51 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Jul 2015 14:39:51 -0700 (PDT) Received-SPF: pass (google.com: domain of peter.griffin@linaro.org designates 209.85.212.181 as permitted sender) client-ip=209.85.212.181; Received: by wicmv11 with SMTP id mv11so235188267wic.0 for ; Wed, 29 Jul 2015 14:39:51 -0700 (PDT) X-Received: by 10.180.83.101 with SMTP id p5mr21287746wiy.52.1438205991544; Wed, 29 Jul 2015 14:39:51 -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 h9sm40559615wjx.20.2015.07.29.14.39.50 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Jul 2015 14:39:50 -0700 (PDT) From: Peter Griffin To: u-boot@lists.denx.de, albert.u.boot@aribaud.net, trini@konsulko.com, panto@antoniou-consulting.com, marex@denx.de, sjg@chromium.org, robherring2@gmail.com Cc: Peter Griffin Subject: [PATCH v3 6/8] mmc: hi6220_dw_mmc: Add hi6220 glue code for dw_mmc controller. Date: Wed, 29 Jul 2015 22:39:34 +0100 Message-Id: <1438205976-11105-7-git-send-email-peter.griffin@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1438205976-11105-1-git-send-email-peter.griffin@linaro.org> References: <1438205976-11105-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 Reviewed-by: Simon Glass --- 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..731458c --- /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 400000 + +/* 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 calloc failed!\n"); + return -ENOMEM; + } + + host->ioaddr = (void *)regbase; + host->buswidth = bus_width; + host->bus_hz = MMC0_DEFAULT_FREQ; + + return hi6220_dwmci_core_init(host, index); +}