linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Lawnick <ml.lawnick-Mmb7MZpHnFY@public.gmane.org>
To: Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, "Delvare,
	Jean " <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>,
	"Sang, Wolfram" <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Subject: Re: [Patch] MPC Adapter: read class attribute from device tree
Date: Tue, 21 Apr 2009 11:26:10 +0200	[thread overview]
Message-ID: <49ED9132.9050806@gmx.de> (raw)
In-Reply-To: <49ED6F03.5050107-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>

Wolfgang Grandegger said the following:
> Hello,
> 
> sorry for jumping in late. I just recently subscribed to this list.
> 
> Michael Lawnick wrote:
>> For MPC adapter there is no class assigned as it is done in other
>> adapters. This way no new-style client will ever be instantiated. With
>> this patch class assignment is read from device tree.
>> Necessary entry:
>> class = <1>; /* I2C_CLASS_HWMON (iic.h) */
> 
> Do we really need that? Probing is dangerous and not necessary. Does it
> not work with a proper DTS entry? But maybe I have missed something?

Our current and our next system consists of two flavors of the same
board with different devices. To minimize maintenance and testing we use
a reduced kernel and load the needed modules at runtime. Furthermore we
will have to handle hot-plugged I2C-devices. Whether this strategy is
best could be discussed in another thread but is rather OT in this
mailing list. Nevertheless loading modules at runtime is legal and
generally supported by LINUX.

Defining all possible (I2C-)devices in DTS would give a mess. E.g. on
one board there will be ~30 temperature sensors, on the other none.
As every DTS entry will force a sysFs subdirectory there would be a
bunch of functionless directories - rather ugly.

If probing of a device is dangerous, it can be defined in DTS anyway and
the device driver can easily omit this part by early return.

Because of the situation above I try to keep the ability of dynamic
instantiation. Jean hesitates, I feel because he sees I2C solely in
static manner.

> 
>> Based on 2.6.29
>> 
>> Signed-off-by: Michael Lawnick <ml.lawnick-Mmb7MZpHnFY@public.gmane.org>
>> Cc: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
>> Cc: Sang, Wolfram <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
>> ---
>>  drivers/i2c/busses/i2c-mpc.c |    5 +++++
>>  1 files changed, 5 insertions(+), 0 deletions(-)
>> 
>> diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
>> --- a/drivers/i2c/busses/i2c-mpc.c
>> +++ b/drivers/i2c/busses/i2c-mpc.c
>> @@ -318,6 +318,7 @@ static int __devinit fsl_i2c_probe(struct of_device
>> *op, const struct of_device_
>>  {
>>  	int result = 0;
>>  	struct mpc_i2c *i2c;
>> +	int *of_val;
>> 
>>  	i2c = kzalloc(sizeof(*i2c), GFP_KERNEL);
>>  	if (!i2c)
>> @@ -354,6 +355,10 @@ static int __devinit fsl_i2c_probe(struct of_device
>> *op, const struct of_device_
>>  	dev_set_drvdata(&op->dev, i2c);
>> 
>>  	i2c->adap = mpc_ops;
>> +	of_val = of_get_property(op->node, "class", NULL);
>> +	if(of_val)
>> +		i2c->adap.class = *of_val;
>> +
>>  	i2c_set_adapdata(&i2c->adap, i2c);
>>  	i2c->adap.dev.parent = &op->dev;
> 
> The CPM I2C bus driver uses "linux,i2c-class" for that purpose. See:
> 
> http://lxr.linux.no/linux+v2.6.29/Documentation/powerpc/dts-bindings/fsl/cpm_qe/cpm/i2c.txt

I love this distributed information :-( - I will fix.
> 
> A consistent binding would be nice and the default should be "0", if we
> really need legacy probing.

If linux,i2c-class is not set, 0 will be used.
> 
> Furthermore, the new binding needs to be documented and published on the
> Devicetree-discuss ML.
> 
Hmm, how are they involved if linux,i2c-class is used - it's already
defined as you showed above.

-- 
Kind regards,
Michael

  parent reply	other threads:[~2009-04-21  9:26 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-21  6:42 [Patch] MPC Adapter: read class attribute from device tree Michael Lawnick
     [not found] ` <49ED6AD3.2060808-Mmb7MZpHnFY@public.gmane.org>
2009-04-21  7:00   ` Wolfgang Grandegger
     [not found]     ` <49ED6F03.5050107-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
2009-04-21  9:26       ` Michael Lawnick [this message]
     [not found]         ` <49ED9132.9050806-Mmb7MZpHnFY@public.gmane.org>
2009-04-21  9:51           ` Wolfram Sang
     [not found]             ` <20090421095112.GB3100-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2009-04-21 13:05               ` Michael Lawnick
     [not found]                 ` <49EDC487.8010201-Mmb7MZpHnFY@public.gmane.org>
2009-04-21 13:37                   ` Wolfgang Grandegger
     [not found]                     ` <49EDCC31.2030506-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
2009-04-21 14:22                       ` Michael Lawnick
     [not found]                         ` <49EDD69D.1020104-Mmb7MZpHnFY@public.gmane.org>
2009-04-22  7:38                           ` Wolfgang Grandegger
2009-04-24  8:52                   ` Wolfram Sang
     [not found]                     ` <20090424085256.GA26169-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2009-04-24  9:35                       ` Jean Delvare
     [not found]                         ` <20090424113527.4fb94f38-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2009-04-24 10:49                           ` Michael Lawnick
2009-04-24 10:53                       ` Michael Lawnick
     [not found]                         ` <49F19A11.3090700-Mmb7MZpHnFY@public.gmane.org>
2009-04-24 15:38                           ` Jon Smirl
     [not found]                             ` <9e4733910904240838k5f425d7m849cd6b7fad19f27-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-04-27  5:54                               ` Michael Lawnick
2009-04-27  9:07                               ` Wolfgang Grandegger
     [not found]                                 ` <49F575E2.1070005-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
2009-05-03 22:13                                   ` Ben Dooks
2009-04-27 10:17                               ` Jean Delvare
     [not found]                                 ` <20090427121758.7965c48a-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2009-05-20  6:28                                   ` Jean Delvare
2009-04-21  9:59           ` Jean Delvare
     [not found]             ` <20090421115936.28656d09-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2009-04-21 14:11               ` Michael Lawnick
     [not found]                 ` <49EDD423.3050302-Mmb7MZpHnFY@public.gmane.org>
2009-04-21 16:00                   ` Jon Smirl
     [not found]                     ` <9e4733910904210900r4c5d1a8en178ad106134b7e6d-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-04-21 16:33                       ` Jean Delvare
     [not found]                         ` <20090421183310.50ff7e0c-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2009-04-21 19:18                           ` Jon Smirl
     [not found]                             ` <9e4733910904211218l8428128k1f8dd021c50c7846-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-04-22  5:37                               ` Michael Lawnick
2009-04-24  9:09                               ` Wolfram Sang
2009-04-22  7:40                   ` Jean Delvare
2009-04-21 10:35           ` Wolfgang Grandegger
     [not found]             ` <49EDA185.7040206-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
2009-04-21 11:01               ` Jean Delvare
     [not found]                 ` <20090421130134.1e82a078-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2009-04-21 11:26                   ` Wolfgang Grandegger
2009-04-21  8:37   ` Wolfram Sang
2009-04-21  8:39   ` Jean Delvare

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=49ED9132.9050806@gmx.de \
    --to=ml.lawnick-mmb7mzphnfy@public.gmane.org \
    --cc=khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
    --cc=wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org \
    /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;
as well as URLs for NNTP newsgroup(s).