Skip to content

Commit b456259

Browse files
committed
Merge tag 'mmc-v6.7-2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc
Pull MMC fixes from Ulf Hansson: "MMC core: - Fix broken cache-flush support for Micron eMMCs - Revert 'mmc: core: Capture correct oemid-bits for eMMC cards' MMC host: - sdhci_am654: Fix TAP value parsing for legacy speed mode - sdhci-pci-gli: Fix support for ASPM mode for GL9755/GL9750 - vub300: Fix an error path in probe" * tag 'mmc-v6.7-2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: mmc: sdhci-pci-gli: GL9750: Mask the replay timer timeout of AER mmc: sdhci-pci-gli: GL9755: Mask the replay timer timeout of AER Revert "mmc: core: Capture correct oemid-bits for eMMC cards" mmc: vub300: fix an error code mmc: Add quirk MMC_QUIRK_BROKEN_CACHE_FLUSH for Micron eMMC Q2J54A mmc: sdhci_am654: fix start loop index for TAP value parsing
2 parents b077b7e + 015c9cb commit b456259

File tree

8 files changed

+38
-8
lines changed

8 files changed

+38
-8
lines changed

drivers/mmc/core/block.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2381,8 +2381,10 @@ enum mmc_issued mmc_blk_mq_issue_rq(struct mmc_queue *mq, struct request *req)
23812381
}
23822382
ret = mmc_blk_cqe_issue_flush(mq, req);
23832383
break;
2384-
case REQ_OP_READ:
23852384
case REQ_OP_WRITE:
2385+
card->written_flag = true;
2386+
fallthrough;
2387+
case REQ_OP_READ:
23862388
if (host->cqe_enabled)
23872389
ret = mmc_blk_cqe_issue_rw_rq(mq, req);
23882390
else

drivers/mmc/core/card.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,4 +280,8 @@ static inline int mmc_card_broken_sd_cache(const struct mmc_card *c)
280280
return c->quirks & MMC_QUIRK_BROKEN_SD_CACHE;
281281
}
282282

283+
static inline int mmc_card_broken_cache_flush(const struct mmc_card *c)
284+
{
285+
return c->quirks & MMC_QUIRK_BROKEN_CACHE_FLUSH;
286+
}
283287
#endif

drivers/mmc/core/mmc.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ static int mmc_decode_cid(struct mmc_card *card)
104104
case 3: /* MMC v3.1 - v3.3 */
105105
case 4: /* MMC v4 */
106106
card->cid.manfid = UNSTUFF_BITS(resp, 120, 8);
107-
card->cid.oemid = UNSTUFF_BITS(resp, 104, 8);
107+
card->cid.oemid = UNSTUFF_BITS(resp, 104, 16);
108108
card->cid.prod_name[0] = UNSTUFF_BITS(resp, 96, 8);
109109
card->cid.prod_name[1] = UNSTUFF_BITS(resp, 88, 8);
110110
card->cid.prod_name[2] = UNSTUFF_BITS(resp, 80, 8);
@@ -2086,13 +2086,17 @@ static int _mmc_flush_cache(struct mmc_host *host)
20862086
{
20872087
int err = 0;
20882088

2089+
if (mmc_card_broken_cache_flush(host->card) && !host->card->written_flag)
2090+
return 0;
2091+
20892092
if (_mmc_cache_enabled(host)) {
20902093
err = mmc_switch(host->card, EXT_CSD_CMD_SET_NORMAL,
20912094
EXT_CSD_FLUSH_CACHE, 1,
20922095
CACHE_FLUSH_TIMEOUT_MS);
20932096
if (err)
2094-
pr_err("%s: cache flush error %d\n",
2095-
mmc_hostname(host), err);
2097+
pr_err("%s: cache flush error %d\n", mmc_hostname(host), err);
2098+
else
2099+
host->card->written_flag = false;
20962100
}
20972101

20982102
return err;

drivers/mmc/core/quirks.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,12 @@ static const struct mmc_fixup __maybe_unused mmc_blk_fixups[] = {
110110
MMC_QUIRK_TRIM_BROKEN),
111111

112112
/*
113-
* Micron MTFC4GACAJCN-1M advertises TRIM but it does not seems to
114-
* support being used to offload WRITE_ZEROES.
113+
* Micron MTFC4GACAJCN-1M supports TRIM but does not appear to support
114+
* WRITE_ZEROES offloading. It also supports caching, but the cache can
115+
* only be flushed after a write has occurred.
115116
*/
116117
MMC_FIXUP("Q2J54A", CID_MANFID_MICRON, 0x014e, add_quirk_mmc,
117-
MMC_QUIRK_TRIM_BROKEN),
118+
MMC_QUIRK_TRIM_BROKEN | MMC_QUIRK_BROKEN_CACHE_FLUSH),
118119

