提交 578b36b6 编写于 作者: G Gao, Yunpeng 提交者: Ulf Hansson

mmc: sdhci-acpi: add probe_slot method for emmc/sd/sdio

Similar to sdhci-pci controller, also add probe_slot
and remove_slot method in the sdhci-acpi driver.
Signed-off-by: NYunpeng Gao <yunpeng.gao@intel.com>
Signed-off-by: NChuanxiao Dong <chuanxiao.dong@intel.com>
Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
上级 f1b55a55
...@@ -67,6 +67,8 @@ struct sdhci_acpi_slot { ...@@ -67,6 +67,8 @@ struct sdhci_acpi_slot {
unsigned int caps2; unsigned int caps2;
mmc_pm_flag_t pm_caps; mmc_pm_flag_t pm_caps;
unsigned int flags; unsigned int flags;
int (*probe_slot)(struct platform_device *);
int (*remove_slot)(struct platform_device *);
}; };
struct sdhci_acpi_host { struct sdhci_acpi_host {
...@@ -122,6 +124,51 @@ static const struct sdhci_acpi_chip sdhci_acpi_chip_int = { ...@@ -122,6 +124,51 @@ static const struct sdhci_acpi_chip sdhci_acpi_chip_int = {
.ops = &sdhci_acpi_ops_int, .ops = &sdhci_acpi_ops_int,
}; };
static int sdhci_acpi_emmc_probe_slot(struct platform_device *pdev)
{
struct sdhci_acpi_host *c = platform_get_drvdata(pdev);
struct sdhci_host *host;
if (!c || !c->host)
return 0;
host = c->host;
/* Platform specific code during emmc proble slot goes here */
return 0;
}
static int sdhci_acpi_sdio_probe_slot(struct platform_device *pdev)
{
struct sdhci_acpi_host *c = platform_get_drvdata(pdev);
struct sdhci_host *host;
if (!c || !c->host)
return 0;
host = c->host;
/* Platform specific code during emmc proble slot goes here */
return 0;
}
static int sdhci_acpi_sd_probe_slot(struct platform_device *pdev)
{
struct sdhci_acpi_host *c = platform_get_drvdata(pdev);
struct sdhci_host *host;
if (!c || !c->host || !c->slot)
return 0;
host = c->host;
/* Platform specific code during emmc proble slot goes here */
return 0;
}
static const struct sdhci_acpi_slot sdhci_acpi_slot_int_emmc = { static const struct sdhci_acpi_slot sdhci_acpi_slot_int_emmc = {
.chip = &sdhci_acpi_chip_int, .chip = &sdhci_acpi_chip_int,
.caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE | .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE |
...@@ -129,6 +176,7 @@ static const struct sdhci_acpi_slot sdhci_acpi_slot_int_emmc = { ...@@ -129,6 +176,7 @@ static const struct sdhci_acpi_slot sdhci_acpi_slot_int_emmc = {
.caps2 = MMC_CAP2_HC_ERASE_SZ, .caps2 = MMC_CAP2_HC_ERASE_SZ,
.flags = SDHCI_ACPI_RUNTIME_PM, .flags = SDHCI_ACPI_RUNTIME_PM,
.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN, .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
.probe_slot = sdhci_acpi_emmc_probe_slot,
}; };
static const struct sdhci_acpi_slot sdhci_acpi_slot_int_sdio = { static const struct sdhci_acpi_slot sdhci_acpi_slot_int_sdio = {
...@@ -137,12 +185,14 @@ static const struct sdhci_acpi_slot sdhci_acpi_slot_int_sdio = { ...@@ -137,12 +185,14 @@ static const struct sdhci_acpi_slot sdhci_acpi_slot_int_sdio = {
.caps = MMC_CAP_NONREMOVABLE | MMC_CAP_POWER_OFF_CARD, .caps = MMC_CAP_NONREMOVABLE | MMC_CAP_POWER_OFF_CARD,
.flags = SDHCI_ACPI_RUNTIME_PM, .flags = SDHCI_ACPI_RUNTIME_PM,
.pm_caps = MMC_PM_KEEP_POWER, .pm_caps = MMC_PM_KEEP_POWER,
.probe_slot = sdhci_acpi_sdio_probe_slot,
}; };
static const struct sdhci_acpi_slot sdhci_acpi_slot_int_sd = { static const struct sdhci_acpi_slot sdhci_acpi_slot_int_sd = {
.flags = SDHCI_ACPI_SD_CD | SDHCI_ACPI_SD_CD_OVERRIDE_LEVEL | .flags = SDHCI_ACPI_SD_CD | SDHCI_ACPI_SD_CD_OVERRIDE_LEVEL |
SDHCI_ACPI_RUNTIME_PM, SDHCI_ACPI_RUNTIME_PM,
.quirks2 = SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON, .quirks2 = SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON,
.probe_slot = sdhci_acpi_sd_probe_slot,
}; };
struct sdhci_acpi_uid_slot { struct sdhci_acpi_uid_slot {
...@@ -277,6 +327,11 @@ static int sdhci_acpi_probe(struct platform_device *pdev) ...@@ -277,6 +327,11 @@ static int sdhci_acpi_probe(struct platform_device *pdev)
} }
if (c->slot) { if (c->slot) {
if (c->slot->probe_slot) {
err = c->slot->probe_slot(pdev);
if (err)
goto err_free;
}
if (c->slot->chip) { if (c->slot->chip) {
host->ops = c->slot->chip->ops; host->ops = c->slot->chip->ops;
host->quirks |= c->slot->chip->quirks; host->quirks |= c->slot->chip->quirks;
...@@ -334,6 +389,9 @@ static int sdhci_acpi_remove(struct platform_device *pdev) ...@@ -334,6 +389,9 @@ static int sdhci_acpi_remove(struct platform_device *pdev)
pm_runtime_put_noidle(dev); pm_runtime_put_noidle(dev);
} }
if (c->slot && c->slot->remove_slot)
c->slot->remove_slot(pdev);
dead = (sdhci_readl(c->host, SDHCI_INT_STATUS) == ~0); dead = (sdhci_readl(c->host, SDHCI_INT_STATUS) == ~0);
sdhci_remove_host(c->host, dead); sdhci_remove_host(c->host, dead);
sdhci_free_host(c->host); sdhci_free_host(c->host);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册