Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fe4a3c7a authored by Pierre Ossman's avatar Pierre Ossman
Browse files

mmc: Allow host drivers to specify a max block size



Most controllers have an upper limit on the block size. Allow the host
drivers to specify this and make sure we avoid hitting this limit.

Signed-off-by: default avatarPierre Ossman <drzeus@drzeus.cx>
parent dba4acca
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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;
+2 −0
Original line number Diff line number Diff line
@@ -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);
+1 −0
Original line number Diff line number Diff line
@@ -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;
+4 −0
Original line number Diff line number Diff line
@@ -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;
@@ -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;
+5 −0
Original line number Diff line number Diff line
@@ -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);
Loading