devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Abraham <thomas.abraham@linaro.org>
To: linux-mmc@vger.kernel.org, devicetree-discuss@lists.ozlabs.org
Cc: cjb@laptop.org, grant.likely@secretlab.ca,
	rob.herring@calxeda.com, linux-samsung-soc@vger.kernel.org,
	kgene.kim@samsung.com, girish.shivananjappa@linaro.org,
	jh80.chung@samsung.com, tgih.jun@samsung.com, patches@linaro.org
Subject: [PATCH v4 7/9] mmc: dw_mmc: prepare functions in dw_mmc-pltfm for reuse
Date: Sun, 26 Aug 2012 17:22:05 +0530	[thread overview]
Message-ID: <1345981927-26359-8-git-send-email-thomas.abraham@linaro.org> (raw)
In-Reply-To: <1345981927-26359-1-git-send-email-thomas.abraham@linaro.org>

Platform implementations of dw-mshc controller may choose to extend the features
of the standard dw-mshc controller such as adding additional clocking options or
modifying the bus interface. Support for such implementation specific extensions
can be incorporated into dw_mmc-pltfm, but including multiple such platform
specific implementations would convolute the existing dw_mmc-pltfm code.

Instead, it would be better to create implementation specific platform drivers
to support implementation specific features. Such platforms drivers can reuse
the existing infrastructure in dw_mmc-pltfm for resource identification and
controller registration and provide support for implementation specific
features. So, allow the infrastructure in dw_mmc-pltfm to be reused by other
implementation specific platform drivers.

Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
---
 drivers/mmc/host/dw_mmc-pltfm.c |   14 +++++++++++---
 drivers/mmc/host/dw_mmc-pltfm.h |   19 +++++++++++++++++++
 2 files changed, 30 insertions(+), 3 deletions(-)
 create mode 100644 drivers/mmc/host/dw_mmc-pltfm.h

diff --git a/drivers/mmc/host/dw_mmc-pltfm.c b/drivers/mmc/host/dw_mmc-pltfm.c
index 25c5f11..57df3eb 100644
--- a/drivers/mmc/host/dw_mmc-pltfm.c
+++ b/drivers/mmc/host/dw_mmc-pltfm.c
@@ -23,7 +23,7 @@
 
 #include "dw_mmc.h"
 
-static int dw_mci_pltfm_probe(struct platform_device *pdev)
+int dw_mci_pltfm_register(struct platform_device *pdev)
 {
 	struct dw_mci *host;
 	struct resource	*regs;
@@ -52,8 +52,14 @@ static int dw_mci_pltfm_probe(struct platform_device *pdev)
 	ret = dw_mci_probe(host);
 	return ret;
 }
+EXPORT_SYMBOL_GPL(dw_mci_pltfm_register);
+
+static int dw_mci_pltfm_probe(struct platform_device *pdev)
+{
+	return dw_mci_pltfm_register(pdev);
+}
 
-static int __exit dw_mci_pltfm_remove(struct platform_device *pdev)
+int __exit dw_mci_pltfm_remove(struct platform_device *pdev)
 {
 	struct dw_mci *host = platform_get_drvdata(pdev);
 
@@ -61,6 +67,7 @@ static int __exit dw_mci_pltfm_remove(struct platform_device *pdev)
 	dw_mci_remove(host);
 	return 0;
 }
+EXPORT_SYMBOL_GPL(dw_mci_pltfm_remove);
 
 #ifdef CONFIG_PM_SLEEP
 /*
@@ -94,7 +101,8 @@ static int dw_mci_pltfm_resume(struct device *dev)
 #define dw_mci_pltfm_resume	NULL
 #endif /* CONFIG_PM_SLEEP */
 
