All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Heiko Stübner" <heiko@sntech.de>
To: "linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Mike Turquette <mturquette@linaro.org>,
	Seungwon Jeon <tgih.jun@samsung.com>,
	Jaehoon Chung <jh80.chung@samsung.com>,
	Chris Ball <cjb@laptop.org>,
	linux-mmc@vger.kernel.org, Grant Likely <grant.likely@linaro.org>,
	Rob Herring <rob.herring@calxeda.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	devicetree-discuss@lists.ozlabs.org,
	Russell King <linux@arm.linux.org.uk>,
	Arnd Bergmann <arnd@arndb.de>, Olof Johansson <olof@lixom.net>,
	Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
	Andy Shevchenko <andy.shevchenko@gmail.com>
Subject: [PATCH v3 4/7] mmc: dw_mmc-pltfm: add Rockchip variant
Date: Tue, 11 Jun 2013 13:30:56 +0200	[thread overview]
Message-ID: <201306111330.56901.heiko@sntech.de> (raw)
In-Reply-To: <201306111328.52679.heiko@sntech.de>

Cortex-A9 SoCs from Rockchip use a slightly modified variant of dw_mmc
controllers that seems to require the SDMMC_CMD_USE_HOLD_REG bit to
always be set.

There also seem to be no other modifications (additional register etc)
present, so to keep the footprint low, add this small variant to the
pltfm driver.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 drivers/mmc/host/dw_mmc-pltfm.c |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc-pltfm.c b/drivers/mmc/host/dw_mmc-pltfm.c
index 9b05381..cbbbcf3 100644
--- a/drivers/mmc/host/dw_mmc-pltfm.c
+++ b/drivers/mmc/host/dw_mmc-pltfm.c
@@ -24,6 +24,15 @@
 
 #include "dw_mmc.h"
 
+static void dw_mci_rockchip_prepare_command(struct dw_mci *host, u32 *cmdr)
+{
+	*cmdr |= SDMMC_CMD_USE_HOLD_REG;
+}
+
+static const struct dw_mci_drv_data rockchip_drv_data = {
+	.prepare_command	= dw_mci_rockchip_prepare_command,
+};
+
 int dw_mci_pltfm_register(struct platform_device *pdev,
 				const struct dw_mci_drv_data *drv_data)
 {
@@ -100,13 +109,23 @@ EXPORT_SYMBOL_GPL(dw_mci_pltfm_pmops);
 
 static const struct of_device_id dw_mci_pltfm_match[] = {
 	{ .compatible = "snps,dw-mshc", },
+	{ .compatible = "rockchip,cortex-a9-dw-mshc",
+		.data = &rockchip_drv_data },
 	{},
 };
 MODULE_DEVICE_TABLE(of, dw_mci_pltfm_match);
 
 static int dw_mci_pltfm_probe(struct platform_device *pdev)
 {
-	return dw_mci_pltfm_register(pdev, NULL);
+	const struct dw_mci_drv_data *drv_data = NULL;
+	const struct of_device_id *match;
+
+	if (pdev->dev.of_node) {
+		match = of_match_node(dw_mci_pltfm_match, pdev->dev.of_node);
+		drv_data = match->data;
+	}
+
+	return dw_mci_pltfm_register(pdev, drv_data);
 }
 
 int dw_mci_pltfm_remove(struct platform_device *pdev)
-- 
1.7.2.3


WARNING: multiple messages have this Message-ID (diff)
From: heiko@sntech.de (Heiko Stübner)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 4/7] mmc: dw_mmc-pltfm: add Rockchip variant
Date: Tue, 11 Jun 2013 13:30:56 +0200	[thread overview]
Message-ID: <201306111330.56901.heiko@sntech.de> (raw)
In-Reply-To: <201306111328.52679.heiko@sntech.de>

Cortex-A9 SoCs from Rockchip use a slightly modified variant of dw_mmc
controllers that seems to require the SDMMC_CMD_USE_HOLD_REG bit to
always be set.

There also seem to be no other modifications (additional register etc)
present, so to keep the footprint low, add this small variant to the
pltfm driver.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 drivers/mmc/host/dw_mmc-pltfm.c |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc-pltfm.c b/drivers/mmc/host/dw_mmc-pltfm.c
index 9b05381..cbbbcf3 100644
--- a/drivers/mmc/host/dw_mmc-pltfm.c
+++ b/drivers/mmc/host/dw_mmc-pltfm.c
@@ -24,6 +24,15 @@
 
 #include "dw_mmc.h"
 
