diff options
author | Jaehoon Chung <jh80.chung@samsung.com> | 2017-06-05 00:41:34 -0400 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2017-06-29 11:14:26 -0400 |
commit | 42f989c002f235557e3a03feac3b2f16b17d53f6 (patch) | |
tree | 63ac45c4e60397320cdbf6cfb3a5d8eafc6a0e88 | |
parent | e4a65ef7687b6aaf36bedb497d3fd1480163d2d5 (diff) |
mmc: dw_mmc: use the 'slot' instead of 'cur_slot'
Remove the 'cur_slot'. Instead, just use 'slot'.
There is no multiple slots, so we need to consider only one slot.
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-rw-r--r-- | drivers/mmc/host/dw_mmc-exynos.c | 4 | ||||
-rw-r--r-- | drivers/mmc/host/dw_mmc.c | 33 | ||||
-rw-r--r-- | drivers/mmc/host/dw_mmc.h | 3 |
3 files changed, 18 insertions, 22 deletions
diff --git a/drivers/mmc/host/dw_mmc-exynos.c b/drivers/mmc/host/dw_mmc-exynos.c index 25691cca1881..35026795be28 100644 --- a/drivers/mmc/host/dw_mmc-exynos.c +++ b/drivers/mmc/host/dw_mmc-exynos.c | |||
@@ -157,8 +157,8 @@ static void dw_mci_exynos_set_clksel_timing(struct dw_mci *host, u32 timing) | |||
157 | * HOLD register should be bypassed in case there is no phase shift | 157 | * HOLD register should be bypassed in case there is no phase shift |
158 | * applied on CMD/DATA that is sent to the card. | 158 | * applied on CMD/DATA that is sent to the card. |
159 | */ | 159 | */ |
160 | if (!SDMMC_CLKSEL_GET_DRV_WD3(clksel) && host->cur_slot) | 160 | if (!SDMMC_CLKSEL_GET_DRV_WD3(clksel) && host->slot) |
161 | set_bit(DW_MMC_CARD_NO_USE_HOLD, &host->cur_slot->flags); | 161 | set_bit(DW_MMC_CARD_NO_USE_HOLD, &host->slot->flags); |
162 | } | 162 | } |
163 | 163 | ||
164 | #ifdef CONFIG_PM | 164 | #ifdef CONFIG_PM |
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 8a4fa88a74d2..97a8b0c97341 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c | |||
@@ -392,7 +392,7 @@ static u32 dw_mci_prep_stop_abort(struct dw_mci *host, struct mmc_command *cmd) | |||
392 | cmdr = stop->opcode | SDMMC_CMD_STOP | | 392 | cmdr = stop->opcode | SDMMC_CMD_STOP | |
393 | SDMMC_CMD_RESP_CRC | SDMMC_CMD_RESP_EXP; | 393 | SDMMC_CMD_RESP_CRC | SDMMC_CMD_RESP_EXP; |
394 | 394 | ||
395 | if (!test_bit(DW_MMC_CARD_NO_USE_HOLD, &host->cur_slot->flags)) | 395 | if (!test_bit(DW_MMC_CARD_NO_USE_HOLD, &host->slot->flags)) |
396 | cmdr |= SDMMC_CMD_USE_HOLD_REG; | 396 | cmdr |= SDMMC_CMD_USE_HOLD_REG; |
397 | 397 | ||
398 | return cmdr; | 398 | return cmdr; |
@@ -480,7 +480,7 @@ static void dw_mci_dmac_complete_dma(void *arg) | |||
480 | if ((host->use_dma == TRANS_MODE_EDMAC) && | 480 | if ((host->use_dma == TRANS_MODE_EDMAC) && |
481 | data && (data->flags & MMC_DATA_READ)) | 481 | data && (data->flags & MMC_DATA_READ)) |
482 | /* Invalidate cache after read */ | 482 | /* Invalidate cache after read */ |
483 | dma_sync_sg_for_cpu(mmc_dev(host->cur_slot->mmc), | 483 | dma_sync_sg_for_cpu(mmc_dev(host->slot->mmc), |
484 | data->sg, | 484 | data->sg, |
485 | data->sg_len, | 485 | data->sg_len, |
486 | DMA_FROM_DEVICE); | 486 | DMA_FROM_DEVICE); |
@@ -820,7 +820,7 @@ static int dw_mci_edmac_start_dma(struct dw_mci *host, | |||
820 | 820 | ||
821 | /* Flush cache before write */ | 821 | /* Flush cache before write */ |
822 | if (host->data->flags & MMC_DATA_WRITE) | 822 | if (host->data->flags & MMC_DATA_WRITE) |
823 | dma_sync_sg_for_device(mmc_dev(host->cur_slot->mmc), sgl, | 823 | dma_sync_sg_for_device(mmc_dev(host->slot->mmc), sgl, |
824 | sg_elems, DMA_TO_DEVICE); | 824 | sg_elems, DMA_TO_DEVICE); |
825 | 825 | ||
826 | dma_async_issue_pending(host->dms->ch); | 826 | dma_async_issue_pending(host->dms->ch); |
@@ -1282,7 +1282,6 @@ static void __dw_mci_start_request(struct dw_mci *host, | |||
1282 | 1282 | ||
1283 | mrq = slot->mrq; | 1283 | mrq = slot->mrq; |
1284 | 1284 | ||
1285 | host->cur_slot = slot; | ||
1286 | host->mrq = mrq; | 1285 | host->mrq = mrq; |
1287 | 1286 | ||
1288 | host->pending_events = 0; | 1287 | host->pending_events = 0; |
@@ -1763,7 +1762,7 @@ static bool dw_mci_reset(struct dw_mci *host) | |||
1763 | 1762 | ||
1764 | ciu_out: | 1763 | ciu_out: |
1765 | /* After a CTRL reset we need to have CIU set clock registers */ | 1764 | /* After a CTRL reset we need to have CIU set clock registers */ |
1766 | mci_send_cmd(host->cur_slot, SDMMC_CMD_UPD_CLK, 0); | 1765 | mci_send_cmd(host->slot, SDMMC_CMD_UPD_CLK, 0); |
1767 | 1766 | ||
1768 | return ret; | 1767 | return ret; |
1769 | } | 1768 | } |
@@ -1790,11 +1789,11 @@ static void dw_mci_request_end(struct dw_mci *host, struct mmc_request *mrq) | |||
1790 | __acquires(&host->lock) | 1789 | __acquires(&host->lock) |
1791 | { | 1790 | { |
1792 | struct dw_mci_slot *slot; | 1791 | struct dw_mci_slot *slot; |
1793 | struct mmc_host *prev_mmc = host->cur_slot->mmc; | 1792 | struct mmc_host *prev_mmc = host->slot->mmc; |
1794 | 1793 | ||
1795 | WARN_ON(host->cmd || host->data); | 1794 | WARN_ON(host->cmd || host->data); |
1796 | 1795 | ||
1797 | host->cur_slot->mrq = NULL; | 1796 | host->slot->mrq = NULL; |
1798 | host->mrq = NULL; | 1797 | host->mrq = NULL; |
1799 | if (!list_empty(&host->queue)) { | 1798 | if (!list_empty(&host->queue)) { |
1800 | slot = list_entry(host->queue.next, | 1799 | slot = list_entry(host->queue.next, |
@@ -1944,7 +1943,7 @@ static void dw_mci_tasklet_func(unsigned long priv) | |||
1944 | err = dw_mci_command_complete(host, cmd); | 1943 | err = dw_mci_command_complete(host, cmd); |
1945 | if (cmd == mrq->sbc && !err) { | 1944 | if (cmd == mrq->sbc && !err) { |
1946 | prev_state = state = STATE_SENDING_CMD; | 1945 | prev_state = state = STATE_SENDING_CMD; |
1947 | __dw_mci_start_request(host, host->cur_slot, | 1946 | __dw_mci_start_request(host, host->slot, |
1948 | mrq->cmd); | 1947 | mrq->cmd); |
1949 | goto unlock; | 1948 | goto unlock; |
1950 | } | 1949 | } |
@@ -3261,9 +3260,9 @@ int dw_mci_runtime_suspend(struct device *dev) | |||
3261 | 3260 | ||
3262 | clk_disable_unprepare(host->ciu_clk); | 3261 | clk_disable_unprepare(host->ciu_clk); |
3263 | 3262 | ||
3264 | if (host->cur_slot && | 3263 | if (host->slot && |
3265 | (mmc_can_gpio_cd(host->cur_slot->mmc) || | 3264 | (mmc_can_gpio_cd(host->slot->mmc) || |
3266 | !mmc_card_is_removable(host->cur_slot->mmc))) | 3265 | !mmc_card_is_removable(host->slot->mmc))) |
3267 | clk_disable_unprepare(host->biu_clk); | 3266 | clk_disable_unprepare(host->biu_clk); |
3268 | 3267 | ||
3269 | return 0; | 3268 | return 0; |
@@ -3276,9 +3275,9 @@ int dw_mci_runtime_resume(struct device *dev) | |||
3276 | struct dw_mci *host = dev_get_drvdata(dev); | 3275 | struct dw_mci *host = dev_get_drvdata(dev); |
3277 | struct dw_mci_slot *slot = host->slot; | 3276 | struct dw_mci_slot *slot = host->slot; |
3278 | 3277 | ||
3279 | if (host->cur_slot && | 3278 | if (host->slot && |
3280 | (mmc_can_gpio_cd(host->cur_slot->mmc) || | 3279 | (mmc_can_gpio_cd(host->slot->mmc) || |
3281 | !mmc_card_is_removable(host->cur_slot->mmc))) { | 3280 | !mmc_card_is_removable(host->slot->mmc))) { |
3282 | ret = clk_prepare_enable(host->biu_clk); | 3281 | ret = clk_prepare_enable(host->biu_clk); |
3283 | if (ret) | 3282 | if (ret) |
3284 | return ret; | 3283 | return ret; |
@@ -3326,9 +3325,9 @@ int dw_mci_runtime_resume(struct device *dev) | |||
3326 | return 0; | 3325 | return 0; |
3327 | 3326 | ||
3328 | err: | 3327 | err: |
3329 | if (host->cur_slot && | 3328 | if (host->slot && |
3330 | (mmc_can_gpio_cd(host->cur_slot->mmc) || | 3329 | (mmc_can_gpio_cd(host->slot->mmc) || |
3331 | !mmc_card_is_removable(host->cur_slot->mmc))) | 3330 | !mmc_card_is_removable(host->slot->mmc))) |
3332 | clk_disable_unprepare(host->biu_clk); | 3331 | clk_disable_unprepare(host->biu_clk); |
3333 | 3332 | ||
3334 | return ret; | 3333 | return ret; |
diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h index 1ec8f4092fab..75da3756955d 100644 --- a/drivers/mmc/host/dw_mmc.h +++ b/drivers/mmc/host/dw_mmc.h | |||
@@ -132,7 +132,6 @@ struct dw_mci_dma_slave { | |||
132 | * ======= | 132 | * ======= |
133 | * | 133 | * |
134 | * @lock is a softirq-safe spinlock protecting @queue as well as | 134 | * @lock is a softirq-safe spinlock protecting @queue as well as |
135 | * @cur_slot, @mrq and @state. These must always be updated | ||
136 | * at the same time while holding @lock. | 135 | * at the same time while holding @lock. |
137 | * | 136 | * |
138 | * @irq_lock is an irq-safe spinlock protecting the INTMASK register | 137 | * @irq_lock is an irq-safe spinlock protecting the INTMASK register |
@@ -168,7 +167,6 @@ struct dw_mci { | |||
168 | struct scatterlist *sg; | 167 | struct scatterlist *sg; |
169 | struct sg_mapping_iter sg_miter; | 168 | struct sg_mapping_iter sg_miter; |
170 | 169 | ||
171 | struct dw_mci_slot *cur_slot; | ||
172 | struct mmc_request *mrq; | 170 | struct mmc_request *mrq; |
173 | struct mmc_command *cmd; | 171 | struct mmc_command *cmd; |
174 | struct mmc_data *data; | 172 | struct mmc_data *data; |
@@ -204,7 +202,6 @@ struct dw_mci { | |||
204 | 202 | ||
205 | u32 bus_hz; | 203 | u32 bus_hz; |
206 | u32 current_speed; | 204 | u32 current_speed; |
207 | u32 num_slots; | ||
208 | u32 fifoth_val; | 205 | u32 fifoth_val; |
209 | u16 verid; | 206 | u16 verid; |
210 | struct device *dev; | 207 | struct device *dev; |