Skip to content

Commit 6c23529

Browse files
committed
Merge tag 'mmc-v6.7-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc
Pull MMC fixes from Ulf Hansson: "MMC core: - Fix releasing the host by canceling the delayed work - Fix pause retune on all RPMB partitions MMC host: - meson-mx-sdhc: Fix HW hang during card initialization - sdhci-sprd: Fix eMMC init failure after HW reset" * tag 'mmc-v6.7-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: mmc: sdhci-sprd: Fix eMMC init failure after hw reset mmc: core: Cancel delayed work before releasing host mmc: rpmb: fixes pause retune on all RPMB partitions. mmc: meson-mx-sdhc: Fix initialization frozen issue
2 parents 2b5bd14 + 8abf77c commit 6c23529

File tree

4 files changed

+17
-27
lines changed

4 files changed

+17
-27
lines changed

drivers/mmc/core/block.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -851,9 +851,10 @@ static const struct block_device_operations mmc_bdops = {
851851
static int mmc_blk_part_switch_pre(struct mmc_card *card,
852852
unsigned int part_type)
853853
{
854+
const unsigned int mask = EXT_CSD_PART_CONFIG_ACC_RPMB;
854855
int ret = 0;
855856

856-
if (part_type == EXT_CSD_PART_CONFIG_ACC_RPMB) {
857+
if ((part_type & mask) == mask) {
857858
if (card->ext_csd.cmdq_en) {
858859
ret = mmc_cmdq_disable(card);
859860
if (ret)
@@ -868,9 +869,10 @@ static int mmc_blk_part_switch_pre(struct mmc_card *card,
868869
static int mmc_blk_part_switch_post(struct mmc_card *card,
869870
unsigned int part_type)
870871
{
872+
const unsigned int mask = EXT_CSD_PART_CONFIG_ACC_RPMB;
871873
int ret = 0;
872874

873-
if (part_type == EXT_CSD_PART_CONFIG_ACC_RPMB) {
875+
if ((part_type & mask) == mask) {
874876
mmc_retune_unpause(card->host);
875877
if (card->reenable_cmdq && !card->ext_csd.cmdq_en)
876878
ret = mmc_cmdq_enable(card);
@@ -3145,4 +3147,3 @@ module_exit(mmc_blk_exit);
31453147

31463148
MODULE_LICENSE("GPL");
31473149
MODULE_DESCRIPTION("Multimedia Card (MMC) block device driver");
3148-

drivers/mmc/core/host.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,7 @@ EXPORT_SYMBOL(mmc_remove_host);
692692
*/
693693
void mmc_free_host(struct mmc_host *host)
694694
{
695+
cancel_delayed_work_sync(&host->detect);
695696
mmc_pwrseq_free(host);
696697
put_device(&host->class_dev);
697698
}

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

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ static int meson_mx_sdhc_enable_clks(struct mmc_host *mmc)
269269
static int meson_mx_sdhc_set_clk(struct mmc_host *mmc, struct mmc_ios *ios)
270270
{
271271
struct meson_mx_sdhc_host *host = mmc_priv(mmc);
272-
u32 rx_clk_phase;
272+
u32 val, rx_clk_phase;
273273
int ret;
274274

275275
meson_mx_sdhc_disable_clks(mmc);
@@ -290,27 +290,11 @@ static int meson_mx_sdhc_set_clk(struct mmc_host *mmc, struct mmc_ios *ios)
290290
mmc->actual_clock = clk_get_rate(host->sd_clk);
291291

292292
/*
293-
* according to Amlogic the following latching points are
294-
* selected with empirical values, there is no (known) formula
295-
* to calculate these.
293+
* Phase 90 should work in most cases. For data transmission,
294+
* meson_mx_sdhc_execute_tuning() will find a accurate value
296295
*/
297-
if (mmc->actual_clock > 100000000) {
298-
rx_clk_phase = 1;
299-
} else if (mmc->actual_clock > 45000000) {
300-
if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_330)
301-
rx_clk_phase = 15;
302-
else
303-
rx_clk_phase = 11;
304-
} else if (mmc->actual_clock >= 25000000) {
305-
rx_clk_phase = 15;
306-
} else if (mmc->actual_clock > 5000000) {
307-
rx_clk_phase = 23;
308-
} else if (mmc->actual_clock > 1000000) {
309-
rx_clk_phase = 55;
310-
} else {
311-
rx_clk_phase = 1061;
312-
}
313-
296+
regmap_read(host->regmap, MESON_SDHC_CLKC, &val);
297+
rx_clk_phase = FIELD_GET(MESON_SDHC_CLKC_CLK_DIV, val) / 4;
314298
regmap_update_bits(host->regmap, MESON_SDHC_CLK2,
315299
MESON_SDHC_CLK2_RX_CLK_PHASE,
316300
FIELD_PREP(MESON_SDHC_CLK2_RX_CLK_PHASE,

drivers/mmc/host/sdhci-sprd.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,15 +239,19 @@ static inline void _sdhci_sprd_set_clock(struct sdhci_host *host,
239239
div = ((div & 0x300) >> 2) | ((div & 0xFF) << 8);
240240
sdhci_enable_clk(host, div);
241241

242+
val = sdhci_readl(host, SDHCI_SPRD_REG_32_BUSY_POSI);
243+
mask = SDHCI_SPRD_BIT_OUTR_CLK_AUTO_EN | SDHCI_SPRD_BIT_INNR_CLK_AUTO_EN;
242244
/* Enable CLK_AUTO when the clock is greater than 400K. */
243245
if (clk > 400000) {
244-
val = sdhci_readl(host, SDHCI_SPRD_REG_32_BUSY_POSI);
245-
mask = SDHCI_SPRD_BIT_OUTR_CLK_AUTO_EN |
246-
SDHCI_SPRD_BIT_INNR_CLK_AUTO_EN;
247246
if (mask != (val & mask)) {
248247
val |= mask;
249248
sdhci_writel(host, val, SDHCI_SPRD_REG_32_BUSY_POSI);
250249
}
250+
} else {
251+
if (val & mask) {
252+
val &= ~mask;
253+
sdhci_writel(host, val, SDHCI_SPRD_REG_32_BUSY_POSI);
254+
}
251255
}
252256
}
253257

0 commit comments

Comments
 (0)