aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mmc
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2010-11-25 02:45:43 -0500
committerPaul Mundt <lethal@linux-sh.org>2010-11-25 02:45:43 -0500
commit1ad2096c4eba144522d87541c4024b8c84e95051 (patch)
treea149d469a4da72a7b6e6b777879b740046c4ebc9 /include/linux/mmc
parentc4d73e7d75a54451d6e073c118ba2b8d87bd350d (diff)
parentdf73af86b6e737f357aae85e0b5e621516117780 (diff)
Merge branch 'rmobile/mmcif' into rmobile-latest
Diffstat (limited to 'include/linux/mmc')
-rw-r--r--include/linux/mmc/sh_mmcif.h54
1 files changed, 45 insertions, 9 deletions
diff --git a/include/linux/mmc/sh_mmcif.h b/include/linux/mmc/sh_mmcif.h
index 5c99da1078aa..f216a8879b58 100644
--- a/include/linux/mmc/sh_mmcif.h
+++ b/include/linux/mmc/sh_mmcif.h
@@ -14,8 +14,9 @@
14#ifndef __SH_MMCIF_H__ 14#ifndef __SH_MMCIF_H__
15#define __SH_MMCIF_H__ 15#define __SH_MMCIF_H__
16 16
17#include <linux/platform_device.h>
18#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/platform_device.h>
19#include <linux/sh_dma.h>
19 20
20/* 21/*
21 * MMCIF : CE_CLK_CTRL [19:16] 22 * MMCIF : CE_CLK_CTRL [19:16]
@@ -31,13 +32,19 @@
31 * 1111 : Peripheral clock (sup_pclk set '1') 32 * 1111 : Peripheral clock (sup_pclk set '1')
32 */ 33 */
33 34
35struct sh_mmcif_dma {
36 struct sh_dmae_slave chan_priv_tx;
37 struct sh_dmae_slave chan_priv_rx;
38};
39
34struct sh_mmcif_plat_data { 40struct sh_mmcif_plat_data {
35 void (*set_pwr)(struct platform_device *pdev, int state); 41 void (*set_pwr)(struct platform_device *pdev, int state);
36 void (*down_pwr)(struct platform_device *pdev); 42 void (*down_pwr)(struct platform_device *pdev);
37 int (*get_cd)(struct platform_device *pdef); 43 int (*get_cd)(struct platform_device *pdef);
38 u8 sup_pclk; /* 1 :SH7757, 0: SH7724/SH7372 */ 44 struct sh_mmcif_dma *dma;
39 unsigned long caps; 45 u8 sup_pclk; /* 1 :SH7757, 0: SH7724/SH7372 */
40 u32 ocr; 46 unsigned long caps;
47 u32 ocr;
41}; 48};
42 49
43#define MMCIF_CE_CMD_SET 0x00000000 50#define MMCIF_CE_CMD_SET 0x00000000
@@ -59,6 +66,29 @@ struct sh_mmcif_plat_data {
59#define MMCIF_CE_HOST_STS2 0x0000004C 66#define MMCIF_CE_HOST_STS2 0x0000004C
60#define MMCIF_CE_VERSION 0x0000007C 67#define MMCIF_CE_VERSION 0x0000007C
61 68
69/* CE_BUF_ACC */
70#define BUF_ACC_DMAWEN (1 << 25)
71#define BUF_ACC_DMAREN (1 << 24)
72#define BUF_ACC_BUSW_32 (0 << 17)
73#define BUF_ACC_BUSW_16 (1 << 17)
74#define BUF_ACC_ATYP (1 << 16)
75
76/* CE_CLK_CTRL */
77#define CLK_ENABLE (1 << 24) /* 1: output mmc clock */
78#define CLK_CLEAR ((1 << 19) | (1 << 18) | (1 << 17) | (1 << 16))
79#define CLK_SUP_PCLK ((1 << 19) | (1 << 18) | (1 << 17) | (1 << 16))
80#define SRSPTO_256 ((1 << 13) | (0 << 12)) /* resp timeout */
81#define SRBSYTO_29 ((1 << 11) | (1 << 10) | \
82 (1 << 9) | (1 << 8)) /* resp busy timeout */
83#define SRWDTO_29 ((1 << 7) | (1 << 6) | \
84 (1 << 5) | (1 << 4)) /* read/write timeout */
85#define SCCSTO_29 ((1 << 3) | (1 << 2) | \
86 (1 << 1) | (1 << 0)) /* ccs timeout */
87
88/* CE_VERSION */
89#define SOFT_RST_ON (1 << 31)
90#define SOFT_RST_OFF ~SOFT_RST_ON
91
62static inline u32 sh_mmcif_readl(void __iomem *addr, int reg) 92static inline u32 sh_mmcif_readl(void __iomem *addr, int reg)
63{ 93{
64 return readl(addr + reg); 94 return readl(addr + reg);
@@ -149,17 +179,23 @@ static inline void sh_mmcif_boot_init(void __iomem *base)
149 179
150 /* reset */ 180 /* reset */
151 tmp = sh_mmcif_readl(base, MMCIF_CE_VERSION); 181 tmp = sh_mmcif_readl(base, MMCIF_CE_VERSION);
152 sh_mmcif_writel(base, MMCIF_CE_VERSION, tmp | 0x80000000); 182 sh_mmcif_writel(base, MMCIF_CE_VERSION, tmp | SOFT_RST_ON);
153 sh_mmcif_writel(base, MMCIF_CE_VERSION, tmp & ~0x80000000); 183 sh_mmcif_writel(base, MMCIF_CE_VERSION, tmp & SOFT_RST_OFF);
154 184
155 /* byte swap */ 185 /* byte swap */
156 sh_mmcif_writel(base, MMCIF_CE_BUF_ACC, 0x00010000); 186 sh_mmcif_writel(base, MMCIF_CE_BUF_ACC, BUF_ACC_ATYP);
157 187
158 /* Set block size in MMCIF hardware */ 188 /* Set block size in MMCIF hardware */
159 sh_mmcif_writel(base, MMCIF_CE_BLOCK_SET, SH_MMCIF_BBS); 189 sh_mmcif_writel(base, MMCIF_CE_BLOCK_SET, SH_MMCIF_BBS);
160 190
161 /* Enable the clock, set it to Bus clock/256 (about 325Khz)*/ 191 /* Enable the clock, set it to Bus clock/256 (about 325Khz).
162 sh_mmcif_writel(base, MMCIF_CE_CLK_CTRL, 0x01072fff); 192 * It is unclear where 0x70000 comes from or if it is even needed.
193 * It is there for byte-compatibility with code that is known to
194 * work.
195 */
196 sh_mmcif_writel(base, MMCIF_CE_CLK_CTRL,
197 CLK_ENABLE | SRSPTO_256 | SRBSYTO_29 | SRWDTO_29 |
198 SCCSTO_29 | 0x70000);
163 199
164 /* CMD0 */ 200 /* CMD0 */
165 sh_mmcif_boot_cmd(base, 0x00000040, 0); 201 sh_mmcif_boot_cmd(base, 0x00000040, 0);