Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 46209
b: refs/heads/master
c: 55db890
h: refs/heads/master
i:
  46207: f8b0fbc
v: v3
  • Loading branch information
Pierre Ossman committed Feb 4, 2007
1 parent a07e22a commit 4f65474
Show file tree
Hide file tree
Showing 14 changed files with 56 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fe4a3c7a20f14d86022a8132adbf6ddb98e7197c
refs/heads/master: 55db890a838c7b37256241b1fc53d6344aa79cc0
1 change: 1 addition & 0 deletions trunk/drivers/mmc/at91_mci.c
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,7 @@ static int __init at91_mci_probe(struct platform_device *pdev)
mmc->caps = MMC_CAP_BYTEBLOCK;

mmc->max_blk_size = 4095;
mmc->max_blk_count = mmc->max_req_size;

host = mmc_priv(mmc);
host->mmc = mmc;
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/mmc/au1xmmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,7 @@ static int __devinit au1xmmc_probe(struct platform_device *pdev)
mmc->max_phys_segs = AU1XMMC_DESCRIPTOR_COUNT;

mmc->max_blk_size = 2048;
mmc->max_blk_count = 512;

mmc->ocr_avail = AU1XMMC_OCR;

Expand Down
3 changes: 2 additions & 1 deletion trunk/drivers/mmc/imxmmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -958,9 +958,10 @@ static int imxmci_probe(struct platform_device *pdev)
/* MMC core transfer sizes tunable parameters */
mmc->max_hw_segs = 64;
mmc->max_phys_segs = 64;
mmc->max_sectors = 64; /* default 1 << (PAGE_CACHE_SHIFT - 9) */
mmc->max_seg_size = 64*512; /* default PAGE_CACHE_SIZE */
mmc->max_req_size = 64*512; /* default PAGE_CACHE_SIZE */
mmc->max_blk_size = 2048;
mmc->max_blk_count = 65535;

host = mmc_priv(mmc);
host->mmc = mmc;
Expand Down
6 changes: 5 additions & 1 deletion trunk/drivers/mmc/mmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
mrq->cmd->mrq = mrq;
if (mrq->data) {
BUG_ON(mrq->data->blksz > host->max_blk_size);
BUG_ON(mrq->data->blocks > host->max_blk_count);
BUG_ON(mrq->data->blocks * mrq->data->blksz >
host->max_req_size);

mrq->cmd->data = mrq->data;
mrq->data->error = 0;
Expand Down Expand Up @@ -1605,10 +1608,11 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev)
*/
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;

host->max_req_size = PAGE_CACHE_SIZE;
host->max_blk_size = 512;
host->max_blk_count = PAGE_CACHE_SIZE / 512;
}

return host;
Expand Down
4 changes: 3 additions & 1 deletion trunk/drivers/mmc/mmc_block.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,12 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
brq.cmd.arg <<= 9;
brq.cmd.flags = MMC_RSP_R1 | MMC_CMD_ADTC;
brq.data.blksz = 1 << md->block_bits;
brq.data.blocks = req->nr_sectors >> (md->block_bits - 9);
brq.stop.opcode = MMC_STOP_TRANSMISSION;
brq.stop.arg = 0;
brq.stop.flags = MMC_RSP_R1B | MMC_CMD_AC;
brq.data.blocks = req->nr_sectors >> (md->block_bits - 9);
if (brq.data.blocks > card->host->max_blk_count)
brq.data.blocks = card->host->max_blk_count;

mmc_set_data_timeout(&brq.data, card, rq_data_dir(req) != READ);

Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/mmc/mmc_queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ 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_sectors(mq->queue, host->max_req_size / 512);
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);
Expand Down
10 changes: 7 additions & 3 deletions trunk/drivers/mmc/mmci.c
Original file line number Diff line number Diff line change
Expand Up @@ -524,21 +524,25 @@ static int mmci_probe(struct amba_device *dev, void *id)
/*
* Since we only have a 16-bit data length register, we must
* ensure that we don't exceed 2^16-1 bytes in a single request.
* Choose 64 (512-byte) sectors as the limit.
*/
mmc->max_sectors = 64;
mmc->max_req_size = 65535;

/*
* Set the maximum segment size. Since we aren't doing DMA
* (yet) we are only limited by the data length register.
*/
mmc->max_seg_size = mmc->max_sectors << 9;
mmc->max_seg_size = mmc->max_req_size;

/*
* Block size can be up to 2048 bytes, but must be a power of two.
*/
mmc->max_blk_size = 2048;

/*
* No limit on the number of blocks transferred.
*/
mmc->max_blk_count = mmc->max_req_size;

