Loading Documentation/devicetree/bindings/mmc/mmc.txt +1 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ Optional properties: - no-sdio: controller is limited to send sdio cmd during initialization - no-sd: controller is limited to send sd cmd during initialization - no-mmc: controller is limited to send mmc cmd during initialization - extcon: phandle to external connector (Refer Documentation/devicetree/bindings/extcon/extcon-gpio.txt for more details). *NOTE* on CD and WP polarity. To use common for all SD/MMC host controllers line polarity properties, we have to fix the meaning of the "normal" and "inverted" Loading drivers/mmc/core/core.c +3 −0 Original line number Diff line number Diff line Loading @@ -4321,6 +4321,7 @@ void mmc_start_host(struct mmc_host *host) mmc_power_up(host, host->ocr_avail); mmc_gpiod_request_cd_irq(host); mmc_register_extcon(host); mmc_release_host(host); _mmc_detect_change(host, 0, false); } Loading Loading @@ -4357,6 +4358,8 @@ void mmc_stop_host(struct mmc_host *host) BUG_ON(host->card); mmc_register_extcon(host); mmc_claim_host(host); mmc_power_off(host); mmc_release_host(host); Loading drivers/mmc/core/slot-gpio.c +48 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #include <linux/mmc/slot-gpio.h> #include <linux/module.h> #include <linux/slab.h> #include <linux/extcon.h> #include "slot-gpio.h" Loading Loading @@ -154,6 +155,53 @@ void mmc_gpiod_request_cd_irq(struct mmc_host *host) } EXPORT_SYMBOL(mmc_gpiod_request_cd_irq); static int mmc_card_detect_notifier(struct notifier_block *nb, unsigned long event, void *ptr) { struct mmc_host *host = container_of(nb, struct mmc_host, card_detect_nb); host->trigger_card_event = true; mmc_detect_change(host, 0); return NOTIFY_DONE; } void mmc_register_extcon(struct mmc_host *host) { struct extcon_dev *extcon = host->extcon; int err; if (!extcon) return; host->card_detect_nb.notifier_call = mmc_card_detect_notifier; err = extcon_register_notifier(extcon, EXTCON_MECHANICAL, &host->card_detect_nb); if (err) { dev_err(mmc_dev(host), "%s: extcon_register_notifier() failed ret=%d\n", __func__, err); host->caps |= MMC_CAP_NEEDS_POLL; } } EXPORT_SYMBOL(mmc_register_extcon); void mmc_unregister_extcon(struct mmc_host *host) { struct extcon_dev *extcon = host->extcon; int err; if (!extcon) return; err = extcon_unregister_notifier(extcon, EXTCON_MECHANICAL, &host->card_detect_nb); if (err) dev_err(mmc_dev(host), "%s: extcon_unregister_notifier() failed ret=%d\n", __func__, err); } EXPORT_SYMBOL(mmc_unregister_extcon); /* Register an alternate interrupt service routine for * the card-detect GPIO. */ Loading drivers/mmc/host/Kconfig +2 −0 Original line number Diff line number Diff line Loading @@ -401,6 +401,8 @@ config MMC_SDHCI_MSM depends on MMC_SDHCI_PLTFM select PM_DEVFREQ select DEVFREQ_GOV_SIMPLE_ONDEMAND select EXTCON select EXTCON_GPIO help This selects the Secure Digital Host Controller Interface (SDHCI) support present in Qualcomm Technologies, Inc. SOCs. The controller Loading drivers/mmc/host/sdhci-pltfm.c +10 −0 Original line number Diff line number Diff line Loading @@ -121,6 +121,7 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev, struct resource *iomem; void __iomem *ioaddr; int irq, ret; struct extcon_dev *extcon; iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); ioaddr = devm_ioremap_resource(&pdev->dev, iomem); Loading Loading @@ -156,6 +157,15 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev, host->quirks2 = pdata->quirks2; } extcon = extcon_get_edev_by_phandle(&pdev->dev, 0); if (IS_ERR(extcon) && PTR_ERR(extcon) != -ENODEV) { ret = PTR_ERR(extcon); goto err; } if (!IS_ERR(extcon)) host->mmc->extcon = extcon; platform_set_drvdata(pdev, host); return host; Loading Loading
Documentation/devicetree/bindings/mmc/mmc.txt +1 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ Optional properties: - no-sdio: controller is limited to send sdio cmd during initialization - no-sd: controller is limited to send sd cmd during initialization - no-mmc: controller is limited to send mmc cmd during initialization - extcon: phandle to external connector (Refer Documentation/devicetree/bindings/extcon/extcon-gpio.txt for more details). *NOTE* on CD and WP polarity. To use common for all SD/MMC host controllers line polarity properties, we have to fix the meaning of the "normal" and "inverted" Loading
drivers/mmc/core/core.c +3 −0 Original line number Diff line number Diff line Loading @@ -4321,6 +4321,7 @@ void mmc_start_host(struct mmc_host *host) mmc_power_up(host, host->ocr_avail); mmc_gpiod_request_cd_irq(host); mmc_register_extcon(host); mmc_release_host(host); _mmc_detect_change(host, 0, false); } Loading Loading @@ -4357,6 +4358,8 @@ void mmc_stop_host(struct mmc_host *host) BUG_ON(host->card); mmc_register_extcon(host); mmc_claim_host(host); mmc_power_off(host); mmc_release_host(host); Loading
drivers/mmc/core/slot-gpio.c +48 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #include <linux/mmc/slot-gpio.h> #include <linux/module.h> #include <linux/slab.h> #include <linux/extcon.h> #include "slot-gpio.h" Loading Loading @@ -154,6 +155,53 @@ void mmc_gpiod_request_cd_irq(struct mmc_host *host) } EXPORT_SYMBOL(mmc_gpiod_request_cd_irq); static int mmc_card_detect_notifier(struct notifier_block *nb, unsigned long event, void *ptr) { struct mmc_host *host = container_of(nb, struct mmc_host, card_detect_nb); host->trigger_card_event = true; mmc_detect_change(host, 0); return NOTIFY_DONE; } void mmc_register_extcon(struct mmc_host *host) { struct extcon_dev *extcon = host->extcon; int err; if (!extcon) return; host->card_detect_nb.notifier_call = mmc_card_detect_notifier; err = extcon_register_notifier(extcon, EXTCON_MECHANICAL, &host->card_detect_nb); if (err) { dev_err(mmc_dev(host), "%s: extcon_register_notifier() failed ret=%d\n", __func__, err); host->caps |= MMC_CAP_NEEDS_POLL; } } EXPORT_SYMBOL(mmc_register_extcon); void mmc_unregister_extcon(struct mmc_host *host) { struct extcon_dev *extcon = host->extcon; int err; if (!extcon) return; err = extcon_unregister_notifier(extcon, EXTCON_MECHANICAL, &host->card_detect_nb); if (err) dev_err(mmc_dev(host), "%s: extcon_unregister_notifier() failed ret=%d\n", __func__, err); } EXPORT_SYMBOL(mmc_unregister_extcon); /* Register an alternate interrupt service routine for * the card-detect GPIO. */ Loading
drivers/mmc/host/Kconfig +2 −0 Original line number Diff line number Diff line Loading @@ -401,6 +401,8 @@ config MMC_SDHCI_MSM depends on MMC_SDHCI_PLTFM select PM_DEVFREQ select DEVFREQ_GOV_SIMPLE_ONDEMAND select EXTCON select EXTCON_GPIO help This selects the Secure Digital Host Controller Interface (SDHCI) support present in Qualcomm Technologies, Inc. SOCs. The controller Loading
drivers/mmc/host/sdhci-pltfm.c +10 −0 Original line number Diff line number Diff line Loading @@ -121,6 +121,7 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev, struct resource *iomem; void __iomem *ioaddr; int irq, ret; struct extcon_dev *extcon; iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); ioaddr = devm_ioremap_resource(&pdev->dev, iomem); Loading Loading @@ -156,6 +157,15 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev, host->quirks2 = pdata->quirks2; } extcon = extcon_get_edev_by_phandle(&pdev->dev, 0); if (IS_ERR(extcon) && PTR_ERR(extcon) != -ENODEV) { ret = PTR_ERR(extcon); goto err; } if (!IS_ERR(extcon)) host->mmc->extcon = extcon; platform_set_drvdata(pdev, host); return host; Loading