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: 493053 X-Patchwork-Delegate: trini@ti.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 1271C1402B5 for ; Thu, 9 Jul 2015 01:58:49 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 61FBF4BA56; Wed, 8 Jul 2015 17:58:47 +0200 (CEST) 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 7i8JBKZqmRY2; Wed, 8 Jul 2015 17:58:47 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id EE6D34BA57; Wed, 8 Jul 2015 17:58:35 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 597184B9E6 for ; Wed, 8 Jul 2015 17:57:41 +0200 (CEST) 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 xV3RWU0OV1A6 for ; Wed, 8 Jul 2015 17:57:41 +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 mail-wi0-f169.google.com (mail-wi0-f169.google.com [209.85.212.169]) by theia.denx.de (Postfix) with ESMTPS id 802E24B9A8 for ; Wed, 8 Jul 2015 17:57:38 +0200 (CEST) Received: by wifm2 with SMTP id m2so93937291wif.1 for ; Wed, 08 Jul 2015 08:57:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0M6TCV7OrXncTsuoJ0pOk8P8tav00Q/MhqJd2TJNgwc=; b=BT/XxBsWt2zuUTN9x9g7P3vG2bj+8ca4U6IJsiyMsPUgZdvASrkBHLdB2a2bbG81D9 gMu+Q4OHZZqfK/f0Rjv0gNCjHOwG+2DeYEM4T2sXSiK/ZobfP//rrfDaOZd8DS7jadUo gyn+FWBh/ItC7+ir9j0P7Nc5SwdBdmoLvlQlNAWd/N8tdFy/DqnOykTrx54S+M9bGzsH WoQjD8+9bMcB81T/nJyJ7QsweFom0iAzTO2DrBGpxcgbozidmbtx7c8Pz5peVR7neXDu 5y2DuP+6ujkaOlSR6d4M9Qr67EyfAUSqq6eBLHmQhXVpuflJz2KdWoU6BytTm6IsST45 hUrw== X-Gm-Message-State: ALoCoQkjO2L040Adrmu4++3c2LUEy9PzW+rnTsjsuQMWwsUWYSX/6J7208j2aOz/R49u6mW9EPTB 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 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> Subject: [U-Boot] [PATCH v2 4/6] mmc: hi6220_dw_mmc: Add hi6220 glue code for dw_mmc controller. X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" 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..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); +}