From: Suman Anna <s-anna@ti.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Tony Lindgren <tony@atomide.com>,
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,
Jassi Brar <jassisinghbrar@gmail.com>
Subject: Re: [PATCH 6/6] mailbox/omap: add a custom of_xlate function
Date: Wed, 25 Jun 2014 11:32:13 -0500 [thread overview]
Message-ID: <53AAF98D.7070309@ti.com> (raw)
In-Reply-To: <5721425.bMLltMQDlc@wuerfel>
Hi Arnd,
On 06/25/2014 03:39 AM, Arnd Bergmann wrote:
> On Tuesday 24 June 2014 20:47:58 Suman Anna wrote:
>> +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;
>>
>
> Wouldn't it be easier to change the omap_mbox_device_find() function to
> take a phandle argument directly? You shouldn't have to walk all
> nodes in the system, or match it by name if you already have the
> device node.
The omap_mbox_device_find() function is also used on the non-DT mailbox
client path (for OMAP3) at the moment where we don't have the device
node pointers. I am merely reusing the function for the DT lookup path,
and once I remove the non-DT support, I can surely do the matching logic
just based on the device node pointer. I just chose to minimize the
changes to the omap_mbox_device_find() to do both variants now when I
know that I am gonna remove the non-DT part (name lookup) later on.
The current expected DT usage model for the OMAP mailbox client is (with
the v7 mailbox framework)
mbox = <&controller_phandle &channel_phandle>
So, this is not walking through all the nodes in the system, only the
channel/sub-mailbox nodes present on the particular controller node.
Surely, it can done as mbox = <&channel_phandle> as the parent
controller node relationship is inherent, but this requires changes to
the mailbox framework, and I am not sure if every platform
implementation would implement the child channels as their own nodes.
>
> Also, the xlate function is normally the place where you read out
> the other arguments and set them as members in your omap_mbox
> structure.
The current flow for the xlate function is during the
mailbox_request_channel. The channels themselves would have been
registered during the controller node probe, so this is merely a lookup
for the correct channel. Should we be renaming the xlate function, if
the behavior is not what one expects out of a standard xlate?
regards
Suman
WARNING: multiple messages have this Message-ID (diff)
From: s-anna@ti.com (Suman Anna)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 6/6] mailbox/omap: add a custom of_xlate function
Date: Wed, 25 Jun 2014 11:32:13 -0500 [thread overview]
Message-ID: <53AAF98D.7070309@ti.com> (raw)
In-Reply-To: <5721425.bMLltMQDlc@wuerfel>
Hi Arnd,
On 06/25/2014 03:39 AM, Arnd Bergmann wrote:
> On Tuesday 24 June 2014 20:47:58 Suman Anna wrote:
>> +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;
>>
>
> Wouldn't it be easier to change the omap_mbox_device_find() function to
> take a phandle argument directly? You shouldn't have to walk all
> nodes in the system, or match it by name if you already have the
> device node.
The omap_mbox_device_find() function is also used on the non-DT mailbox
client path (for OMAP3) at the moment where we don't have the device
node pointers. I am merely reusing the function for the DT lookup path,
and once I remove the non-DT support, I can surely do the matching logic
just based on the device node pointer. I just chose to minimize the
changes to the omap_mbox_device_find() to do both variants now when I
know that I am gonna remove the non-DT part (name lookup) later on.
The current expected DT usage model for the OMAP mailbox client is (with
the v7 mailbox framework)
mbox = <&controller_phandle &channel_phandle>
So, this is not walking through all the nodes in the system, only the
channel/sub-mailbox nodes present on the particular controller node.
Surely, it can done as mbox = <&channel_phandle> as the parent
controller node relationship is inherent, but this requires changes to
the mailbox framework, and I am not sure if every platform
implementation would implement the child channels as their own nodes.
>
> Also, the xlate function is normally the place where you read out
> the other arguments and set them as members in your omap_mbox
> structure.
The current flow for the xlate function is during the
mailbox_request_channel. The channels themselves would have been
registered during the controller node probe, so this is merely a lookup
for the correct channel. Should we be renaming the xlate function, if
the behavior is not what one expects out of a standard xlate?
regards
Suman
WARNING: multiple messages have this Message-ID (diff)
From: Suman Anna <s-anna@ti.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Tony Lindgren <tony@atomide.com>,
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>,
Jassi Brar <jassisinghbrar@gmail.com>
Subject: Re: [PATCH 6/6] mailbox/omap: add a custom of_xlate function
Date: Wed, 25 Jun 2014 11:32:13 -0500 [thread overview]
Message-ID: <53AAF98D.7070309@ti.com> (raw)
In-Reply-To: <5721425.bMLltMQDlc@wuerfel>
Hi Arnd,
On 06/25/2014 03:39 AM, Arnd Bergmann wrote:
> On Tuesday 24 June 2014 20:47:58 Suman Anna wrote:
>> +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;
>>
>
> Wouldn't it be easier to change the omap_mbox_device_find() function to
> take a phandle argument directly? You shouldn't have to walk all
> nodes in the system, or match it by name if you already have the
> device node.
The omap_mbox_device_find() function is also used on the non-DT mailbox
client path (for OMAP3) at the moment where we don't have the device
node pointers. I am merely reusing the function for the DT lookup path,
and once I remove the non-DT support, I can surely do the matching logic
just based on the device node pointer. I just chose to minimize the
changes to the omap_mbox_device_find() to do both variants now when I
know that I am gonna remove the non-DT part (name lookup) later on.
The current expected DT usage model for the OMAP mailbox client is (with
the v7 mailbox framework)
mbox = <&controller_phandle &channel_phandle>
So, this is not walking through all the nodes in the system, only the
channel/sub-mailbox nodes present on the particular controller node.
Surely, it can done as mbox = <&channel_phandle> as the parent
controller node relationship is inherent, but this requires changes to
the mailbox framework, and I am not sure if every platform
implementation would implement the child channels as their own nodes.
>
> Also, the xlate function is normally the place where you read out
> the other arguments and set them as members in your omap_mbox
> structure.
The current flow for the xlate function is during the
mailbox_request_channel. The channels themselves would have been
registered during the controller node probe, so this is merely a lookup
for the correct channel. Should we be renaming the xlate function, if
the behavior is not what one expects out of a standard xlate?
regards
Suman
next prev parent reply other threads:[~2014-06-25 16:32 UTC|newest]
Thread overview: 53+ 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 ` Suman Anna
2014-06-25 1:47 ` Suman Anna
2014-06-25 1:47 ` [PATCH 1/6] Documentation: dt: add omap mailbox bindings Suman Anna
2014-06-25 1:47 ` Suman Anna
2014-06-25 1:47 ` Suman Anna
2014-06-25 1:47 ` [PATCH 2/6] mailbox/omap: add support for parsing dt devices Suman Anna
2014-06-25 1:47 ` Suman Anna
2014-06-25 1:47 ` Suman Anna
2014-06-28 17:07 ` Pavel Machek
2014-06-28 17:07 ` Pavel Machek
2014-06-30 16:00 ` Suman Anna
2014-06-30 16:00 ` Suman Anna
2014-06-30 16:00 ` Suman Anna
2014-06-30 18:59 ` Pavel Machek
2014-06-30 18:59 ` Pavel Machek
2014-06-30 19:34 ` Suman Anna
2014-06-30 19:34 ` Suman Anna
2014-06-30 19:34 ` Suman Anna
2014-06-30 20:32 ` Pavel Machek
2014-06-30 20:32 ` Pavel Machek
2014-06-30 20:32 ` Pavel Machek
2014-07-04 6:45 ` Tony Lindgren
2014-07-04 6:45 ` Tony Lindgren
2014-07-04 8:05 ` Pavel Machek
2014-07-04 8:05 ` Pavel Machek
[not found] ` <20140704080556.GA16274-tWAi6jLit6GreWDznjuHag@public.gmane.org>
2014-07-04 8:23 ` Tony Lindgren
2014-07-04 8:23 ` Tony Lindgren
2014-07-04 8:23 ` Tony Lindgren
[not found] ` <20140704082354.GD28884-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2014-07-08 17:55 ` Suman Anna
2014-07-08 17:55 ` Suman Anna
2014-07-08 17:55 ` Suman Anna
[not found] ` <53BC3081.9010402-l0cyMroinI0@public.gmane.org>
2014-07-09 8:29 ` Tony Lindgren
2014-07-09 8:29 ` Tony Lindgren
2014-07-09 8:29 ` Tony Lindgren
2014-07-09 15:15 ` Suman Anna
2014-07-09 15:15 ` Suman Anna
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 ` 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 ` Suman Anna
2014-06-25 1:47 ` 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
2014-06-25 1:47 ` [PATCH 6/6] mailbox/omap: add a custom of_xlate function Suman Anna
2014-06-25 1:47 ` Suman Anna
2014-06-25 1:47 ` Suman Anna
2014-06-25 8:39 ` Arnd Bergmann
2014-06-25 8:39 ` Arnd Bergmann
2014-06-25 16:32 ` Suman Anna [this message]
2014-06-25 16:32 ` Suman Anna
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=53AAF98D.7070309@ti.com \
--to=s-anna@ti.com \
--cc=arnd@arndb.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.