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

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'mmc-v6.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc

Pull MMC fixes from Ulf Hansson:
"MMC core:
- Capture correct oemid-bits for eMMC cards
- Fix error propagation for some ioctl commands
- Hold retuning if SDIO is in 1-bit mode

MMC host:
- mtk-sd: Use readl_poll_timeout_atomic to not "schedule while atomic"
- sdhci-msm: Correct minimum number of clocks
- sdhci-pci-gli: Fix LPM negotiation so x86/S0ix SoCs can suspend
- sdhci-sprd: Fix error code in sdhci_sprd_tuning()"

* tag 'mmc-v6.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc:
mmc: core: Capture correct oemid-bits for eMMC cards
mmc: mtk-sd: Use readl_poll_timeout_atomic in msdc_reset_hw
mmc: core: Fix error propagation for some ioctl commands
mmc: sdhci-sprd: Fix error code in sdhci_sprd_tuning()
mmc: sdhci-pci-gli: fix LPM negotiation so x86/S0ix SoCs can suspend
mmc: core: sdio: hold retuning if sdio in 1-bit mode
dt-bindings: mmc: sdhci-msm: correct minimum number of clocks

+99 -55
+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 }
+1 -1
drivers/mmc/core/mmc.c
··· 104 104 case 3: /* MMC v3.1 - v3.3 */ 105 105 case 4: /* MMC v4 */ 106 106 card->cid.manfid = UNSTUFF_BITS(resp, 120, 8); 107 - card->cid.oemid = UNSTUFF_BITS(resp, 104, 16); 107 + card->cid.oemid = UNSTUFF_BITS(resp, 104, 8); 108 108 card->cid.prod_name[0] = UNSTUFF_BITS(resp, 96, 8); 109 109 card->cid.prod_name[1] = UNSTUFF_BITS(resp, 88, 8); 110 110 card->cid.prod_name[2] = UNSTUFF_BITS(resp, 80, 8);
+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
··· 1144 1144 return value; 1145 1145 } 1146 1146 1147 - #ifdef CONFIG_PM_SLEEP 1148 - static int sdhci_pci_gli_resume(struct sdhci_pci_chip *chip) 1149 - { 1150 - struct sdhci_pci_slot *slot = chip->slots[0]; 1151 - 1152 - pci_free_irq_vectors(slot->chip->pdev); 1153 - gli_pcie_enable_msi(slot); 1154 - 1155 - return sdhci_pci_resume_host(chip); 1156 - } 1157 - 1158 - static int sdhci_cqhci_gli_resume(struct sdhci_pci_chip *chip) 1159 - { 1160 - struct sdhci_pci_slot *slot = chip->slots[0]; 1161 - int ret; 1162 - 1163 - ret = sdhci_pci_gli_resume(chip); 1164 - if (ret) 1165 - return ret; 1166 - 1167 - return cqhci_resume(slot->host->mmc); 1168 - } 1169 - 1170 - static int sdhci_cqhci_gli_suspend(struct sdhci_pci_chip *chip) 1171 - { 1172 - struct sdhci_pci_slot *slot = chip->slots[0]; 1173 - int ret; 1174 - 1175 - ret = cqhci_suspend(slot->host->mmc); 1176 - if (ret) 1177 - return ret; 1178 - 1179 - return sdhci_suspend_host(slot->host); 1180 - } 1181 - #endif 1182 - 1183 1147 static void gl9763e_hs400_enhanced_strobe(struct mmc_host *mmc, 1184 1148 struct mmc_ios *ios) 1185 1149 { ··· 1384 1420 } 1385 1421 #endif 1386 1422 1423 + #ifdef CONFIG_PM_SLEEP 1424 + static int sdhci_pci_gli_resume(struct sdhci_pci_chip *chip) 1425 + { 1426 + struct sdhci_pci_slot *slot = chip->slots[0]; 1427 + 1428 + pci_free_irq_vectors(slot->chip->pdev); 1429 + gli_pcie_enable_msi(slot); 1430 + 1431 + return sdhci_pci_resume_host(chip); 1432 + } 1433 + 1434 + static int gl9763e_resume(struct sdhci_pci_chip *chip) 1435 + { 1436 + struct sdhci_pci_slot *slot = chip->slots[0]; 1437 + int ret; 1438 + 1439 + ret = sdhci_pci_gli_resume(chip); 1440 + if (ret) 1441 + return ret; 1442 + 1443 + ret = cqhci_resume(slot->host->mmc); 1444 + if (ret) 1445 + return ret; 1446 + 1447 + /* 1448 + * Disable LPM negotiation to bring device back in sync 1449 + * with its runtime_pm state. 1450 + */ 1451 + gl9763e_set_low_power_negotiation(slot, false); 1452 + 1453 + return 0; 1454 + } 1455 + 1456 + static int gl9763e_suspend(struct sdhci_pci_chip *chip) 1457 + { 1458 + struct sdhci_pci_slot *slot = chip->slots[0]; 1459 + int ret; 1460 + 1461 + /* 1462 + * Certain SoCs can suspend only with the bus in low- 1463 + * power state, notably x86 SoCs when using S0ix. 1464 + * Re-enable LPM negotiation to allow entering L1 state 1465 + * and entering system suspend. 1466 + */ 1467 + gl9763e_set_low_power_negotiation(slot, true); 1468 + 1469 + ret = cqhci_suspend(slot->host->mmc); 1470 + if (ret) 1471 + goto err_suspend; 1472 + 1473 + ret = sdhci_suspend_host(slot->host); 1474 + if (ret) 1475 + goto err_suspend_host; 1476 + 1477 + return 0; 1478 + 1479 + err_suspend_host: 1480 + cqhci_resume(slot->host->mmc); 1481 + err_suspend: 1482 + gl9763e_set_low_power_negotiation(slot, false); 1483 + return ret; 1484 + } 1485 + #endif 1486 + 1387 1487 static int gli_probe_slot_gl9763e(struct sdhci_pci_slot *slot) 1388 1488 { 1389 1489 struct pci_dev *pdev = slot->chip->pdev; ··· 1555 1527 .probe_slot = gli_probe_slot_gl9763e, 1556 1528 .ops = &sdhci_gl9763e_ops, 1557 1529 #ifdef CONFIG_PM_SLEEP 1558 - .resume = sdhci_cqhci_gli_resume, 1559 - .suspend = sdhci_cqhci_gli_suspend, 1530 + .resume = gl9763e_resume, 1531 + .suspend = gl9763e_suspend, 1560 1532 #endif 1561 1533 #ifdef CONFIG_PM 1562 1534 .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