aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/files/0003-Add-support-for-SDHCI-on-Zynq-via-OF.patch
blob: e5c3fdd124a9c329fca4feb4212ef3beb17fff8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
From 50fb94af95605a73e013d20ccc65f7d269e215b7 Mon Sep 17 00:00:00 2001
From: Vlad Lungu <vlad.lungu@windriver.com>
Date: Wed, 28 Mar 2012 11:34:18 +0100
Subject: [PATCH] Add support for SDHCI on Zynq via OF

Signed-off-by: Vlad Lungu <vlad.lungu@windriver.com>
---
 drivers/mmc/host/Kconfig             |   13 +++++
 drivers/mmc/host/Makefile            |    1 +
 drivers/mmc/host/sdhci-of-xilinxps.c |   84 ++++++++++++++++++++++++++++++++++
 3 files changed, 98 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mmc/host/sdhci-of-xilinxps.c

diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index cf444b0..fab6847 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -118,6 +118,19 @@ config MMC_SDHCI_OF_HLWD
 
 	  If unsure, say N.
 
+config MMC_SDHCI_OF_XILINX_PS
+	tristate "SDHCI OF support for the Xilinx Zynq SDHCI controllers"
+	depends on MMC_SDHCI_PLTFM
+	depends on OF
+	depends on ARCH_ZYNQ || ARCH_XILINX
+	help
+	  This selects the Secure Digital Host Controller Interface (SDHCI)
+	  found in the Xilinx Zynq EPP.
+
+	  If you have a controller with this interface, say Y or M here.
+
+	  If unsure, say N.
+
 config MMC_SDHCI_CNS3XXX
 	tristate "SDHCI support on the Cavium Networks CNS3xxx SoC"
 	depends on ARCH_CNS3XXX
diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
index b4b83f3..b58b1a1 100644
--- a/drivers/mmc/host/Makefile
+++ b/drivers/mmc/host/Makefile
@@ -50,6 +50,7 @@ obj-$(CONFIG_MMC_SDHCI_DOVE)		+= sdhci-dove.o
 obj-$(CONFIG_MMC_SDHCI_TEGRA)		+= sdhci-tegra.o
 obj-$(CONFIG_MMC_SDHCI_OF_ESDHC)	+= sdhci-of-esdhc.o
 obj-$(CONFIG_MMC_SDHCI_OF_HLWD)		+= sdhci-of-hlwd.o
+obj-$(CONFIG_MMC_SDHCI_OF_XILINX_PS)	+= sdhci-of-xilinxps.o
 
 ifeq ($(CONFIG_CB710_DEBUG),y)
 	CFLAGS-cb710-mmc	+= -DDEBUG
diff --git a/drivers/mmc/host/sdhci-of-xilinxps.c b/drivers/mmc/host/sdhci-of-xilinxps.c
new file mode 100644
index 0000000..2a9bd1c
--- /dev/null
+++ b/drivers/mmc/host/sdhci-of-xilinxps.c
@@ -0,0 +1,84 @@
+/*
+ * drivers/mmc/host/sdhci-of-zynq.c
+ *
+ * Xilinx Zynq Host Controller Interface.
+ * Copyright (c) 2012 Wind River Systems, Inc.
+ *
+ * Based on sdhci-of-esdhc.c
+ *
+ * Copyright (c) 2007 Freescale Semiconductor, Inc.
+ * Copyright (c) 2009 MontaVista Software, Inc.
+ *
+ * Authors: Xiaobo Xie <X.Xie@freescale.com>
+ *          Anton Vorontsov <avorontsov@ru.mvista.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ */
+
+#include <linux/io.h>
+#include <linux/delay.h>
+#include <linux/module.h>
+#include <linux/mmc/host.h>
+#include "sdhci-pltfm.h"
+
+static unsigned int zynq_of_get_max_clock(struct sdhci_host *host)
+{
+	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+
+	return pltfm_host->clock;
+}
+
+static struct sdhci_ops sdhci_zynq_ops = {
+	.get_max_clock = zynq_of_get_max_clock,
+};
+
+static struct sdhci_pltfm_data sdhci_zynq_pdata = {
+	.quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
+	.ops = &sdhci_zynq_ops,
+};
+
+static int __devinit sdhci_zynq_probe(struct platform_device *pdev)
+{
+	return sdhci_pltfm_register(pdev, &sdhci_zynq_pdata);
+}
+
+static int __devexit sdhci_zynq_remove(struct platform_device *pdev)
+{
+	return sdhci_pltfm_unregister(pdev);
+}
+
+static const struct of_device_id sdhci_zynq_of_match[] = {
+	{ .compatible = "xlnx,ps7-sdhci-1.00.a" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, sdhci_zynq_of_match);
+
+static struct platform_driver sdhci_zynq_driver = {
+	.driver = {
+		.name = "sdhci-zynq",
+		.owner = THIS_MODULE,
+		.of_match_table = sdhci_zynq_of_match,
+		.pm = SDHCI_PLTFM_PMOPS,
+	},
+	.probe = sdhci_zynq_probe,
+	.remove = __devexit_p(sdhci_zynq_remove),
+};
+
+static int __init sdhci_zynq_init(void)
+{
+	return platform_driver_register(&sdhci_zynq_driver);
+}
+module_init(sdhci_zynq_init);
+
+static void __exit sdhci_zynq_exit(void)
+{
+	platform_driver_unregister(&sdhci_zynq_driver);
+}
+module_exit(sdhci_zynq_exit);
+
+MODULE_DESCRIPTION("SDHCI OF driver for Xilinx Zynq");
+MODULE_AUTHOR("Vlad Lungu <vlad.lungu@windriver.com>");
+MODULE_LICENSE("GPL v2");
-- 
1.7.7