From patchwork Wed Sep 16 08:23:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wenyou Yang X-Patchwork-Id: 518640 X-Patchwork-Delegate: andreas.biessmann@googlemail.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 32B60140497 for ; Thu, 17 Sep 2015 08:16:01 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CACCC4B7AF; Thu, 17 Sep 2015 00:15:59 +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 Nd8EVzQcPSA9; Thu, 17 Sep 2015 00:15:59 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4C2794B809; Thu, 17 Sep 2015 00:13:20 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E20684B6EF for ; Wed, 16 Sep 2015 10:25:28 +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 iKzWAUNR7CBn for ; Wed, 16 Sep 2015 10:25:28 +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 DVREDG02.corp.atmel.com (nasmtp01.atmel.com [192.199.1.246]) by theia.denx.de (Postfix) with ESMTPS id 47CCC4B6E7 for ; Wed, 16 Sep 2015 10:25:22 +0200 (CEST) Received: from apsmtp01.atmel.com (10.168.254.31) by DVREDG02.corp.atmel.com (10.42.103.31) with Microsoft SMTP Server (TLS) id 14.3.235.1; Wed, 16 Sep 2015 02:25:15 -0600 Received: from shaarm01.corp.atmel.com (10.168.254.13) by apsmtp01.atmel.com (10.168.254.31) with Microsoft SMTP Server id 14.3.235.1; Wed, 16 Sep 2015 16:25:11 +0800 From: Wenyou Yang To: U-Boot Mailing List Date: Wed, 16 Sep 2015 16:23:01 +0800 Message-ID: <1442391781-403-1-git-send-email-wenyou.yang@atmel.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 Cc: Pantelis Antoniou Subject: [U-Boot] [PATCH] mmc: atmel: Add support fo atmel sdhci 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Signed-off-by: Wenyou Yang --- arch/arm/mach-at91/include/mach/atmel_sdhci.h | 13 +++++++++ drivers/mmc/Makefile | 1 + drivers/mmc/atmel_sdhci.c | 35 +++++++++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 arch/arm/mach-at91/include/mach/atmel_sdhci.h create mode 100644 drivers/mmc/atmel_sdhci.c diff --git a/arch/arm/mach-at91/include/mach/atmel_sdhci.h b/arch/arm/mach-at91/include/mach/atmel_sdhci.h new file mode 100644 index 0000000..cf3bf89 --- /dev/null +++ b/arch/arm/mach-at91/include/mach/atmel_sdhci.h @@ -0,0 +1,13 @@ +/* + * Copyright (c) 2015 Atmel Corporation + * Wenyou.Yang + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#ifndef __ATMEL_SDHCI_H +#define __ATMEL_SDHCI_H + +int atmel_sdhci_init(void *regbase, u32 id); + +#endif diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile index 99d0295..5d35705 100644 --- a/drivers/mmc/Makefile +++ b/drivers/mmc/Makefile @@ -8,6 +8,7 @@ obj-$(CONFIG_DM_MMC) += mmc-uclass.o obj-$(CONFIG_ARM_PL180_MMCI) += arm_pl180_mmci.o +obj-$(CONFIG_ATMEL_SDHCI) += atmel_sdhci.o obj-$(CONFIG_BCM2835_SDHCI) += bcm2835_sdhci.o obj-$(CONFIG_BFIN_SDH) += bfin_sdh.o obj-$(CONFIG_DAVINCI_MMC) += davinci_mmc.o diff --git a/drivers/mmc/atmel_sdhci.c b/drivers/mmc/atmel_sdhci.c new file mode 100644 index 0000000..64776a1 --- /dev/null +++ b/drivers/mmc/atmel_sdhci.c @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2015 Atmel Corporation + * Wenyou.Yang + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include +#include +#include +#include + +#define ATMEL_SDHC_MIN_FRQ 400000 + +int atmel_sdhci_init(void *regbase, u32 id) +{ + struct sdhci_host *host = NULL; + u32 max_clk, min_clk = ATMEL_SDHC_MIN_FRQ; + + host = (struct sdhci_host *)malloc(sizeof(struct sdhci_host)); + if (!host) { + printf("atmel_sdhci_init: sdhci_host malloc fail\n"); + return -1; + } + + host->name = "atmel_sdhci"; + host->ioaddr = (void *)regbase; + host->quirks = 0; + host->version = sdhci_readw(host, SDHCI_HOST_VERSION); + max_clk = at91_get_periph_generated_clk(id); + + add_sdhci(host, max_clk, min_clk); + + return 0; +}