diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 84d0d7ac0ae65b..518fbaa62e0921 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -1095,7 +1095,7 @@ static void sdhci_initialize_data(struct sdhci_host *host, WARN_ON(host->data); /* Sanity checks */ - BUG_ON(data->blksz * data->blocks > 524288); + BUG_ON(data->blksz * data->blocks > host->mmc->max_req_size); BUG_ON(data->blksz > host->mmc->max_blk_size); BUG_ON(data->blocks > 65535); @@ -4720,11 +4720,18 @@ int sdhci_setup_host(struct sdhci_host *host) /* * Maximum number of sectors in one transfer. Limited by SDMA boundary - * size (512KiB). Note some tuning modes impose a 4MiB limit, but this - * is less anyway. + * size and by tuning modes on ADMA. On tuning mode 3 16MiB is more than + * enough to cover big data transfers. */ - mmc->max_req_size = 524288; - + if (host->flags & SDHCI_USE_ADMA) { + if (host->tuning_mode != SDHCI_TUNING_MODE_3) + mmc->max_req_size = 4194304; + else + mmc->max_req_size = 16777216; + } else { + /* On PIO/SDMA use SDMA boundary size (512KiB). */ + mmc->max_req_size = 524288; + } /* * Maximum number of segments. Depends on if the hardware * can do scatter/gather or not. diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 5ce7cdcc192fd2..7c85aeee814d6d 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -339,11 +339,11 @@ struct sdhci_adma2_64_desc { #define ADMA2_END 0x2 /* - * Maximum segments assuming a 512KiB maximum requisition size and a minimum + * Maximum segments assuming a 16MiB maximum requisition size and a minimum * 4KiB page size. Note this also allows enough for multiple descriptors in * case of PAGE_SIZE >= 64KiB. */ -#define SDHCI_MAX_SEGS 128 +#define SDHCI_MAX_SEGS 4096 /* Allow for a a command request and a data request at the same time */ #define SDHCI_MAX_MRQS 2