linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: shawn.guo@linaro.org (Shawn Guo)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 5/5] mmc: sdhci-esdhc-imx: eliminate enum imx_esdhc_type
Date: Mon, 14 Oct 2013 16:23:44 +0800	[thread overview]
Message-ID: <1381739024-24924-6-git-send-email-shawn.guo@linaro.org> (raw)
In-Reply-To: <1381739024-24924-1-git-send-email-shawn.guo@linaro.org>

We now have 'flags' in struct pltfm_imx_data to identify the features
and quirks for ESDHC variants running on different i.MX SoCs.  The enum
imx_esdhc_type can be eliminated by interpreting the ESDHC variants with
the ESDHC_FLAG_* flags.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 drivers/mmc/host/sdhci-esdhc-imx.c |   52 +++++-------------------------------
 1 file changed, 6 insertions(+), 46 deletions(-)

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index f1e1385..f2cd5b0 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -100,18 +100,15 @@
  */
 #define ESDHC_FLAG_USDHC		BIT(3)
 
-enum imx_esdhc_type {
-	IMX25_ESDHC,
-	IMX35_ESDHC,
-	IMX51_ESDHC,
-	IMX53_ESDHC,
-	IMX6Q_USDHC,
-};
+#define IMX25_ESDHC	(ESDHC_FLAG_NO_DMAS_BITS | ESDHC_FLAG_ENGCM07207)
+#define IMX35_ESDHC	(ESDHC_FLAG_ENGCM07207)
+#define IMX51_ESDHC	(0)
+#define IMX53_ESDHC	(ESDHC_FLAG_MULTIBLK_NO_INT)
+#define IMX6Q_USDHC	(ESDHC_FLAG_USDHC)
 
 struct pltfm_imx_data {
 	int flags;
 	u32 scratchpad;
-	enum imx_esdhc_type devtype;
 	struct pinctrl *pinctrl;
 	struct pinctrl_state *pins_default;
 	struct pinctrl_state *pins_100mhz;
@@ -154,31 +151,6 @@ static const struct of_device_id imx_esdhc_dt_ids[] = {
 };
 MODULE_DEVICE_TABLE(of, imx_esdhc_dt_ids);
 
-static inline int is_imx25_esdhc(struct pltfm_imx_data *data)
-{
-	return data->devtype == IMX25_ESDHC;
-}
-
-static inline int is_imx35_esdhc(struct pltfm_imx_data *data)
-{
-	return data->devtype == IMX35_ESDHC;
-}
-
-static inline int is_imx51_esdhc(struct pltfm_imx_data *data)
-{
-	return data->devtype == IMX51_ESDHC;
-}
-
-static inline int is_imx53_esdhc(struct pltfm_imx_data *data)
-{
-	return data->devtype == IMX53_ESDHC;
-}
-
-static inline int is_imx6q_usdhc(struct pltfm_imx_data *data)
-{
-	return data->devtype == IMX6Q_USDHC;
-}
-
 static inline int esdhc_is_usdhc(struct pltfm_imx_data *data)
 {
 	return !!(data->flags & ESDHC_FLAG_USDHC);
@@ -866,19 +838,10 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
 		goto free_sdhci;
 	}
 
-	imx_data->devtype = of_id ? (enum imx_esdhc_type) of_id->data :
+	imx_data->flags = of_id ? (int) of_id->data :
 				    pdev->id_entry->driver_data;
 	pltfm_host->priv = imx_data;
 
-	if (is_imx25_esdhc(imx_data))
-		imx_data->flags |= ESDHC_FLAG_NO_DMAS_BITS;
-
-	if (is_imx25_esdhc(imx_data) || is_imx35_esdhc(imx_data))
-		imx_data->flags |= ESDHC_FLAG_ENGCM07207;
-
-	if (is_imx6q_usdhc(imx_data))
-		imx_data->flags |= ESDHC_FLAG_USDHC;
-
 	imx_data->clk_ipg = devm_clk_get(&pdev->dev, "ipg");
 	if (IS_ERR(imx_data->clk_ipg)) {
 		err = PTR_ERR(imx_data->clk_ipg);
@@ -924,9 +887,6 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
 		host->quirks |= SDHCI_QUIRK_NO_MULTIBLOCK
 			| SDHCI_QUIRK_BROKEN_ADMA;
 
-	if (is_imx53_esdhc(imx_data))
-		imx_data->flags |= ESDHC_FLAG_MULTIBLK_NO_INT;
-
 	/*
 	 * The imx6q ROM code will change the default watermark level setting
 	 * to something insane.  Change it back here.
-- 
1.7.9.5

  parent reply	other threads:[~2013-10-14  8:23 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-14  8:23 [PATCH 0/5] mmc: sdhci-esdhc-imx: eliminate enum imx_esdhc_type Shawn Guo
2013-10-14  8:23 ` [PATCH 1/5] mmc: sdhci-esdhc-imx: add flag ESDHC_FLAG_NO_DMAS_BITS Shawn Guo
2013-10-14  8:23 ` [PATCH 2/5] mmc: sdhci-esdhc-imx: add flag ESDHC_FLAG_ENGCM07207 Shawn Guo
2013-10-15  6:49   ` Lucas Stach
2013-10-14  8:23 ` [PATCH 3/5] mmc: sdhci-esdhc-imx: add flag ESDHC_FLAG_USDHC Shawn Guo
2013-10-14  8:23 ` [PATCH 4/5] mmc: sdhci-esdhc-imx: pdev->id_entry should be immutable Shawn Guo
2013-10-14  8:23 ` Shawn Guo [this message]
2013-10-14  8:31   ` [PATCH 5/5] mmc: sdhci-esdhc-imx: eliminate enum imx_esdhc_type Lucas Stach
2013-10-14 13:27     ` Shawn Guo
2013-10-14 13:56       ` Shawn Guo
2013-10-14  8:44   ` Lothar Waßmann
2013-10-15  4:55 ` [PATCH 6/6] mmc: sdhci-esdhc-imx: create struct esdhc_soc_data Shawn Guo
2013-10-15  6:50 ` [PATCH 0/5] mmc: sdhci-esdhc-imx: eliminate enum imx_esdhc_type Lucas Stach
2013-10-15  7:36 ` Dong Aisheng
2013-10-15  8:54   ` Shawn Guo
2013-10-16 15:19   ` Shawn Guo

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=1381739024-24924-6-git-send-email-shawn.guo@linaro.org \
    --to=shawn.guo@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.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).