Skip to content

Commit 17d50f8

Browse files
committed
Merge tag 'mmc-v5.15-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc
Pull MMC fixes from Ulf Hansson: - tmio: Re-enable card irqs after a reset - mtk-sd: Fixup probing of cqhci for crypto - cqhci: Fix support for suspend/resume - vub300: Fix control-message timeouts - dw_mmc-exynos: Fix support for tuning - winbond: Silences build errors on M68K - sdhci-esdhc-imx: Fix support for tuning - sdhci-pci: Read card detect from ACPI for Intel Merrifield - sdhci: Fix eMMC support for Thundercomm TurboX CM2290 * tag 'mmc-v5.15-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: mmc: tmio: reenable card irqs after the reset callback mmc: mediatek: Move cqhci init behind ungate clock mmc: cqhci: clear HALT state after CQE enable mmc: vub300: fix control-message timeouts mmc: dw_mmc: exynos: fix the finding clock sample value mmc: winbond: don't build on M68K mmc: sdhci-esdhc-imx: clear the buffer_read_ready to reset standard tuning circuit mmc: sdhci-pci: Read card detect from ACPI for Intel Merrifield mmc: sdhci: Map more voltage level to SDHCI_POWER_330
2 parents fd919bb + 90935eb commit 17d50f8

File tree

9 files changed

+104
-39
lines changed

9 files changed

+104
-39
lines changed

drivers/mmc/host/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ config MMC_OMAP_HS
506506

507507
config MMC_WBSD
508508
tristate "Winbond W83L51xD SD/MMC Card Interface support"
509-
depends on ISA_DMA_API
509+
depends on ISA_DMA_API && !M68K
510510
help
511511
This selects the Winbond(R) W83L51xD Secure digital and
512512
Multimedia card Interface.

drivers/mmc/host/cqhci-core.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,9 @@ static void __cqhci_enable(struct cqhci_host *cq_host)
282282

283283
cqhci_writel(cq_host, cqcfg, CQHCI_CFG);
284284

285+
if (cqhci_readl(cq_host, CQHCI_CTL) & CQHCI_HALT)
286+
cqhci_writel(cq_host, 0, CQHCI_CTL);
287+
285288
mmc->cqe_on = true;
286289

287290
if (cq_host->ops->enable)

drivers/mmc/host/dw_mmc-exynos.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,18 @@ static s8 dw_mci_exynos_get_best_clksmpl(u8 candiates)
464464
}
465465
}
466466

467+
/*
468+
* If there is no cadiates value, then it needs to return -EIO.
469+
* If there are candiates values and don't find bset clk sample value,
470+
* then use a first candiates clock sample value.
471+
*/
472+
for (i = 0; i < iter; i++) {
473+
__c = ror8(candiates, i);
474+
if ((__c & 0x1) == 0x1) {
475+
loc = i;
476+
goto out;
477+
}
478+
}
467479
out:
468480
return loc;
469481
}
@@ -494,6 +506,8 @@ static int dw_mci_exynos_execute_tuning(struct dw_mci_slot *slot, u32 opcode)
494506
priv->tuned_sample = found;
495507
} else {
496508
ret = -EIO;
509+
dev_warn(&mmc->class_dev,
510+
"There is no candiates value about clksmpl!\n");
497511
}
498512

499513
return ret;

drivers/mmc/host/mtk-sd.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2577,6 +2577,25 @@ static int msdc_drv_probe(struct platform_device *pdev)
25772577
host->dma_mask = DMA_BIT_MASK(32);
25782578
mmc_dev(mmc)->dma_mask = &host->dma_mask;
25792579

