Patchwork [U-Boot,V2,2/2] MMC: add marvell sdhci driver

login
register
mail settings
Submitter Lei Wen
Date June 29, 2011, 7:50 a.m.
Message ID <1309333807-839-3-git-send-email-leiwen@marvell.com>
Download mbox | patch
Permalink /patch/102528/
State Accepted, archived
Delegated to: Andy Fleming
Headers show

Comments

Lei Wen - June 29, 2011, 7:50 a.m.
This could support both armada100 and pantheon serial in the mainline,
while this driver also be tested to support upcoming mg, mmp2 and mmp3
hardware.

Signed-off-by: Lei Wen <leiwen@marvell.com>
---
V1:
add marvell sdhci driver implementation

V2:
rename the previous file name from sdhci-mv to mv_sdhci

 drivers/mmc/Makefile   |    1 +
 drivers/mmc/mv_sdhci.c |   21 +++++++++++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mmc/mv_sdhci.c

Patch

diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile
index 50b5117..bf6534a 100644
--- a/drivers/mmc/Makefile
+++ b/drivers/mmc/Makefile
@@ -39,6 +39,7 @@  COBJS-$(CONFIG_OMAP_HSMMC) += omap_hsmmc.o
 COBJS-$(CONFIG_PXA_MMC) += pxa_mmc.o
 COBJS-$(CONFIG_S5P_MMC) += s5p_mmc.o
 COBJS-$(CONFIG_SDHCI) += sdhci.o
+COBJS-$(CONFIG_MV_SDHCI) += mv_sdhci.o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
diff --git a/drivers/mmc/mv_sdhci.c b/drivers/mmc/mv_sdhci.c
new file mode 100644
index 0000000..af0d486
--- /dev/null
+++ b/drivers/mmc/mv_sdhci.c
@@ -0,0 +1,21 @@ 
+#include <common.h>
+#include <malloc.h>
+#include <sdhci.h>
+
+static char *MVSDH_NAME = "mv_sdh";
+int mv_sdh_init(u32 regbase, u32 max_clk, u32 min_clk, u32 quirks)
+{
+	struct sdhci_host *host = NULL;
+	host = (struct sdhci_host *)malloc(sizeof(struct sdhci_host));
+	if (!host) {
+		printf("sdh_host malloc fail!\n");
+		return 1;
+	}
+
+	host->name = MVSDH_NAME;
+	host->ioaddr = (void *)regbase;
+	host->quirks = quirks;
+	host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
+	add_sdhci(host, max_clk, min_clk);
+	return 0;
+}