All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Stein <alexander.stein-93q1YBGzJSMe9JSWTWOYM3xStJ4P+DSV@public.gmane.org>
To: Feng Tang <feng.tang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	"Jean Delvare (PC drivers,
	core)" <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>,
	"Ben Dooks (embedded platforms)"
	<ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>,
	Tomoya MORINAGA
	<tomoya.rohm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: i2c-eg20t: regression since i2c_add_numbered_adapter change
Date: Wed, 22 Aug 2012 11:17:51 +0200	[thread overview]
Message-ID: <24029861.U7thTLuEmC@ws-stein> (raw)
In-Reply-To: <20120822160439.62c619bf@feng-i7>

Hello,

Am Mittwoch, 22. August 2012, 16:04:39 schrieb Feng Tang:
> > Why use a fixed one? Give the driver (and maybe every i2c bus driver) a parameter which sets the base bus number it should use.
> > E.g. i2c-eg20t.base-bus-num=2 so it will register the bus numbers starting from 2. If this parameter is unset. It would use the first free one, thus simply using i2c_add_adapter.
> 
> The reason we need a fixed number is it is easier for platform code
> which needs to register dozens of i2c devices to different controllers
> with i2c_register_board_info, and they need provide a bus number for
> each i2c device, this _binding_ info is not detectable but have to
> be fixed.

Yes, I'm aware of that. With "Why use a fixed one?" I meant why hard-code it into the driver. I should be changeable.
Because this is/was not possible in general to use i2c_register_board_info, so we used an echo to /sys/bus/i2c/devices/i2c-0/new_device or /sys/bus/i2c/devices/i2c-1/new_device.

> Yes, your module parameter "base-bus-num" sounds like a plan too,
> at the cost of some extra setting in the kernel cmdline. And I'm fine
> with all solutions as long as I can get a _fixed_ bus number so that
> I can easily write the platform config code (I guess this is same
> for device tree, and even ACPI 5.0)

i2c_add_numbered_adapter only works reliably if only using a single driver. If you are using several, especially if one uses dynamic bus numbers, you're kinda screwed.
So, not very driver can add busses starting at bus number 0.
I guess using an Intel Atom (i2c-isch) with an eg20t is not that uncommon, so you'll end up using 2 drivers where each one should have a fixed number.
Some mechanism like udev for renaming ethernet or block devices is needed here.

Regards,
Alexander

WARNING: multiple messages have this Message-ID (diff)
From: Alexander Stein <alexander.stein@systec-electronic.com>
To: Feng Tang <feng.tang@intel.com>
Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Jean Delvare (PC drivers, core)" <khali@linux-fr.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: Wed, 22 Aug 2012 11:17:51 +0200	[thread overview]
Message-ID: <24029861.U7thTLuEmC@ws-stein> (raw)
In-Reply-To: <20120822160439.62c619bf@feng-i7>

Hello,

Am Mittwoch, 22. August 2012, 16:04:39 schrieb Feng Tang:
> > Why use a fixed one? Give the driver (and maybe every i2c bus driver) a parameter which sets the base bus number it should use.
> > E.g. i2c-eg20t.base-bus-num=2 so it will register the bus numbers starting from 2. If this parameter is unset. It would use the first free one, thus simply using i2c_add_adapter.
> 
> The reason we need a fixed number is it is easier for platform code
> which needs to register dozens of i2c devices to different controllers
> with i2c_register_board_info, and they need provide a bus number for
> each i2c device, this _binding_ info is not detectable but have to
> be fixed.

Yes, I'm aware of that. With "Why use a fixed one?" I meant why hard-code it into the driver. I should be changeable.
Because this is/was not possible in general to use i2c_register_board_info, so we used an echo to /sys/bus/i2c/devices/i2c-0/new_device or /sys/bus/i2c/devices/i2c-1/new_device.

> Yes, your module parameter "base-bus-num" sounds like a plan too,
> at the cost of some extra setting in the kernel cmdline. And I'm fine
> with all solutions as long as I can get a _fixed_ bus number so that
> I can easily write the platform config code (I guess this is same
> for device tree, and even ACPI 5.0)

i2c_add_numbered_adapter only works reliably if only using a single driver. If you are using several, especially if one uses dynamic bus numbers, you're kinda screwed.
So, not very driver can add busses starting at bus number 0.
I guess using an Intel Atom (i2c-isch) with an eg20t is not that uncommon, so you'll end up using 2 drivers where each one should have a fixed number.
Some mechanism like udev for renaming ethernet or block devices is needed here.

Regards,
Alexander


  reply	other threads:[~2012-08-22  9:17 UTC|newest]

Thread overview: 24+ 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  6:30 ` Alexander Stein
2012-08-22  7:29 ` Feng Tang
2012-08-22  7:29   ` Feng Tang
2012-08-22  7:57   ` Alexander Stein
2012-08-22  8:04     ` Feng Tang
2012-08-22  8:04       ` Feng Tang
2012-08-22  9:17       ` Alexander Stein [this message]
2012-08-22  9:17         ` Alexander Stein
2012-08-23  8:28         ` Feng Tang
2012-08-23  8:28           ` Feng Tang
2012-08-29 18:40           ` Jean Delvare
2012-08-29 18:40             ` Jean Delvare
     [not found]             ` <20120829204031.648a73e1-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2012-08-30  7:49               ` Alexander Stein
2012-08-30  7:49                 ` Alexander Stein
2012-08-30  9:19                 ` Feng Tang
2012-08-30  9:19                   ` Feng Tang
2012-08-30 11:08                   ` Alexander Stein
2012-08-30 11:08                     ` Alexander Stein
2012-08-31  2:16                     ` Feng Tang
2012-08-31  2:16                       ` Feng Tang
2012-09-08 13:18                 ` Jean Delvare
2012-08-30  9:10               ` Feng Tang
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=24029861.U7thTLuEmC@ws-stein \
    --to=alexander.stein-93q1ybgzjsme9jswtwoym3xstj4p+dsv@public.gmane.org \
    --cc=ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org \
    --cc=feng.tang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=tomoya.rohm-Re5JQEeQqe8AvxtiuMwx3w@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 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.