Commit a7d15860 authored by Russell King's avatar Russell King

[MMC] Add host specific block queue parameters

Allow MMC host drivers to specify their data phase capabilities
to the block queue.  This will eventually allow us to perform
SG data phase operations, thereby processing a single request
in one go.
parent 35c26f4f
/*
* linux/drivers/mmc/mmc.c
*
* Copyright (C) 2003 Russell King, All Rights Reserved.
* Copyright (C) 2003-2004 Russell King, All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
......@@ -14,6 +14,7 @@
#include <linux/completion.h>
#include <linux/device.h>
#include <linux/delay.h>
#include <linux/pagemap.h>
#include <linux/err.h>
#include <linux/mmc/card.h>
......@@ -721,6 +722,15 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev)
INIT_WORK(&host->detect, mmc_rescan, host);
host->dev = dev;
/*
* By default, hosts do not support SGIO or large requests.
* They have to set these according to their abilities.
*/
host->max_hw_segs = 1;
host->max_phys_segs = 1;
host->max_sectors = 1 << (PAGE_CACHE_SHIFT - 9);
host->max_seg_size = PAGE_CACHE_SIZE;
}
return host;
......
......@@ -43,7 +43,6 @@
#define MMC_SHIFT 3
static int mmc_major;
static int maxsectors = 8;
/*
* There is one mmc_blk_data per slot.
......@@ -336,7 +335,6 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card)
md->block_bits = card->csd.read_blkbits;
blk_queue_max_sectors(md->queue.queue, maxsectors);
blk_queue_hardsect_size(md->queue.queue, 1 << md->block_bits);
set_capacity(md->disk, card->csd.capacity);
}
......@@ -489,9 +487,6 @@ static void __exit mmc_blk_exit(void)
module_init(mmc_blk_init);
module_exit(mmc_blk_exit);
module_param(maxsectors, int, 0444);
MODULE_PARM_DESC(maxsectors, "Maximum number of sectors for a single request");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Multimedia Card (MMC) block device driver");
......@@ -124,11 +124,12 @@ static void mmc_request(request_queue_t *q)
*/
int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock)
{
struct mmc_host *host = card->host;
u64 limit = BLK_BOUNCE_HIGH;
int ret;
if (card->host->dev->dma_mask && *card->host->dev->dma_mask)
limit = *card->host->dev->dma_mask;
if (host->dev->dma_mask && *host->dev->dma_mask)
limit = *host->dev->dma_mask;
mq->card = card;
mq->queue = blk_init_queue(mmc_request, lock);
......@@ -137,6 +138,10 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock
blk_queue_prep_rq(mq->queue, mmc_prep_request);
blk_queue_bounce_limit(mq->queue, limit);
blk_queue_max_sectors(mq->queue, host->max_sectors);
blk_queue_max_phys_segments(mq->queue, host->max_phys_segs);
blk_queue_max_hw_segments(mq->queue, host->max_hw_segs);
blk_queue_max_segment_size(mq->queue, host->max_seg_size);
mq->queue->queuedata = mq;
mq->req = NULL;
......
......@@ -69,6 +69,13 @@ struct mmc_host {
u32 ocr_avail;
char host_name[8];
/* host specific block data */
unsigned int max_seg_size; /* see blk_queue_max_segment_size */
unsigned short max_hw_segs; /* see blk_queue_max_hw_segments */
unsigned short max_phys_segs; /* see blk_queue_max_phys_segments */
unsigned short max_sectors; /* see blk_queue_max_sectors */
unsigned short unused;
/* private data */
struct mmc_ios ios; /* current io bus settings */
u32 ocr; /* the current OCR setting */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment