All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lokesh Vutla <lokeshvutla@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/6] dm: mmc: omap_hsmmc: Update to support of-platdata
Date: Sat, 22 Apr 2017 12:20:43 +0530	[thread overview]
Message-ID: <20170422065048.8617-2-lokeshvutla@ti.com> (raw)
In-Reply-To: <20170422065048.8617-1-lokeshvutla@ti.com>

This is to aid platforms that uses OF_PLATDATA.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
---
 arch/arm/include/asm/omap_mmc.h |  9 +++++++++
 drivers/mmc/omap_hsmmc.c        | 24 ++++++++++++++----------
 2 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/arch/arm/include/asm/omap_mmc.h b/arch/arm/include/asm/omap_mmc.h
index f2bf645b33..ba019b0788 100644
--- a/arch/arm/include/asm/omap_mmc.h
+++ b/arch/arm/include/asm/omap_mmc.h
@@ -25,6 +25,8 @@
 #ifndef OMAP_MMC_H_
 #define OMAP_MMC_H_
 
+#include <mmc.h>
+
 struct hsmmc {
 #ifdef CONFIG_DM_MMC
 	unsigned char res0[0x100];
@@ -52,6 +54,13 @@ struct hsmmc {
 	unsigned int capa;		/* 0x140 */
 };
 
+struct omap_hsmmc_plat {
+	struct mmc_config cfg;
+	struct hsmmc *base_addr;
+	struct mmc mmc;
+	bool cd_inverted;
+};
+
 /*
  * OMAP HS MMC Bit definitions
  */
diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c
index 83dda09c1f..f2489473b0 100644
--- a/drivers/mmc/omap_hsmmc.c
+++ b/drivers/mmc/omap_hsmmc.c
@@ -56,11 +56,6 @@ DECLARE_GLOBAL_DATA_PTR;
 #define SYSCTL_SRC	(1 << 25)
 #define SYSCTL_SRD	(1 << 26)
 
-struct omap_hsmmc_plat {
-	struct mmc_config cfg;
-	struct mmc mmc;
-};
-
 struct omap_hsmmc_data {
 	struct hsmmc *base_addr;
 #ifndef CONFIG_DM_MMC
@@ -773,16 +768,16 @@ int omap_mmc_init(int dev_index, uint host_caps_mask, uint f_max, int cd_gpio,
 	return 0;
 }
 #else
+#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
 static int omap_hsmmc_ofdata_to_platdata(struct udevice *dev)
 {
-	struct omap_hsmmc_data *priv = dev_get_priv(dev);
 	struct omap_hsmmc_plat *plat = dev_get_platdata(dev);
 	struct mmc_config *cfg = &plat->cfg;
 	const void *fdt = gd->fdt_blob;
 	int node = dev_of_offset(dev);
 	int val;
 
-	priv->base_addr = map_physmem(dev_get_addr(dev), sizeof(struct hsmmc *),
+	plat->base_addr = map_physmem(dev_get_addr(dev), sizeof(struct hsmmc *),
 				      MAP_NOCACHE);
 
 	cfg->host_caps = MMC_MODE_HS_52MHz | MMC_MODE_HS;
@@ -809,11 +804,12 @@ static int omap_hsmmc_ofdata_to_platdata(struct udevice *dev)
 	cfg->b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT;
 
 #ifdef OMAP_HSMMC_USE_GPIO
-	priv->cd_inverted = fdtdec_get_bool(fdt, node, "cd-inverted");
+	plat->cd_inverted = fdtdec_get_bool(fdt, node, "cd-inverted");
 #endif
 
 	return 0;
 }
+#endif
 
 #ifdef CONFIG_BLK
 
@@ -834,6 +830,10 @@ static int omap_hsmmc_probe(struct udevice *dev)
 
 	cfg->name = "OMAP SD/MMC";
 	cfg->ops = &omap_hsmmc_ops;
+	priv->base_addr = plat->base_addr;
+#ifdef OMAP_HSMMC_USE_GPIO
+	priv->cd_inverted = plat->cd_inverted;
+#endif
 
 #ifdef CONFIG_BLK
 	mmc = &plat->mmc;
@@ -843,7 +843,7 @@ static int omap_hsmmc_probe(struct udevice *dev)
 		return -1;
 #endif
 
-#ifdef OMAP_HSMMC_USE_GPIO
+#if defined(OMAP_HSMMC_USE_GPIO) && CONFIG_IS_ENABLED(OF_CONTROL)
 	gpio_request_by_name(dev, "cd-gpios", 0, &priv->cd_gpio, GPIOD_IS_IN);
 	gpio_request_by_name(dev, "wp-gpios", 0, &priv->wp_gpio, GPIOD_IS_IN);
 #endif
@@ -854,23 +854,27 @@ static int omap_hsmmc_probe(struct udevice *dev)
 	return 0;
 }
 
+#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
 static const struct udevice_id omap_hsmmc_ids[] = {
 	{ .compatible = "ti,omap3-hsmmc" },
 	{ .compatible = "ti,omap4-hsmmc" },
 	{ .compatible = "ti,am33xx-hsmmc" },
 	{ }
 };
+#endif
 
 U_BOOT_DRIVER(omap_hsmmc) = {
 	.name	= "omap_hsmmc",
 	.id	= UCLASS_MMC,
+#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
 	.of_match = omap_hsmmc_ids,
 	.ofdata_to_platdata = omap_hsmmc_ofdata_to_platdata,
+	.platdata_auto_alloc_size = sizeof(struct omap_hsmmc_plat),
+#endif
 #ifdef CONFIG_BLK
 	.bind = omap_hsmmc_bind,
 #endif
 	.probe	= omap_hsmmc_probe,
 	.priv_auto_alloc_size = sizeof(struct omap_hsmmc_data),
-	.platdata_auto_alloc_size = sizeof(struct omap_hsmmc_plat),
 };
 #endif
-- 
2.11.0

  reply	other threads:[~2017-04-22  6:50 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-22  6:50 [U-Boot] [PATCH 0/6] arm: am335x: Enable SPL_DM Lokesh Vutla
2017-04-22  6:50 ` Lokesh Vutla [this message]
2017-04-25 21:09   ` [U-Boot] [PATCH 1/6] dm: mmc: omap_hsmmc: Update to support of-platdata Tom Rini
2017-04-22  6:50 ` [U-Boot] [PATCH 2/6] dm: mmc: omap_hsmmc: Add pre-reloc flag to the driver Lokesh Vutla
2017-04-25 21:09   ` Tom Rini
2017-04-22  6:50 ` [U-Boot] [PATCH 3/6] configs: am335x_evm: Use omap2 generic spl load script Lokesh Vutla
2017-04-24 15:23   ` Andrew F. Davis
2017-04-25  4:13     ` Lokesh Vutla
2017-04-25 21:10     ` Tom Rini
2017-04-26  6:14       ` Lokesh Vutla
2017-04-26 11:25         ` Tom Rini
2017-04-22  6:50 ` [U-Boot] [PATCH 4/6] am33xx: Provide platform data for mmc Lokesh Vutla
2017-04-25 21:10   ` Tom Rini
2017-04-26  0:05     ` Adam Ford
2017-04-26  4:29       ` Lokesh Vutla
2017-04-22  6:50 ` [U-Boot] [PATCH 5/6] configs: am335x_evm: Enable SPL_DM Lokesh Vutla
2017-04-25 21:10   ` Tom Rini
2017-04-22  6:50 ` [U-Boot] [PATCH 6/6] arm: am335x: Enable tiny printf in SPL Lokesh Vutla
2017-04-25 21:10   ` Tom Rini

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=20170422065048.8617-2-lokeshvutla@ti.com \
    --to=lokeshvutla@ti.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.