mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Trent Piepho <tpiepho@kymetacorp.com>
To: barebox <barebox@lists.infradead.org>
Subject: [PATCH 2/4] mci: dw_mmc: socfpga: Supply bus-width in platform_data
Date: Wed, 18 Nov 2015 21:11:49 +0000	[thread overview]
Message-ID: <1447881110.4553.173.camel@rtred1test09.kymeta.local> (raw)
In-Reply-To: <1447880807.4553.171.camel@rtred1test09.kymeta.local>

Since there is no OF support in the xloader on socfpga it uses the
platform_data system.  There needs to be a way to supply the
equivalent of the DT property bus-width this way to support devices
that need to use a smaller bus.

So that we don't need to put every flag that might get added to the
MMC_CAP list into platform_data, just put the bus width ones into
platform_data.

The socfpga dts sources specify a bus-width of 4 so use that in the
platform_data for socfpga.

Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com>
---
 arch/arm/mach-socfpga/xload.c  |  2 ++
 drivers/mci/dw_mmc.c           | 24 +++++++++++++-----------
 include/platform_data/dw_mmc.h |  1 +
 3 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-socfpga/xload.c b/arch/arm/mach-socfpga/xload.c
index 272896b..cf05ff3 100644
--- a/arch/arm/mach-socfpga/xload.c
+++ b/arch/arm/mach-socfpga/xload.c
@@ -10,6 +10,7 @@
 #include <linux/sizes.h>
 #include <fs.h>
 #include <io.h>
+#include <mci.h>
 
 #include <linux/clkdev.h>
 #include <linux/stat.h>
@@ -33,6 +34,7 @@ enum socfpga_clks {
 static struct clk *clks[clk_max];
 
 static struct dw_mmc_platform_data mmc_pdata = {
+	.bus_width_caps = MMC_CAP_4_BIT_DATA,
 	.ciu_div = 3,
 };
 
diff --git a/drivers/mci/dw_mmc.c b/drivers/mci/dw_mmc.c
index acdf795..f8ff389 100644
--- a/drivers/mci/dw_mmc.c
+++ b/drivers/mci/dw_mmc.c
@@ -698,9 +698,22 @@ static int dw_mmc_probe(struct device_d *dev)
 	if (IS_ERR(host->ioaddr))
 		return PTR_ERR(host->ioaddr);
 
+	host->idmac = dma_alloc_coherent(sizeof(*host->idmac) * DW_MMC_NUM_IDMACS,
+					 DMA_ADDRESS_BROKEN);
+
+	host->mci.send_cmd = dwmci_cmd;
+	host->mci.set_ios = dwmci_set_ios;
+	host->mci.init = dwmci_init;
+	host->mci.card_present = dwmci_card_present;
+	host->mci.hw_dev = dev;
+	host->mci.voltages = MMC_VDD_32_33 | MMC_VDD_33_34;
+	host->mci.host_caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA;
+
 	if (pdata) {
 		mci->devname = pdata->devname;
 		host->ciu_div = pdata->ciu_div;
+		host->mci.host_caps &= ~MMC_CAP_BIT_DATA_MASK;
+		host->mci.host_caps |= pdata->bus_width_caps;
 	} else if (dev->device_node) {
 		const char *alias = of_alias_get(dev->device_node);
 		if (alias)
@@ -712,17 +725,6 @@ static int dw_mmc_probe(struct device_d *dev)
 	/* divider is 0 based in pdata and 1 based in our private struct */
 	host->ciu_div++;
 
-	host->idmac = dma_alloc_coherent(sizeof(*host->idmac) * DW_MMC_NUM_IDMACS,
-					 DMA_ADDRESS_BROKEN);
-
-	host->mci.send_cmd = dwmci_cmd;
-	host->mci.set_ios = dwmci_set_ios;
-	host->mci.init = dwmci_init;
-	host->mci.card_present = dwmci_card_present;
-	host->mci.hw_dev = dev;
-	host->mci.voltages = MMC_VDD_32_33 | MMC_VDD_33_34;
-	host->mci.host_caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA;
-
 	if (of_device_is_compatible(dev->device_node,
 	    "rockchip,rk2928-dw-mshc"))
 		host->pwren_value = 0;
diff --git a/include/platform_data/dw_mmc.h b/include/platform_data/dw_mmc.h
index 48faa76..ce1b339 100644
--- a/include/platform_data/dw_mmc.h
+++ b/include/platform_data/dw_mmc.h
@@ -3,6 +3,7 @@
 
 struct dw_mmc_platform_data {
 	char *devname;
+	unsigned int bus_width_caps;
 	int ciu_div;
 };
 
-- 
1.8.3.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2015-11-18 21:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-18 21:06 [PATCH 1/4] mci: core: bus-width property should override driver default Trent Piepho
2015-11-18 21:11 ` Trent Piepho [this message]
2015-11-18 21:12 ` [PATCH 3/4] mci: dw_mmc: Delete devname in platform_data Trent Piepho
2015-11-18 21:14 ` [PATCH 4/4] mci: dw_mmc: Add support for high speed modes Trent Piepho
2015-11-19  7:52 ` [PATCH 1/4] mci: core: bus-width property should override driver default Sascha Hauer

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=1447881110.4553.173.camel@rtred1test09.kymeta.local \
    --to=tpiepho@kymetacorp.com \
    --cc=barebox@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