aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/core/queue.c12
-rw-r--r--drivers/mmc/core/queue.h1
-rw-r--r--drivers/mmc/host/android-goldfish.c4
-rw-r--r--drivers/mmc/host/atmel-mci.c12
-rw-r--r--drivers/mmc/host/renesas_sdhi_internal_dmac.c10
5 files changed, 25 insertions, 14 deletions
diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c
index 648eb6743ed5..6edffeed9953 100644
--- a/drivers/mmc/core/queue.c
+++ b/drivers/mmc/core/queue.c
@@ -238,10 +238,6 @@ static void mmc_mq_exit_request(struct blk_mq_tag_set *set, struct request *req,
238 mmc_exit_request(mq->queue, req); 238 mmc_exit_request(mq->queue, req);
239} 239}
240 240
241/*
242 * We use BLK_MQ_F_BLOCKING and have only 1 hardware queue, which means requests
243 * will not be dispatched in parallel.
244 */
245static blk_status_t mmc_mq_queue_rq(struct blk_mq_hw_ctx *hctx, 241static blk_status_t mmc_mq_queue_rq(struct blk_mq_hw_ctx *hctx,
246 const struct blk_mq_queue_data *bd) 242 const struct blk_mq_queue_data *bd)
247{ 243{
@@ -264,7 +260,7 @@ static blk_status_t mmc_mq_queue_rq(struct blk_mq_hw_ctx *hctx,
264 260
265 spin_lock_irq(q->queue_lock); 261 spin_lock_irq(q->queue_lock);
266 262
267 if (mq->recovery_needed) { 263 if (mq->recovery_needed || mq->busy) {
268 spin_unlock_irq(q->queue_lock); 264 spin_unlock_irq(q->queue_lock);
269 return BLK_STS_RESOURCE; 265 return BLK_STS_RESOURCE;
270 } 266 }
@@ -291,6 +287,9 @@ static blk_status_t mmc_mq_queue_rq(struct blk_mq_hw_ctx *hctx,
291 break; 287 break;
292 } 288 }
293 289
290 /* Parallel dispatch of requests is not supported at the moment */
291 mq->busy = true;
292
294 mq->in_flight[issue_type] += 1; 293 mq->in_flight[issue_type] += 1;
295 get_card = (mmc_tot_in_flight(mq) == 1); 294 get_card = (mmc_tot_in_flight(mq) == 1);
296 cqe_retune_ok = (mmc_cqe_qcnt(mq) == 1); 295 cqe_retune_ok = (mmc_cqe_qcnt(mq) == 1);
@@ -333,9 +332,12 @@ static blk_status_t mmc_mq_queue_rq(struct blk_mq_hw_ctx *hctx,
333 mq->in_flight[issue_type] -= 1; 332 mq->in_flight[issue_type] -= 1;
334 if (mmc_tot_in_flight(mq) == 0) 333 if (mmc_tot_in_flight(mq) == 0)
335 put_card = true; 334 put_card = true;
335 mq->busy = false;
336 spin_unlock_irq(q->queue_lock); 336 spin_unlock_irq(q->queue_lock);
337 if (put_card) 337 if (put_card)
338 mmc_put_card(card, &mq->ctx); 338 mmc_put_card(card, &mq->ctx);
339 } else {
340 WRITE_ONCE(mq->busy, false);
339 } 341 }
340 342
341 return ret; 343 return ret;
diff --git a/drivers/mmc/core/queue.h b/drivers/mmc/core/queue.h
index 17e59d50b496..9bf3c9245075 100644
--- a/drivers/mmc/core/queue.h
+++ b/drivers/mmc/core/queue.h
@@ -81,6 +81,7 @@ struct mmc_queue {
81 unsigned int cqe_busy; 81 unsigned int cqe_busy;
82#define MMC_CQE_DCMD_BUSY BIT(0) 82#define MMC_CQE_DCMD_BUSY BIT(0)
83#define MMC_CQE_QUEUE_FULL BIT(1) 83#define MMC_CQE_QUEUE_FULL BIT(1)
84 bool busy;
84 bool use_cqe; 85 bool use_cqe;
85 bool recovery_needed; 86 bool recovery_needed;
86 bool in_recovery; 87 bool in_recovery;
diff --git a/drivers/mmc/host/android-goldfish.c b/drivers/mmc/host/android-goldfish.c
index 294de177632c..61e4e2a213c9 100644
--- a/drivers/mmc/host/android-goldfish.c
+++ b/drivers/mmc/host/android-goldfish.c
@@ -217,7 +217,7 @@ static void goldfish_mmc_xfer_done(struct goldfish_mmc_host *host,
217 * We don't really have DMA, so we need 217 * We don't really have DMA, so we need
218 * to copy from our platform driver buffer 218 * to copy from our platform driver buffer
219 */ 219 */
220 sg_copy_to_buffer(data->sg, 1, host->virt_base, 220 sg_copy_from_buffer(data->sg, 1, host->virt_base,
221 data->sg->length); 221 data->sg->length);
222 } 222 }
223 host->data->bytes_xfered += data->sg->length; 223 host->data->bytes_xfered += data->sg->length;
@@ -393,7 +393,7 @@ static void goldfish_mmc_prepare_data(struct goldfish_mmc_host *host,
393 * We don't really have DMA, so we need to copy to our 393 * We don't really have DMA, so we need to copy to our
394 * platform driver buffer 394 * platform driver buffer
395 */ 395 */
396 sg_copy_from_buffer(data->sg, 1, host->virt_base, 396 sg_copy_to_buffer(data->sg, 1, host->virt_base,
397 data->sg->length); 397 data->sg->length);
398 } 398 }
399} 399}
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index 5aa2c9404e92..be53044086c7 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -1976,7 +1976,7 @@ static void atmci_read_data_pio(struct atmel_mci *host)
1976 do { 1976 do {
1977 value = atmci_readl(host, ATMCI_RDR); 1977 value = atmci_readl(host, ATMCI_RDR);
1978 if (likely(offset + 4 <= sg->length)) { 1978 if (likely(offset + 4 <= sg->length)) {
1979 sg_pcopy_to_buffer(sg, 1, &value, sizeof(u32), offset); 1979 sg_pcopy_from_buffer(sg, 1, &value, sizeof(u32), offset);
1980 1980
1981 offset += 4; 1981 offset += 4;
1982 nbytes += 4; 1982 nbytes += 4;
@@ -1993,7 +1993,7 @@ static void atmci_read_data_pio(struct atmel_mci *host)
1993 } else { 1993 } else {
1994 unsigned int remaining = sg->length - offset; 1994 unsigned int remaining = sg->length - offset;
1995 1995
1996 sg_pcopy_to_buffer(sg, 1, &value, remaining, offset); 1996 sg_pcopy_from_buffer(sg, 1, &value, remaining, offset);
1997 nbytes += remaining; 1997 nbytes += remaining;
1998 1998
1999 flush_dcache_page(sg_page(sg)); 1999 flush_dcache_page(sg_page(sg));
@@ -2003,7 +2003,7 @@ static void atmci_read_data_pio(struct atmel_mci *host)
2003 goto done; 2003 goto done;
2004 2004
2005 offset = 4 - remaining; 2005 offset = 4 - remaining;
2006 sg_pcopy_to_buffer(sg, 1, (u8 *)&value + remaining, 2006 sg_pcopy_from_buffer(sg, 1, (u8 *)&value + remaining,
2007 offset, 0); 2007 offset, 0);
2008 nbytes += offset; 2008 nbytes += offset;
2009 } 2009 }
@@ -2042,7 +2042,7 @@ static void atmci_write_data_pio(struct atmel_mci *host)
2042 2042
2043 do { 2043 do {
2044 if (likely(offset + 4 <= sg->length)) { 2044 if (likely(offset + 4 <= sg->length)) {
2045 sg_pcopy_from_buffer(sg, 1, &value, sizeof(u32), offset); 2045 sg_pcopy_to_buffer(sg, 1, &value, sizeof(u32), offset);
2046 atmci_writel(host, ATMCI_TDR, value); 2046 atmci_writel(host, ATMCI_TDR, value);
2047 2047
2048 offset += 4; 2048 offset += 4;
@@ -2059,7 +2059,7 @@ static void atmci_write_data_pio(struct atmel_mci *host)
2059 unsigned int remaining = sg->length - offset; 2059 unsigned int remaining = sg->length - offset;
2060 2060
2061 value = 0; 2061 value = 0;
2062 sg_pcopy_from_buffer(sg, 1, &value, remaining, offset); 2062 sg_pcopy_to_buffer(sg, 1, &value, remaining, offset);
2063 nbytes += remaining; 2063 nbytes += remaining;
2064 2064
2065 host->sg = sg = sg_next(sg); 2065 host->sg = sg = sg_next(sg);
@@ -2070,7 +2070,7 @@ static void atmci_write_data_pio(struct atmel_mci *host)
2070 } 2070 }
2071 2071
2072 offset = 4 - remaining; 2072 offset = 4 - remaining;
2073 sg_pcopy_from_buffer(sg, 1, (u8 *)&value + remaining, 2073 sg_pcopy_to_buffer(sg, 1, (u8 *)&value + remaining,
2074 offset, 0); 2074 offset, 0);
2075 atmci_writel(host, ATMCI_TDR, value); 2075 atmci_writel(host, ATMCI_TDR, value);
2076 nbytes += offset; 2076 nbytes += offset;
diff --git a/drivers/mmc/host/renesas_sdhi_internal_dmac.c b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
index 35cc0de6be67..ca0b43973769 100644
--- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c
+++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
@@ -45,14 +45,16 @@
45/* DM_CM_RST */ 45/* DM_CM_RST */
46#define RST_DTRANRST1 BIT(9) 46#define RST_DTRANRST1 BIT(9)
47#define RST_DTRANRST0 BIT(8) 47#define RST_DTRANRST0 BIT(8)
48#define RST_RESERVED_BITS GENMASK_ULL(32, 0) 48#define RST_RESERVED_BITS GENMASK_ULL(31, 0)
49 49
50/* DM_CM_INFO1 and DM_CM_INFO1_MASK */ 50/* DM_CM_INFO1 and DM_CM_INFO1_MASK */
51#define INFO1_CLEAR 0 51#define INFO1_CLEAR 0
52#define INFO1_MASK_CLEAR GENMASK_ULL(31, 0)
52#define INFO1_DTRANEND1 BIT(17) 53#define INFO1_DTRANEND1 BIT(17)
53#define INFO1_DTRANEND0 BIT(16) 54#define INFO1_DTRANEND0 BIT(16)
54 55
55/* DM_CM_INFO2 and DM_CM_INFO2_MASK */ 56/* DM_CM_INFO2 and DM_CM_INFO2_MASK */
57#define INFO2_MASK_CLEAR GENMASK_ULL(31, 0)
56#define INFO2_DTRANERR1 BIT(17) 58#define INFO2_DTRANERR1 BIT(17)
57#define INFO2_DTRANERR0 BIT(16) 59#define INFO2_DTRANERR0 BIT(16)
58 60
@@ -252,6 +254,12 @@ renesas_sdhi_internal_dmac_request_dma(struct tmio_mmc_host *host,
252{ 254{
253 struct renesas_sdhi *priv = host_to_priv(host); 255 struct renesas_sdhi *priv = host_to_priv(host);
254 256
257 /* Disable DMAC interrupts, we don't use them */
258 renesas_sdhi_internal_dmac_dm_write(host, DM_CM_INFO1_MASK,
259 INFO1_MASK_CLEAR);
260 renesas_sdhi_internal_dmac_dm_write(host, DM_CM_INFO2_MASK,
261 INFO2_MASK_CLEAR);
262
255 /* Each value is set to non-zero to assume "enabling" each DMA */ 263 /* Each value is set to non-zero to assume "enabling" each DMA */
256 host->chan_rx = host->chan_tx = (void *)0xdeadbeaf; 264 host->chan_rx = host->chan_tx = (void *)0xdeadbeaf;
257 265