mmc: sdhci-xenon: use match data for controllers variants
authorMarcin Wojtas <mw@semihalf.com>
Fri, 4 Dec 2020 17:16:23 +0000 (18:16 +0100)
committerUlf Hansson <ulf.hansson@linaro.org>
Fri, 11 Dec 2020 09:08:37 +0000 (10:08 +0100)
As a part of the ACPI support preparation resign from checking
compatible strings in the driver. Instead of that use a new
enum and assign the values to match data accordingly.

Signed-off-by: Marcin Wojtas <mw@semihalf.com>
Link: https://lore.kernel.org/r/20201204171626.10935-2-mw@semihalf.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/sdhci-xenon-phy.c
drivers/mmc/host/sdhci-xenon.c
drivers/mmc/host/sdhci-xenon.h

index 03ce57ef4585886c138e64e2e5b8d5b605ce1aa9..c33e0cddc81acc3908f4778308318f493408febe 100644 (file)
@@ -651,11 +651,13 @@ static int get_dt_pad_ctrl_data(struct sdhci_host *host,
                                struct device_node *np,
                                struct xenon_emmc_phy_params *params)
 {
+       struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+       struct xenon_priv *priv = sdhci_pltfm_priv(pltfm_host);
        int ret = 0;
        const char *name;
        struct resource iomem;
 
-       if (of_device_is_compatible(np, "marvell,armada-3700-sdhci"))
+       if (priv->hw_version == XENON_A3700)
                params->pad_ctrl.set_soc_pad = armada_3700_soc_pad_voltage_set;
        else
                return 0;
index 24c978de2a3f187df6f2af7acc575af8f62532aa..1e7ce9b1a143231b5702cf140aa6084b77ea18b0 100644 (file)
@@ -418,7 +418,7 @@ static int xenon_probe_dt(struct platform_device *pdev)
        u32 tuning_count;
 
        /* Disable HS200 on Armada AP806 */
-       if (of_device_is_compatible(np, "marvell,armada-ap806-sdhci"))
+       if (priv->hw_version == XENON_AP806)
                host->quirks2 |= SDHCI_QUIRK2_BROKEN_HS200;
 
        sdhc_id = 0x0;
@@ -495,6 +495,8 @@ static int xenon_probe(struct platform_device *pdev)
        pltfm_host = sdhci_priv(host);
        priv = sdhci_pltfm_priv(pltfm_host);
 
+       priv->hw_version = (unsigned long)device_get_match_data(&pdev->dev);
+
        /*
         * Link Xenon specific mmc_host_ops function,
         * to replace standard ones in sdhci_ops.
@@ -667,9 +669,9 @@ static const struct dev_pm_ops sdhci_xenon_dev_pm_ops = {
 };
 
 static const struct of_device_id sdhci_xenon_dt_ids[] = {
-       { .compatible = "marvell,armada-ap806-sdhci",},
-       { .compatible = "marvell,armada-cp110-sdhci",},
-       { .compatible = "marvell,armada-3700-sdhci",},
+       { .compatible = "marvell,armada-ap806-sdhci", .data = (void *)XENON_AP806},
+       { .compatible = "marvell,armada-cp110-sdhci", .data =  (void *)XENON_CP110},
+       { .compatible = "marvell,armada-3700-sdhci", .data =  (void *)XENON_A3700},
        {}
 };
 MODULE_DEVICE_TABLE(of, sdhci_xenon_dt_ids);
index 593b82d7b68a81be7001f11acffc9d76c4f47871..39e898605937556594ceacbdd871e9a09318b869 100644 (file)
 #define XENON_CTRL_HS200                       0x5
 #define XENON_CTRL_HS400                       0x6
 
+enum xenon_variant {
+       XENON_A3700,
+       XENON_AP806,
+       XENON_AP807,
+       XENON_CP110
+};
+
 struct xenon_priv {
        unsigned char   tuning_count;
        /* idx of SDHC */
@@ -90,6 +97,7 @@ struct xenon_priv {
        void            *phy_params;
        struct xenon_emmc_phy_regs *emmc_phy_regs;
        bool restore_needed;
+       enum xenon_variant hw_version;
 };
 
 int xenon_phy_adj(struct sdhci_host *host, struct mmc_ios *ios);