spin_lock_init(&host->lock);

writel(0, host->base + MMCIMASK0);
Expand Down
5 changes: 3 additions & 2 deletions trunk/drivers/mmc/omap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1100,8 +1100,9 @@ static int __init mmc_omap_probe(struct platform_device *pdev)
mmc->max_phys_segs = 32;
mmc->max_hw_segs = 32;
mmc->max_blk_size = 2048; /* BLEN is 11 bits (+1) */
mmc->max_sectors = 256; /* NBLK max 11-bits, OMAP also limited by DMA */
mmc->max_seg_size = mmc->max_sectors * 512;
mmc->max_blk_count = 2048; /* NBLK is 11 bits (+1) */
mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count;
mmc->max_seg_size = mmc->max_req_size;

if (host->power_pin >= 0) {
if ((ret = omap_request_gpio(host->power_pin)) != 0) {
Expand Down
5 changes: 5 additions & 0 deletions trunk/drivers/mmc/pxamci.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,11 @@ static int pxamci_probe(struct platform_device *pdev)
*/
mmc->max_blk_size = 1023;

/*
* Block count register is 16 bits.
*/
mmc->max_blk_count = 65535;

host = mmc_priv(mmc);
host->mmc = mmc;
host->dma = -1;
Expand Down
13 changes: 9 additions & 4 deletions trunk/drivers/mmc/sdhci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1333,15 +1333,15 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot)

/*
* Maximum number of sectors in one transfer. Limited by DMA boundary
* size (512KiB), which means (512 KiB/512=) 1024 entries.
* size (512KiB).
*/
mmc->max_sectors = 1024;
mmc->max_req_size = 524288;

/*
* Maximum segment size. Could be one segment with the maximum number
* of sectors.
* of bytes.
*/
mmc->max_seg_size = mmc->max_sectors * 512;
mmc->max_seg_size = mmc->max_req_size;

/*
* Maximum block size. This varies from controller to controller and
Expand All @@ -1356,6 +1356,11 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot)
}
mmc->max_blk_size = 512 << mmc->max_blk_size;

/*
* Maximum block count.
*/
mmc->max_blk_count = 65535;

/*
* Init tasklets.
*/
Expand Down
9 changes: 6 additions & 3 deletions trunk/drivers/mmc/tifm_sd.c
Original file line number Diff line number Diff line change
Expand Up @@ -885,10 +885,13 @@ static int tifm_sd_probe(struct tifm_dev *sock)
mmc->f_max = 24000000;
mmc->max_hw_segs = 1;
mmc->max_phys_segs = 1;
mmc->max_sectors = 127;
//2k maximum hw block length
mmc->max_seg_size = mmc->max_sectors << 11;
// limited by DMA counter - it's safer to stick with
// block counter has 11 bits though
mmc->max_blk_count = 256;
// 2k maximum hw block length
mmc->max_blk_size = 2048;
mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count;
mmc->max_seg_size = mmc->max_req_size;
sock->signal_irq = tifm_sd_signal_irq;
rc = tifm_sd_initialize_host(host);

Expand Down
15 changes: 10 additions & 5 deletions trunk/drivers/mmc/wbsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1343,23 +1343,28 @@ static int __devinit wbsd_alloc_mmc(struct device *dev)
mmc->max_phys_segs = 128;

/*
* Maximum number of sectors in one transfer. Also limited by 64kB
* buffer.
* Maximum request size. Also limited by 64KiB buffer.
*/
mmc->max_sectors = 128;
mmc->max_req_size = 65536;

/*
* Maximum segment size. Could be one segment with the maximum number
* of segments.
* of bytes.
*/
mmc->max_seg_size = mmc->max_sectors * 512;
mmc->max_seg_size = mmc->max_req_size;

/*
* Maximum block size. We have 12 bits (= 4095) but have to subtract
* space for CRC. So the maximum is 4095 - 4*2 = 4087.
*/
mmc->max_blk_size = 4087;

/*
* Maximum block count. There is no real limit so the maximum
* request size will be the only restriction.
*/
mmc->max_blk_count = mmc->max_req_size;

dev_set_drvdata(dev, mmc);

return 0;
Expand Down
3 changes: 2 additions & 1 deletion trunk/include/linux/mmc/host.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,10 @@ struct mmc_host {
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;
unsigned int max_req_size; /* maximum number of bytes in one req */
unsigned int max_blk_size; /* maximum size of one mmc block */
unsigned int max_blk_count; /* maximum number of blocks in one req */

/* private data */
struct mmc_ios ios; /* current io bus settings */
Expand Down

0 comments on commit 4f65474

Please sign in to comment.