Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 46208
b: refs/heads/master
c: fe4a3c7
h: refs/heads/master
v: v3
  • Loading branch information
Pierre Ossman committed Feb 4, 2007
1 parent f8b0fbc commit a07e22a
Show file tree
Hide file tree
Showing 13 changed files with 45 additions and 13 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: dba4accab17bd2e2e09088f746257a8c14af1cc2
refs/heads/master: fe4a3c7a20f14d86022a8132adbf6ddb98e7197c
2 changes: 2 additions & 0 deletions trunk/drivers/mmc/at91_mci.c
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,8 @@ static int __init at91_mci_probe(struct platform_device *pdev)
mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
mmc->caps = MMC_CAP_BYTEBLOCK;

mmc->max_blk_size = 4095;

host = mmc_priv(mmc);
host->mmc = mmc;
host->buffer = NULL;
Expand Down
2 changes: 2 additions & 0 deletions trunk/drivers/mmc/au1xmmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,8 @@ static int __devinit au1xmmc_probe(struct platform_device *pdev)
mmc->max_seg_size = AU1XMMC_DESCRIPTOR_SIZE;
mmc->max_phys_segs = AU1XMMC_DESCRIPTOR_COUNT;

mmc->max_blk_size = 2048;

mmc->ocr_avail = AU1XMMC_OCR;

host = mmc_priv(mmc);
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/mmc/imxmmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,7 @@ static int imxmci_probe(struct platform_device *pdev)
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_blk_size = 2048;

host = mmc_priv(mmc);
host->mmc = mmc;
Expand Down
4 changes: 4 additions & 0 deletions trunk/drivers/mmc/mmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
mrq->cmd->error = 0;
mrq->cmd->mrq = mrq;
if (mrq->data) {
BUG_ON(mrq->data->blksz > host->max_blk_size);

mrq->cmd->data = mrq->data;
mrq->data->error = 0;
mrq->data->mrq = mrq;
Expand Down Expand Up @@ -1605,6 +1607,8 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev)
host->max_phys_segs = 1;
host->max_sectors = 1 << (PAGE_CACHE_SHIFT - 9);
host->max_seg_size = PAGE_CACHE_SIZE;

host->max_blk_size = 512;
}

return host;
Expand Down
5 changes: 5 additions & 0 deletions trunk/drivers/mmc/mmci.c
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,11 @@ static int mmci_probe(struct amba_device *dev, void *id)
*/
mmc->max_seg_size = mmc->max_sectors << 9;

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

spin_lock_init(&host->lock);

writel(0, host->base + MMCIMASK0);
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/mmc/omap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1099,6 +1099,7 @@ 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;

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 @@ -450,6 +450,11 @@ static int pxamci_probe(struct platform_device *pdev)
*/
mmc->max_seg_size = PAGE_SIZE;

/*
* Block length register is 10 bits.
*/
mmc->max_blk_size = 1023;

host = mmc_priv(mmc);
host->mmc = mmc;
host->dma = -1;
Expand Down
24 changes: 14 additions & 10 deletions trunk/drivers/mmc/sdhci.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_data *data)

/* Sanity checks */
BUG_ON(data->blksz * data->blocks > 524288);
BUG_ON(data->blksz > host->max_block);
BUG_ON(data->blksz > host->mmc->max_blk_size);
BUG_ON(data->blocks > 65535);

/* timeout in us */
Expand Down Expand Up @@ -1290,15 +1290,6 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot)
if (caps & SDHCI_TIMEOUT_CLK_UNIT)
host->timeout_clk *= 1000;

host->max_block = (caps & SDHCI_MAX_BLOCK_MASK) >> SDHCI_MAX_BLOCK_SHIFT;
if (host->max_block >= 3) {
printk(KERN_ERR "%s: Invalid maximum block size.\n",
host->slot_descr);
ret = -ENODEV;
goto unmap;
}
host->max_block = 512 << host->max_block;

/*
* Set host parameters.
*/
Expand Down Expand Up @@ -1352,6 +1343,19 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot)
*/
mmc->max_seg_size = mmc->max_sectors * 512;

/*
* Maximum block size. This varies from controller to controller and
* is specified in the capabilities register.
*/
mmc->max_blk_size = (caps & SDHCI_MAX_BLOCK_MASK) >> SDHCI_MAX_BLOCK_SHIFT;
if (mmc->max_blk_size >= 3) {
printk(KERN_ERR "%s: Invalid maximum block size.\n",
host->slot_descr);
ret = -ENODEV;
goto unmap;
}
mmc->max_blk_size = 512 << mmc->max_blk_size;

/*
* Init tasklets.
*/
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/mmc/sdhci.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ struct sdhci_host {

unsigned int max_clk; /* Max possible freq (MHz) */
unsigned int timeout_clk; /* Timeout freq (KHz) */
unsigned int max_block; /* Max block size (bytes) */

unsigned int clock; /* Current clock (MHz) */
unsigned short power; /* Current voltage */
Expand Down
4 changes: 3 additions & 1 deletion trunk/drivers/mmc/tifm_sd.c
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,9 @@ static int tifm_sd_probe(struct tifm_dev *sock)
mmc->max_hw_segs = 1;
mmc->max_phys_segs = 1;
mmc->max_sectors = 127;
mmc->max_seg_size = mmc->max_sectors << 11; //2k maximum hw block length
//2k maximum hw block length
mmc->max_seg_size = mmc->max_sectors << 11;
mmc->max_blk_size = 2048;
sock->signal_irq = tifm_sd_signal_irq;
rc = tifm_sd_initialize_host(host);

Expand Down
6 changes: 6 additions & 0 deletions trunk/drivers/mmc/wbsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1354,6 +1354,12 @@ static int __devinit wbsd_alloc_mmc(struct device *dev)
*/
mmc->max_seg_size = mmc->max_sectors * 512;

/*
* 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;

dev_set_drvdata(dev, mmc);

return 0;
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/mmc/host.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ struct mmc_host {
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_blk_size; /* maximum size of one mmc block */

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

0 comments on commit a07e22a

Please sign in to comment.