14 #ifndef LINUX_MMC_SH_MMCIF_H
15 #define LINUX_MMC_SH_MMCIF_H
48 #define MMCIF_CE_CMD_SET 0x00000000
49 #define MMCIF_CE_ARG 0x00000008
50 #define MMCIF_CE_ARG_CMD12 0x0000000C
51 #define MMCIF_CE_CMD_CTRL 0x00000010
52 #define MMCIF_CE_BLOCK_SET 0x00000014
53 #define MMCIF_CE_CLK_CTRL 0x00000018
54 #define MMCIF_CE_BUF_ACC 0x0000001C
55 #define MMCIF_CE_RESP3 0x00000020
56 #define MMCIF_CE_RESP2 0x00000024
57 #define MMCIF_CE_RESP1 0x00000028
58 #define MMCIF_CE_RESP0 0x0000002C
59 #define MMCIF_CE_RESP_CMD12 0x00000030
60 #define MMCIF_CE_DATA 0x00000034
61 #define MMCIF_CE_INT 0x00000040
62 #define MMCIF_CE_INT_MASK 0x00000044
63 #define MMCIF_CE_HOST_STS1 0x00000048
64 #define MMCIF_CE_HOST_STS2 0x0000004C
65 #define MMCIF_CE_VERSION 0x0000007C
68 #define BUF_ACC_DMAWEN (1 << 25)
69 #define BUF_ACC_DMAREN (1 << 24)
70 #define BUF_ACC_BUSW_32 (0 << 17)
71 #define BUF_ACC_BUSW_16 (1 << 17)
72 #define BUF_ACC_ATYP (1 << 16)
75 #define CLK_ENABLE (1 << 24)
76 #define CLK_CLEAR (0xf << 16)
77 #define CLK_SUP_PCLK (0xf << 16)
78 #define CLKDIV_4 (1 << 16)
80 #define CLKDIV_256 (7 << 16)
81 #define SRSPTO_256 (2 << 12)
82 #define SRBSYTO_29 (0xf << 8)
83 #define SRWDTO_29 (0xf << 4)
84 #define SCCSTO_29 (0xf << 0)
87 #define SOFT_RST_ON (1 << 31)
88 #define SOFT_RST_OFF 0
100 #define SH_MMCIF_BBS 512
102 static inline void sh_mmcif_boot_cmd_send(
void __iomem *base,
103 unsigned long cmd,
unsigned long arg)
110 static inline int sh_mmcif_boot_cmd_poll(
void __iomem *base,
unsigned long mask)
115 for (cnt = 0; cnt < 1000000; cnt++) {
126 static inline int sh_mmcif_boot_cmd(
void __iomem *base,
127 unsigned long cmd,
unsigned long arg)
129 sh_mmcif_boot_cmd_send(base, cmd, arg);
130 return sh_mmcif_boot_cmd_poll(base, 0x00010000);
133 static inline int sh_mmcif_boot_do_read_single(
void __iomem *base,
134 unsigned int block_nr,
140 sh_mmcif_boot_cmd(base, 0x0d400000, 0x00010000);
146 sh_mmcif_boot_cmd(base, 0x11480000, block_nr *
SH_MMCIF_BBS);
147 if (sh_mmcif_boot_cmd_poll(base, 0x00100000) < 0)
156 static inline int sh_mmcif_boot_do_read(
void __iomem *base,
157 unsigned long first_block,
158 unsigned long nr_blocks,
170 sh_mmcif_boot_cmd(base, 0x09806000, 0x00010000);
173 sh_mmcif_boot_cmd(base, 0x07400000, 0x00010000);
178 for (k = 0; !ret && k < nr_blocks; k++)
179 ret = sh_mmcif_boot_do_read_single(base, first_block + k,
185 static inline void sh_mmcif_boot_init(
void __iomem *base)
203 sh_mmcif_boot_cmd(base, 0x00000040, 0);
207 sh_mmcif_boot_cmd(base, 0x01405040, 0x40300000);
212 sh_mmcif_boot_cmd(base, 0x02806040, 0);
215 sh_mmcif_boot_cmd(base, 0x03400040, 0x00010000);