diff options
| -rw-r--r-- | drivers/mmc/host/sdhci.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 2f14334e42df..e9290a3439d5 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | #include <linux/dma-mapping.h> | 21 | #include <linux/dma-mapping.h> |
| 22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
| 23 | #include <linux/scatterlist.h> | 23 | #include <linux/scatterlist.h> |
| 24 | #include <linux/swiotlb.h> | ||
| 24 | #include <linux/regulator/consumer.h> | 25 | #include <linux/regulator/consumer.h> |
| 25 | #include <linux/pm_runtime.h> | 26 | #include <linux/pm_runtime.h> |
| 26 | #include <linux/of.h> | 27 | #include <linux/of.h> |
| @@ -3651,22 +3652,29 @@ int sdhci_setup_host(struct sdhci_host *host) | |||
| 3651 | spin_lock_init(&host->lock); | 3652 | spin_lock_init(&host->lock); |
| 3652 | 3653 | ||
| 3653 | /* | 3654 | /* |
| 3655 | * Maximum number of sectors in one transfer. Limited by SDMA boundary | ||
| 3656 | * size (512KiB). Note some tuning modes impose a 4MiB limit, but this | ||
| 3657 | * is less anyway. | ||
| 3658 | */ | ||
| 3659 | mmc->max_req_size = 524288; | ||
| 3660 | |||
| 3661 | /* | ||
| 3654 | * Maximum number of segments. Depends on if the hardware | 3662 | * Maximum number of segments. Depends on if the hardware |
| 3655 | * can do scatter/gather or not. | 3663 | * can do scatter/gather or not. |
| 3656 | */ | 3664 | */ |
| 3657 | if (host->flags & SDHCI_USE_ADMA) | 3665 | if (host->flags & SDHCI_USE_ADMA) { |
| 3658 | mmc->max_segs = SDHCI_MAX_SEGS; | 3666 | mmc->max_segs = SDHCI_MAX_SEGS; |
| 3659 | else if (host->flags & SDHCI_USE_SDMA) | 3667 | } else if (host->flags & SDHCI_USE_SDMA) { |
| 3660 | mmc->max_segs = 1; | 3668 | mmc->max_segs = 1; |
| 3661 | else /* PIO */ | 3669 | if (swiotlb_max_segment()) { |
| 3670 | unsigned int max_req_size = (1 << IO_TLB_SHIFT) * | ||
| 3671 | IO_TLB_SEGSIZE; | ||
| 3672 | mmc->max_req_size = min(mmc->max_req_size, | ||
| 3673 | max_req_size); | ||
| 3674 | } | ||
| 3675 | } else { /* PIO */ | ||
| 3662 | mmc->max_segs = SDHCI_MAX_SEGS; | 3676 | mmc->max_segs = SDHCI_MAX_SEGS; |
| 3663 | 3677 | } | |
| 3664 | /* | ||
| 3665 | * Maximum number of sectors in one transfer. Limited by SDMA boundary | ||
| 3666 | * size (512KiB). Note some tuning modes impose a 4MiB limit, but this | ||
| 3667 | * is less anyway. | ||
| 3668 | */ | ||
| 3669 | mmc->max_req_size = 524288; | ||
| 3670 | 3678 | ||
| 3671 | /* | 3679 | /* |
| 3672 | * Maximum segment size. Could be one segment with the maximum number | 3680 | * Maximum segment size. Could be one segment with the maximum number |
