Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: Merge branch fixes into next

Merge the mmc fixes for v6.6-rc[n] into the next branch, to allow them to
get tested together with the new mmc changes that are targeted for v6.7.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

+98 -54
+1 -1
Documentation/devicetree/bindings/mmc/sdhci-msm.yaml
··· 69 69 maxItems: 4 70 70 71 71 clocks: 72 - minItems: 3 72 + minItems: 2 73 73 items: 74 74 - description: Main peripheral bus clock, PCLK/HCLK - AHB Bus clock 75 75 - description: SDC MMC clock, MCLK
+20 -11
drivers/mmc/core/block.c
··· 179 179 struct mmc_queue *mq); 180 180 static void mmc_blk_hsq_req_done(struct mmc_request *mrq); 181 181 static int mmc_spi_err_check(struct mmc_card *card); 182 + static int mmc_blk_busy_cb(void *cb_data, bool *busy); 182 183 183 184 static struct mmc_blk_data *mmc_blk_get(struct gendisk *disk) 184 185 { ··· 471 470 struct mmc_data data = {}; 472 471 struct mmc_request mrq = {}; 473 472 struct scatterlist sg; 474 - bool r1b_resp, use_r1b_resp = false; 473 + bool r1b_resp; 475 474 unsigned int busy_timeout_ms; 476 475 int err; 477 476 unsigned int target_part; ··· 552 551 busy_timeout_ms = idata->ic.cmd_timeout_ms ? : MMC_BLK_TIMEOUT_MS; 553 552 r1b_resp = (cmd.flags & MMC_RSP_R1B) == MMC_RSP_R1B; 554 553 if (r1b_resp) 555 - use_r1b_resp = mmc_prepare_busy_cmd(card->host, &cmd, 556 - busy_timeout_ms); 554 + mmc_prepare_busy_cmd(card->host, &cmd, busy_timeout_ms); 557 555 558 556 mmc_wait_for_req(card->host, &mrq); 559 557 memcpy(&idata->ic.response, cmd.resp, sizeof(cmd.resp)); ··· 605 605 if (idata->ic.postsleep_min_us) 606 606 usleep_range(idata->ic.postsleep_min_us, idata->ic.postsleep_max_us); 607 607 608 - /* No need to poll when using HW busy detection. */ 609 - if ((card->host->caps & MMC_CAP_WAIT_WHILE_BUSY) && use_r1b_resp) 610 - return 0; 611 - 612 608 if (mmc_host_is_spi(card->host)) { 613 609 if (idata->ic.write_flag || r1b_resp || cmd.flags & MMC_RSP_SPI_BUSY) 614 610 return mmc_spi_err_check(card); 615 611 return err; 616 612 } 617 - /* Ensure RPMB/R1B command has completed by polling with CMD13. */ 618 - if (idata->rpmb || r1b_resp) 619 - err = mmc_poll_for_busy(card, busy_timeout_ms, false, 620 - MMC_BUSY_IO); 613 + 614 + /* 615 + * Ensure RPMB, writes and R1B responses are completed by polling with 616 + * CMD13. Note that, usually we don't need to poll when using HW busy 617 + * detection, but here it's needed since some commands may indicate the 618 + * error through the R1 status bits. 619 + */ 620 + if (idata->rpmb || idata->ic.write_flag || r1b_resp) { 621 + struct mmc_blk_busy_data cb_data = { 622 + .card = card, 623 + }; 624 + 625 + err = __mmc_poll_for_busy(card->host, 0, busy_timeout_ms, 626 + &mmc_blk_busy_cb, &cb_data); 627 + 628 + idata->ic.response[0] = cb_data.status; 629 + } 621 630 622 631 return err; 623 632 }
+7 -1
drivers/mmc/core/sdio.c
··· 1089 1089 } 1090 1090 err = mmc_sdio_reinit_card(host); 1091 1091 } else if (mmc_card_wake_sdio_irq(host)) { 1092 - /* We may have switched to 1-bit mode during suspend */ 1092 + /* 1093 + * We may have switched to 1-bit mode during suspend, 1094 + * need to hold retuning, because tuning only supprt 1095 + * 4-bit mode or 8 bit mode. 1096 + */ 1097 + mmc_retune_hold_now(host); 1093 1098 err = sdio_enable_4bit_bus(host->card); 1099 + mmc_retune_release(host); 1094 1100 } 1095 1101 1096 1102 if (err)
+3 -3
drivers/mmc/host/mtk-sd.c
··· 669 669 u32 val; 670 670 671 671 sdr_set_bits(host->base + MSDC_CFG, MSDC_CFG_RST); 672 - readl_poll_timeout(host->base + MSDC_CFG, val, !(val & MSDC_CFG_RST), 0, 0); 672 + readl_poll_timeout_atomic(host->base + MSDC_CFG, val, !(val & MSDC_CFG_RST), 0, 0); 673 673 674 674 sdr_set_bits(host->base + MSDC_FIFOCS, MSDC_FIFOCS_CLR); 675 - readl_poll_timeout(host->base + MSDC_FIFOCS, val, 676 - !(val & MSDC_FIFOCS_CLR), 0, 0); 675 + readl_poll_timeout_atomic(host->base + MSDC_FIFOCS, val, 676 + !(val & MSDC_FIFOCS_CLR), 0, 0); 677 677 678 678 val = readl(host->base + MSDC_INT); 679 679 writel(val, host->base + MSDC_INT);
+66 -38
drivers/mmc/host/sdhci-pci-gli.c
··· 1158 1158 return value; 1159 1159 } 1160 1160 1161 - #ifdef CONFIG_PM_SLEEP 1162 - static int sdhci_pci_gli_resume(struct sdhci_pci_chip *chip) 1163 - { 1164 - struct sdhci_pci_slot *slot = chip->slots[0]; 1165 - 1166 - pci_free_irq_vectors(slot->chip->pdev); 1167 - gli_pcie_enable_msi(slot); 1168 - 1169 - return sdhci_pci_resume_host(chip); 1170 - } 1171 - 1172 - static int sdhci_cqhci_gli_resume(struct sdhci_pci_chip *chip) 1173 - { 1174 - struct sdhci_pci_slot *slot = chip->slots[0]; 1175 - int ret; 1176 - 1177 - ret = sdhci_pci_gli_resume(chip); 1178 - if (ret) 1179 - return ret; 1180 - 1181 - return cqhci_resume(slot->host->mmc); 1182 - } 1183 - 1184 - static int sdhci_cqhci_gli_suspend(struct sdhci_pci_chip *chip) 1185 - { 1186 - struct sdhci_pci_slot *slot = chip->slots[0]; 1187 - int ret; 1188 - 1189 - ret = cqhci_suspend(slot->host->mmc); 1190 - if (ret) 1191 - return ret; 1192 - 1193 - return sdhci_suspend_host(slot->host); 1194 - } 1195 - #endif 1196 - 1197 1161 static void gl9763e_hs400_enhanced_strobe(struct mmc_host *mmc, 1198 1162 struct mmc_ios *ios) 1199 1163 { ··· 1398 1434 } 1399 1435 #endif 1400 1436 1437 + #ifdef CONFIG_PM_SLEEP 1438 + static int sdhci_pci_gli_resume(struct sdhci_pci_chip *chip) 1439 + { 1440 + struct sdhci_pci_slot *slot = chip->slots[0]; 1441 + 1442 + pci_free_irq_vectors(slot->chip->pdev); 1443 + gli_pcie_enable_msi(slot); 1444 + 1445 + return sdhci_pci_resume_host(chip); 1446 + } 1447 + 1448 + static int gl9763e_resume(struct sdhci_pci_chip *chip) 1449 + { 1450 + struct sdhci_pci_slot *slot = chip->slots[0]; 1451 + int ret; 1452 + 1453 + ret = sdhci_pci_gli_resume(chip); 1454 + if (ret) 1455 + return ret; 1456 + 1457 + ret = cqhci_resume(slot->host->mmc); 1458 + if (ret) 1459 + return ret; 1460 + 1461 + /* 1462 + * Disable LPM negotiation to bring device back in sync 1463 + * with its runtime_pm state. 1464 + */ 1465 + gl9763e_set_low_power_negotiation(slot, false); 1466 + 1467 + return 0; 1468 + } 1469 + 1470 + static int gl9763e_suspend(struct sdhci_pci_chip *chip) 1471 + { 1472 + struct sdhci_pci_slot *slot = chip->slots[0]; 1473 + int ret; 1474 + 1475 + /* 1476 + * Certain SoCs can suspend only with the bus in low- 1477 + * power state, notably x86 SoCs when using S0ix. 1478 + * Re-enable LPM negotiation to allow entering L1 state 1479 + * and entering system suspend. 1480 + */ 1481 + gl9763e_set_low_power_negotiation(slot, true); 1482 + 1483 + ret = cqhci_suspend(slot->host->mmc); 1484 + if (ret) 1485 + goto err_suspend; 1486 + 1487 + ret = sdhci_suspend_host(slot->host); 1488 + if (ret) 1489 + goto err_suspend_host; 1490 + 1491 + return 0; 1492 + 1493 + err_suspend_host: 1494 + cqhci_resume(slot->host->mmc); 1495 + err_suspend: 1496 + gl9763e_set_low_power_negotiation(slot, false); 1497 + return ret; 1498 + } 1499 + #endif 1500 + 1401 1501 static int gli_probe_slot_gl9763e(struct sdhci_pci_slot *slot) 1402 1502 { 1403 1503 struct pci_dev *pdev = slot->chip->pdev; ··· 1569 1541 .probe_slot = gli_probe_slot_gl9763e, 1570 1542 .ops = &sdhci_gl9763e_ops, 1571 1543 #ifdef CONFIG_PM_SLEEP 1572 - .resume = sdhci_cqhci_gli_resume, 1573 - .suspend = sdhci_cqhci_gli_suspend, 1544 + .resume = gl9763e_resume, 1545 + .suspend = gl9763e_suspend, 1574 1546 #endif 1575 1547 #ifdef CONFIG_PM 1576 1548 .runtime_suspend = gl9763e_runtime_suspend,
+1
drivers/mmc/host/sdhci-sprd.c
··· 644 644 best_clk_sample = sdhci_sprd_get_best_clk_sample(mmc, value); 645 645 if (best_clk_sample < 0) { 646 646 dev_err(mmc_dev(host->mmc), "all tuning phase fail!\n"); 647 + err = best_clk_sample; 647 648 goto out; 648 649 } 649 650