+static void dw_mci_rockchip_prepare_command(struct dw_mci *host, u32 *cmdr)
+{
+	*cmdr |= SDMMC_CMD_USE_HOLD_REG;
+}
+
+static const struct dw_mci_drv_data rockchip_drv_data = {
+	.prepare_command	= dw_mci_rockchip_prepare_command,
+};
+
 int dw_mci_pltfm_register(struct platform_device *pdev,
 				const struct dw_mci_drv_data *drv_data)
 {
@@ -100,13 +109,23 @@ EXPORT_SYMBOL_GPL(dw_mci_pltfm_pmops);
 
 static const struct of_device_id dw_mci_pltfm_match[] = {
 	{ .compatible = "snps,dw-mshc", },
+	{ .compatible = "rockchip,cortex-a9-dw-mshc",
+		.data = &rockchip_drv_data },
 	{},
 };
 MODULE_DEVICE_TABLE(of, dw_mci_pltfm_match);
 
 static int dw_mci_pltfm_probe(struct platform_device *pdev)
 {
-	return dw_mci_pltfm_register(pdev, NULL);
+	const struct dw_mci_drv_data *drv_data = NULL;
+	const struct of_device_id *match;
+
+	if (pdev->dev.of_node) {
+		match = of_match_node(dw_mci_pltfm_match, pdev->dev.of_node);
+		drv_data = match->data;
+	}
+
+	return dw_mci_pltfm_register(pdev, drv_data);
 }
 
 int dw_mci_pltfm_remove(struct platform_device *pdev)
-- 
1.7.2.3

  parent reply	other threads:[~2013-06-11 11:31 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-11 11:28 [PATCH v3 0/7] arm: add basic support for Rockchip Cortex-A9 SoCs Heiko Stübner
2013-06-11 11:28 ` Heiko Stübner
2013-06-11 11:28 ` Heiko Stübner
2013-06-11 11:29 ` [PATCH v3 1/7] clk: divider: add flag to limit possible dividers to even numbers Heiko Stübner
2013-06-11 11:29   ` Heiko Stübner
2013-06-11 11:29   ` Heiko Stübner
2013-06-11 11:51   ` Andy Shevchenko
2013-06-11 11:51     ` Andy Shevchenko
2013-06-11 11:51     ` Andy Shevchenko
2013-06-11 12:06     ` Heiko Stübner
2013-06-11 12:06       ` Heiko Stübner
2013-06-11 12:06       ` Heiko Stübner
2013-06-11 12:37       ` Andy Shevchenko
2013-06-11 12:37         ` Andy Shevchenko
2013-06-11 12:37         ` Andy Shevchenko
2013-06-11 12:39         ` Andy Shevchenko
2013-06-11 12:39           ` Andy Shevchenko
2013-06-11 12:39           ` Andy Shevchenko
2013-06-11 18:57   ` Mike Turquette
2013-06-11 18:57     ` Mike Turquette
2013-06-11 19:23     ` Heiko Stübner
2013-06-11 19:23       ` Heiko Stübner
2013-06-11 19:23       ` Heiko Stübner
2013-06-11 11:29 ` [PATCH v3 2/7] mmc: dw_mmc-pltfm: remove static from dw_mci_pltfm_remove Heiko Stübner
2013-06-11 11:29   ` Heiko Stübner
2013-06-11 11:29   ` Heiko Stübner
2013-06-11 11:30 ` [PATCH v3 3/7] mmc: dw_mmc-pltfm: move probe and remove below dt match table Heiko Stübner
2013-06-11 11:30   ` Heiko Stübner
2013-06-11 11:30   ` Heiko Stübner
2013-06-12  1:16   ` Seungwon Jeon
2013-06-12  1:16     ` Seungwon Jeon
2013-06-11 11:30 ` Heiko Stübner [this message]
2013-06-11 11:30   ` [PATCH v3 4/7] mmc: dw_mmc-pltfm: add Rockchip variant Heiko Stübner
2013-06-11 11:30   ` Heiko Stübner
2013-06-12  1:22   ` Seungwon Jeon
2013-06-12  1:22     ` Seungwon Jeon
2013-06-11 11:31 ` [PATCH v3 5/7] clk: add basic Rockchip rk3066a clock support Heiko Stübner
2013-06-11 11:31   ` Heiko Stübner
2013-06-11 11:31   ` Heiko Stübner
2013-06-11 20:06   ` Mike Turquette
2013-06-11 20:06     ` Mike Turquette
2013-06-12 22:45     ` Heiko Stübner
2013-06-12 22:45       ` Heiko Stübner
2013-06-12 22:45       ` Heiko Stübner
2013-06-12 23:02       ` Olof Johansson
2013-06-12 23:02         ` Olof Johansson
2013-06-12 23:02         ` Olof Johansson
2013-06-12 23:40         ` Heiko Stübner
2013-06-12 23:40           ` Heiko Stübner
2013-06-12 23:40           ` Heiko Stübner
2013-06-11 11:32 ` [PATCH v3 6/7] arm: add debug uarts for rockchip rk29xx and rk3xxx series Heiko Stübner
2013-06-11 11:32   ` Heiko Stübner
2013-06-11 11:32   ` Heiko Stübner
2013-06-11 11:32 ` [PATCH v3 7/7] arm: add basic support for Rockchip RK3066a boards Heiko Stübner
2013-06-11 11:32   ` Heiko Stübner
2013-06-11 11:32   ` Heiko Stübner

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=201306111330.56901.heiko@sntech.de \
    --to=heiko@sntech.de \
    --cc=andy.shevchenko@gmail.com \
    --cc=arnd@arndb.de \
    --cc=cjb@laptop.org \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@linaro.org \
    --cc=jh80.chung@samsung.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mturquette@linaro.org \
    --cc=olof@lixom.net \
    --cc=rob.herring@calxeda.com \
    --cc=tgih.jun@samsung.com \
    --cc=thomas.petazzoni@free-electrons.com \
    /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.