aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mmc/sh_mmcif.h
diff options
context:
space:
mode:
authorSimon Horman <horms@verge.net.au>2010-11-09 03:47:02 -0500
committerPaul Mundt <lethal@linux-sh.org>2010-11-10 04:25:10 -0500
commitda1d39e3903bc35be2b5e8d2116fdd5d337244d4 (patch)
tree29f84c830cec7732f6a2868498d40ccbeccf9244 /include/linux/mmc/sh_mmcif.h
parenta7bcf21e60c73cb7f7c13fad928967d7e47c3cac (diff)
mmc, sh: Move constants to sh_mmcif.h
This moves some constants from sh_mmcif.c to sh_mmcif.h so that they can be used in sh_mmcif_boot_init(). It also alters the definition of SOFT_RST_OFF from (0 << 31) to ~SOFT_RST_ON (= ~(1 << 31)). The former seems bogus. The latter is consistent with the code in sh_mmcif_boot_init(). 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>
Diffstat (limited to 'include/linux/mmc/sh_mmcif.h')
-rw-r--r--include/linux/mmc/sh_mmcif.h39
1 files changed, 34 insertions, 5 deletions
diff --git a/include/linux/mmc/sh_mmcif.h b/include/linux/mmc/sh_mmcif.h
index 5c99da1078aa..a6bfa5296495 100644
--- a/include/linux/mmc/sh_mmcif.h
+++ b/include/linux/mmc/sh_mmcif.h
@@ -59,6 +59,29 @@ struct sh_mmcif_plat_data {
59#define MMCIF_CE_HOST_STS2 0x0000004C 59#define MMCIF_CE_HOST_STS2 0x0000004C
60#define MMCIF_CE_VERSION 0x0000007C 60#define MMCIF_CE_VERSION 0x0000007C
61 61
62/* CE_BUF_ACC */
63#define BUF_ACC_DMAWEN (1 << 25)
64#define BUF_ACC_DMAREN (1 << 24)
65#define BUF_ACC_BUSW_32 (0 << 17)
66#define BUF_ACC_BUSW_16 (1 << 17)
67#define BUF_ACC_ATYP (1 << 16)
68
69/* CE_CLK_CTRL */
70#define CLK_ENABLE (1 << 24) /* 1: output mmc clock */
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))
73#define SRSPTO_256 ((1 << 13) | (0 << 12)) /* resp timeout */
74#define SRBSYTO_29 ((1 << 11) | (1 << 10) | \
75 (1 << 9) | (1 << 8)) /* resp busy timeout */
76#define SRWDTO_29 ((1 << 7) | (1 << 6) | \
77 (1 << 5) | (1 << 4)) /* read/write timeout */
78#define SCCSTO_29 ((1 << 3) | (1 << 2) | \
79 (1 << 1) | (1 << 0)) /* ccs timeout */
80
81/* CE_VERSION */
82#define SOFT_RST_ON (1 << 31)
83#define SOFT_RST_OFF ~SOFT_RST_ON
84
62static inline u32 sh_mmcif_readl(void __iomem *addr, int reg) 85static inline u32 sh_mmcif_readl(void __iomem *addr, int reg)
63{ 86{
64 return readl(addr + reg); 87 return readl(addr + reg);
@@ -149,17 +172,23 @@ static inline void sh_mmcif_boot_init(void __iomem *base)
149 172
150 /* reset */ 173 /* reset */
151 tmp = sh_mmcif_readl(base, MMCIF_CE_VERSION); 174 tmp = sh_mmcif_readl(base, MMCIF_CE_VERSION);
152 sh_mmcif_writel(base, MMCIF_CE_VERSION, tmp | 0x80000000); 175 sh_mmcif_writel(base, MMCIF_CE_VERSION, tmp | SOFT_RST_ON);
153 sh_mmcif_writel(base, MMCIF_CE_VERSION, tmp & ~0x80000000); 176 sh_mmcif_writel(base, MMCIF_CE_VERSION, tmp & SOFT_RST_OFF);
154 177
155 /* byte swap */ 178 /* byte swap */
156 sh_mmcif_writel(base, MMCIF_CE_BUF_ACC, 0x00010000); 179 sh_mmcif_writel(base, MMCIF_CE_BUF_ACC, BUF_ACC_ATYP);
157 180
158 /* Set block size in MMCIF hardware */ 181 /* Set block size in MMCIF hardware */
159 sh_mmcif_writel(base, MMCIF_CE_BLOCK_SET, SH_MMCIF_BBS); 182 sh_mmcif_writel(base, MMCIF_CE_BLOCK_SET, SH_MMCIF_BBS);
160 183
161 /* Enable the clock, set it to Bus clock/256 (about 325Khz)*/ 184 /* Enable the clock, set it to Bus clock/256 (about 325Khz).
162 sh_mmcif_writel(base, MMCIF_CE_CLK_CTRL, 0x01072fff); 185 * It is unclear where 0x70000 comes from or if it is even needed.
186 * It is there for byte-compatibility with code that is known to
187 * work.
188 */
189 sh_mmcif_writel(base, MMCIF_CE_CLK_CTRL,
190 CLK_ENABLE | SRSPTO_256 | SRBSYTO_29 | SRWDTO_29 |
191 SCCSTO_29 | 0x70000);
163 192
164 /* CMD0 */ 193 /* CMD0 */
165 sh_mmcif_boot_cmd(base, 0x00000040, 0); 194 sh_mmcif_boot_cmd(base, 0x00000040, 0);