119120
/*
120121
* Kingston EMMC04G-M627 advertises TRIM but it does not seems to

drivers/mmc/host/sdhci-pci-gli.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
#define PCI_GLI_9750_PM_CTRL 0xFC
2929
#define PCI_GLI_9750_PM_STATE GENMASK(1, 0)
3030

31+
#define PCI_GLI_9750_CORRERR_MASK 0x214
32+
#define PCI_GLI_9750_CORRERR_MASK_REPLAY_TIMER_TIMEOUT BIT(12)
33+
3134
#define SDHCI_GLI_9750_CFG2 0x848
3235
#define SDHCI_GLI_9750_CFG2_L1DLY GENMASK(28, 24)
3336
#define GLI_9750_CFG2_L1DLY_VALUE 0x1F
@@ -152,6 +155,9 @@
152155
#define PCI_GLI_9755_PM_CTRL 0xFC
153156
#define PCI_GLI_9755_PM_STATE GENMASK(1, 0)
154157

158+
#define PCI_GLI_9755_CORRERR_MASK 0x214
159+
#define PCI_GLI_9755_CORRERR_MASK_REPLAY_TIMER_TIMEOUT BIT(12)
160+
155161
#define SDHCI_GLI_9767_GM_BURST_SIZE 0x510
156162
#define SDHCI_GLI_9767_GM_BURST_SIZE_AXI_ALWAYS_SET BIT(8)
157163

@@ -561,6 +567,11 @@ static void gl9750_hw_setting(struct sdhci_host *host)
561567
value &= ~PCI_GLI_9750_PM_STATE;
562568
pci_write_config_dword(pdev, PCI_GLI_9750_PM_CTRL, value);
563569

570+
/* mask the replay timer timeout of AER */
571+
pci_read_config_dword(pdev, PCI_GLI_9750_CORRERR_MASK, &value);
572+
value |= PCI_GLI_9750_CORRERR_MASK_REPLAY_TIMER_TIMEOUT;
573+
pci_write_config_dword(pdev, PCI_GLI_9750_CORRERR_MASK, value);
574+
564575
gl9750_wt_off(host);
565576
}
566577

@@ -770,6 +781,11 @@ static void gl9755_hw_setting(struct sdhci_pci_slot *slot)
770781
value &= ~PCI_GLI_9755_PM_STATE;
771782
pci_write_config_dword(pdev, PCI_GLI_9755_PM_CTRL, value);
772783

784+
/* mask the replay timer timeout of AER */
785+
pci_read_config_dword(pdev, PCI_GLI_9755_CORRERR_MASK, &value);
786+
value |= PCI_GLI_9755_CORRERR_MASK_REPLAY_TIMER_TIMEOUT;
787+
pci_write_config_dword(pdev, PCI_GLI_9755_CORRERR_MASK, value);
788+
773789
gl9755_wt_off(pdev);
774790
}
775791

drivers/mmc/host/sdhci_am654.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ static int sdhci_am654_get_otap_delay(struct sdhci_host *host,
598598
return 0;
599599
}
600600

601-
for (i = MMC_TIMING_MMC_HS; i <= MMC_TIMING_MMC_HS400; i++) {
601+
for (i = MMC_TIMING_LEGACY; i <= MMC_TIMING_MMC_HS400; i++) {
602602

603603
ret = device_property_read_u32(dev, td[i].otap_binding,
604604
&sdhci_am654->otap_del_sel[i]);

drivers/mmc/host/vub300.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2309,6 +2309,7 @@ static int vub300_probe(struct usb_interface *interface,
23092309
vub300->read_only =
23102310
(0x0010 & vub300->system_port_status.port_flags) ? 1 : 0;
23112311
} else {
2312+
retval = -EINVAL;
23122313
goto error5;
23132314
}
23142315
usb_set_intfdata(interface, vub300);

include/linux/mmc/card.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,9 @@ struct mmc_card {
295295
#define MMC_QUIRK_BROKEN_HPI (1<<13) /* Disable broken HPI support */
296296
#define MMC_QUIRK_BROKEN_SD_DISCARD (1<<14) /* Disable broken SD discard support */
297297
#define MMC_QUIRK_BROKEN_SD_CACHE (1<<15) /* Disable broken SD cache support */
298+
#define MMC_QUIRK_BROKEN_CACHE_FLUSH (1<<16) /* Don't flush cache until the write has occurred */
298299

300+
bool written_flag; /* Indicates eMMC has been written since power on */
299301
bool reenable_cmdq; /* Re-enable Command Queue */
300302

301303
unsigned int erase_size; /* erase size in sectors */

0 commit comments

Comments
 (0)