Currently host drivers using the sdhci-pltfm code can not configure the
host based on the type of card inserted.

The sdio driver e.g. calls the card_init callback, so the host can now
know what card is used and configure itself accordingly.

Provide a callback for users of the sdhci-pltfm code to use this callback
function.

Signed-off-by: Steffen Trumtrar <s.trumt...@pengutronix.de>
---
 drivers/mmc/host/sdhci.c |    9 +++++++++
 drivers/mmc/host/sdhci.h |    1 +
 2 files changed, 10 insertions(+)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 9ddef47..20bf40b 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2106,6 +2106,14 @@ static void sdhci_card_event(struct mmc_host *mmc)
        spin_unlock_irqrestore(&host->lock, flags);
 }
 
+static void sdhci_init_card(struct mmc_host *mmc, struct mmc_card *card)
+{
+       struct sdhci_host *host = mmc_priv(mmc);
+
+       if (host->ops->card_type_init)
+               host->ops->card_type_init(host, card);
+}
+
 static const struct mmc_host_ops sdhci_ops = {
        .request        = sdhci_request,
        .set_ios        = sdhci_set_ios,
@@ -2117,6 +2125,7 @@ static const struct mmc_host_ops sdhci_ops = {
        .execute_tuning                 = sdhci_execute_tuning,
        .card_event                     = sdhci_card_event,
        .card_busy      = sdhci_card_busy,
+       .init_card      = sdhci_init_card,
 };
 
 /*****************************************************************************\
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index 0a3ed01..331a285 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -296,6 +296,7 @@ struct sdhci_ops {
        void    (*adma_workaround)(struct sdhci_host *host, u32 intmask);
        void    (*platform_init)(struct sdhci_host *host);
        void    (*card_event)(struct sdhci_host *host);
+       void    (*card_type_init)(struct sdhci_host *host, struct mmc_card 
*card);
 };
 
 #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to