[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1347494898-16671-2-git-send-email-omar.luna@linaro.org>
Date: Wed, 12 Sep 2012 19:08:14 -0500
From: Omar Ramirez Luna <omar.luna@...aro.org>
To: Tony Lindgren <tony@...mide.com>, Benoit Cousson <b-cousson@...com>
Cc: Russell King <linux@....linux.org.uk>,
Omar Ramirez Luna <omar.luna@...aro.org>,
devicetree-discuss@...ts.ozlabs.org, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-omap@...r.kernel.org
Subject: [PATCH v2 1/2] OMAP: mailbox: add device tree support
Adapt driver to use DT if provided.
Signed-off-by: Omar Ramirez Luna <omar.luna@...aro.org>
---
.../devicetree/bindings/arm/omap/mailbox.txt | 9 +++++++++
arch/arm/mach-omap2/devices.c | 3 +++
arch/arm/mach-omap2/mailbox.c | 12 ++++++++++++
3 files changed, 24 insertions(+)
create mode 100644 Documentation/devicetree/bindings/arm/omap/mailbox.txt
diff --git a/Documentation/devicetree/bindings/arm/omap/mailbox.txt b/Documentation/devicetree/bindings/arm/omap/mailbox.txt
new file mode 100644
index 0000000..c57c0d5
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/omap/mailbox.txt
@@ -0,0 +1,9 @@
+OMAP Mailbox module
+
+Required properties:
+ compatible : should be "ti,omap2-mailbox" for OMAP2 mailbox
+ compatible : should be "ti,omap3-mailbox" for OMAP3 mailbox
+ compatible : should be "ti,omap4-mailbox" for OMAP4 mailbox
+
+Optional properties:
+ None
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index c00c689..19093fb 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -279,6 +279,9 @@ static inline void __init omap_init_mbox(void)
struct omap_hwmod *oh;
struct platform_device *pdev;
+ if (of_have_populated_dt())
+ return;
+
oh = omap_hwmod_lookup("mailbox");
if (!oh) {
pr_err("%s: unable to find hwmod\n", __func__);
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index 6875be8..80beadf 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -13,6 +13,7 @@
#include <linux/module.h>
#include <linux/clk.h>
#include <linux/err.h>
+#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/io.h>
#include <linux/pm_runtime.h>
@@ -400,11 +401,22 @@ static int __devexit omap2_mbox_remove(struct platform_device *pdev)
return 0;
}
+#if defined(CONFIG_OF)
+static const struct of_device_id omap_mailbox_of_match[] = {
+ { .compatible = "ti,omap2-mailbox" },
+ { .compatible = "ti,omap3-mailbox" },
+ { .compatible = "ti,omap4-mailbox" },
+ {},
+};
+MODULE_DEVICE_TABLE(of, omap_mailbox_of_match);
+#endif
+
static struct platform_driver omap2_mbox_driver = {
.probe = omap2_mbox_probe,
.remove = __devexit_p(omap2_mbox_remove),
.driver = {
.name = "omap-mailbox",
+ .of_match_table = of_match_ptr(omap_mailbox_of_match),
},
};
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists