Skip to content

Commit

Permalink
Merge tag 'mmc-v6.6' of git://git.kernel.org/pub/scm/linux/kernel/git…
Browse files Browse the repository at this point in the history
…/ulfh/mmc

Pull MMC updates from Ulf Hansson:
 "MMC core:
   - Convert drivers to use the ->remove_new() callback
   - Propagate the removable attribute for the card's device

  MMC host:
   - Convert drivers to use the ->remove_new() callback
   - atmel-mci: Convert to gpio descriptors and cleanup the code
   - davinci: Make SDIO irq truly optional
   - renesas_sdhi: Register irqs before registering controller
   - sdhci: Simplify the sdhci_pltfm_* interface a bit
   - sdhci-esdhc-imx: Improve support for the 1.8V errata
   - sdhci-of-at91: Add support for the microchip sam9x7 variant
   - sdhci-of-dwcmshc: Add support for runtime PM
   - sdhci-pci-o2micro: Add support for the new Bayhub GG8 variant
   - sdhci-sprd: Add support for SD high-speed mode tuning
   - uniphier-sd: Register irqs before registering controller"

* tag 'mmc-v6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: (108 commits)
  mmc: atmel-mci: Move card detect gpio polarity quirk to gpiolib
  mmc: atmel-mci: move atmel MCI header file
  mmc: atmel-mci: Convert to gpio descriptors
  mmc: sdhci-sprd: Add SD HS mode online tuning
  mmc: core: Add host specific tuning support for SD HS mode
  mmc: sdhci-of-dwcmshc: Add runtime PM operations
  mmc: sdhci-of-dwcmshc: Add error handling in dwcmshc_resume
  mmc: sdhci-esdhc-imx: improve ESDHC_FLAG_ERR010450
  mmc: sdhci-pltfm: Rename sdhci_pltfm_register()
  mmc: sdhci-pltfm: Remove sdhci_pltfm_unregister()
  mmc: sdhci-st: Use sdhci_pltfm_remove()
  mmc: sdhci-pxav2: Use sdhci_pltfm_remove()
  mmc: sdhci-of-sparx5: Use sdhci_pltfm_remove()
  mmc: sdhci-of-hlwd: Use sdhci_pltfm_remove()
  mmc: sdhci-of-esdhc: Use sdhci_pltfm_remove()
  mmc: sdhci-of-at91: Use sdhci_pltfm_remove()
  mmc: sdhci-of-arasan: Use sdhci_pltfm_remove()
  mmc: sdhci-iproc: Use sdhci_pltfm_remove()
  mmc: sdhci_f_sdh30: Use sdhci_pltfm_remove()
  mmc: sdhci-dove: Use sdhci_pltfm_remove()
  ...
  • Loading branch information
Linus Torvalds committed Aug 29, 2023
2 parents 3b6bf5b + 98ac9e4 commit 995cda6
Show file tree
Hide file tree
Showing 90 changed files with 816 additions and 579 deletions.
6 changes: 6 additions & 0 deletions Documentation/devicetree/bindings/mmc/arasan,sdhci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@ properties:
description:
The MIO bank number in which the command and data lines are configured.

iommus:
maxItems: 1

power-domains:
maxItems: 1

dependencies:
'#clock-cells': [ clock-output-names ]

Expand Down
2 changes: 1 addition & 1 deletion Documentation/devicetree/bindings/mmc/mmc-controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ properties:
post-power-on-delay-ms:
description:
It was invented for MMC pwrseq-simple which could be referred to
mmc-pwrseq-simple.txt. But now it\'s reused as a tunable delay
mmc-pwrseq-simple.yaml. But now it\'s reused as a tunable delay
waiting for I/O signalling and card power supply to be stable,
regardless of whether pwrseq-simple is used. Default to 10ms if
no available.
Expand Down
10 changes: 0 additions & 10 deletions Documentation/devicetree/bindings/mmc/mtk-sd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,6 @@ properties:
should switch dat1 pin to GPIO mode.
maxItems: 1

