Skip to content

Commit f75fda3

Browse files
wojtas-marcinUlf Hansson
authored andcommitted
mmc: sdhci-xenon: use match data for controllers variants
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>
1 parent 6f56023 commit f75fda3

3 files changed

Lines changed: 17 additions & 5 deletions

File tree

drivers/mmc/host/sdhci-xenon-phy.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,11 +651,13 @@ static int get_dt_pad_ctrl_data(struct sdhci_host *host,
651651
struct device_node *np,
652652
struct xenon_emmc_phy_params *params)
653653
{
654+
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
655+
struct xenon_priv *priv = sdhci_pltfm_priv(pltfm_host);
654656
int ret = 0;
655657
const char *name;
656658
struct resource iomem;
657659

658-
if (of_device_is_compatible(np, "marvell,armada-3700-sdhci"))
660+
if (priv->hw_version == XENON_A3700)
659661
params->pad_ctrl.set_soc_pad = armada_3700_soc_pad_voltage_set;
660662
else
661663
return 0;

drivers/mmc/host/sdhci-xenon.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ static int xenon_probe_dt(struct platform_device *pdev)
418418
u32 tuning_count;
419419

420420
/* Disable HS200 on Armada AP806 */
421-
if (of_device_is_compatible(np, "marvell,armada-ap806-sdhci"))
421+
if (priv->hw_version == XENON_AP806)
422422
host->quirks2 |= SDHCI_QUIRK2_BROKEN_HS200;
423423

424424
sdhc_id = 0x0;
@@ -495,6 +495,8 @@ static int xenon_probe(struct platform_device *pdev)
495495
pltfm_host = sdhci_priv(host);
496496
priv = sdhci_pltfm_priv(pltfm_host);
497497

498+
priv->hw_version = (unsigned long)device_get_match_data(&pdev->dev);
499+
498500
/*
499501
* Link Xenon specific mmc_host_ops function,
500502
* to replace standard ones in sdhci_ops.
@@ -667,9 +669,9 @@ static const struct dev_pm_ops sdhci_xenon_dev_pm_ops = {
667669
};
668670

669671
static const struct of_device_id sdhci_xenon_dt_ids[] = {
670-
{ .compatible = "marvell,armada-ap806-sdhci",},
671-
{ .compatible = "marvell,armada-cp110-sdhci",},
672-
{ .compatible = "marvell,armada-3700-sdhci",},
672+
{ .compatible = "marvell,armada-ap806-sdhci", .data = (void *)XENON_AP806},
673+
{ .compatible = "marvell,armada-cp110-sdhci", .data = (void *)XENON_CP110},
674+
{ .compatible = "marvell,armada-3700-sdhci", .data = (void *)XENON_A3700},
673675
{}
674676
};
675677
MODULE_DEVICE_TABLE(of, sdhci_xenon_dt_ids);

drivers/mmc/host/sdhci-xenon.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@
5353
#define XENON_CTRL_HS200 0x5
5454
#define XENON_CTRL_HS400 0x6
5555

56+
enum xenon_variant {
57+
XENON_A3700,
58+
XENON_AP806,
59+
XENON_AP807,
60+
XENON_CP110
61+
};
62+
5663
struct xenon_priv {
5764
unsigned char tuning_count;
5865
/* idx of SDHC */
@@ -90,6 +97,7 @@ struct xenon_priv {
9097
void *phy_params;
9198
struct xenon_emmc_phy_regs *emmc_phy_regs;
9299
bool restore_needed;
100+
enum xenon_variant hw_version;
93101
};
94102

95103
int xenon_phy_adj(struct sdhci_host *host, struct mmc_ios *ios);

0 commit comments

Comments
 (0)