Skip to content

Commit af4a32a

Browse files
committed
Merge tag 'mmc-v5.7-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc
Pull MMC fixes from Ulf Hansson: - meson-mx-sdio: Fix support for HW busy detection - sdhci-msm: Fix support for HW busy detection - cqhci: Fix polling loop by converting to readx_poll_timeout() - sdhci-xenon: Fix annoying 1.8V regulator warning - sdhci-pci: Fix eMMC driver strength for BYT-based controllers * tag 'mmc-v5.7-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: mmc: sdhci-pci: Fix eMMC driver strength for BYT-based controllers mmc: sdhci-xenon: fix annoying 1.8V regulator warning mmc: sdhci-msm: Enable host capabilities pertains to R1b response mmc: cqhci: Avoid false "cqhci: CQE stuck on" by not open-coding timeout loop mmc: meson-mx-sdio: remove the broken ->card_busy() op mmc: meson-mx-sdio: Set MMC_CAP_WAIT_WHILE_BUSY mmc: core: make mmc_interrupt_hpi() static
2 parents 1d2cc5a + 1a8eb6b commit af4a32a

File tree

6 files changed

+27
-22
lines changed

6 files changed

+27
-22
lines changed

drivers/mmc/core/mmc_ops.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ static int mmc_send_hpi_cmd(struct mmc_card *card)
878878
* Issued High Priority Interrupt, and check for card status
879879
* until out-of prg-state.
880880
*/
881-
int mmc_interrupt_hpi(struct mmc_card *card)
881+
static int mmc_interrupt_hpi(struct mmc_card *card)
882882
{
883883
int err;
884884
u32 status;

drivers/mmc/host/cqhci.c

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <linux/delay.h>
66
#include <linux/highmem.h>
77
#include <linux/io.h>
8+
#include <linux/iopoll.h>
89
#include <linux/module.h>
910
#include <linux/dma-mapping.h>
1011
#include <linux/slab.h>
@@ -349,12 +350,16 @@ static int cqhci_enable(struct mmc_host *mmc, struct mmc_card *card)
349350
/* CQHCI is idle and should halt immediately, so set a small timeout */
350351
#define CQHCI_OFF_TIMEOUT 100
351352

353+
static u32 cqhci_read_ctl(struct cqhci_host *cq_host)
354+
{
355+
return cqhci_readl(cq_host, CQHCI_CTL);
356+
}
357+
352358
static void cqhci_off(struct mmc_host *mmc)
353359
{
354360
struct cqhci_host *cq_host = mmc->cqe_private;
355-
ktime_t timeout;
356-
bool timed_out;
357361
u32 reg;
362+
int err;
358363

359364
if (!cq_host->enabled || !mmc->cqe_on || cq_host->recovery_halt)
360365
return;
@@ -364,15 +369,9 @@ static void cqhci_off(struct mmc_host *mmc)
364369

365370
cqhci_writel(cq_host, CQHCI_HALT, CQHCI_CTL);
366371

367-
timeout = ktime_add_us(ktime_get(), CQHCI_OFF_TIMEOUT);
368-
while (1) {
369-
timed_out = ktime_compare(ktime_get(), timeout) > 0;
370-
reg = cqhci_readl(cq_host, CQHCI_CTL);
371-
if ((reg & CQHCI_HALT) || timed_out)
372-
break;
373-
}
374-
375-
if (timed_out)
372+
err = readx_poll_timeout(cqhci_read_ctl, cq_host, reg,
373+
reg & CQHCI_HALT, 0, CQHCI_OFF_TIMEOUT);
374+
if (err < 0)
376375
pr_err("%s: cqhci: CQE stuck on\n", mmc_hostname(mmc));
377376
else
378377
pr_debug("%s: cqhci: CQE off\n", mmc_hostname(mmc));

drivers/mmc/host/meson-mx-sdio.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -357,14 +357,6 @@ static void meson_mx_mmc_request(struct mmc_host *mmc, struct mmc_request *mrq)
357357
meson_mx_mmc_start_cmd(mmc, mrq->cmd);
358358
}
359359

360-
static int meson_mx_mmc_card_busy(struct mmc_host *mmc)
361-
{
362-
struct meson_mx_mmc_host *host = mmc_priv(mmc);
363-
u32 irqc = readl(host->base + MESON_MX_SDIO_IRQC);
364-
365-
return !!(irqc & MESON_MX_SDIO_IRQC_FORCE_DATA_DAT_MASK);
366-
}
367-
368360
static void meson_mx_mmc_read_response(struct mmc_host *mmc,
369361
struct mmc_command *cmd)
370362
{
@@ -506,7 +498,6 @@ static void meson_mx_mmc_timeout(struct timer_list *t)
506498
static struct mmc_host_ops meson_mx_mmc_ops = {
507499
.request = meson_mx_mmc_request,
508500
.set_ios = meson_mx_mmc_set_ios,
509-
.card_busy = meson_mx_mmc_card_busy,
510501
.get_cd = mmc_gpio_get_cd,
511502
.get_ro = mmc_gpio_get_ro,
512503
};
@@ -570,7 +561,7 @@ static int meson_mx_mmc_add_host(struct meson_mx_mmc_host *host)
570561
mmc->f_max = clk_round_rate(host->cfg_div_clk,
571562
clk_get_rate(host->parent_clk));
572563

573-
mmc->caps |= MMC_CAP_ERASE | MMC_CAP_CMD23;
564+
mmc->caps |= MMC_CAP_ERASE | MMC_CAP_CMD23 | MMC_CAP_WAIT_WHILE_BUSY;
574565
mmc->ops = &meson_mx_mmc_ops;
575566

576567
ret = mmc_of_parse(mmc);

drivers/mmc/host/sdhci-msm.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2087,6 +2087,8 @@ static int sdhci_msm_probe(struct platform_device *pdev)
20872087
goto clk_disable;
20882088
}
20892089

2090+
msm_host->mmc->caps |= MMC_CAP_WAIT_WHILE_BUSY | MMC_CAP_NEED_RSP_BUSY;
2091+
20902092
pm_runtime_get_noresume(&pdev->dev);
20912093
pm_runtime_set_active(&pdev->dev);
20922094
pm_runtime_enable(&pdev->dev);

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,9 @@ static int intel_select_drive_strength(struct mmc_card *card,
601601
struct sdhci_pci_slot *slot = sdhci_priv(host);
602602
struct intel_host *intel_host = sdhci_pci_priv(slot);
603603

604+
if (!(mmc_driver_type_mask(intel_host->drv_strength) & card_drv))
605+
return 0;
606+
604607
return intel_host->drv_strength;
605608
}
606609

drivers/mmc/host/sdhci-xenon.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,16 @@ static void xenon_voltage_switch(struct sdhci_host *host)
235235
{
236236
/* Wait for 5ms after set 1.8V signal enable bit */
237237
usleep_range(5000, 5500);
238+
239+
/*
240+
* For some reason the controller's Host Control2 register reports
241+
* the bit representing 1.8V signaling as 0 when read after it was
242+
* written as 1. Subsequent read reports 1.
243+
*
244+
* Since this may cause some issues, do an empty read of the Host
245+
* Control2 register here to circumvent this.
246+
*/
247+
sdhci_readw(host, SDHCI_HOST_CONTROL2);
238248
}
239249

240250
static const struct sdhci_ops sdhci_xenon_ops = {

0 commit comments

Comments
 (0)