assigned-clocks:
description:
PLL of the source clock.
maxItems: 1

assigned-clock-parents:
description:
parent of source clock, used for HS400 mode to get 400Mhz source clock.
maxItems: 1

hs400-ds-delay:
$ref: /schemas/types.yaml#/definitions/uint32
description:
Expand Down
4 changes: 3 additions & 1 deletion Documentation/devicetree/bindings/mmc/sdhci-atmel.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ Documentation/devicetree/bindings/mmc/mmc.txt and the properties used by the
sdhci-of-at91 driver.

Required properties:
- compatible: Must be "atmel,sama5d2-sdhci" or "microchip,sam9x60-sdhci".
- compatible: Must be "atmel,sama5d2-sdhci" or "microchip,sam9x60-sdhci"
or "microchip,sam9x7-sdhci", "microchip,sam9x60-sdhci".
- clocks: Phandlers to the clocks.
- clock-names: Must be "hclock", "multclk", "baseclk" for
"atmel,sama5d2-sdhci".
Must be "hclock", "multclk" for "microchip,sam9x60-sdhci".
Must be "hclock", "multclk" for "microchip,sam9x7-sdhci".

Optional properties:
- assigned-clocks: The same with "multclk".
Expand Down
20 changes: 18 additions & 2 deletions drivers/gpio/gpiolib-of.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ static void of_gpio_set_polarity_by_property(const struct device_node *np,
const char *propname,
enum of_gpio_flags *flags)
{
const struct device_node *np_compat = np;
const struct device_node *np_propname = np;
static const struct {
const char *compatible;
const char *gpio_propname;
Expand Down Expand Up @@ -252,15 +254,29 @@ static void of_gpio_set_polarity_by_property(const struct device_node *np,
#if IS_ENABLED(CONFIG_REGULATOR_GPIO)
{ "regulator-gpio", "enable-gpio", "enable-active-high" },
{ "regulator-gpio", "enable-gpios", "enable-active-high" },
#endif
#if IS_ENABLED(CONFIG_MMC_ATMELMCI)
{ "atmel,hsmci", "cd-gpios", "cd-inverted" },
#endif
};
unsigned int i;
bool active_high;

#if IS_ENABLED(CONFIG_MMC_ATMELMCI)
/*
* The Atmel HSMCI has compatible property in the parent node and
* gpio property in a child node
*/
if (of_device_is_compatible(np->parent, "atmel,hsmci")) {
np_compat = np->parent;
np_propname = np;
}
#endif

for (i = 0; i < ARRAY_SIZE(gpios); i++) {
if (of_device_is_compatible(np, gpios[i].compatible) &&
if (of_device_is_compatible(np_compat, gpios[i].compatible) &&
!strcmp(propname, gpios[i].gpio_propname)) {
active_high = of_property_read_bool(np,
active_high = of_property_read_bool(np_propname,
gpios[i].polarity_propname);
of_gpio_quirk_polarity(np, active_high, flags);
break;
Expand Down
11 changes: 1 addition & 10 deletions drivers/mmc/core/block.c
Original file line number Diff line number Diff line change
Expand Up @@ -918,17 +918,9 @@ static int mmc_sd_num_wr_blocks(struct mmc_card *card, u32 *written_blocks)

struct scatterlist sg;

cmd.opcode = MMC_APP_CMD;
cmd.arg = card->rca << 16;
cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC;

err = mmc_wait_for_cmd(card->host, &cmd, 0);
err = mmc_app_cmd(card->host, card);
if (err)
return err;
if (!mmc_host_is_spi(card->host) && !(cmd.resp[0] & R1_APP_CMD))
return -EIO;

memset(&cmd, 0, sizeof(struct mmc_command));

cmd.opcode = SD_APP_SEND_NUM_WR_BLKS;
cmd.arg = 0;
Expand Down Expand Up @@ -3026,7 +3018,6 @@ static void mmc_blk_remove(struct mmc_card *card)
pm_runtime_disable(&card->dev);
pm_runtime_put_noidle(&card->dev);
mmc_blk_remove_req(md);
dev_set_drvdata(&card->dev, NULL);
destroy_workqueue(card->complete_wq);
}

Expand Down
3 changes: 3 additions & 0 deletions drivers/mmc/core/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,9 @@ int mmc_add_card(struct mmc_card *card)


dev_set_name(&card->dev, "%s:%04x", mmc_hostname(card->host), card->rca);
dev_set_removable(&card->dev,
mmc_card_is_removable(card->host) ?
DEVICE_REMOVABLE : DEVICE_FIXED);

switch (card->type) {
case MMC_TYPE_MMC:
Expand Down
1 change: 0 additions & 1 deletion drivers/mmc/core/mmc_ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ int mmc_send_adtc_data(struct mmc_card *card, struct mmc_host *host, u32 opcode,
u32 args, void *buf, unsigned len);
int mmc_send_csd(struct mmc_card *card, u32 *csd);
int __mmc_send_status(struct mmc_card *card, u32 *status, unsigned int retries);
int mmc_send_status(struct mmc_card *card, u32 *status);
int mmc_send_cid(struct mmc_host *host, u32 *cid);
int mmc_spi_read_ocr(struct mmc_host *host, int highcap, u32 *ocrp);
int mmc_spi_set_crc(struct mmc_host *host, int use_crc);
Expand Down
6 changes: 2 additions & 4 deletions drivers/mmc/core/pwrseq_emmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,12 @@ static int mmc_pwrseq_emmc_probe(struct platform_device *pdev)
return mmc_pwrseq_register(&pwrseq->pwrseq);
}

static int mmc_pwrseq_emmc_remove(struct platform_device *pdev)
static void mmc_pwrseq_emmc_remove(struct platform_device *pdev)
{
struct mmc_pwrseq_emmc *pwrseq = platform_get_drvdata(pdev);

unregister_restart_handler(&pwrseq->reset_nb);
mmc_pwrseq_unregister(&pwrseq->pwrseq);

return 0;
}

static const struct of_device_id mmc_pwrseq_emmc_of_match[] = {
Expand All @@ -109,7 +107,7 @@ MODULE_DEVICE_TABLE(of, mmc_pwrseq_emmc_of_match);

static struct platform_driver mmc_pwrseq_emmc_driver = {
.probe = mmc_pwrseq_emmc_probe,
.remove = mmc_pwrseq_emmc_remove,
.remove_new = mmc_pwrseq_emmc_remove,
.driver = {
.name = "pwrseq_emmc",
.of_match_table = mmc_pwrseq_emmc_of_match,
Expand Down
6 changes: 2 additions & 4 deletions drivers/mmc/core/pwrseq_sd8787.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,18 +113,16 @@ static int mmc_pwrseq_sd8787_probe(struct platform_device *pdev)
return mmc_pwrseq_register(&pwrseq->pwrseq);
}

static int mmc_pwrseq_sd8787_remove(struct platform_device *pdev)
static void mmc_pwrseq_sd8787_remove(struct platform_device *pdev)
{
struct mmc_pwrseq_sd8787 *pwrseq = platform_get_drvdata(pdev);

mmc_pwrseq_unregister(&pwrseq->pwrseq);

return 0;
}

static struct platform_driver mmc_pwrseq_sd8787_driver = {
.probe = mmc_pwrseq_sd8787_probe,
.remove = mmc_pwrseq_sd8787_remove,
.remove_new = mmc_pwrseq_sd8787_remove,
.driver = {
.name = "pwrseq_sd8787",
.of_match_table = mmc_pwrseq_sd8787_of_match,
Expand Down
6 changes: 2 additions & 4 deletions drivers/mmc/core/pwrseq_simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,18 +142,16 @@ static int mmc_pwrseq_simple_probe(struct platform_device *pdev)
return mmc_pwrseq_register(&pwrseq->pwrseq);
}

static int mmc_pwrseq_simple_remove(struct platform_device *pdev)
static void mmc_pwrseq_simple_remove(struct platform_device *pdev)
{
struct mmc_pwrseq_simple *pwrseq = platform_get_drvdata(pdev);

mmc_pwrseq_unregister(&pwrseq->pwrseq);

return 0;
}

static struct platform_driver mmc_pwrseq_simple_driver = {
.probe = mmc_pwrseq_simple_probe,
.remove = mmc_pwrseq_simple_remove,
.remove_new = mmc_pwrseq_simple_remove,
.driver = {
.name = "pwrseq_simple",
.of_match_table = mmc_pwrseq_simple_of_match,
Expand Down
14 changes: 14 additions & 0 deletions drivers/mmc/core/sd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1518,6 +1518,13 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
*/
mmc_set_clock(host, mmc_sd_get_max_clock(card));

if (host->ios.timing == MMC_TIMING_SD_HS &&
host->ops->prepare_sd_hs_tuning) {
err = host->ops->prepare_sd_hs_tuning(host, card);
if (err)
goto free_card;
}

/*
* Switch to wider bus (if supported).
*/
Expand All @@ -1529,6 +1536,13 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,

mmc_set_bus_width(host, MMC_BUS_WIDTH_4);
}

if (host->ios.timing == MMC_TIMING_SD_HS &&
host->ops->execute_sd_hs_tuning) {
err = host->ops->execute_sd_hs_tuning(host, card);
if (err)
goto free_card;
}
}
cont:
if (!oldcard) {
Expand Down
1 change: 1 addition & 0 deletions drivers/mmc/core/sd_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ int mmc_sd_switch(struct mmc_card *card, int mode, int group,
return mmc_send_adtc_data(card, card->host, SD_SWITCH, cmd_args, resp,
64);
}
EXPORT_SYMBOL_GPL(mmc_sd_switch);

int mmc_app_sd_status(struct mmc_card *card, void *ssr)
{
Expand Down
2 changes: 0 additions & 2 deletions drivers/mmc/core/sd_ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ int mmc_send_if_cond(struct mmc_host *host, u32 ocr);
int mmc_send_if_cond_pcie(struct mmc_host *host, u32 ocr);
int mmc_send_relative_addr(struct mmc_host *host, unsigned int *rca);
int mmc_app_send_scr(struct mmc_card *card);
int mmc_sd_switch(struct mmc_card *card, int mode, int group,
u8 value, u8 *resp);
int mmc_app_sd_status(struct mmc_card *card, void *ssr);
int mmc_app_cmd(struct mmc_host *host, struct mmc_card *card);

Expand Down
6 changes: 2 additions & 4 deletions drivers/mmc/host/alcor.c
Original file line number Diff line number Diff line change
Expand Up @@ -1125,7 +1125,7 @@ static int alcor_pci_sdmmc_drv_probe(struct platform_device *pdev)
return ret;
}

static int alcor_pci_sdmmc_drv_remove(struct platform_device *pdev)
static void alcor_pci_sdmmc_drv_remove(struct platform_device *pdev)
{
struct alcor_sdmmc_host *host = dev_get_drvdata(&pdev->dev);
struct mmc_host *mmc = mmc_from_priv(host);
Expand All @@ -1136,8 +1136,6 @@ static int alcor_pci_sdmmc_drv_remove(struct platform_device *pdev)
alcor_hw_uninit(host);
mmc_remove_host(mmc);
mmc_free_host(mmc);

return 0;
}

#ifdef CONFIG_PM_SLEEP
Expand Down Expand Up @@ -1177,7 +1175,7 @@ MODULE_DEVICE_TABLE(platform, alcor_pci_sdmmc_ids);

static struct platform_driver alcor_pci_sdmmc_driver = {
.probe = alcor_pci_sdmmc_drv_probe,
.remove = alcor_pci_sdmmc_drv_remove,
.remove_new = alcor_pci_sdmmc_drv_remove,
.id_table = alcor_pci_sdmmc_ids,
.driver = {
.name = DRV_NAME_ALCOR_PCI_SDMMC,
Expand Down
Loading

0 comments on commit 995cda6

Please sign in to comment.