Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'common/mmcif' into rmobile/mmcif

+34 -28
-23
drivers/mmc/host/sh_mmcif.c
··· 62 62 /* CE_BLOCK_SET */ 63 63 #define BLOCK_SIZE_MASK 0x0000ffff 64 64 65 - /* CE_CLK_CTRL */ 66 - #define CLK_ENABLE (1 << 24) /* 1: output mmc clock */ 67 - #define CLK_CLEAR ((1 << 19) | (1 << 18) | (1 << 17) | (1 << 16)) 68 - #define CLK_SUP_PCLK ((1 << 19) | (1 << 18) | (1 << 17) | (1 << 16)) 69 - #define SRSPTO_256 ((1 << 13) | (0 << 12)) /* resp timeout */ 70 - #define SRBSYTO_29 ((1 << 11) | (1 << 10) | \ 71 - (1 << 9) | (1 << 8)) /* resp busy timeout */ 72 - #define SRWDTO_29 ((1 << 7) | (1 << 6) | \ 73 - (1 << 5) | (1 << 4)) /* read/write timeout */ 74 - #define SCCSTO_29 ((1 << 3) | (1 << 2) | \ 75 - (1 << 1) | (1 << 0)) /* ccs timeout */ 76 - 77 - /* CE_BUF_ACC */ 78 - #define BUF_ACC_DMAWEN (1 << 25) 79 - #define BUF_ACC_DMAREN (1 << 24) 80 - #define BUF_ACC_BUSW_32 (0 << 17) 81 - #define BUF_ACC_BUSW_16 (1 << 17) 82 - #define BUF_ACC_ATYP (1 << 16) 83 - 84 65 /* CE_INT */ 85 66 #define INT_CCSDE (1 << 29) 86 67 #define INT_CMD12DRE (1 << 26) ··· 145 164 STS2_DATBSYTO | STS2_CRCSTTO | \ 146 165 STS2_AC12BSYTO | STS2_RSPBSYTO | \ 147 166 STS2_AC12RSPTO | STS2_RSPTO) 148 - 149 - /* CE_VERSION */ 150 - #define SOFT_RST_ON (1 << 31) 151 - #define SOFT_RST_OFF (0 << 31) 152 167 153 168 #define CLKDEV_EMMC_DATA 52000000 /* 52MHz */ 154 169 #define CLKDEV_MMC_DATA 20000000 /* 20MHz */
+34 -5
include/linux/mmc/sh_mmcif.h
··· 59 59 #define MMCIF_CE_HOST_STS2 0x0000004C 60 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 + 62 85 static inline u32 sh_mmcif_readl(void __iomem *addr, int reg) 63 86 { 64 87 return readl(addr + reg); ··· 172 149 173 150 /* reset */ 174 151 tmp = sh_mmcif_readl(base, MMCIF_CE_VERSION); 175 - sh_mmcif_writel(base, MMCIF_CE_VERSION, tmp | 0x80000000); 176 - sh_mmcif_writel(base, MMCIF_CE_VERSION, tmp & ~0x80000000); 152 + sh_mmcif_writel(base, MMCIF_CE_VERSION, tmp | SOFT_RST_ON); 153 + sh_mmcif_writel(base, MMCIF_CE_VERSION, tmp & SOFT_RST_OFF); 177 154 178 155 /* byte swap */ 179 - sh_mmcif_writel(base, MMCIF_CE_BUF_ACC, 0x00010000); 156 + sh_mmcif_writel(base, MMCIF_CE_BUF_ACC, BUF_ACC_ATYP); 180 157 181 158 /* Set block size in MMCIF hardware */ 182 159 sh_mmcif_writel(base, MMCIF_CE_BLOCK_SET, SH_MMCIF_BBS); 183 160 184 - /* Enable the clock, set it to Bus clock/256 (about 325Khz)*/ 185 - sh_mmcif_writel(base, MMCIF_CE_CLK_CTRL, 0x01072fff); 161 + /* Enable the clock, set it to Bus clock/256 (about 325Khz). 162 + * It is unclear where 0x70000 comes from or if it is even needed. 163 + * It is there for byte-compatibility with code that is known to 164 + * work. 165 + */ 166 + sh_mmcif_writel(base, MMCIF_CE_CLK_CTRL, 167 + CLK_ENABLE | SRSPTO_256 | SRBSYTO_29 | SRWDTO_29 | 168 + SCCSTO_29 | 0x70000); 186 169 187 170 /* CMD0 */ 188 171 sh_mmcif_boot_cmd(base, 0x00000040, 0);