aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mmc/sh_mmcif.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/mmc/sh_mmcif.h')
-rw-r--r--include/linux/mmc/sh_mmcif.h37
1 files changed, 14 insertions, 23 deletions
diff --git a/include/linux/mmc/sh_mmcif.h b/include/linux/mmc/sh_mmcif.h
index 44fc5348fd5..bf173502d74 100644
--- a/include/linux/mmc/sh_mmcif.h
+++ b/include/linux/mmc/sh_mmcif.h
@@ -104,6 +104,9 @@ static inline void sh_mmcif_writel(void __iomem *addr, int reg, u32 val)
104 104
105#define SH_MMCIF_BBS 512 /* boot block size */ 105#define SH_MMCIF_BBS 512 /* boot block size */
106 106
107enum { MMCIF_PROGRESS_ENTER, MMCIF_PROGRESS_INIT,
108 MMCIF_PROGRESS_LOAD, MMCIF_PROGRESS_DONE };
109
107static inline void sh_mmcif_boot_cmd_send(void __iomem *base, 110static inline void sh_mmcif_boot_cmd_send(void __iomem *base,
108 unsigned long cmd, unsigned long arg) 111 unsigned long cmd, unsigned long arg)
109{ 112{
@@ -166,6 +169,17 @@ static inline int sh_mmcif_boot_do_read(void __iomem *base,
166 unsigned long k; 169 unsigned long k;
167 int ret = 0; 170 int ret = 0;
168 171
172 /* In data transfer mode: Set clock to Bus clock/4 (about 20Mhz) */
173 sh_mmcif_writel(base, MMCIF_CE_CLK_CTRL,
174 CLK_ENABLE | CLKDIV_4 | SRSPTO_256 |
175 SRBSYTO_29 | SRWDTO_29 | SCCSTO_29);
176
177 /* CMD9 - Get CSD */
178 sh_mmcif_boot_cmd(base, 0x09806000, 0x00010000);
179
180 /* CMD7 - Select the card */
181 sh_mmcif_boot_cmd(base, 0x07400000, 0x00010000);
182
169 /* CMD16 - Set the block size */ 183 /* CMD16 - Set the block size */
170 sh_mmcif_boot_cmd(base, 0x10400000, SH_MMCIF_BBS); 184 sh_mmcif_boot_cmd(base, 0x10400000, SH_MMCIF_BBS);
171 185
@@ -209,27 +223,4 @@ static inline void sh_mmcif_boot_init(void __iomem *base)
209 sh_mmcif_boot_cmd(base, 0x03400040, 0x00010000); 223 sh_mmcif_boot_cmd(base, 0x03400040, 0x00010000);
210} 224}
211 225
212static inline void sh_mmcif_boot_slurp(void __iomem *base,
213 unsigned char *buf,
214 unsigned long no_bytes)
215{
216 unsigned long tmp;
217
218 /* In data transfer mode: Set clock to Bus clock/4 (about 20Mhz) */
219 sh_mmcif_writel(base, MMCIF_CE_CLK_CTRL,
220 CLK_ENABLE | CLKDIV_4 | SRSPTO_256 |
221 SRBSYTO_29 | SRWDTO_29 | SCCSTO_29);
222
223 /* CMD9 - Get CSD */
224 sh_mmcif_boot_cmd(base, 0x09806000, 0x00010000);
225
226 /* CMD7 - Select the card */
227 sh_mmcif_boot_cmd(base, 0x07400000, 0x00010000);
228
229 tmp = no_bytes / SH_MMCIF_BBS;
230 tmp += (no_bytes % SH_MMCIF_BBS) ? 1 : 0;
231
232 sh_mmcif_boot_do_read(base, 512, tmp, buf);
233}
234
235#endif /* __SH_MMCIF_H__ */ 226#endif /* __SH_MMCIF_H__ */