From: Rajendra Nayak <rnayak@ti.com>
To: linux-mmc@vger.kernel.org, devicetree-discuss@lists.ozlabs.org
Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
grant.likely@secretlab.ca, rob.herring@calxeda.com,
thomas.abraham@linaro.org, balajitk@ti.com, cjb@laptop.org,
tony@atomide.com, Rajendra Nayak <rnayak@ti.com>
Subject: [PATCH 4/4] omap4: mmc: use auxdata to pass platform function ptrs
Date: Fri, 4 Nov 2011 17:20:41 +0530 [thread overview]
Message-ID: <1320407441-29697-5-git-send-email-rnayak@ti.com> (raw)
In-Reply-To: <1320407441-29697-1-git-send-email-rnayak@ti.com>
mmc driver still relies on platform specific functions
being invoked from the driver by means of function pointers
being passed through platform_data structure.
use the auxdata for now to pass these the same way until
we find a way to get rid of these calls from the driver.
Signed-off-by: Rajendra Nayak <rnayak@ti.com>
---
arch/arm/mach-omap2/board-generic.c | 19 +++++++++++++++++--
arch/arm/mach-omap2/hsmmc.c | 9 +++++----
arch/arm/mach-omap2/hsmmc.h | 5 +++++
drivers/mmc/host/omap_hsmmc.c | 8 ++++++++
4 files changed, 35 insertions(+), 6 deletions(-)
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index 62c6b2e..af2fdd9 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -15,14 +15,29 @@
#include <linux/io.h>
#include <linux/of_platform.h>
#include <linux/irqdomain.h>
+#include <linux/i2c/twl.h>
#include <mach/hardware.h>
#include <asm/mach/arch.h>
#include <plat/board.h>
#include <plat/common.h>
+#include <plat/mmc.h>
#include <mach/omap4-common.h>
+#include "hsmmc.h"
+
+struct omap_mmc_platform_data omap4_mmc1_pdata = {
+ .init = twl6030_mmc_card_detect_config,
+ .slots[0] = {
+ .before_set_reg = omap4_hsmmc1_before_set_reg,
+ .after_set_reg = omap4_hsmmc1_after_set_reg,
+ },
+};
+struct of_dev_auxdata omap_auxdata_lookup[] __initdata = {
+ OF_DEV_AUXDATA("ti,omap-hsmmc0", 0x4809c000, "omap_hsmmc.0", &omap4_mmc1_pdata),
+ {}
+};
static struct of_device_id omap_dt_match_table[] __initdata = {
{ .compatible = "simple-bus", },
@@ -44,8 +59,8 @@ static void __init omap_generic_init(void)
omap_serial_init();
omap_sdrc_init(NULL, NULL);
-
- of_platform_populate(NULL, omap_dt_match_table, NULL, NULL);
+ omap2_hsmmc_init(NULL);
+ of_platform_populate(NULL, omap_dt_match_table, omap_auxdata_lookup, NULL);
}
#if defined(CONFIG_SOC_OMAP2420)
diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index 7708584..dc698be 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -120,7 +120,7 @@ static void omap_hsmmc1_after_set_reg(struct device *dev, int slot,
}
}
-static void omap4_hsmmc1_before_set_reg(struct device *dev, int slot,
+void omap4_hsmmc1_before_set_reg(struct device *dev, int slot,
int power_on, int vdd)
{
u32 reg;
@@ -141,7 +141,7 @@ static void omap4_hsmmc1_before_set_reg(struct device *dev, int slot,
omap4_ctrl_pad_writel(reg, control_pbias_offset);
}
-static void omap4_hsmmc1_after_set_reg(struct device *dev, int slot,
+void omap4_hsmmc1_after_set_reg(struct device *dev, int slot,
int power_on, int vdd)
{
u32 reg;
@@ -495,8 +495,9 @@ void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers)
omap4_ctrl_pad_writel(reg, control_mmc1);
}
- for (; controllers->mmc; controllers++)
- omap_init_hsmmc(controllers, controllers->mmc);
+ if (controllers)
+ for (; controllers->mmc; controllers++)
+ omap_init_hsmmc(controllers, controllers->mmc);
}
diff --git a/arch/arm/mach-omap2/hsmmc.h b/arch/arm/mach-omap2/hsmmc.h
index f757e78..543ab4d 100644
--- a/arch/arm/mach-omap2/hsmmc.h
+++ b/arch/arm/mach-omap2/hsmmc.h
@@ -34,6 +34,11 @@ struct omap2_hsmmc_info {
#if defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
void omap2_hsmmc_init(struct omap2_hsmmc_info *);
+extern void omap4_hsmmc1_before_set_reg(struct device *dev, int slot,
+ int power_on, int vdd);
+extern void omap4_hsmmc1_after_set_reg(struct device *dev, int slot,
+ int power_on, int vdd);
+
#else
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 90b4a61..5fb5a95 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1953,6 +1953,7 @@ static const struct of_device_id omap_mmc_of_match[];
static int __init omap_hsmmc_probe(struct platform_device *pdev)
{
struct omap_mmc_platform_data *pdata = pdev->dev.platform_data;
+ struct omap_mmc_platform_data *aux_pdata = pdev->dev.platform_data;
struct mmc_host *mmc;
struct omap_hsmmc_host *host = NULL;
struct resource *res;
@@ -1964,6 +1965,13 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev)
pdata = of_get_hsmmc_pdata(&pdev->dev);
if (match->data)
pdata->reg_offset = *(u16 *)match->data;
+ if (aux_pdata) {
+ pdata->init = aux_pdata->init;
+ pdata->slots[0].before_set_reg =
+ aux_pdata->slots[0].before_set_reg;
+ pdata->slots[0].after_set_reg =
+ aux_pdata->slots[0].after_set_reg;
+ }
}
if (pdata == NULL) {
--
1.7.1
prev parent reply other threads:[~2011-11-04 11:50 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-04 11:50 [PATCH 0/4] omap hsmmc device tree support Rajendra Nayak
2011-11-04 11:50 ` [PATCH 1/4] mmc: Add additional binding for mmc host controller Rajendra Nayak
2011-11-04 19:58 ` Olof Johansson
2011-11-04 11:50 ` [PATCH 2/4] mmc: omap: adapt the hsmmc driver to device tree Rajendra Nayak
2011-11-04 20:04 ` Olof Johansson
2011-11-04 21:25 ` Cousson, Benoit
2011-11-04 21:28 ` Olof Johansson
2011-11-07 6:14 ` Rajendra Nayak
2011-11-04 22:15 ` Segher Boessenkool
2011-11-07 6:18 ` Rajendra Nayak
2011-11-14 21:30 ` Tony Lindgren
2011-11-15 4:15 ` Rajendra Nayak
2011-11-19 0:21 ` Tony Lindgren
2011-11-04 11:50 ` [PATCH 3/4] omap4: mmc: Pass SoC and board data for omap4 mmc from dt Rajendra Nayak
2011-11-04 11:50 ` Rajendra Nayak [this message]
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=1320407441-29697-5-git-send-email-rnayak@ti.com \
--to=rnayak@ti.com \
--cc=balajitk@ti.com \
--cc=cjb@laptop.org \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=grant.likely@secretlab.ca \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=rob.herring@calxeda.com \
--cc=thomas.abraham@linaro.org \
--cc=tony@atomide.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 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).