From patchwork Thu Jul 30 17:55:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 51719 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by patches.linaro.org (Postfix) with ESMTPS id 96BD522DB5 for ; Thu, 30 Jul 2015 17:55:45 +0000 (UTC) Received: by lbcjf8 with SMTP id jf8sf16629719lbc.0 for ; Thu, 30 Jul 2015 10:55:44 -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=hO4tsPsJRqdcOjr3GEfjUSWienMJLywKDFPsyljIcIB00X1YehSdS4toHixQrHusMf Np/Fl85jelT6SKP2+LGZry02BNLuaGbBelCnhxwt0WVRmv4jTfY7QiEWCiZrzbMc1lW6 2rUjOz1pnhaV9Kj6lNJGA+46plA/A6+fnWERL5e+/G+ehDiGBgOdr6NmFFMoCBTkM9j6 bmmquRUR3CILg0J8X+MEKVSx+nVMnF8J30WHVHQqABKgbNiDaj+L7FJXiwb2wPRfulj1 IVgK7EROAcyLkZ0pV6NTKRaSl6HfDeG93GDXFM/L4LtbnI2g5AxSnzFUaSDKaZgPJ+Pw YC1A== X-Gm-Message-State: ALoCoQkwO2W5Sr0jHxkn/rA7jgnSnp7n9qM3jlRxdIEPwP/+JkTiNxZLOq44HT8/RxreJzjZIk4f X-Received: by 10.180.205.202 with SMTP id li10mr1437722wic.5.1438278944601; Thu, 30 Jul 2015 10:55:44 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.8.171 with SMTP id dl11ls183445lad.28.gmail; Thu, 30 Jul 2015 10:55:44 -0700 (PDT) X-Received: by 10.152.245.43 with SMTP id xl11mr42785659lac.26.1438278944402; Thu, 30 Jul 2015 10:55:44 -0700 (PDT) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id o7si1406308lbw.36.2015.07.30.10.55.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Jul 2015 10:55:44 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by lafd3 with SMTP id d3so29795009laf.1 for ; Thu, 30 Jul 2015 10:55:44 -0700 (PDT) X-Received: by 10.112.125.34 with SMTP id mn2mr41256716lbb.76.1438278943973; Thu, 30 Jul 2015 10:55:43 -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 l6csp764939lba; Thu, 30 Jul 2015 10:55:43 -0700 (PDT) X-Received: by 10.194.2.9 with SMTP id 9mr76382838wjq.95.1438278940357; Thu, 30 Jul 2015 10:55:40 -0700 (PDT) Received: from mail-wi0-f180.google.com (mail-wi0-f180.google.com. [209.85.212.180]) by mx.google.com with ESMTPS id fp5si275452wib.85.2015.07.30.10.55.40 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Jul 2015 10:55:40 -0700 (PDT) Received-SPF: pass (google.com: domain of peter.griffin@linaro.org designates 209.85.212.180 as permitted sender) client-ip=209.85.212.180; Received: by wicmv11 with SMTP id mv11so30403904wic.0 for ; Thu, 30 Jul 2015 10:55:40 -0700 (PDT) X-Received: by 10.180.105.165 with SMTP id gn5mr8348236wib.20.1438278940170; Thu, 30 Jul 2015 10:55:40 -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 lm5sm257774wic.22.2015.07.30.10.55.38 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 30 Jul 2015 10:55:39 -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 v4 6/9] mmc: hi6220_dw_mmc: Add hi6220 glue code for dw_mmc controller. Date: Thu, 30 Jul 2015 18:55:22 +0100 Message-Id: <1438278925-3038-7-git-send-email-peter.griffin@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1438278925-3038-1-git-send-email-peter.griffin@linaro.org> References: <1438278925-3038-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.215.45 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); +}