linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Feng Tang <feng.tang@intel.com>
To: Alexander Stein <alexander.stein@systec-electronic.com>
Cc: Jean Delvare <khali@linux-fr.org>, <linux-i2c@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	"Ben Dooks (embedded platforms)" <ben-linux@fluff.org>,
	Tomoya MORINAGA <tomoya.rohm@gmail.com>
Subject: Re: i2c-eg20t: regression since i2c_add_numbered_adapter change
Date: Thu, 30 Aug 2012 17:19:15 +0800	[thread overview]
Message-ID: <20120830171915.36b6d10b@feng-i7> (raw)
In-Reply-To: <4378288.tkkLiQ5MQ7@ws-stein>

Hi Alexander,

On Thu, 30 Aug 2012 09:49:52 +0200
Alexander Stein <alexander.stein@systec-electronic.com> wrote:

> > 
> > Whenever you call i2c_register_board_info(), every I2C bus number
> > referenced in the I2C device list passed as a parameter is reserved for
> > static I2C bus numbers, dynamic I2C bus numbers will never overlap.
> > 
> > So in the quoted example, if i2c-isch is able to dynamically pick I2C
> > bus number 0 while i2c-eg20t want it statically, it means that either
> > no device was declared on bus 0 with i2c_register_board_info(), or
> > i2c_register_board_info() was called too late in the game.
> 
> In my case i2c_register_board_info is never called due to a non-existant platform setup (see below).

I think we can have that, and we did have that for a non-product platform,
it's easy to add a platform driver which can use dmidecode info to
identify itself.

> 
> > Note that there was an assumption at the time the code was written,
> > that there was no need or reason to reserve a static I2C bus number if
> > no slave device was declared on said I2C bus. I never much liked it but
> > it never caused problems so far. This means that either:
> > * you call i2c_register_board_info() to register your slave I2C devices
> >   and all the affected I2C bus drivers call i2c_add_numbered_adapter();
> >   or
> > * you don't call i2c_register_board_info() and all I2C bus drivers call
> >   i2c_add_adapter().
> > You can't mix, i.e. if you don't register any slave device on a bus but
> > the bus driver still calls i2c_add_numbered_adapter(), it may fail.
> > 
> > If this is a problem now on some systems, it should be easy enough to
> > work around by adding a specific function to reserve an I2C bus number
> > for static allocation, even without declaring any slave device on it.
> > This function would be called at the same time
> > i2c_register_board_info() typically is.
> 
> IMO the i2c_register_board_info only works in quite static setups. Especially with I2C-Busses attached to hotplugable PCI devices this way doesn't work reliable any more.
> The device come and go dynamically so you can't assume fixed mapping.

Can you specify the hotplugable?
1. A hotplugable i2c bus controller (say i2c_eg20t) with all fixed i2c
 devices connecting to it
2. i2c bus controller is fixed, while the i2c devices will be dynamically
 connected to it.
3. Both the bus controller and devices are dynamically hotplugged

Thanks,
Feng

  reply	other threads:[~2012-08-30  9:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-22  6:30 i2c-eg20t: regression since i2c_add_numbered_adapter change Alexander Stein
2012-08-22  7:29 ` Feng Tang
2012-08-22  7:57   ` Alexander Stein
2012-08-22  8:04     ` Feng Tang
2012-08-22  9:17       ` Alexander Stein
2012-08-23  8:28         ` Feng Tang
2012-08-29 18:40           ` Jean Delvare
2012-08-30  7:49             ` Alexander Stein
2012-08-30  9:19               ` Feng Tang [this message]
2012-08-30 11:08                 ` Alexander Stein
2012-08-31  2:16                   ` Feng Tang
2012-09-08 13:18               ` Jean Delvare
2012-08-30  9:10             ` Feng Tang

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=20120830171915.36b6d10b@feng-i7 \
    --to=feng.tang@intel.com \
    --cc=alexander.stein@systec-electronic.com \
    --cc=ben-linux@fluff.org \
    --cc=khali@linux-fr.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tomoya.rohm@gmail.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;
as well as URLs for NNTP newsgroup(s).