2580+
host->timeout_clks = 3 * 1048576;
2581+
host->dma.gpd = dma_alloc_coherent(&pdev->dev,
2582+
2 * sizeof(struct mt_gpdma_desc),
2583+
&host->dma.gpd_addr, GFP_KERNEL);
2584+
host->dma.bd = dma_alloc_coherent(&pdev->dev,
2585+
MAX_BD_NUM * sizeof(struct mt_bdma_desc),
2586+
&host->dma.bd_addr, GFP_KERNEL);
2587+
if (!host->dma.gpd || !host->dma.bd) {
2588+
ret = -ENOMEM;
2589+
goto release_mem;
2590+
}
2591+
msdc_init_gpd_bd(host, &host->dma);
2592+
INIT_DELAYED_WORK(&host->req_timeout, msdc_request_timeout);
2593+
spin_lock_init(&host->lock);
2594+
2595+
platform_set_drvdata(pdev, mmc);
2596+
msdc_ungate_clock(host);
2597+
msdc_init_hw(host);
2598+
25802599
if (mmc->caps2 & MMC_CAP2_CQE) {
25812600
host->cq_host = devm_kzalloc(mmc->parent,
25822601
sizeof(*host->cq_host),
@@ -2597,25 +2616,6 @@ static int msdc_drv_probe(struct platform_device *pdev)
25972616
mmc->max_seg_size = 64 * 1024;
25982617
}
25992618

2600-
host->timeout_clks = 3 * 1048576;
2601-
host->dma.gpd = dma_alloc_coherent(&pdev->dev,
2602-
2 * sizeof(struct mt_gpdma_desc),
2603-
&host->dma.gpd_addr, GFP_KERNEL);
2604-
host->dma.bd = dma_alloc_coherent(&pdev->dev,
2605-
MAX_BD_NUM * sizeof(struct mt_bdma_desc),
2606-
&host->dma.bd_addr, GFP_KERNEL);
2607-
if (!host->dma.gpd || !host->dma.bd) {
2608-
ret = -ENOMEM;
2609-
goto release_mem;
2610-
}
2611-
msdc_init_gpd_bd(host, &host->dma);
2612-
INIT_DELAYED_WORK(&host->req_timeout, msdc_request_timeout);
2613-
spin_lock_init(&host->lock);
2614-
2615-
platform_set_drvdata(pdev, mmc);
2616-
msdc_ungate_clock(host);
2617-
msdc_init_hw(host);
2618-
26192619
ret = devm_request_irq(&pdev->dev, host->irq, msdc_irq,
26202620
IRQF_TRIGGER_NONE, pdev->name, host);
26212621
if (ret)

drivers/mmc/host/sdhci-esdhc-imx.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,6 +1187,7 @@ static void esdhc_reset_tuning(struct sdhci_host *host)
11871187
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
11881188
struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
11891189
u32 ctrl;
1190+
int ret;
11901191

11911192
/* Reset the tuning circuit */
11921193
if (esdhc_is_usdhc(imx_data)) {
@@ -1199,7 +1200,22 @@ static void esdhc_reset_tuning(struct sdhci_host *host)
11991200
} else if (imx_data->socdata->flags & ESDHC_FLAG_STD_TUNING) {
12001201
ctrl = readl(host->ioaddr + SDHCI_AUTO_CMD_STATUS);
12011202
ctrl &= ~ESDHC_MIX_CTRL_SMPCLK_SEL;
1203+
ctrl &= ~ESDHC_MIX_CTRL_EXE_TUNE;
12021204
writel(ctrl, host->ioaddr + SDHCI_AUTO_CMD_STATUS);
1205+
/* Make sure ESDHC_MIX_CTRL_EXE_TUNE cleared */
1206+
ret = readl_poll_timeout(host->ioaddr + SDHCI_AUTO_CMD_STATUS,
1207+
ctrl, !(ctrl & ESDHC_MIX_CTRL_EXE_TUNE), 1, 50);
1208+
if (ret == -ETIMEDOUT)
1209+
dev_warn(mmc_dev(host->mmc),
1210+
"Warning! clear execute tuning bit failed\n");
1211+
/*
1212+
* SDHCI_INT_DATA_AVAIL is W1C bit, set this bit will clear the
1213+
* usdhc IP internal logic flag execute_tuning_with_clr_buf, which
1214+
* will finally make sure the normal data transfer logic correct.
1215+
*/
1216+
ctrl = readl(host->ioaddr + SDHCI_INT_STATUS);
1217+
ctrl |= SDHCI_INT_DATA_AVAIL;
1218+
writel(ctrl, host->ioaddr + SDHCI_INT_STATUS);
12031219
}
12041220
}
12051221
}

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

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -616,16 +616,12 @@ static int intel_select_drive_strength(struct mmc_card *card,
616616
return intel_host->drv_strength;
617617
}
618618

619-
static int bxt_get_cd(struct mmc_host *mmc)
619+
static int sdhci_get_cd_nogpio(struct mmc_host *mmc)
620620
{
621-
int gpio_cd = mmc_gpio_get_cd(mmc);
622621
struct sdhci_host *host = mmc_priv(mmc);
623622
unsigned long flags;
624623
int ret = 0;
625624

626-
if (!gpio_cd)
627-
return 0;
628-
629625
spin_lock_irqsave(&host->lock, flags);
630626

631627
if (host->flags & SDHCI_DEVICE_DEAD)
@@ -638,6 +634,21 @@ static int bxt_get_cd(struct mmc_host *mmc)
638634
return ret;
639635
}
640636

