aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap1/devices.c
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2008-12-10 20:37:16 -0500
committerTony Lindgren <tony@atomide.com>2008-12-10 20:37:16 -0500
commitd88746652b4d133284d1fdd05b5e999e8f44c998 (patch)
tree2a6cfd6fe175a18eb4b4f600e0a79444259c9a5d /arch/arm/mach-omap1/devices.c
parent652bcd8f72cc0cdf4499ce7d73990514e5e3e4b9 (diff)
omap mmc: Add better MMC low-level init
This will simplify the MMC low-level init, and make it more flexible to add support for a newer MMC controller in the following patches. The patch rearranges platform data and gets rid of slot vs controller confusion in the old data structures. Also fix device id numbering in the clock code. Some code snippets are based on an earlier patch by Russell King <linux@arm.linux.org.uk>. Cc: Pierre Ossman <drzeus-mmc@drzeus.cx> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap1/devices.c')
-rw-r--r--arch/arm/mach-omap1/devices.c90
1 files changed, 90 insertions, 0 deletions
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
index e382b438c64e..024dab13d4b4 100644
--- a/arch/arm/mach-omap1/devices.c
+++ b/arch/arm/mach-omap1/devices.c
@@ -22,6 +22,7 @@
22#include <mach/board.h> 22#include <mach/board.h>
23#include <mach/mux.h> 23#include <mach/mux.h>
24#include <mach/gpio.h> 24#include <mach/gpio.h>
25#include <mach/mmc.h>
25 26
26/*-------------------------------------------------------------------------*/ 27/*-------------------------------------------------------------------------*/
27 28
@@ -99,6 +100,95 @@ static inline void omap_init_mbox(void)
99static inline void omap_init_mbox(void) { } 100static inline void omap_init_mbox(void) { }
100#endif 101#endif
101 102
103/*-------------------------------------------------------------------------*/
104
105#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
106
107static inline void omap1_mmc_mux(struct omap_mmc_platform_data *mmc_controller,
108 int controller_nr)
109{
110 if (controller_nr == 0) {
111 omap_cfg_reg(MMC_CMD);
112 omap_cfg_reg(MMC_CLK);
113 omap_cfg_reg(MMC_DAT0);
114 if (cpu_is_omap1710()) {
115 omap_cfg_reg(M15_1710_MMC_CLKI);
116 omap_cfg_reg(P19_1710_MMC_CMDDIR);
117 omap_cfg_reg(P20_1710_MMC_DATDIR0);
118 }
119 if (mmc_controller->slots[0].wire4) {
120 omap_cfg_reg(MMC_DAT1);
121 /* NOTE: DAT2 can be on W10 (here) or M15 */
122 if (!mmc_controller->slots[0].nomux)
123 omap_cfg_reg(MMC_DAT2);
124 omap_cfg_reg(MMC_DAT3);
125 }
126 }
127
128 /* Block 2 is on newer chips, and has many pinout options */
129 if (cpu_is_omap16xx() && controller_nr == 1) {
130 if (!mmc_controller->slots[1].nomux) {
131 omap_cfg_reg(Y8_1610_MMC2_CMD);
132 omap_cfg_reg(Y10_1610_MMC2_CLK);
133 omap_cfg_reg(R18_1610_MMC2_CLKIN);
134 omap_cfg_reg(W8_1610_MMC2_DAT0);
135 if (mmc_controller->slots[1].wire4) {
136 omap_cfg_reg(V8_1610_MMC2_DAT1);
137 omap_cfg_reg(W15_1610_MMC2_DAT2);
138 omap_cfg_reg(R10_1610_MMC2_DAT3);
139 }
140
141 /* These are needed for the level shifter */
142 omap_cfg_reg(V9_1610_MMC2_CMDDIR);
143 omap_cfg_reg(V5_1610_MMC2_DATDIR0);
144 omap_cfg_reg(W19_1610_MMC2_DATDIR1);
145 }
146
147 /* Feedback clock must be set on OMAP-1710 MMC2 */
148 if (cpu_is_omap1710())
149 omap_writel(omap_readl(MOD_CONF_CTRL_1) | (1 << 24),
150 MOD_CONF_CTRL_1);
151 }
152}
153
154void __init omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
155 int nr_controllers)
156{
157 int i;
158
159 for (i = 0; i < nr_controllers; i++) {
160 unsigned long base, size;
161 unsigned int irq = 0;
162
163 if (!mmc_data[i])
164 continue;
165
166 omap1_mmc_mux(mmc_data[i], i);
167
168 switch (i) {
169 case 0:
170 base = OMAP1_MMC1_BASE;
171 irq = INT_MMC;
172 break;
173 case 1:
174 if (!cpu_is_omap16xx())
175 return;
176 base = OMAP1_MMC2_BASE;
177 irq = INT_1610_MMC2;
178 break;
179 default:
180 continue;
181 }
182 size = OMAP1_MMC_SIZE;
183
184 omap_mmc_add(i, base, size, irq, mmc_data[i]);
185 };
186}
187
188#endif
189
190/*-------------------------------------------------------------------------*/
191
102#if defined(CONFIG_OMAP_STI) 192#if defined(CONFIG_OMAP_STI)
103 193
104#define OMAP1_STI_BASE 0xfffea000 194#define OMAP1_STI_BASE 0xfffea000