From: Marcin Wojtas <mw@semihalf.com>
To: linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org
Cc: ulf.hansson@linaro.org, huziji@marvell.com,
adrian.hunter@intel.com, jaz@semihalf.com, tn@semihalf.com,
ard.biesheuvel@arm.com, kostap@marvell.com,
Marcin Wojtas <mw@semihalf.com>
Subject: [PATCH v3 1/4] mmc: sdhci-xenon: use match data for controllers variants
Date: Wed, 2 Dec 2020 19:51:15 +0100 [thread overview]
Message-ID: <20201202185118.29076-2-mw@semihalf.com> (raw)
In-Reply-To: <20201202185118.29076-1-mw@semihalf.com>
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>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
---
drivers/mmc/host/sdhci-xenon.h | 8 ++++++++
drivers/mmc/host/sdhci-xenon-phy.c | 4 +++-
drivers/mmc/host/sdhci-xenon.c | 10 ++++++----
3 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/drivers/mmc/host/sdhci-xenon.h b/drivers/mmc/host/sdhci-xenon.h
index 593b82d7b68a..39e898605937 100644
--- a/drivers/mmc/host/sdhci-xenon.h
+++ b/drivers/mmc/host/sdhci-xenon.h
@@ -53,6 +53,13 @@
#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);
diff --git a/drivers/mmc/host/sdhci-xenon-phy.c b/drivers/mmc/host/sdhci-xenon-phy.c
index 03ce57ef4585..c33e0cddc81a 100644
--- a/drivers/mmc/host/sdhci-xenon-phy.c
+++ b/drivers/mmc/host/sdhci-xenon-phy.c
@@ -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;
diff --git a/drivers/mmc/host/sdhci-xenon.c b/drivers/mmc/host/sdhci-xenon.c
index 24c978de2a3f..1e7ce9b1a143 100644
--- a/drivers/mmc/host/sdhci-xenon.c
+++ b/drivers/mmc/host/sdhci-xenon.c
@@ -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);
--
2.29.0
next prev parent reply other threads:[~2020-12-02 18:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-02 18:51 [PATCH v3 0/4] sdhci-xenon ACPI support Marcin Wojtas
2020-12-02 18:51 ` Marcin Wojtas [this message]
2020-12-02 18:51 ` [PATCH v3 2/4] mmc: sdhci-xenon: switch to device_* API Marcin Wojtas
2020-12-02 18:51 ` [PATCH v3 3/4] mmc: sdhci-xenon: use clk only with DT Marcin Wojtas
2020-12-04 13:51 ` Ulf Hansson
2020-12-04 17:19 ` Marcin Wojtas
2020-12-02 18:51 ` [PATCH v3 4/4] mmc: sdhci-xenon: introduce ACPI support Marcin Wojtas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201202185118.29076-2-mw@semihalf.com \
--to=mw@semihalf.com \
--cc=adrian.hunter@intel.com \
--cc=ard.biesheuvel@arm.com \
--cc=huziji@marvell.com \
--cc=jaz@semihalf.com \
--cc=kostap@marvell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=tn@semihalf.com \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).