637+
static int bxt_get_cd(struct mmc_host *mmc)
638+
{
639+
int gpio_cd = mmc_gpio_get_cd(mmc);
640+
641+
if (!gpio_cd)
642+
return 0;
643+
644+
return sdhci_get_cd_nogpio(mmc);
645+
}
646+
647+
static int mrfld_get_cd(struct mmc_host *mmc)
648+
{
649+
return sdhci_get_cd_nogpio(mmc);
650+
}
651+
641652
#define SDHCI_INTEL_PWR_TIMEOUT_CNT 20
642653
#define SDHCI_INTEL_PWR_TIMEOUT_UDELAY 100
643654

@@ -1341,6 +1352,14 @@ static int intel_mrfld_mmc_probe_slot(struct sdhci_pci_slot *slot)
13411352
MMC_CAP_1_8V_DDR;
13421353
break;
13431354
case INTEL_MRFLD_SD:
1355+
slot->cd_idx = 0;
1356+
slot->cd_override_level = true;
1357+
/*
1358+
* There are two PCB designs of SD card slot with the opposite
1359+
* card detection sense. Quirk this out by ignoring GPIO state
1360+
* completely in the custom ->get_cd() callback.
1361+
*/
1362+
slot->host->mmc_host_ops.get_cd = mrfld_get_cd;
13441363
slot->host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V;
13451364
break;
13461365
case INTEL_MRFLD_SDIO:

