All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v1 4/4] mmc: socfpga: support of-platdata
Date: Mon,  7 Jan 2019 22:14:23 +0100	[thread overview]
Message-ID: <20190107211423.10151-5-simon.k.r.goldschmidt@gmail.com> (raw)
In-Reply-To: <20190107211423.10151-1-simon.k.r.goldschmidt@gmail.com>

This adds support for OF_PLATDATA to the socfpga_dw_mmc driver.

To do that, also the name of the driver has to be changed to match the
compatible string in the platdata generated from dts.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

---

 drivers/mmc/socfpga_dw_mmc.c | 28 +++++++++++++++++++++++++---
 1 file changed, 25 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/socfpga_dw_mmc.c b/drivers/mmc/socfpga_dw_mmc.c
index 739c1629a2..8503dff932 100644
--- a/drivers/mmc/socfpga_dw_mmc.c
+++ b/drivers/mmc/socfpga_dw_mmc.c
@@ -8,6 +8,7 @@
 #include <asm/arch/system_manager.h>
 #include <clk.h>
 #include <dm.h>
+#include <dt-structs.h>
 #include <dwmmc.h>
 #include <errno.h>
 #include <fdtdec.h>
@@ -24,6 +25,9 @@ static const struct socfpga_system_manager *system_manager_base =
 		(void *)SOCFPGA_SYSMGR_ADDRESS;
 
 struct socfpga_dwmci_plat {
+#if CONFIG_IS_ENABLED(OF_PLATDATA)
+	struct dtd_altr_socfpga_dw_mshc dtplat;
+#endif
 	struct mmc_config cfg;
 	struct mmc mmc;
 };
@@ -100,6 +104,7 @@ static int socfpga_dwmmc_get_clk_rate(struct udevice *dev)
 
 static int socfpga_dwmmc_ofdata_to_platdata(struct udevice *dev)
 {
+#if !CONFIG_IS_ENABLED(OF_PLATDATA)
 	struct dwmci_socfpga_priv_data *priv = dev_get_priv(dev);
 	struct dwmci_host *host = &priv->host;
 	int fifo_depth;
@@ -129,13 +134,13 @@ static int socfpga_dwmmc_ofdata_to_platdata(struct udevice *dev)
 	priv->smplsel = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
 					"smplsel", 0);
 	host->priv = priv;
