mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Suman Anna <s-anna@ti.com>
To: Tony Lindgren <tony@atomide.com>
Cc: Jassi Brar <jaswinder.singh@linaro.org>,
	Dave Gerlach <d-gerlach@ti.com>, <linux-kernel@vger.kernel.org>,
	<linux-omap@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	Suman Anna <s-anna@ti.com>, Jassi Brar <jassisinghbrar@gmail.com>
Subject: [PATCH 6/6] mailbox/omap: add a custom of_xlate function
Date: Tue, 24 Jun 2014 20:47:58 -0500	[thread overview]
Message-ID: <1403660878-56350-7-git-send-email-s-anna@ti.com> (raw)
In-Reply-To: <1403660878-56350-1-git-send-email-s-anna@ti.com>

The mailbox framework currently does not support using the
channel phandles directly in the mbox property of client nodes,
and also expects a minimum value of 1 for the #mbox-cells in the
mailbox controller device node. Implement a custom of_xlate function
for the OMAP mailbox driver that allows phandles for the pargs
specifier instead of indexing to avoid any channel registration
order dependencies.

Cc: Jassi Brar <jassisinghbrar@gmail.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
---
 drivers/mailbox/omap-mailbox.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/drivers/mailbox/omap-mailbox.c b/drivers/mailbox/omap-mailbox.c
index d71e84f..4847466 100644
--- a/drivers/mailbox/omap-mailbox.c
+++ b/drivers/mailbox/omap-mailbox.c
@@ -676,6 +676,28 @@ static const struct of_device_id omap_mailbox_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, omap_mailbox_of_match);
 
+static struct mbox_chan *omap_mbox_of_xlate(struct mbox_controller *controller,
+					    const struct of_phandle_args *sp)
+{
+	phandle phandle = sp->args[0];
+	struct device_node *node;
+	struct omap_mbox_device *mdev;
+	struct omap_mbox *mbox;
+
+	node = of_find_node_by_phandle(phandle);
+	if (!node) {
+		pr_err("could not find node phandle 0x%x\n", phandle);
+		return NULL;
+	}
+
+	mdev = container_of(controller, struct omap_mbox_device, controller);
+	if (WARN_ON(!mdev))
+		return NULL;
+
+	mbox = omap_mbox_device_find(mdev, node->name);
+	return mbox ? mbox->chan : NULL;
+}
+
 static int omap_mbox_probe(struct platform_device *pdev)
 {
 	struct resource *mem;
@@ -835,6 +857,7 @@ static int omap_mbox_probe(struct platform_device *pdev)
 	mdev->controller.ops = &omap_mbox_chan_ops;
 	mdev->controller.chans = chnls;
 	mdev->controller.num_chans = info_count;
+	mdev->controller.of_xlate = omap_mbox_of_xlate;
 	ret = omap_mbox_register(mdev);
 	if (ret)
 		return ret;
-- 
2.0.0


  parent reply	other threads:[~2014-06-25  1:49 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-25  1:47 [PATCH 0/6] OMAP Mailbox framework adoption & DT support Suman Anna
2014-06-25  1:47 ` [PATCH 1/6] Documentation: dt: add omap mailbox bindings Suman Anna
2014-06-25  1:47 ` [PATCH 2/6] mailbox/omap: add support for parsing dt devices Suman Anna
2014-06-28 17:07   ` Pavel Machek
2014-06-30 16:00     ` Suman Anna
2014-06-30 18:59       ` Pavel Machek
2014-06-30 19:34         ` Suman Anna
2014-06-30 20:32           ` Pavel Machek
2014-07-04  6:45             ` Tony Lindgren
2014-07-04  8:05               ` Pavel Machek
2014-07-04  8:23                 ` Tony Lindgren
2014-07-08 17:55                   ` Suman Anna
2014-07-09  8:29                     ` Tony Lindgren
2014-07-09 15:15                       ` Suman Anna
2014-06-25  1:47 ` [PATCH 3/6] ARM: dts: OMAP2+: Add sub mailboxes device node information Suman Anna
2014-06-25  1:47 ` [PATCH 4/6] mailbox/omap: adapt to the new mailbox framework Suman Anna
2014-06-25  1:47 ` [PATCH 5/6] ARM: dts: OMAP2+: Add #mbox-cells property to all mailbox nodes Suman Anna
2014-06-25  1:47 ` Suman Anna [this message]
2014-06-25  8:39   ` [PATCH 6/6] mailbox/omap: add a custom of_xlate function Arnd Bergmann
2014-06-25 16:32     ` Suman Anna

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=1403660878-56350-7-git-send-email-s-anna@ti.com \
    --to=s-anna@ti.com \
    --cc=d-gerlach@ti.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jassisinghbrar@gmail.com \
    --cc=jaswinder.singh@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.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

all inboxes | Powered by JetHome®