drivers/mmc/host/sdhci.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2042,6 +2042,12 @@ void sdhci_set_power_noreg(struct sdhci_host *host, unsigned char mode,
20422042
break;
20432043
case MMC_VDD_32_33:
20442044
case MMC_VDD_33_34:
2045+
/*
2046+
* 3.4 ~ 3.6V are valid only for those platforms where it's
2047+
* known that the voltage range is supported by hardware.
2048+
*/
2049+
case MMC_VDD_34_35:
2050+
case MMC_VDD_35_36:
20452051
pwr = SDHCI_POWER_330;
20462052
break;
20472053
default:

drivers/mmc/host/tmio_mmc_core.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,10 @@ static void tmio_mmc_reset(struct tmio_mmc_host *host)
195195
sd_ctrl_write32_as_16_and_16(host, CTL_IRQ_MASK, host->sdcard_irq_mask_all);
196196
host->sdcard_irq_mask = host->sdcard_irq_mask_all;
197197

198+
if (host->native_hotplug)
199+
tmio_mmc_enable_mmc_irqs(host,
200+
TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT);
201+
198202
tmio_mmc_set_bus_width(host, host->mmc->ios.bus_width);
199203

200204
if (host->pdata->flags & TMIO_MMC_SDIO_IRQ) {
@@ -956,8 +960,15 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
956960
case MMC_POWER_OFF:
957961
tmio_mmc_power_off(host);
958962
/* For R-Car Gen2+, we need to reset SDHI specific SCC */
959-
if (host->pdata->flags & TMIO_MMC_MIN_RCAR2)
963+
if (host->pdata->flags & TMIO_MMC_MIN_RCAR2) {
960964
host->reset(host);
965+
966+
if (host->native_hotplug)
967+
tmio_mmc_enable_mmc_irqs(host,
968+
TMIO_STAT_CARD_REMOVE |
969+
TMIO_STAT_CARD_INSERT);
970+
}
971+
961972
host->set_clock(host, 0);
962973
break;
963974
case MMC_POWER_UP:
@@ -1185,10 +1196,6 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host)
11851196
_host->set_clock(_host, 0);
11861197
tmio_mmc_reset(_host);
11871198

1188-
if (_host->native_hotplug)
1189-
tmio_mmc_enable_mmc_irqs(_host,
1190-
TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT);
1191-
11921199
spin_lock_init(&_host->lock);
11931200
mutex_init(&_host->ios_lock);
11941201

drivers/mmc/host/vub300.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ static void check_vub300_port_status(struct vub300_mmc_host *vub300)
576576
GET_SYSTEM_PORT_STATUS,
577577
USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
578578
0x0000, 0x0000, &vub300->system_port_status,
579-
sizeof(vub300->system_port_status), HZ);
579+
sizeof(vub300->system_port_status), 1000);
580580
if (sizeof(vub300->system_port_status) == retval)
581581
new_system_port_status(vub300);
582582
}
@@ -1241,7 +1241,7 @@ static void __download_offload_pseudocode(struct vub300_mmc_host *vub300,
12411241
SET_INTERRUPT_PSEUDOCODE,
12421242
USB_DIR_OUT | USB_TYPE_VENDOR |
12431243
USB_RECIP_DEVICE, 0x0000, 0x0000,
1244-
xfer_buffer, xfer_length, HZ);
1244+
xfer_buffer, xfer_length, 1000);
12451245
kfree(xfer_buffer);
12461246
if (retval < 0)
12471247
goto copy_error_message;
@@ -1284,7 +1284,7 @@ static void __download_offload_pseudocode(struct vub300_mmc_host *vub300,
12841284
SET_TRANSFER_PSEUDOCODE,
12851285
USB_DIR_OUT | USB_TYPE_VENDOR |
12861286
USB_RECIP_DEVICE, 0x0000, 0x0000,
1287-
xfer_buffer, xfer_length, HZ);
1287+
xfer_buffer, xfer_length, 1000);
12881288
kfree(xfer_buffer);
12891289
if (retval < 0)
12901290
goto copy_error_message;
@@ -1991,7 +1991,7 @@ static void __set_clock_speed(struct vub300_mmc_host *vub300, u8 buf[8],
19911991
usb_control_msg(vub300->udev, usb_sndctrlpipe(vub300->udev, 0),
19921992
SET_CLOCK_SPEED,
19931993
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
1994-
0x00, 0x00, buf, buf_array_size, HZ);
1994+
0x00, 0x00, buf, buf_array_size, 1000);
19951995
if (retval != 8) {
19961996
dev_err(&vub300->udev->dev, "SET_CLOCK_SPEED"
19971997
" %dkHz failed with retval=%d\n", kHzClock, retval);
@@ -2013,14 +2013,14 @@ static void vub300_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
20132013
usb_control_msg(vub300->udev, usb_sndctrlpipe(vub300->udev, 0),
20142014
SET_SD_POWER,
20152015
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
2016-
0x0000, 0x0000, NULL, 0, HZ);
2016+
0x0000, 0x0000, NULL, 0, 1000);
20172017
/* must wait for the VUB300 u-proc to boot up */
20182018
msleep(600);
20192019
} else if ((ios->power_mode == MMC_POWER_UP) && !vub300->card_powered) {
20202020
usb_control_msg(vub300->udev, usb_sndctrlpipe(vub300->udev, 0),
20212021
SET_SD_POWER,
20222022
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
2023-
0x0001, 0x0000, NULL, 0, HZ);
2023+
0x0001, 0x0000, NULL, 0, 1000);
20242024
msleep(600);
20252025
vub300->card_powered = 1;
20262026
} else if (ios->power_mode == MMC_POWER_ON) {
@@ -2275,14 +2275,14 @@ static int vub300_probe(struct usb_interface *interface,
22752275
GET_HC_INF0,
22762276
USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
22772277
0x0000, 0x0000, &vub300->hc_info,
2278-
sizeof(vub300->hc_info), HZ);
2278+
sizeof(vub300->hc_info), 1000);
22792279
if (retval < 0)
22802280
goto error5;
22812281
retval =
22822282
usb_control_msg(vub300->udev, usb_sndctrlpipe(vub300->udev, 0),
22832283
SET_ROM_WAIT_STATES,
22842284
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
2285-
firmware_rom_wait_states, 0x0000, NULL, 0, HZ);
2285+
firmware_rom_wait_states, 0x0000, NULL, 0, 1000);
22862286
if (retval < 0)
22872287
goto error5;
22882288
dev_info(&vub300->udev->dev,
@@ -2297,7 +2297,7 @@ static int vub300_probe(struct usb_interface *interface,
22972297
GET_SYSTEM_PORT_STATUS,
22982298
USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
22992299
0x0000, 0x0000, &vub300->system_port_status,
2300-
sizeof(vub300->system_port_status), HZ);
2300+
sizeof(vub300->system_port_status), 1000);
23012301
if (retval < 0) {
23022302
goto error4;
23032303
} else if (sizeof(vub300->system_port_status) == retval) {

0 commit comments

Comments
 (0)