-static SIMPLE_DEV_PM_OPS(dw_mci_pltfm_pmops, dw_mci_pltfm_suspend, dw_mci_pltfm_resume);
+SIMPLE_DEV_PM_OPS(dw_mci_pltfm_pmops, dw_mci_pltfm_suspend, dw_mci_pltfm_resume);
+EXPORT_SYMBOL_GPL(dw_mci_pltfm_pmops);
 
 static const struct of_device_id dw_mci_pltfm_match[] = {
 	{ .compatible = "snps,dw-mshc", },
diff --git a/drivers/mmc/host/dw_mmc-pltfm.h b/drivers/mmc/host/dw_mmc-pltfm.h
new file mode 100644
index 0000000..5618608
--- /dev/null
+++ b/drivers/mmc/host/dw_mmc-pltfm.h
@@ -0,0 +1,19 @@
+/*
+ * Synopsys DesignWare Multimedia Card Interface Platform driver
+ *
+ * Copyright (C) 2012, Samsung Electronics Co., Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef _DW_MMC_PLTFM_H_
+#define _DW_MMC_PLTFM_H_
+
+extern int dw_mci_pltfm_register(struct platform_device *pdev);
+extern int __exit dw_mci_pltfm_remove(struct platform_device *pdev);
+extern const struct dev_pm_ops dw_mci_pltfm_pmops;
+
+#endif /* _DW_MMC_PLTFM_H_ */
-- 
1.6.6.rc2


  parent reply	other threads:[~2012-08-26 11:52 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-26 11:51 [PATCH v4 0/9] mmc: dw_mmc: add support for device tree based instantiation Thomas Abraham
2012-08-26 11:51 ` [PATCH v4 1/9] mmc: dw_mmc: convert copy of struct device in struct dw_mci to a reference Thomas Abraham
2012-08-26 11:52 ` [PATCH v4 2/9] mmc: dw_mmc: Use devm_* functions in dw_mmc platform driver Thomas Abraham
2012-08-26 11:52 ` [PATCH v4 3/9] mmc: dw_mmc: allow probe to succeed even if one slot is initialized Thomas Abraham
2012-08-26 11:52 ` [PATCH v4 4/9] mmc: dw_mmc: lookup for optional biu and ciu clocks Thomas Abraham
2012-08-28 10:43   ` Seungwon Jeon
2012-08-28 11:23     ` Thomas Abraham
2012-08-26 11:52 ` [PATCH v4 5/9] mmc: dw_mmc: add quirk to indicate missing write protect line Thomas Abraham
2012-08-26 11:52 ` [PATCH v4 6/9] mmc: dw_mmc: add device tree support Thomas Abraham
2012-08-26 11:52 ` Thomas Abraham [this message]
2012-08-26 11:52 ` [PATCH v4 8/9] mmc: dw_mmc: add support for implementation specific callbacks Thomas Abraham
2012-08-26 11:52 ` [PATCH v4 9/9] mmc: dw_mmc: add support for exynos specific implementation of dw-mshc Thomas Abraham
2012-08-27  8:58   ` Jaehoon Chung
2012-08-28  4:48     ` Thomas Abraham
2012-08-28  4:55       ` Jaehoon Chung
2012-08-28  5:10         ` Thomas Abraham
2012-08-28  5:10           ` Thomas Abraham
2012-08-28  5:16             ` Jaehoon Chung
2012-08-28  5:20               ` Thomas Abraham
2012-08-28  7:06   ` Seungwon Jeon
2012-08-28  7:42     ` Thomas Abraham
2012-08-28 10:43       ` Seungwon Jeon
2012-08-28 11:35         ` Thomas Abraham
2012-08-27  9:31 ` [PATCH v4 0/9] mmc: dw_mmc: add support for device tree based instantiation Will Newton
2012-08-28  4:52   ` Thomas Abraham

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=1345981927-26359-8-git-send-email-thomas.abraham@linaro.org \
    --to=thomas.abraham@linaro.org \
    --cc=cjb@laptop.org \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=girish.shivananjappa@linaro.org \
    --cc=grant.likely@secretlab.ca \
    --cc=jh80.chung@samsung.com \
    --cc=kgene.kim@samsung.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=patches@linaro.org \
    --cc=rob.herring@calxeda.com \
    --cc=tgih.jun@samsung.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).