diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2015-01-12 23:58:20 -0500 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2015-01-20 04:22:48 -0500 |
commit | 7445bf9e6f4e5d7755e22c7c9b06f4ae0d6160c6 (patch) | |
tree | e12be5f236a6ad6788379ab67c02749d5118be0b /drivers/mmc | |
parent | 85c02ddd591e5252eb1cbe8743a839638d7415fd (diff) |
mmc: tmio: tmio_mmc_host has .bus_shift
Current .bus_shift is implemented under tmio_mmc_data.
It goes to tmio_mmc_host by this patch.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/host/sh_mobile_sdhi.c | 5 | ||||
-rw-r--r-- | drivers/mmc/host/tmio_mmc.c | 5 | ||||
-rw-r--r-- | drivers/mmc/host/tmio_mmc.h | 17 | ||||
-rw-r--r-- | drivers/mmc/host/tmio_mmc_dma.c | 2 |
4 files changed, 15 insertions, 14 deletions
diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c index c92efe59284d..0db2a0a0376b 100644 --- a/drivers/mmc/host/sh_mobile_sdhi.c +++ b/drivers/mmc/host/sh_mobile_sdhi.c | |||
@@ -218,6 +218,8 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev) | |||
218 | host->clk_enable = sh_mobile_sdhi_clk_enable; | 218 | host->clk_enable = sh_mobile_sdhi_clk_enable; |
219 | host->clk_disable = sh_mobile_sdhi_clk_disable; | 219 | host->clk_disable = sh_mobile_sdhi_clk_disable; |
220 | host->multi_io_quirk = sh_mobile_sdhi_multi_io_quirk; | 220 | host->multi_io_quirk = sh_mobile_sdhi_multi_io_quirk; |
221 | /* SD control register space size is 0x100, 0x200 for bus_shift=1 */ | ||
222 | host->bus_shift = resource_size(res) >> 9; | ||
221 | 223 | ||
222 | mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED; | 224 | mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED; |
223 | if (p) { | 225 | if (p) { |
@@ -277,9 +279,6 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev) | |||
277 | dma_priv->dma_rx_offset = of_data->dma_rx_offset; | 279 | dma_priv->dma_rx_offset = of_data->dma_rx_offset; |
278 | } | 280 | } |
279 | 281 | ||
280 | /* SD control register space size is 0x100, 0x200 for bus_shift=1 */ | ||
281 | mmc_data->bus_shift = resource_size(res) >> 9; | ||
282 | |||
283 | ret = tmio_mmc_host_probe(host, mmc_data); | 282 | ret = tmio_mmc_host_probe(host, mmc_data); |
284 | if (ret < 0) | 283 | if (ret < 0) |
285 | goto efree; | 284 | goto efree; |
diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c index a7c2e459187c..f746df493892 100644 --- a/drivers/mmc/host/tmio_mmc.c +++ b/drivers/mmc/host/tmio_mmc.c | |||
@@ -88,14 +88,15 @@ static int tmio_mmc_probe(struct platform_device *pdev) | |||
88 | if (!res) | 88 | if (!res) |
89 | return -EINVAL; | 89 | return -EINVAL; |
90 | 90 | ||
91 | /* SD control register space size is 0x200, 0x400 for bus_shift=1 */ | ||
92 | pdata->bus_shift = resource_size(res) >> 10; | ||
93 | pdata->flags |= TMIO_MMC_HAVE_HIGH_REG; | 91 | pdata->flags |= TMIO_MMC_HAVE_HIGH_REG; |
94 | 92 | ||
95 | host = tmio_mmc_host_alloc(pdev); | 93 | host = tmio_mmc_host_alloc(pdev); |
96 | if (!host) | 94 | if (!host) |
97 | goto cell_disable; | 95 | goto cell_disable; |
98 | 96 | ||
97 | /* SD control register space size is 0x200, 0x400 for bus_shift=1 */ | ||
98 | host->bus_shift = resource_size(res) >> 10; | ||
99 | |||
99 | ret = tmio_mmc_host_probe(host, pdata); | 100 | ret = tmio_mmc_host_probe(host, pdata); |
100 | if (ret) | 101 | if (ret) |
101 | goto host_free; | 102 | goto host_free; |
diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h index 263256c897ed..a5d30bfa7e64 100644 --- a/drivers/mmc/host/tmio_mmc.h +++ b/drivers/mmc/host/tmio_mmc.h | |||
@@ -66,6 +66,7 @@ struct tmio_mmc_host { | |||
66 | struct scatterlist *sg_orig; | 66 | struct scatterlist *sg_orig; |
67 | unsigned int sg_len; | 67 | unsigned int sg_len; |
68 | unsigned int sg_off; | 68 | unsigned int sg_off; |
69 | unsigned long bus_shift; | ||
69 | 70 | ||
70 | struct platform_device *pdev; | 71 | struct platform_device *pdev; |
71 | struct tmio_mmc_data *pdata; | 72 | struct tmio_mmc_data *pdata; |
@@ -169,19 +170,19 @@ int tmio_mmc_host_runtime_resume(struct device *dev); | |||
169 | 170 | ||
170 | static inline u16 sd_ctrl_read16(struct tmio_mmc_host *host, int addr) | 171 | static inline u16 sd_ctrl_read16(struct tmio_mmc_host *host, int addr) |
171 | { | 172 | { |
172 | return readw(host->ctl + (addr << host->pdata->bus_shift)); | 173 | return readw(host->ctl + (addr << host->bus_shift)); |
173 | } | 174 | } |
174 | 175 | ||
175 | static inline void sd_ctrl_read16_rep(struct tmio_mmc_host *host, int addr, | 176 | static inline void sd_ctrl_read16_rep(struct tmio_mmc_host *host, int addr, |
176 | u16 *buf, int count) | 177 | u16 *buf, int count) |
177 | { | 178 | { |
178 | readsw(host->ctl + (addr << host->pdata->bus_shift), buf, count); | 179 | readsw(host->ctl + (addr << host->bus_shift), buf, count); |
179 | } | 180 | } |
180 | 181 | ||
181 | static inline u32 sd_ctrl_read32(struct tmio_mmc_host *host, int addr) | 182 | static inline u32 sd_ctrl_read32(struct tmio_mmc_host *host, int addr) |
182 | { | 183 | { |
183 | return readw(host->ctl + (addr << host->pdata->bus_shift)) | | 184 | return readw(host->ctl + (addr << host->bus_shift)) | |
184 | readw(host->ctl + ((addr + 2) << host->pdata->bus_shift)) << 16; | 185 | readw(host->ctl + ((addr + 2) << host->bus_shift)) << 16; |
185 | } | 186 | } |
186 | 187 | ||
187 | static inline void sd_ctrl_write16(struct tmio_mmc_host *host, int addr, u16 val) | 188 | static inline void sd_ctrl_write16(struct tmio_mmc_host *host, int addr, u16 val) |
@@ -191,19 +192,19 @@ static inline void sd_ctrl_write16(struct tmio_mmc_host *host, int addr, u16 val | |||
191 | */ | 192 | */ |
192 | if (host->write16_hook && host->write16_hook(host, addr)) | 193 | if (host->write16_hook && host->write16_hook(host, addr)) |
193 | return; | 194 | return; |
194 | writew(val, host->ctl + (addr << host->pdata->bus_shift)); | 195 | writew(val, host->ctl + (addr << host->bus_shift)); |
195 | } | 196 | } |
196 | 197 | ||
197 | static inline void sd_ctrl_write16_rep(struct tmio_mmc_host *host, int addr, | 198 | static inline void sd_ctrl_write16_rep(struct tmio_mmc_host *host, int addr, |
198 | u16 *buf, int count) | 199 | u16 *buf, int count) |
199 | { | 200 | { |
200 | writesw(host->ctl + (addr << host->pdata->bus_shift), buf, count); | 201 | writesw(host->ctl + (addr << host->bus_shift), buf, count); |
201 | } | 202 | } |
202 | 203 | ||
203 | static inline void sd_ctrl_write32(struct tmio_mmc_host *host, int addr, u32 val) | 204 | static inline void sd_ctrl_write32(struct tmio_mmc_host *host, int addr, u32 val) |
204 | { | 205 | { |
205 | writew(val, host->ctl + (addr << host->pdata->bus_shift)); | 206 | writew(val, host->ctl + (addr << host->bus_shift)); |
206 | writew(val >> 16, host->ctl + ((addr + 2) << host->pdata->bus_shift)); | 207 | writew(val >> 16, host->ctl + ((addr + 2) << host->bus_shift)); |
207 | } | 208 | } |
208 | 209 | ||
209 | 210 | ||
diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c index 6c214d60bbb6..ee0131eb078d 100644 --- a/drivers/mmc/host/tmio_mmc_dma.c +++ b/drivers/mmc/host/tmio_mmc_dma.c | |||
@@ -289,7 +289,7 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat | |||
289 | if (host->dma->chan_priv_tx) | 289 | if (host->dma->chan_priv_tx) |
290 | cfg.slave_id = host->dma->slave_id_tx; | 290 | cfg.slave_id = host->dma->slave_id_tx; |
291 | cfg.direction = DMA_MEM_TO_DEV; | 291 | cfg.direction = DMA_MEM_TO_DEV; |
292 | cfg.dst_addr = res->start + (CTL_SD_DATA_PORT << host->pdata->bus_shift); | 292 | cfg.dst_addr = res->start + (CTL_SD_DATA_PORT << host->bus_shift); |
293 | cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; | 293 | cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; |
294 | cfg.src_addr = 0; | 294 | cfg.src_addr = 0; |
295 | ret = dmaengine_slave_config(host->chan_tx, &cfg); | 295 | ret = dmaengine_slave_config(host->chan_tx, &cfg); |