aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Horman <horms@verge.net.au>2010-11-26 19:11:55 -0500
committerPaul Mundt <lethal@linux-sh.org>2010-11-28 22:54:55 -0500
commit22efa0fee32d9e7f6f6fbc396a872b5708d86048 (patch)
treee5ed9af4fcb68b6c44f25e88a3e97fcb68c681c9
parent1ae0affedce1d3e401991fbe7f2674753f0a7641 (diff)
sh, mmc: Use defines when setting CE_CLK_CTRL
The 16-19th bits of CE_CLK_CTRL set the MMC clock frequency. Cc: Yusuke Goda <yusuke.goda.sx@renesas.com> Cc: Magnus Damm <magnus.damm@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r--include/linux/mmc/sh_mmcif.h17
1 files changed, 9 insertions, 8 deletions
diff --git a/include/linux/mmc/sh_mmcif.h b/include/linux/mmc/sh_mmcif.h
index 342ec1a3868..ffabf8c0a53 100644
--- a/include/linux/mmc/sh_mmcif.h
+++ b/include/linux/mmc/sh_mmcif.h
@@ -70,6 +70,9 @@ struct sh_mmcif_plat_data {
70#define CLK_ENABLE (1 << 24) /* 1: output mmc clock */ 70#define CLK_ENABLE (1 << 24) /* 1: output mmc clock */
71#define CLK_CLEAR ((1 << 19) | (1 << 18) | (1 << 17) | (1 << 16)) 71#define CLK_CLEAR ((1 << 19) | (1 << 18) | (1 << 17) | (1 << 16))
72#define CLK_SUP_PCLK ((1 << 19) | (1 << 18) | (1 << 17) | (1 << 16)) 72#define CLK_SUP_PCLK ((1 << 19) | (1 << 18) | (1 << 17) | (1 << 16))
73#define CLKDIV_4 (1<<16) /* mmc clock frequency.
74 * n: bus clock/(2^(n+1)) */
75#define CLKDIV_256 (7<<16) /* mmc clock frequency. (see above) */
73#define SRSPTO_256 ((1 << 13) | (0 << 12)) /* resp timeout */ 76#define SRSPTO_256 ((1 << 13) | (0 << 12)) /* resp timeout */
74#define SRBSYTO_29 ((1 << 11) | (1 << 10) | \ 77#define SRBSYTO_29 ((1 << 11) | (1 << 10) | \
75 (1 << 9) | (1 << 8)) /* resp busy timeout */ 78 (1 << 9) | (1 << 8)) /* resp busy timeout */
@@ -178,14 +181,10 @@ static inline void sh_mmcif_boot_init(void __iomem *base)
178 /* Set block size in MMCIF hardware */ 181 /* Set block size in MMCIF hardware */
179 sh_mmcif_writel(base, MMCIF_CE_BLOCK_SET, SH_MMCIF_BBS); 182 sh_mmcif_writel(base, MMCIF_CE_BLOCK_SET, SH_MMCIF_BBS);
180 183
181 /* Enable the clock, set it to Bus clock/256 (about 325Khz). 184 /* Enable the clock, set it to Bus clock/256 (about 325Khz). */
182 * It is unclear where 0x70000 comes from or if it is even needed.
183 * It is there for byte-compatibility with code that is known to
184 * work.
185 */
186 sh_mmcif_writel(base, MMCIF_CE_CLK_CTRL, 185 sh_mmcif_writel(base, MMCIF_CE_CLK_CTRL,
187 CLK_ENABLE | SRSPTO_256 | SRBSYTO_29 | SRWDTO_29 | 186 CLK_ENABLE | CLKDIV_256 | SRSPTO_256 |
188 SCCSTO_29 | 0x70000); 187 SRBSYTO_29 | SRWDTO_29 | SCCSTO_29);
189 188
190 /* CMD0 */ 189 /* CMD0 */
191 sh_mmcif_boot_cmd(base, 0x00000040, 0); 190 sh_mmcif_boot_cmd(base, 0x00000040, 0);
@@ -210,7 +209,9 @@ static inline void sh_mmcif_boot_slurp(void __iomem *base,
210 unsigned long tmp; 209 unsigned long tmp;
211 210
212 /* In data transfer mode: Set clock to Bus clock/4 (about 20Mhz) */ 211 /* In data transfer mode: Set clock to Bus clock/4 (about 20Mhz) */
213 sh_mmcif_writel(base, MMCIF_CE_CLK_CTRL, 0x01012fff); 212 sh_mmcif_writel(base, MMCIF_CE_CLK_CTRL,
213 CLK_ENABLE | CLKDIV_4 | SRSPTO_256 |
214 SRBSYTO_29 | SRWDTO_29 | SCCSTO_29);
214 215
215 /* CMD9 - Get CSD */ 216 /* CMD9 - Get CSD */
216 sh_mmcif_boot_cmd(base, 0x09806000, 0x00010000); 217 sh_mmcif_boot_cmd(base, 0x09806000, 0x00010000);