aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core/queue.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-11-13 13:17:35 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-11-13 13:17:35 -0500
commitdee02770cdcd8bc06a48c917ce5df2fb56cf6059 (patch)
treec79799cc851a224a02c007ff5122e12992bde7ab /drivers/mmc/core/queue.c
parente4a8ca3baa5557fa54557d42b5910ed0d3316922 (diff)
parent06641e8deae68ee2769c734158bc9170be257bb9 (diff)
Merge tag 'mmc-v4.15' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc
Pull MMC updates from Ulf Hansson: "MMC core: - Introduce host claiming by context to support blkmq - Preparations for enabling CQE (eMMC CMDQ) requests - Re-factorizations to prepare for blkmq support - Re-factorizations to prepare for CQE support - Fix signal voltage switch for SD cards without power cycle - Convert RPMB to a character device - Export eMMC revision via sysfs - Support eMMC DT binding for fixed driver type - Document mmc_regulator_get_supply() API MMC host: - omap_hsmmc: Updated regulator management for PBIAS - sdhci-omap: Add new OMAP SDHCI driver - meson-mx-sdio: New driver for the Amlogic Meson8 and Meson8b SoCs - sdhci-pci: Add support for Intel CDF - sdhci-acpi: Fix voltage switch for some Intel host controllers - sdhci-msm: Enable delay circuit calibration clocks - sdhci-msm: Manage power IRQ properly - mediatek: Add support of mt2701/mt2712 - mediatek: Updates management of clocks and tunings - mediatek: Upgrade eMMC HS400 support - rtsx_pci: Update tuning for gen3 PCI-Express - renesas_sdhi: Support R-Car Gen[123] fallback compatibility strings - Catch all errors when getting regulators - Various additional improvements and cleanups" * tag 'mmc-v4.15' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: (91 commits) sdhci-fujitsu: add support for setting the CMD_DAT_DELAY attribute dt-bindings: sdhci-fujitsu: document cmd-dat-delay property mmc: tmio: Replace msleep() of 20ms or less with usleep_range() mmc: dw_mmc: Convert timers to use timer_setup() mmc: dw_mmc: Cleanup the DTO timer like the CTO one mmc: vub300: Use common code in __download_offload_pseudocode() mmc: tmio: Use common error handling code in tmio_mmc_host_probe() mmc: Convert timers to use timer_setup() mmc: sdhci-acpi: Fix voltage switch for some Intel host controllers mmc: sdhci-acpi: Let devices define their own private data mmc: mediatek: perfer to use rise edge latching for cmd line mmc: mediatek: improve eMMC hs400 mode read performance mmc: mediatek: add latch-ck support mmc: mediatek: add support of source_cg clock mmc: mediatek: add stop_clk fix and enhance_rx support mmc: mediatek: add busy_check support mmc: mediatek: add async fifo and data tune support mmc: mediatek: add pad_tune0 support mmc: mediatek: make hs400_tune_response only for mt8173 arm64: dts: mt8173: remove "mediatek, mt8135-mmc" from mmc nodes ...
Diffstat (limited to 'drivers/mmc/core/queue.c')
-rw-r--r--drivers/mmc/core/queue.c41
1 files changed, 25 insertions, 16 deletions
diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c
index 0a4e77a5ba33..4f33d277b125 100644
--- a/drivers/mmc/core/queue.c
+++ b/drivers/mmc/core/queue.c
@@ -30,7 +30,7 @@ static int mmc_prep_request(struct request_queue *q, struct request *req)
30{ 30{
31 struct mmc_queue *mq = q->queuedata; 31 struct mmc_queue *mq = q->queuedata;
32 32
33 if (mq && (mmc_card_removed(mq->card) || mmc_access_rpmb(mq))) 33 if (mq && mmc_card_removed(mq->card))
34 return BLKPREP_KILL; 34 return BLKPREP_KILL;
35 35
36 req->rq_flags |= RQF_DONTPREP; 36 req->rq_flags |= RQF_DONTPREP;
@@ -177,6 +177,29 @@ static void mmc_exit_request(struct request_queue *q, struct request *req)
177 mq_rq->sg = NULL; 177 mq_rq->sg = NULL;
178} 178}
179 179
180static void mmc_setup_queue(struct mmc_queue *mq, struct mmc_card *card)
181{
182 struct mmc_host *host = card->host;
183 u64 limit = BLK_BOUNCE_HIGH;
184
185 if (mmc_dev(host)->dma_mask && *mmc_dev(host)->dma_mask)
186 limit = (u64)dma_max_pfn(mmc_dev(host)) << PAGE_SHIFT;
187
188 queue_flag_set_unlocked(QUEUE_FLAG_NONROT, mq->queue);
189 queue_flag_clear_unlocked(QUEUE_FLAG_ADD_RANDOM, mq->queue);
190 if (mmc_can_erase(card))
191 mmc_queue_setup_discard(mq->queue, card);
192
193 blk_queue_bounce_limit(mq->queue, limit);
194 blk_queue_max_hw_sectors(mq->queue,
195 min(host->max_blk_count, host->max_req_size / 512));
196 blk_queue_max_segments(mq->queue, host->max_segs);
197 blk_queue_max_segment_size(mq->queue, host->max_seg_size);
198
199 /* Initialize thread_sem even if it is not used */
200 sema_init(&mq->thread_sem, 1);
201}
202
180/** 203/**
181 * mmc_init_queue - initialise a queue structure. 204 * mmc_init_queue - initialise a queue structure.
182 * @mq: mmc queue 205 * @mq: mmc queue
@@ -190,12 +213,8 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card,
190 spinlock_t *lock, const char *subname) 213 spinlock_t *lock, const char *subname)
191{ 214{
192 struct mmc_host *host = card->host; 215 struct mmc_host *host = card->host;
193 u64 limit = BLK_BOUNCE_HIGH;
194 int ret = -ENOMEM; 216 int ret = -ENOMEM;
195 217
196 if (mmc_dev(host)->dma_mask && *mmc_dev(host)->dma_mask)
197 limit = (u64)dma_max_pfn(mmc_dev(host)) << PAGE_SHIFT;
198
199 mq->card = card; 218 mq->card = card;
200 mq->queue = blk_alloc_queue(GFP_KERNEL); 219 mq->queue = blk_alloc_queue(GFP_KERNEL);
201 if (!mq->queue) 220 if (!mq->queue)
@@ -214,18 +233,8 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card,
214 } 233 }
215 234
216 blk_queue_prep_rq(mq->queue, mmc_prep_request); 235 blk_queue_prep_rq(mq->queue, mmc_prep_request);
217 queue_flag_set_unlocked(QUEUE_FLAG_NONROT, mq->queue);
218 queue_flag_clear_unlocked(QUEUE_FLAG_ADD_RANDOM, mq->queue);
219 if (mmc_can_erase(card))
220 mmc_queue_setup_discard(mq->queue, card);
221 236
222 blk_queue_bounce_limit(mq->queue, limit); 237 mmc_setup_queue(mq, card);
223 blk_queue_max_hw_sectors(mq->queue,
224 min(host->max_blk_count, host->max_req_size / 512));
225 blk_queue_max_segments(mq->queue, host->max_segs);
226 blk_queue_max_segment_size(mq->queue, host->max_seg_size);
227
228 sema_init(&mq->thread_sem, 1);
229 238
230 mq->thread = kthread_run(mmc_queue_thread, mq, "mmcqd/%d%s", 239 mq->thread = kthread_run(mmc_queue_thread, mq, "mmcqd/%d%s",
231 host->index, subname ? subname : ""); 240 host->index, subname ? subname : "");