[PATCH] Add omap_hsmmc platform data.

Juergen Kilb J.Kilb at phytec.de
Fri Sep 9 08:10:54 EDT 2011


Add platform data to specify maximum frequency of hsmmc interface
which can be restricted due to external level shifters.

Signed-off-by: Juergen Kilb <J.Kilb at phytec.de>
---
 arch/arm/mach-omap/include/mach/omap_hsmmc.h |   28 ++++++++++++++++++++++++++
 drivers/mci/omap_hsmmc.c                     |   10 ++++++++-
 2 files changed, 37 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-omap/include/mach/omap_hsmmc.h

diff --git a/arch/arm/mach-omap/include/mach/omap_hsmmc.h b/arch/arm/mach-omap/include/mach/omap_hsmmc.h
new file mode 100644
index 0000000..a15f8e6
--- /dev/null
+++ b/arch/arm/mach-omap/include/mach/omap_hsmmc.h
@@ -0,0 +1,28 @@
+/**
+ * @file
+ * @brief This file contains exported structure for OMAP hsmmc
+ *
+ * FileName: include/asm-arm/arch-omap/omap_hsmmc.h
+ *
+ * OMAP3 and OMAP4 has a MMC/SD controller embedded.
+ * This file provides the platform data structure required to
+ * addapt to platform specialities.
+ */
+/*
+ * (C) Copyright 2011
+ * Phytec Messtechnik GmbH, <www.phytec.de>
+ * Juergen Kilb <j.kilb at phytec.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __ASM_OMAP_HSMMC_H
+#define  __ASM_OMAP_HSMMC_H
+
+/** omapmmc platform data structure */
+struct omap_hsmmc_platform_data {
+	unsigned f_max;         /* host interface upper limit */
+};
+#endif /* __ASM_OMAP_HSMMC_H */
diff --git a/drivers/mci/omap_hsmmc.c b/drivers/mci/omap_hsmmc.c
index 5fdf445..bf8d4a9 100644
--- a/drivers/mci/omap_hsmmc.c
+++ b/drivers/mci/omap_hsmmc.c
@@ -31,6 +31,8 @@
 #include <errno.h>
 #include <asm/io.h>
 
+#include <mach/omap_hsmmc.h>
+
 struct hsmmc {
 	unsigned char res1[0x10];
 	unsigned int sysconfig;		/* 0x10 */
@@ -549,6 +551,7 @@ static void mmc_set_ios(struct mci_host *mci, struct device_d *dev,
 static int omap_mmc_probe(struct device_d *dev)
 {
 	struct omap_hsmmc *hsmmc;
+	struct omap_hsmmc_platform_data *pdata;
 
 	hsmmc = xzalloc(sizeof(*hsmmc));
 
@@ -564,7 +567,12 @@ static int omap_mmc_probe(struct device_d *dev)
 	hsmmc->mci.voltages = MMC_VDD_32_33 | MMC_VDD_33_34;
 
 	hsmmc->mci.f_min = 400000;
-	hsmmc->mci.f_max = 52000000;
+
+	pdata = (struct omap_hsmmc_platform_data *)dev->platform_data;
+	if (pdata->f_max)
+		hsmmc->mci.f_max = pdata->f_max;
+	else
+		hsmmc->mci.f_max = 52000000;
 
 	mci_register(&hsmmc->mci);
 
-- 
1.7.0.4




More information about the barebox mailing list