Skip to contentSkip to conversation

OMAP: mailbox initial device tree support

PATCH New Omar Ramirez Luna 3 participants 9 messages May 1, 2012 – May 30, 2012

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover OMAP: mailbox initial device tree support

To allow mailbox driver to function with device tree.

Tested in OMAP4 and OMAP3. OMAP2 untested.

Omar Ramirez Luna (2):
OMAP: mailbox: add device tree support
arm/dts: OMAP2+: Add mailbox nodes

 .../devicetree/bindings/arm/omap/mailbox.txt       |    9 +++++++++
 arch/arm/boot/dts/omap2.dtsi                       |    5 +++++
 arch/arm/boot/dts/omap3.dtsi                       |    5 +++++
 arch/arm/boot/dts/omap4.dtsi                       |    5 +++++
 arch/arm/mach-omap2/devices.c                      |    3 +++
 arch/arm/mach-omap2/mailbox.c                      |   12 ++++++++++++
 6 files changed, 39 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/omap/mailbox.txt
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 1/2 OMAP: mailbox: add device tree support

Adapt driver to use DT if provided.

---
 .../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(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/omap/mailbox.txt
Documentation/devicetree/bindings/arm/omap/mailbox.txt new file +9 -0
new file mode 100644
index 0000000..c57c0d5
@@ -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
arch/arm/mach-omap2/devices.c +3 -0
index e433603..7a78063 100644
@@ -281,6 +281,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__);
arch/arm/mach-omap2/mailbox.c +12 -0
index 415a6f1..7cf12ca 100644
@@ -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>
@@ -402,11 +403,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),
 	},
 };
 
Signature · 1 line
1.7.4.1
#2 lore raw

PATCH 2/2 arm/dts: OMAP2+: Add mailbox nodes

In reply to Omar Ramirez Luna

Add nodes for mailbox DT, to interface with hwmods.

---
 arch/arm/boot/dts/omap2.dtsi |    5 +++++
 arch/arm/boot/dts/omap3.dtsi |    5 +++++
 arch/arm/boot/dts/omap4.dtsi |    5 +++++
 3 files changed, 15 insertions(+), 0 deletions(-)
arch/arm/boot/dts/omap2.dtsi +5 -0
index f2ab4ea..2175cc3 100644
@@ -46,6 +46,11 @@
 			#interrupt-cells = <1>;
 		};
 
+		mailbox: mailbox at 48094000 {
+			compatible = "ti,omap2-mailbox";
+			ti,hwmods = "mailbox";
+		};
+
 		uart1: serial at 4806a000 {
 			compatible = "ti,omap2-uart";
 			ti,hwmods = "uart1";
arch/arm/boot/dts/omap3.dtsi +5 -0
index c612135..540f6d6 100644
@@ -69,6 +69,11 @@
 			reg = <0x48200000 0x1000>;
 		};
 
+		mailbox: mailbox at 48094000 {
+			compatible = "ti,omap3-mailbox";
+			ti,hwmods = "mailbox";
+		};
+
 		uart1: serial at 4806a000 {
 			compatible = "ti,omap3-uart";
 			ti,hwmods = "uart1";
arch/arm/boot/dts/omap4.dtsi +5 -0
index 3d35559..84f27dd 100644
@@ -104,6 +104,11 @@
 			      <0x48240100 0x0100>;
 		};
 
+		mailbox: mailbox at 4a0f4000 {
+			compatible = "ti,omap4-mailbox";
+			ti,hwmods = "mailbox";
+		};
+
 		uart1: serial at 4806a000 {
 			compatible = "ti,omap4-uart";
 			ti,hwmods = "uart1";
Signature · 1 line
1.7.4.1
#3 lore raw

PATCH 2/2 arm/dts: OMAP2+: Add mailbox nodes

Quoted 3 lines · Omar Ramirez Luna

Add nodes for mailbox DT, to interface with hwmods.

Quoted 54 lines
---
  arch/arm/boot/dts/omap2.dtsi |    5 +++++
  arch/arm/boot/dts/omap3.dtsi |    5 +++++
  arch/arm/boot/dts/omap4.dtsi |    5 +++++
  3 files changed, 15 insertions(+), 0 deletions(-)
arch/arm/boot/dts/omap2.dtsi +5 -0
index f2ab4ea..2175cc3 100644
@@ -46,6 +46,11 @@
  			#interrupt-cells =<1>;
  		};
 
+		mailbox: mailbox at 48094000 {
+			compatible = "ti,omap2-mailbox";
+			ti,hwmods = "mailbox";
+		};
+
  		uart1: serial at 4806a000 {
  			compatible = "ti,omap2-uart";
  			ti,hwmods = "uart1";
arch/arm/boot/dts/omap3.dtsi +5 -0
index c612135..540f6d6 100644
@@ -69,6 +69,11 @@
  			reg =<0x48200000 0x1000>;
  		};
 
+		mailbox: mailbox at 48094000 {
+			compatible = "ti,omap3-mailbox";
+			ti,hwmods = "mailbox";
+		};
+
  		uart1: serial at 4806a000 {
  			compatible = "ti,omap3-uart";
  			ti,hwmods = "uart1";
arch/arm/boot/dts/omap4.dtsi +5 -0
index 3d35559..84f27dd 100644
@@ -104,6 +104,11 @@
  			<0x48240100 0x0100>;
  		};
 
