Skip to content

Commit 838a860

Browse files
committed
Merge tag 'mmc-v5.5-rc2-2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc
Pull MMC fixes from Ulf Hansson: "A couple of MMC host fixes: - sdhci: Fix minimum clock rate for v3 controllers - sdhci-tegra: Fix SDR50 tuning override - sdhci_am654: Fixup tuning issues and support for CQHCI - sdhci_am654: Remove wrong write protect flag" * tag 'mmc-v5.5-rc2-2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: mmc: sdhci: fix minimum clock rate for v3 controller mmc: tegra: fix SDR50 tuning override mmc: sdhci_am654: Fix Command Queuing in AM65x mmc: sdhci_am654: Reset Command and Data line after tuning mmc: sdhci_am654: Remove Inverted Write Protect flag
2 parents 4703d91 + 2a187d0 commit 838a860

3 files changed

Lines changed: 42 additions & 24 deletions

File tree

drivers/mmc/host/sdhci-tegra.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ static void tegra_sdhci_reset(struct sdhci_host *host, u8 mask)
386386
misc_ctrl |= SDHCI_MISC_CTRL_ENABLE_DDR50;
387387
if (soc_data->nvquirks & NVQUIRK_ENABLE_SDR104)
388388
misc_ctrl |= SDHCI_MISC_CTRL_ENABLE_SDR104;
389-
if (soc_data->nvquirks & SDHCI_MISC_CTRL_ENABLE_SDR50)
389+
if (soc_data->nvquirks & NVQUIRK_ENABLE_SDR50)
390390
clk_ctrl |= SDHCI_CLOCK_CTRL_SDR50_TUNING_OVERRIDE;
391391
}
392392

drivers/mmc/host/sdhci.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3913,11 +3913,13 @@ int sdhci_setup_host(struct sdhci_host *host)
39133913
if (host->ops->get_min_clock)
39143914
mmc->f_min = host->ops->get_min_clock(host);
39153915
else if (host->version >= SDHCI_SPEC_300) {
3916-
if (host->clk_mul) {
3917-
mmc->f_min = (host->max_clk * host->clk_mul) / 1024;
3916+
if (host->clk_mul)
39183917
max_clk = host->max_clk * host->clk_mul;
3919-
} else
3920-
mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_300;
3918+
/*
3919+
* Divided Clock Mode minimum clock rate is always less than
3920+
* Programmable Clock Mode minimum clock rate.
3921+
*/
3922+
mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_300;
39213923
} else
39223924
mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_200;
39233925

drivers/mmc/host/sdhci_am654.c

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,35 @@ static void sdhci_am654_write_b(struct sdhci_host *host, u8 val, int reg)
240240
writeb(val, host->ioaddr + reg);
241241
}
242242

243+
static int sdhci_am654_execute_tuning(struct mmc_host *mmc, u32 opcode)
244+
{
245+
struct sdhci_host *host = mmc_priv(mmc);
246+
int err = sdhci_execute_tuning(mmc, opcode);
247+
248+
if (err)
249+
return err;
250+
/*
251+
* Tuning data remains in the buffer after tuning.
252+
* Do a command and data reset to get rid of it
253+
*/
254+
sdhci_reset(host, SDHCI_RESET_CMD | SDHCI_RESET_DATA);
255+
256+
return 0;
257+
}
258+
259+
static u32 sdhci_am654_cqhci_irq(struct sdhci_host *host, u32 intmask)
260+
{
261+
int cmd_error = 0;
262+
int data_error = 0;
263+
264+
if (!sdhci_cqe_irq(host, intmask, &cmd_error, &data_error))
265+
return intmask;
266+
267+
cqhci_irq(host->mmc, intmask, cmd_error, data_error);
268+
269+
return 0;
270+
}
271+
243272
static struct sdhci_ops sdhci_am654_ops = {
244273
.get_max_clock = sdhci_pltfm_clk_get_max_clock,
245274
.get_timeout_clock = sdhci_pltfm_clk_get_max_clock,
@@ -248,13 +277,13 @@ static struct sdhci_ops sdhci_am654_ops = {
248277
.set_power = sdhci_am654_set_power,
249278
.set_clock = sdhci_am654_set_clock,
250279
.write_b = sdhci_am654_write_b,
280+
.irq = sdhci_am654_cqhci_irq,
251281
.reset = sdhci_reset,
252282
};
253283

254284
static const struct sdhci_pltfm_data sdhci_am654_pdata = {
255285
.ops = &sdhci_am654_ops,
256-
.quirks = SDHCI_QUIRK_INVERTED_WRITE_PROTECT |
257-
SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12,
286+
.quirks = SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12,
258287
.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
259288
};
260289

@@ -263,19 +292,6 @@ static const struct sdhci_am654_driver_data sdhci_am654_drvdata = {
263292
.flags = IOMUX_PRESENT | FREQSEL_2_BIT | STRBSEL_4_BIT | DLL_PRESENT,
264293
};
265294

266-
static u32 sdhci_am654_cqhci_irq(struct sdhci_host *host, u32 intmask)
267-
{
268-
int cmd_error = 0;
269-
int data_error = 0;
270-
271-
if (!sdhci_cqe_irq(host, intmask, &cmd_error, &data_error))
272-
return intmask;
273-
274-
cqhci_irq(host->mmc, intmask, cmd_error, data_error);
275-
276-
return 0;
277-
}
278-
279295
static struct sdhci_ops sdhci_j721e_8bit_ops = {
280296
.get_max_clock = sdhci_pltfm_clk_get_max_clock,
281297
.get_timeout_clock = sdhci_pltfm_clk_get_max_clock,
@@ -290,8 +306,7 @@ static struct sdhci_ops sdhci_j721e_8bit_ops = {
290306

291307
static const struct sdhci_pltfm_data sdhci_j721e_8bit_pdata = {
292308
.ops = &sdhci_j721e_8bit_ops,
293-
.quirks = SDHCI_QUIRK_INVERTED_WRITE_PROTECT |
294-
SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12,
309+
.quirks = SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12,
295310
.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
296311
};
297312

@@ -314,8 +329,7 @@ static struct sdhci_ops sdhci_j721e_4bit_ops = {
314329

315330
static const struct sdhci_pltfm_data sdhci_j721e_4bit_pdata = {
316331
.ops = &sdhci_j721e_4bit_ops,
317-
.quirks = SDHCI_QUIRK_INVERTED_WRITE_PROTECT |
318-
SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12,
332+
.quirks = SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12,
319333
.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
320334
};
321335

@@ -549,6 +563,8 @@ static int sdhci_am654_probe(struct platform_device *pdev)
549563
goto pm_runtime_put;
550564
}
551565

566+
host->mmc_host_ops.execute_tuning = sdhci_am654_execute_tuning;
567+
552568
ret = sdhci_am654_init(host);
553569
if (ret)
554570
goto pm_runtime_put;

0 commit comments

Comments
 (0)