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
Adapt driver to use DT if provided.
Signed-off-by: Omar Ramirez Luna omar.luna@linaro.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(+), 0 deletions(-) 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 e433603..7a78063 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c @@ -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__); diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c index 415a6f1..7cf12ca 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> @@ -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), }, };
Add nodes for mailbox DT, to interface with hwmods.
Signed-off-by: Omar Ramirez Luna omar.luna@linaro.org --- 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(-)
diff --git a/arch/arm/boot/dts/omap2.dtsi b/arch/arm/boot/dts/omap2.dtsi index f2ab4ea..2175cc3 100644 --- a/arch/arm/boot/dts/omap2.dtsi +++ b/arch/arm/boot/dts/omap2.dtsi @@ -46,6 +46,11 @@ #interrupt-cells = <1>; };
+ mailbox: mailbox@48094000 { + compatible = "ti,omap2-mailbox"; + ti,hwmods = "mailbox"; + }; + uart1: serial@4806a000 { compatible = "ti,omap2-uart"; ti,hwmods = "uart1"; diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi index c612135..540f6d6 100644 --- a/arch/arm/boot/dts/omap3.dtsi +++ b/arch/arm/boot/dts/omap3.dtsi @@ -69,6 +69,11 @@ reg = <0x48200000 0x1000>; };
+ mailbox: mailbox@48094000 { + compatible = "ti,omap3-mailbox"; + ti,hwmods = "mailbox"; + }; + uart1: serial@4806a000 { compatible = "ti,omap3-uart"; ti,hwmods = "uart1"; diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi index 3d35559..84f27dd 100644 --- a/arch/arm/boot/dts/omap4.dtsi +++ b/arch/arm/boot/dts/omap4.dtsi @@ -104,6 +104,11 @@ <0x48240100 0x0100>; };
+ mailbox: mailbox@4a0f4000 { + compatible = "ti,omap4-mailbox"; + ti,hwmods = "mailbox"; + }; + uart1: serial@4806a000 { compatible = "ti,omap4-uart"; ti,hwmods = "uart1";
On 5/1/2012 7:47 PM, Omar Ramirez Luna wrote:
Add nodes for mailbox DT, to interface with hwmods.
Signed-off-by: Omar Ramirez Lunaomar.luna@linaro.org
Acked-by: Benoit Cousson b-cousson@ti.com
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(-)
diff --git a/arch/arm/boot/dts/omap2.dtsi b/arch/arm/boot/dts/omap2.dtsi index f2ab4ea..2175cc3 100644 --- a/arch/arm/boot/dts/omap2.dtsi +++ b/arch/arm/boot/dts/omap2.dtsi @@ -46,6 +46,11 @@ #interrupt-cells =<1>; };
mailbox: mailbox@48094000 {
compatible = "ti,omap2-mailbox";
ti,hwmods = "mailbox";
};
- uart1: serial@4806a000 { compatible = "ti,omap2-uart"; ti,hwmods = "uart1";
diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi index c612135..540f6d6 100644 --- a/arch/arm/boot/dts/omap3.dtsi +++ b/arch/arm/boot/dts/omap3.dtsi @@ -69,6 +69,11 @@ reg =<0x48200000 0x1000>; };
mailbox: mailbox@48094000 {
compatible = "ti,omap3-mailbox";
ti,hwmods = "mailbox";
};
- uart1: serial@4806a000 { compatible = "ti,omap3-uart"; ti,hwmods = "uart1";
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi index 3d35559..84f27dd 100644 --- a/arch/arm/boot/dts/omap4.dtsi +++ b/arch/arm/boot/dts/omap4.dtsi @@ -104,6 +104,11 @@ <0x48240100 0x0100>; };
mailbox: mailbox@4a0f4000 {
compatible = "ti,omap4-mailbox";
ti,hwmods = "mailbox";
};
- uart1: serial@4806a000 { compatible = "ti,omap4-uart"; ti,hwmods = "uart1";
Hi Omar,
On Tue, May 01, 2012 at 23:17:38, Omar Ramirez Luna wrote:
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
Hi Vaibhav,
Somehow I missed this mail.
On 2 May 2012 00:42, Bedia, Vaibhav vaibhav.bedia@ti.com wrote:
Hi Omar,
On Tue, May 01, 2012 at 23:17:38, Omar Ramirez Luna wrote:
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.
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.
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
On 5/2/2012 7:42 AM, Bedia, Vaibhav wrote:
Hi Omar,
On Tue, May 01, 2012 at 23:17:38, Omar Ramirez Luna wrote:
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.
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
Hi,
On 24 May 2012 10:44, Cousson, Benoit b-cousson@ti.com wrote:
On 5/2/2012 7:42 AM, Bedia, Vaibhav wrote:
Hi Omar,
On Tue, May 01, 2012 at 23:17:38, Omar Ramirez Luna wrote:
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.
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.
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
Hi Tony, Benoit,
On 1 May 2012 12:47, Omar Ramirez Luna omar.luna@linaro.org wrote:
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
Can you share your thoughts for these patches?
Regards,
Omar