+		mailbox: mailbox at 4a0f4000 {
+			compatible = "ti,omap4-mailbox";
+			ti,hwmods = "mailbox";
+		};
+
  		uart1: serial at 4806a000 {
  			compatible = "ti,omap4-uart";
  			ti,hwmods = "uart1";
#4 lore raw

cover OMAP: mailbox initial device tree support

In reply to Omar Ramirez Luna

Hi Omar,

Quoted 4 lines · Omar Ramirez Luna

To allow mailbox driver to function with device tree.

Tested in OMAP4 and OMAP3. OMAP2 untested.

I think the mailbox code needs a cleanup similar to what you had proposed earlier [1] before the device tree support is added.

We probably need to decide whether the number of mailbox sub-modules should be part of hwmod attribute or come from device tree. IMO the static allocation of the mailboxes is better suited in the device-tree data.

Regards,
Vaibhav

[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2011-June/054582.html

#5 lore raw

cover OMAP: mailbox initial device tree support

Hi Vaibhav,

Somehow I missed this mail.

Quoted 10 lines · Vaibhav

Hi Omar,

Quoted 4 lines · Omar Ramirez Luna

To allow mailbox driver to function with device tree.

Tested in OMAP4 and OMAP3. OMAP2 untested.

I think the mailbox code needs a cleanup similar to what you had proposed earlier [1] before the device tree support is added.

I believe the cleanup needs to be there, but this is generic enough to support DT as it is.

Quoted 2 lines

We probably need to decide whether the number of mailbox sub-modules should be part of hwmod attribute or come from device tree.

All the data is currently coming from hwmod, so I don't see why this must be split now between hwmod and DT, but I'm open for suggestions.

Quoted 3 lines

IMO the
static allocation of the mailboxes is better suited in the device-tree data.

If possible I wouldn't want to tie use case specifics to DT or hwmod, the whole point for the cleanup was to allow a dynamic mailbox allocation and not statically assign them.

Regards,

Omar

#6 lore raw

cover OMAP: mailbox initial device tree support

In reply to Bedia, Vaibhav
Quoted 7 lines · Vaibhav

Hi Omar,

Quoted 3 lines · Omar Ramirez Luna

To allow mailbox driver to function with device tree.

Tested in OMAP4 and OMAP3. OMAP2 untested.

Quoted 7 lines

I think the mailbox code needs a cleanup similar to what you had proposed earlier [1] before the device tree support is added.

We probably need to decide whether the number of mailbox sub-modules should be part of hwmod attribute or come from device tree. IMO the static allocation of the mailboxes is better suited in the device-tree data.

Ideally yes, but that assumes we are supporting only DT boot method, which is still not the case today.

That being said, the driver might still be able to leverage DT if available already.

This can be done later as well.

Omar,
That's up to you.

Regards,
Benoit

#7 lore raw

cover OMAP: mailbox initial device tree support

Hi,

Quoted 23 lines · Benoit
Quoted 10 lines · Vaibhav

Hi Omar,

Quoted 4 lines · Omar Ramirez Luna

To allow mailbox driver to function with device tree.

Tested in OMAP4 and OMAP3. OMAP2 untested.

Quoted 7 lines

I think the mailbox code needs a cleanup similar to what you had proposed earlier [1] before the device tree support is added.

We probably need to decide whether the number of mailbox sub-modules should be part of hwmod attribute or come from device tree. IMO the static allocation of the mailboxes is better suited in the device-tree data.

Ideally yes, but that assumes we are supporting only DT boot method, which is still not the case today.

Quoted 8 lines

That being said, the driver might still be able to leverage DT if available already.

This can be done later as well.

Omar,
That's up to you.

Thanks for the ack on the 2nd patch.

Yes, I think these changes doesn't depend on the cleanup of the driver, they could be included prior to them.

Regards,

Omar

#8 lore raw

cover OMAP: mailbox initial device tree support

In reply to Omar Ramirez Luna

Hi Tony, Benoit,

Quoted 8 lines · Omar Ramirez Luna

To allow mailbox driver to function with device tree.

Tested in OMAP4 and OMAP3. OMAP2 untested.

Omar Ramirez Luna (2):
?OMAP: mailbox: add device tree support
?arm/dts: OMAP2+: Add mailbox nodes

Quoted 8 lines
?.../devicetree/bindings/arm/omap/mailbox.txt ? ? ? | ? ?9 +++++++++
?arch/arm/boot/dts/omap2.dtsi ? ? ? ? ? ? ? ? ? ? ? | ? ?5 +++++
?arch/arm/boot/dts/omap3.dtsi ? ? ? ? ? ? ? ? ? ? ? | ? ?5 +++++
?arch/arm/boot/dts/omap4.dtsi ? ? ? ? ? ? ? ? ? ? ? | ? ?5 +++++
?arch/arm/mach-omap2/devices.c ? ? ? ? ? ? ? ? ? ? ?| ? ?3 +++
?arch/arm/mach-omap2/mailbox.c ? ? ? ? ? ? ? ? ? ? ?| ? 12 ++++++++++++

?6 files changed, 39 insertions(+), 0 deletions(-)
?create mode 100644 Documentation/devicetree/bindings/arm/omap/mailbox.txt

Can you share your thoughts for these patches?

Regards,

Omar