All of lore.kernel.org
 help / color / mirror / Atom feed
From: "G, Manjunath Kondaiah" <manjugk@ti.com>
To: Grant Likely <grant.likely@secretlab.ca>
Cc: Kevin Hilman <khilman@ti.com>, Tony Lindgren <tony@atomide.com>,
	devicetree-discuss@lists.ozlabs.org, linux-omap@vger.kernel.org,
	ben-linux@fluff.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 3/4] dt: omap3: add generic board file for dt support
Date: Mon, 18 Jul 2011 15:45:57 +0530	[thread overview]
Message-ID: <CAP6yH7eSmdU16r5iC2MwvU3RwOBXaJNygMUXG=HSMiWUKnor-w@mail.gmail.com> (raw)
In-Reply-To: <CACxGe6uzyxf35WDg6COnPVt3dhQv1H80L1svALxp4naySx2BcA@mail.gmail.com>

Hi Grant,

On 17 July 2011 10:43, Grant Likely <grant.likely@secretlab.ca> wrote:
> Hi Manjunath,
>
> Comments below.  I left in a lot of context for the new folks that
> I've cc'd (Tony and Kevin).
>
> On Sat, Jul 16, 2011 at 2:07 PM, G, Manjunath Kondaiah <manjugk@ti.com> wrote:
>> On Thu, Jul 14, 2011 at 4:45 AM, Grant Likely <grant.likely@secretlab.ca> wrote:
>>>> > +static void __init omap3_init(void)
>>>> > +{
>>>> > +       struct device_node *node;
>>>> > +
[...]
>> +static struct omap_device *of_omap_i2c_device_create(struct device_node *node,
>> +                                                const char *bus_id,
>> +                                                void *platform_data,
>> +                                                struct device *parent)
>> +{
>> +       struct platform_device *pdev;
>> +       struct i2c_board_info *i2c_board_info;
>> +       u8 id;
>> +
>> +       printk("Creating omap i2c device %s\n", node->full_name);
>> +
>> +       if (!of_device_is_available(node))
>> +               return NULL;
>> +
>> +       id = simple_strtol(bus_id, NULL, 0);
>> +       pdev = kzalloc(sizeof(*pdev), GFP_KERNEL);
>> +       pdev->dev.of_node = of_node_get(node);
>> +       if (!pdev->dev.of_node) {
>> +               speed = 100;
>> +       } else {
>> +               u32 prop;
>> +               if (!of_property_read_u32(pdev->dev.of_node, "clock-frequency",
>> +                                                                       &prop))
>> +                       speed = prop/100;
>> +               else
>> +                       speed = 100;
>> +       }
>> +       printk("%s : speed->%d\n",__func__, speed);
>> +
>> +       for_each_child_of_node(bus, child) {
>> +               u32 prop;
>> +
>> +               printk("   create child: %s\n", child->full_name);
>> +               i2c_board_info = kzalloc(sizeof(*i2c_board_info), GFP_KERNEL);
>> +               if (!of_property_read_u32(pdev->dev.of_node, "reg",
>> +                                                               &prop))
>> +               i2c_board_info->addr = prop;
>> +               if (!of_property_read_u32(pdev->dev.of_node, "interrupts",
>> +                                                               &prop))
>> +               i2c_board_info->irq = prop;
>> +               i2c_board_info->platform_data = platform_data;
>> +               strncpy(i2c_board_info->type, child->name,
>> +                                       sizeof(i2c_board_info->type));
>> +       }
>> +       omap_register_i2c_bus(id, speed, i2c_board_info, 1);
>
> While this does in a sense work, and creates an omap_device for the
> i2c bus that does get probed, it ends up encoding an awful lot of
> device specific details into the generic devicetree support code.  The
> i2c bus driver itself must be responsible for decoding the speed and
> child nodes, and in fact it can easily be modified to do so (I've

Decoding speed in i2c driver seems to be fine. But the i2c child nodes are
board specific. We might bring board specific handling code into i2c driver
with this approach.

BTW, I have observed that, if we create i2c device node in omapx-soc.dtsi
file and the define i2c bus clock-frequency in beagle.dts, the clock-frequency
is not available in driver probe. Is this expected behavior?

-M
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: manjugk@ti.com (G, Manjunath Kondaiah)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/4] dt: omap3: add generic board file for dt support
Date: Mon, 18 Jul 2011 15:45:57 +0530	[thread overview]
Message-ID: <CAP6yH7eSmdU16r5iC2MwvU3RwOBXaJNygMUXG=HSMiWUKnor-w@mail.gmail.com> (raw)
In-Reply-To: <CACxGe6uzyxf35WDg6COnPVt3dhQv1H80L1svALxp4naySx2BcA@mail.gmail.com>

Hi Grant,

On 17 July 2011 10:43, Grant Likely <grant.likely@secretlab.ca> wrote:
> Hi Manjunath,
>
> Comments below. ?I left in a lot of context for the new folks that
> I've cc'd (Tony and Kevin).
>
> On Sat, Jul 16, 2011 at 2:07 PM, G, Manjunath Kondaiah <manjugk@ti.com> wrote:
>> On Thu, Jul 14, 2011 at 4:45 AM, Grant Likely <grant.likely@secretlab.ca> wrote:
>>>> > +static void __init omap3_init(void)
>>>> > +{
>>>> > + ? ? ? struct device_node *node;
>>>> > +
[...]
>> +static struct omap_device *of_omap_i2c_device_create(struct device_node *node,
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?const char *bus_id,
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?void *platform_data,
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?struct device *parent)
>> +{
>> + ? ? ? struct platform_device *pdev;
>> + ? ? ? struct i2c_board_info *i2c_board_info;
>> + ? ? ? u8 id;
>> +
>> + ? ? ? printk("Creating omap i2c device %s\n", node->full_name);
>> +
>> + ? ? ? if (!of_device_is_available(node))
>> + ? ? ? ? ? ? ? return NULL;
>> +
>> + ? ? ? id = simple_strtol(bus_id, NULL, 0);
>> + ? ? ? pdev = kzalloc(sizeof(*pdev), GFP_KERNEL);
>> + ? ? ? pdev->dev.of_node = of_node_get(node);
>> + ? ? ? if (!pdev->dev.of_node) {
>> + ? ? ? ? ? ? ? speed = 100;
>> + ? ? ? } else {
>> + ? ? ? ? ? ? ? u32 prop;
>> + ? ? ? ? ? ? ? if (!of_property_read_u32(pdev->dev.of_node, "clock-frequency",
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? &prop))
>> + ? ? ? ? ? ? ? ? ? ? ? speed = prop/100;
>> + ? ? ? ? ? ? ? else
>> + ? ? ? ? ? ? ? ? ? ? ? speed = 100;
>> + ? ? ? }
>> + ? ? ? printk("%s : speed->%d\n",__func__, speed);
>> +
>> + ? ? ? for_each_child_of_node(bus, child) {
>> + ? ? ? ? ? ? ? u32 prop;
>> +
>> + ? ? ? ? ? ? ? printk(" ? create child: %s\n", child->full_name);
>> + ? ? ? ? ? ? ? i2c_board_info = kzalloc(sizeof(*i2c_board_info), GFP_KERNEL);
>> + ? ? ? ? ? ? ? if (!of_property_read_u32(pdev->dev.of_node, "reg",
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? &prop))
>> + ? ? ? ? ? ? ? i2c_board_info->addr = prop;
>> + ? ? ? ? ? ? ? if (!of_property_read_u32(pdev->dev.of_node, "interrupts",
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? &prop))
>> + ? ? ? ? ? ? ? i2c_board_info->irq = prop;
>> + ? ? ? ? ? ? ? i2c_board_info->platform_data = platform_data;
>> + ? ? ? ? ? ? ? strncpy(i2c_board_info->type, child->name,
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? sizeof(i2c_board_info->type));
>> + ? ? ? }
>> + ? ? ? omap_register_i2c_bus(id, speed, i2c_board_info, 1);
>
> While this does in a sense work, and creates an omap_device for the
> i2c bus that does get probed, it ends up encoding an awful lot of
> device specific details into the generic devicetree support code. ?The
> i2c bus driver itself must be responsible for decoding the speed and
> child nodes, and in fact it can easily be modified to do so (I've

Decoding speed in i2c driver seems to be fine. But the i2c child nodes are
board specific. We might bring board specific handling code into i2c driver
with this approach.

BTW, I have observed that, if we create i2c device node in omapx-soc.dtsi
file and the define i2c bus clock-frequency in beagle.dts, the clock-frequency
is not available in driver probe. Is this expected behavior?

-M

  parent reply	other threads:[~2011-07-18 10:15 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-13 22:06 [PATCH 0/4] dt: omap3: add device tree support G, Manjunath Kondaiah
2011-07-13 22:06 ` [PATCH 1/4] dt: omap3: add SoC file for handling i2c controllers G, Manjunath Kondaiah
2011-07-13 22:57   ` Grant Likely
2011-07-13 22:57     ` Grant Likely
2011-07-13 22:58     ` Grant Likely
2011-07-13 22:58       ` Grant Likely
2011-07-14  3:51       ` G, Manjunath Kondaiah
2011-07-14  3:51         ` G, Manjunath Kondaiah
2011-07-14  3:34     ` G, Manjunath Kondaiah
2011-07-14  3:34       ` G, Manjunath Kondaiah
2011-07-13 22:06 ` [PATCH 2/4] dt: OMAP3: Beagle board: set clock freq for i2c devices G, Manjunath Kondaiah
2011-07-13 23:04   ` Grant Likely
2011-07-13 23:04     ` Grant Likely
2011-07-13 22:06 ` [PATCH 3/4] dt: omap3: add generic board file for dt support G, Manjunath Kondaiah
2011-07-13 23:15   ` Grant Likely
2011-07-13 23:15     ` Grant Likely
2011-07-14  8:53     ` [PATCH] omap2+: Use Kconfig symbol in Makefile instead of obj-y Tony Lindgren
2011-07-14  8:53       ` Tony Lindgren
     [not found]     ` <CACxGe6sELS=C==16TZ2pfrxJDDyqjS_qOwJUfwzwMO8hqo8Xag-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-07-16 19:54       ` [PATCH 3/4] dt: omap3: add generic board file for dt support G, Manjunath Kondaiah
2011-07-16 20:07         ` G, Manjunath Kondaiah
2011-07-16 20:07           ` G, Manjunath Kondaiah
2011-07-17  5:13           ` Grant Likely
2011-07-17  5:13             ` Grant Likely
2011-07-18  9:07             ` Tony Lindgren
2011-07-18  9:07               ` Tony Lindgren
2011-07-19 21:34               ` Grant Likely
2011-07-19 21:34                 ` Grant Likely
2011-07-21  7:18                 ` Tony Lindgren
2011-07-21  7:18                   ` Tony Lindgren
2011-07-21  8:55                 ` Rajendra Nayak
2011-07-21  8:55                   ` Rajendra Nayak
     [not found]                   ` <4E27E967.7090501-l0cyMroinI0@public.gmane.org>
2011-07-21  9:09                     ` Felipe Balbi
2011-07-21  9:09                       ` Felipe Balbi
2011-07-21  9:33                       ` Rajendra Nayak
2011-07-21  9:33                         ` Rajendra Nayak
     [not found]                         ` <4E27F264.4040409-l0cyMroinI0@public.gmane.org>
2011-07-21  9:39                           ` Felipe Balbi
2011-07-21  9:39                             ` Felipe Balbi
2011-07-28 18:20                   ` Cousson, Benoit
2011-07-28 18:20                     ` Cousson, Benoit
2011-07-18 10:15             ` G, Manjunath Kondaiah [this message]
2011-07-18 10:15               ` G, Manjunath Kondaiah
2011-07-19 21:36               ` Grant Likely
2011-07-19 21:36                 ` Grant Likely
2011-07-19  5:58             ` G, Manjunath Kondaiah
2011-07-19  5:58               ` G, Manjunath Kondaiah
2011-07-19 21:37               ` Grant Likely
2011-07-19 21:37                 ` Grant Likely
     [not found]                 ` <20110719213737.GQ6848-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2011-07-21 10:24                   ` G, Manjunath Kondaiah
2011-07-21 10:24                     ` G, Manjunath Kondaiah
2011-07-21 23:53             ` Kevin Hilman
2011-07-21 23:53               ` Kevin Hilman
2011-07-13 22:06 ` [PATCH 4/4] dt: i2c-omap: Convert i2c driver to use device tree G, Manjunath Kondaiah
2011-07-13 23:20   ` Grant Likely
2011-07-13 23:20     ` Grant Likely
2011-07-28 17:34     ` Cousson, Benoit
2011-07-28 17:34       ` Cousson, Benoit
2011-07-28 21:32       ` Grant Likely
2011-07-28 21:32         ` Grant Likely
2011-08-03 12:56         ` Cousson, Benoit
2011-08-03 12:56           ` Cousson, Benoit

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='CAP6yH7eSmdU16r5iC2MwvU3RwOBXaJNygMUXG=HSMiWUKnor-w@mail.gmail.com' \
    --to=manjugk@ti.com \
    --cc=ben-linux@fluff.org \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@secretlab.ca \
    --cc=khilman@ti.com \
    --cc=linux-arm-kernel@lists.infradead.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.