aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/core/block.c19
-rw-r--r--drivers/mmc/core/card.h1
-rw-r--r--drivers/mmc/core/quirks.h6
-rw-r--r--drivers/mmc/host/dw_mmc-exynos.c8
-rw-r--r--drivers/mmc/host/dw_mmc.c15
-rw-r--r--drivers/mmc/host/sdhci-acpi.c2
6 files changed, 44 insertions, 7 deletions
diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index 20135a5de748..2cfb963d9f37 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -72,6 +72,7 @@ MODULE_ALIAS("mmc:block");
72#define MMC_BLK_TIMEOUT_MS (10 * 1000) 72#define MMC_BLK_TIMEOUT_MS (10 * 1000)
73#define MMC_SANITIZE_REQ_TIMEOUT 240000 73#define MMC_SANITIZE_REQ_TIMEOUT 240000
74#define MMC_EXTRACT_INDEX_FROM_ARG(x) ((x & 0x00FF0000) >> 16) 74#define MMC_EXTRACT_INDEX_FROM_ARG(x) ((x & 0x00FF0000) >> 16)
75#define MMC_EXTRACT_VALUE_FROM_ARG(x) ((x & 0x0000FF00) >> 8)
75 76
76#define mmc_req_rel_wr(req) ((req->cmd_flags & REQ_FUA) && \ 77#define mmc_req_rel_wr(req) ((req->cmd_flags & REQ_FUA) && \
77 (rq_data_dir(req) == WRITE)) 78 (rq_data_dir(req) == WRITE))
@@ -587,6 +588,24 @@ static int __mmc_blk_ioctl_cmd(struct mmc_card *card, struct mmc_blk_data *md,
587 } 588 }
588 589
589 /* 590 /*
591 * Make sure the cache of the PARTITION_CONFIG register and
592 * PARTITION_ACCESS bits is updated in case the ioctl ext_csd write
593 * changed it successfully.
594 */
595 if ((MMC_EXTRACT_INDEX_FROM_ARG(cmd.arg) == EXT_CSD_PART_CONFIG) &&
596 (cmd.opcode == MMC_SWITCH)) {
597 struct mmc_blk_data *main_md = dev_get_drvdata(&card->dev);
598 u8 value = MMC_EXTRACT_VALUE_FROM_ARG(cmd.arg);
599
600 /*
601 * Update cache so the next mmc_blk_part_switch call operates
602 * on up-to-date data.
603 */
604 card->ext_csd.part_config = value;
605 main_md->part_curr = value & EXT_CSD_PART_CONFIG_ACC_MASK;
606 }
607
608 /*
590 * According to the SD specs, some commands require a delay after 609 * According to the SD specs, some commands require a delay after
591 * issuing the command. 610 * issuing the command.
592 */ 611 */
diff --git a/drivers/mmc/core/card.h b/drivers/mmc/core/card.h
index 79a5b985ccf5..9c821eedd156 100644
--- a/drivers/mmc/core/card.h
+++ b/drivers/mmc/core/card.h
@@ -82,6 +82,7 @@ struct mmc_fixup {
82#define CID_MANFID_APACER 0x27 82#define CID_MANFID_APACER 0x27
83#define CID_MANFID_KINGSTON 0x70 83#define CID_MANFID_KINGSTON 0x70
84#define CID_MANFID_HYNIX 0x90 84#define CID_MANFID_HYNIX 0x90
85#define CID_MANFID_NUMONYX 0xFE
85 86
86#define END_FIXUP { NULL } 87#define END_FIXUP { NULL }
87 88
diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h
index 75d317623852..5153577754f0 100644
--- a/drivers/mmc/core/quirks.h
+++ b/drivers/mmc/core/quirks.h
@@ -109,6 +109,12 @@ static const struct mmc_fixup mmc_ext_csd_fixups[] = {
109 */ 109 */
110 MMC_FIXUP_EXT_CSD_REV(CID_NAME_ANY, CID_MANFID_HYNIX, 110 MMC_FIXUP_EXT_CSD_REV(CID_NAME_ANY, CID_MANFID_HYNIX,
111 0x014a, add_quirk, MMC_QUIRK_BROKEN_HPI, 5), 111 0x014a, add_quirk, MMC_QUIRK_BROKEN_HPI, 5),
112 /*
113 * Certain Micron (Numonyx) eMMC 4.5 cards might get broken when HPI
114 * feature is used so disable the HPI feature for such buggy cards.
115 */
116 MMC_FIXUP_EXT_CSD_REV(CID_NAME_ANY, CID_MANFID_NUMONYX,
117 0x014e, add_quirk, MMC_QUIRK_BROKEN_HPI, 6),
112 118
113 END_FIXUP 119 END_FIXUP
114}; 120};
diff --git a/drivers/mmc/host/dw_mmc-exynos.c b/drivers/mmc/host/dw_mmc-exynos.c
index fa41d9422d57..a84aa3f1ae85 100644
--- a/drivers/mmc/host/dw_mmc-exynos.c
+++ b/drivers/mmc/host/dw_mmc-exynos.c
@@ -165,9 +165,15 @@ static void dw_mci_exynos_set_clksel_timing(struct dw_mci *host, u32 timing)
165static int dw_mci_exynos_runtime_resume(struct device *dev) 165static int dw_mci_exynos_runtime_resume(struct device *dev)
166{ 166{
167 struct dw_mci *host = dev_get_drvdata(dev); 167 struct dw_mci *host = dev_get_drvdata(dev);
168 int ret;
169
170 ret = dw_mci_runtime_resume(dev);
171 if (ret)
172 return ret;
168 173
169 dw_mci_exynos_config_smu(host); 174 dw_mci_exynos_config_smu(host);
170 return dw_mci_runtime_resume(dev); 175
176 return ret;
171} 177}
172 178
173/** 179/**
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index d9b4acefed31..06d47414d0c1 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -413,7 +413,9 @@ static inline void dw_mci_set_cto(struct dw_mci *host)
413 cto_div = (mci_readl(host, CLKDIV) & 0xff) * 2; 413 cto_div = (mci_readl(host, CLKDIV) & 0xff) * 2;
414 if (cto_div == 0) 414 if (cto_div == 0)
415 cto_div = 1; 415 cto_div = 1;
416 cto_ms = DIV_ROUND_UP(MSEC_PER_SEC * cto_clks * cto_div, host->bus_hz); 416
417 cto_ms = DIV_ROUND_UP_ULL((u64)MSEC_PER_SEC * cto_clks * cto_div,
418 host->bus_hz);
417 419
418 /* add a bit spare time */ 420 /* add a bit spare time */
419 cto_ms += 10; 421 cto_ms += 10;
@@ -562,6 +564,7 @@ static int dw_mci_idmac_init(struct dw_mci *host)
562 (sizeof(struct idmac_desc_64addr) * 564 (sizeof(struct idmac_desc_64addr) *
563 (i + 1))) >> 32; 565 (i + 1))) >> 32;
564 /* Initialize reserved and buffer size fields to "0" */ 566 /* Initialize reserved and buffer size fields to "0" */
567 p->des0 = 0;
565 p->des1 = 0; 568 p->des1 = 0;
566 p->des2 = 0; 569 p->des2 = 0;
567 p->des3 = 0; 570 p->des3 = 0;
@@ -584,6 +587,7 @@ static int dw_mci_idmac_init(struct dw_mci *host)
584 i++, p++) { 587 i++, p++) {
585 p->des3 = cpu_to_le32(host->sg_dma + 588 p->des3 = cpu_to_le32(host->sg_dma +
586 (sizeof(struct idmac_desc) * (i + 1))); 589 (sizeof(struct idmac_desc) * (i + 1)));
590 p->des0 = 0;
587 p->des1 = 0; 591 p->des1 = 0;
588 } 592 }
589 593
@@ -1799,8 +1803,8 @@ static bool dw_mci_reset(struct dw_mci *host)
1799 } 1803 }
1800 1804
1801 if (host->use_dma == TRANS_MODE_IDMAC) 1805 if (host->use_dma == TRANS_MODE_IDMAC)
1802 /* It is also recommended that we reset and reprogram idmac */ 1806 /* It is also required that we reinit idmac */
1803 dw_mci_idmac_reset(host); 1807 dw_mci_idmac_init(host);
1804 1808
1805 ret = true; 1809 ret = true;
1806 1810
@@ -1948,8 +1952,9 @@ static void dw_mci_set_drto(struct dw_mci *host)
1948 drto_div = (mci_readl(host, CLKDIV) & 0xff) * 2; 1952 drto_div = (mci_readl(host, CLKDIV) & 0xff) * 2;
1949 if (drto_div == 0) 1953 if (drto_div == 0)
1950 drto_div = 1; 1954 drto_div = 1;
1951 drto_ms = DIV_ROUND_UP(MSEC_PER_SEC * drto_clks * drto_div, 1955
1952 host->bus_hz); 1956 drto_ms = DIV_ROUND_UP_ULL((u64)MSEC_PER_SEC * drto_clks * drto_div,
1957 host->bus_hz);
1953 1958
1954 /* add a bit spare time */ 1959 /* add a bit spare time */
1955 drto_ms += 10; 1960 drto_ms += 10;
diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
index 4065da58789d..32321bd596d8 100644
--- a/drivers/mmc/host/sdhci-acpi.c
+++ b/drivers/mmc/host/sdhci-acpi.c
@@ -680,7 +680,7 @@ static int sdhci_acpi_probe(struct platform_device *pdev)
680 host->hw_name = "ACPI"; 680 host->hw_name = "ACPI";
681 host->ops = &sdhci_acpi_ops_dflt; 681 host->ops = &sdhci_acpi_ops_dflt;
682 host->irq = platform_get_irq(pdev, 0); 682 host->irq = platform_get_irq(pdev, 0);
683 if (host->irq <= 0) { 683 if (host->irq < 0) {
684 err = -EINVAL; 684 err = -EINVAL;
685 goto err_free; 685 goto err_free;
686 } 686 }