-
+#endif
 	return 0;
 }
 
 static int socfpga_dwmmc_probe(struct udevice *dev)
 {
-#ifdef CONFIG_BLK
+#if defined(CONFIG_BLK) || CONFIG_IS_ENABLED(OF_PLATDATA)
 	struct socfpga_dwmci_plat *plat = dev_get_platdata(dev);
 #endif
 	struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
@@ -143,6 +148,23 @@ static int socfpga_dwmmc_probe(struct udevice *dev)
 	struct dwmci_host *host = &priv->host;
 	int ret;
 
+#if CONFIG_IS_ENABLED(OF_PLATDATA)
+	struct dtd_altr_socfpga_dw_mshc *dtplat = &plat->dtplat;
+
+	host->name = dev->name;
+	host->ioaddr = (void *)dtplat->reg[0];
+	host->buswidth = dtplat->bus_width;
+	host->clksel = socfpga_dwmci_clksel;
+	host->dev_index = 0;
+	host->fifoth_val = MSIZE(0x2) |
+		RX_WMARK(dtplat->fifo_depth / 2 - 1) |
+		TX_WMARK(dtplat->fifo_depth / 2);
+	host->priv = priv;
+	/* TODO: these are optional, of-platdata does not support this. */
+	priv->drvsel = 3;
+	priv->smplsel = 0;
+#endif
+
 	ret = socfpga_dwmmc_get_clk_rate(dev);
 	if (ret)
 		return ret;
@@ -185,7 +207,7 @@ static const struct udevice_id socfpga_dwmmc_ids[] = {
 };
 
 U_BOOT_DRIVER(socfpga_dwmmc_drv) = {
-	.name		= "socfpga_dwmmc",
+	.name		= "altr_socfpga_dw_mshc",
 	.id		= UCLASS_MMC,
 	.of_match	= socfpga_dwmmc_ids,
 	.ofdata_to_platdata = socfpga_dwmmc_ofdata_to_platdata,
-- 
2.17.1

  parent reply	other threads:[~2019-01-07 21:14 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-07 21:14 [U-Boot] [PATCH v1 0/4] arm: socfgpa: support of-platdata Simon Goldschmidt
2019-01-07 21:14 ` [U-Boot] [PATCH v1 1/4] arm: socfpga: imply SPL config instead of select Simon Goldschmidt
2019-01-07 22:53   ` Marek Vasut
2019-01-08  6:24     ` Simon Goldschmidt
2019-01-08 11:22       ` Marek Vasut
2019-01-08 12:09         ` Simon Goldschmidt
2019-01-08 12:22           ` Marek Vasut
2019-01-08 12:46             ` Simon Goldschmidt
2019-01-08 12:49               ` Marek Vasut
2019-01-08 14:48                 ` Tom Rini
2019-01-08 14:50                   ` Marek Vasut
2019-01-08 14:58                     ` Tom Rini
2019-01-08 15:04                       ` Simon Goldschmidt
2019-01-08 15:11                         ` Tom Rini
2019-01-08 15:05                       ` Marek Vasut
2019-01-08 15:01                     ` Simon Goldschmidt
2019-01-08 20:52                       ` Simon Goldschmidt
2019-01-08 20:54                         ` Marek Vasut
2019-01-11 20:39     ` Simon Goldschmidt
2019-01-11 22:02       ` Marek Vasut
2019-01-14 15:50         ` Simon Goldschmidt
2019-01-14 15:58           ` Dinh Nguyen
2019-01-14 16:05             ` Simon Goldschmidt
2019-01-14 18:31               ` Marek Vasut
2019-01-14 18:58                 ` Simon Goldschmidt
2019-01-14 19:33                   ` Marek Vasut
2019-01-14 19:43                     ` Simon Goldschmidt
2019-01-14 20:01                       ` Marek Vasut
2019-01-14 20:12                         ` Simon Goldschmidt
2019-01-14 20:23                           ` Marek Vasut
2019-01-14 20:30                             ` Simon Goldschmidt
2019-01-14 20:49                               ` Marek Vasut
2019-01-14 20:59                                 ` Simon Goldschmidt
2019-01-14 21:28                 ` Tom Rini
2019-01-14 21:30                   ` Marek Vasut
2019-01-14 21:35                     ` Simon Goldschmidt
2019-01-14 21:50                     ` Tom Rini
2019-01-14 21:53                       ` Simon Goldschmidt
2019-01-14 21:57                         ` Marek Vasut
2019-01-14 22:26               ` Dinh Nguyen
2019-01-15  6:59                 ` Simon Goldschmidt
2019-01-07 21:14 ` [U-Boot] [PATCH v1 2/4] arm: socfpga: fix compiling with OF_PLATDATA Simon Goldschmidt
2019-01-07 22:53   ` Marek Vasut
2019-01-08  6:32     ` Simon Goldschmidt
2019-01-08 11:46       ` Marek Vasut
2019-01-08 12:14         ` Simon Goldschmidt
2019-01-08 12:23           ` Marek Vasut
2019-01-07 21:14 ` [U-Boot] [PATCH v1 3/4] serial: add an of-platdata driver for "snps, dw-apb-uart" Simon Goldschmidt
2019-01-07 22:12   ` Lukasz Majewski
2019-01-08  6:06     ` Simon Goldschmidt
2019-01-08  7:30       ` Lukasz Majewski
2019-01-08  7:41         ` Simon Goldschmidt
2019-01-08  8:49           ` Lukasz Majewski
2019-01-09  8:35   ` Alexey Brodkin
2019-01-09 11:33     ` Simon Goldschmidt
2019-01-09 18:43     ` Simon Goldschmidt
2019-01-11  8:33       ` Alexey Brodkin
2019-01-11  8:41         ` Simon Goldschmidt
2019-01-11  9:03           ` Alexey Brodkin
2019-01-11 10:00             ` Simon Goldschmidt
2019-01-11  9:22     ` Andy Shevchenko
2019-01-11 10:01       ` Simon Goldschmidt
2019-01-16 21:35         ` Simon Glass
2019-01-10 12:56   ` Simon Glass
2019-01-07 21:14 ` Simon Goldschmidt [this message]
2019-01-07 21:59 ` [U-Boot] [PATCH v1 0/4] arm: socfgpa: support of-platdata Lukasz Majewski
2019-01-08  6:53   ` Simon Goldschmidt
2019-01-07 22:57 ` Marek Vasut
2019-01-08  6:56   ` Simon Goldschmidt
2019-01-08 11:49     ` Marek Vasut
2019-01-08 12:38       ` Simon Goldschmidt
2019-01-08 12:57         ` Marek Vasut
2019-01-08 13:07           ` Simon Goldschmidt
2019-01-08 13:38             ` Marek Vasut
2019-01-08 13:51               ` Simon Goldschmidt
2019-01-08 14:43                 ` Marek Vasut
2019-02-01 18:58                   ` Simon Goldschmidt

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=20190107211423.10151-5-simon.k.r.goldschmidt@gmail.com \
    --to=simon.k.r.goldschmidt@gmail.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.