All of lore.kernel.org
 help / color / mirror / Atom feed
From: Koen Kooi <koen@dominion.thruhere.net>
To: Russ Dill <Russ.Dill@ti.com>
Cc: balbi@ti.com, Pantelis Antoniou <panto@antoniou-consulting.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	"Cousson, Benoit" <b-cousson@ti.com>,
	Tony Lindgren <tony@atomide.com>,
	linux-kernel@vger.kernel.org, Matt Porter <mporter@ti.com>,
	linux-omap@vger.kernel.org, Kevin Hilman <khilman@ti.com>,
	Paul Walmsley <paul@pwsan.com>
Subject: Re: [PATCH 0/3] capebus moving omap_devices to mach-omap2
Date: Fri, 2 Nov 2012 11:39:41 +0100	[thread overview]
Message-ID: <041C30E9-0CD2-4CF4-823A-E27B7BFF1BE1@dominion.thruhere.net> (raw)
In-Reply-To: <CA+Bv8Xb4eAQ2po-nwCT6ZXNdaU7cwshVaGC795e3GYZ+B7L-jQ@mail.gmail.com>


Op 2 nov. 2012, om 10:42 heeft Russ Dill <Russ.Dill@ti.com> het volgende geschreven:

> On Fri, Nov 2, 2012 at 1:57 AM, Felipe Balbi <balbi@ti.com> wrote:
>> Hi,
>> 
>> On Thu, Nov 01, 2012 at 04:49:23PM -0700, Russ Dill wrote:
>>> On Thu, Nov 1, 2012 at 3:05 PM, Felipe Balbi <balbi@ti.com> wrote:
>>>> HI,
>>>> 
>>>> On Thu, Nov 01, 2012 at 03:59:50PM +0200, Pantelis Antoniou wrote:
>>>>> Hi Alan,
>>>>> 
>>>>> On Nov 1, 2012, at 3:51 PM, Alan Cox wrote:
>>>>> 
>>>>>>> What they want, and what every user wants, is I plug this board in, and
>>>>>>> the driver make sure everything is loaded and ready. No, the end users
>>>>>>> don't want to see any of the implementation details of how the bitfile
>>>>>>> is transported; the driver can handle it.
>>>>>> 
>>>>>> That doesn't necessarily make it a bus merely some kind of hotplug
>>>>>> enumeration of devices. That should all work properly both for devices
>>>>>> and busses with spi and i²c as the final bits needed for it got fixed
>>>>>> some time ago.
>>>>>> 
>>>>>> In an ideal world you don't want to be writing custom drivers for stuff.
>>>>>> If your cape routes an i²c serial device to the existing system i²c
>>>>>> busses then you want to just create an instance of any existing driver on
>>>>>> the existing i²c bus not create a whole new layer of goop.
>>>>>> 
>>>>>> It does need to do the plumbing and resource management for the plumbing
>>>>>> but thats not the same as being a bus.
>>>>>> 
>>>>>> Alan
>>>>> 
>>>>> 
>>>>> Fair enough. But there's no such thing a 'hotplug enumeration
>>>>> construct' in Linux yet, and a bus is the closest thing to it. It does
>>>>> take advantage of the nice way device code matches drivers and devices
>>>>> though.
>>>>> 
>>>>> I'm afraid that having the I2C/SPI drivers doing the detection won't
>>>>> work.  The capes can have arbitrary I2C/SPI devices (and even more
>>>>> weird components).  There is no way to assure for example that the I2C
>>>>> device responding to address 'foo' in cape A is the same I2C device
>>>>> responding to the same address in cape B.
>>>> 
>>>> your ->detect() method should take care of that.
>>> 
>>> There isn't some magical serial number in I²C devices that a
>>> ->detect() method can read and the implementation of I²C is somewhat
>>> flexible. One devices read may be another devices write. A detect
>> 
>> look at what other drivers do. You can read a revision register, you can
>> write a command and see if the device responds as expected, it doesn't
>> matter.
> 
> Since a "revision" register isn't required by the I²C spec, it isn't
> implemented on a huge number of chips. Also, having a few dozen probe
> routines come though and write to random address of every single I²C
> device can a) take a really long time, and b) have quite a few
> unintended side effects.
> 
>>> method that only performs reads could easily toggle a gpio that resets
>>> the board, rewrite and eeprom, or set the printer on fire. If you
>> 
>> how ? It's just a read.
> 
> Because the I²C spec is incredibly flexible. For a lot of devices,
> reading from a register is done by writing the register address, and
> then reading the contents. For devices that don't implement registers
> in that way (such as many eeproms), this is just a write.
> 
>>> browse through various detect functions, yes, some of them key off an
>>> ID, but a lot of them just check various registers to see if certain
>>> bits are zero, or certain bits are one. A lot of I²C devices I've
>>> dealt with have no good way of probing them, especially GPIO chips
>>> (you'll notice none of the I²C GPIO expanders have detect functions)
>> 
>> it doesn't mean it can't be done.
> 
> Really? Please, do tell how you would write a detect function for a
> PCA9534. It has 4 registers, an input port registers, an output port
> register, a polarity inversion register, and a configuration register.
> And don't forget, since we are probing, every detect routine for every
> I²C driver will have to run with every I²C address on every bus,
> possibly with both address formats.

Worse, things like early revisions of the picoDLP projector will erase their firmware if you do a linear scan through all addresses. 

regards,

Koen

WARNING: multiple messages have this Message-ID (diff)
From: Koen Kooi <koen@dominion.thruhere.net>
To: Russ Dill <Russ.Dill@ti.com>
Cc: balbi@ti.com, Pantelis Antoniou <panto@antoniou-consulting.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	"Cousson, Benoit" <b-cousson@ti.com>,
	Tony Lindgren <tony@atomide.com>,
	linux-kernel@vger.kernel.org, Matt Porter <mporter@ti.com>,
	linux-omap@vger.kernel.org, Kevin Hilman <khilman@ti.com>,
	Paul Walmsley <paul@pwsan.com>
Subject: Re: [PATCH 0/3] capebus moving omap_devices to mach-omap2
Date: Fri, 2 Nov 2012 11:39:41 +0100	[thread overview]
Message-ID: <041C30E9-0CD2-4CF4-823A-E27B7BFF1BE1@dominion.thruhere.net> (raw)
In-Reply-To: <CA+Bv8Xb4eAQ2po-nwCT6ZXNdaU7cwshVaGC795e3GYZ+B7L-jQ@mail.gmail.com>


Op 2 nov. 2012, om 10:42 heeft Russ Dill <Russ.Dill@ti.com> het volgende geschreven:

> On Fri, Nov 2, 2012 at 1:57 AM, Felipe Balbi <balbi@ti.com> wrote:
>> Hi,
>> 
>> On Thu, Nov 01, 2012 at 04:49:23PM -0700, Russ Dill wrote:
>>> On Thu, Nov 1, 2012 at 3:05 PM, Felipe Balbi <balbi@ti.com> wrote:
>>>> HI,
>>>> 
>>>> On Thu, Nov 01, 2012 at 03:59:50PM +0200, Pantelis Antoniou wrote:
>>>>> Hi Alan,
>>>>> 
>>>>> On Nov 1, 2012, at 3:51 PM, Alan Cox wrote:
>>>>> 
>>>>>>> What they want, and what every user wants, is I plug this board in, and
>>>>>>> the driver make sure everything is loaded and ready. No, the end users
>>>>>>> don't want to see any of the implementation details of how the bitfile
>>>>>>> is transported; the driver can handle it.
>>>>>> 
>>>>>> That doesn't necessarily make it a bus merely some kind of hotplug
>>>>>> enumeration of devices. That should all work properly both for devices
>>>>>> and busses with spi and i²c as the final bits needed for it got fixed
>>>>>> some time ago.
>>>>>> 
>>>>>> In an ideal world you don't want to be writing custom drivers for stuff.
>>>>>> If your cape routes an i²c serial device to the existing system i²c
>>>>>> busses then you want to just create an instance of any existing driver on
>>>>>> the existing i²c bus not create a whole new layer of goop.
>>>>>> 
>>>>>> It does need to do the plumbing and resource management for the plumbing
>>>>>> but thats not the same as being a bus.
>>>>>> 
>>>>>> Alan
>>>>> 
>>>>> 
>>>>> Fair enough. But there's no such thing a 'hotplug enumeration
>>>>> construct' in Linux yet, and a bus is the closest thing to it. It does
>>>>> take advantage of the nice way device code matches drivers and devices
>>>>> though.
>>>>> 
>>>>> I'm afraid that having the I2C/SPI drivers doing the detection won't
>>>>> work.  The capes can have arbitrary I2C/SPI devices (and even more
>>>>> weird components).  There is no way to assure for example that the I2C
>>>>> device responding to address 'foo' in cape A is the same I2C device
>>>>> responding to the same address in cape B.
>>>> 
>>>> your ->detect() method should take care of that.
>>> 
>>> There isn't some magical serial number in I²C devices that a
>>> ->detect() method can read and the implementation of I²C is somewhat
>>> flexible. One devices read may be another devices write. A detect
>> 
>> look at what other drivers do. You can read a revision register, you can
>> write a command and see if the device responds as expected, it doesn't
>> matter.
> 
> Since a "revision" register isn't required by the I²C spec, it isn't
> implemented on a huge number of chips. Also, having a few dozen probe
> routines come though and write to random address of every single I²C
> device can a) take a really long time, and b) have quite a few
> unintended side effects.
> 
>>> method that only performs reads could easily toggle a gpio that resets
>>> the board, rewrite and eeprom, or set the printer on fire. If you
>> 
>> how ? It's just a read.
> 
> Because the I²C spec is incredibly flexible. For a lot of devices,
> reading from a register is done by writing the register address, and
> then reading the contents. For devices that don't implement registers
> in that way (such as many eeproms), this is just a write.
> 
>>> browse through various detect functions, yes, some of them key off an
>>> ID, but a lot of them just check various registers to see if certain
>>> bits are zero, or certain bits are one. A lot of I²C devices I've
>>> dealt with have no good way of probing them, especially GPIO chips
>>> (you'll notice none of the I²C GPIO expanders have detect functions)
>> 
>> it doesn't mean it can't be done.
> 
> Really? Please, do tell how you would write a detect function for a
> PCA9534. It has 4 registers, an input port registers, an output port
> register, a polarity inversion register, and a configuration register.
> And don't forget, since we are probing, every detect routine for every
> I²C driver will have to run with every I²C address on every bus,
> possibly with both address formats.

Worse, things like early revisions of the picoDLP projector will erase their firmware if you do a linear scan through all addresses. 

regards,

Koen--
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

  reply	other threads:[~2012-11-02 10:39 UTC|newest]

Thread overview: 107+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-01 15:17 [PATCH 0/3] capebus moving omap_devices to mach-omap2 Pantelis Antoniou
2012-10-31 17:52 ` Tony Lindgren
2012-10-31 18:04   ` Pantelis Antoniou
2012-10-31 18:09     ` Tony Lindgren
2012-10-31 18:24       ` Pantelis Antoniou
2012-10-31 19:55       ` Benoit Cousson
2012-10-31 19:55         ` Benoit Cousson
2012-10-31 20:12         ` Pantelis Antoniou
2012-10-31 20:12           ` Pantelis Antoniou
2012-10-31 21:26           ` Tony Lindgren
2012-10-31 21:36             ` Pantelis Antoniou
2012-10-31 21:43               ` Tony Lindgren
2012-10-31 22:00                 ` Pantelis Antoniou
2012-10-31 22:16                   ` Tony Lindgren
2012-10-31 22:14               ` Felipe Balbi
2012-10-31 22:14                 ` Felipe Balbi
2012-11-01  7:02                 ` Pantelis Antoniou
2012-11-01  7:02                   ` Pantelis Antoniou
2012-11-01 10:23                   ` Cousson, Benoit
2012-11-01 10:23                     ` Cousson, Benoit
2012-11-01 10:39                     ` Pantelis Antoniou
2012-11-01 10:39                       ` Pantelis Antoniou
2012-11-01 11:04                       ` Felipe Balbi
2012-11-01 11:04                         ` Felipe Balbi
2012-11-01 11:26                         ` Pantelis Antoniou
2012-11-01 11:26                           ` Pantelis Antoniou
2012-11-01 12:40                           ` Felipe Balbi
2012-11-01 12:40                             ` Felipe Balbi
2012-11-01 12:57                             ` Pantelis Antoniou
2012-11-01 12:57                               ` Pantelis Antoniou
2012-11-01 13:16                               ` Felipe Balbi
2012-11-01 13:16                                 ` Felipe Balbi
2012-11-01 13:35                                 ` Pantelis Antoniou
2012-11-01 13:35                                   ` Pantelis Antoniou
2012-11-01 13:51                                   ` Alan Cox
2012-11-01 13:51                                     ` Alan Cox
2012-11-01 13:59                                     ` Pantelis Antoniou
2012-11-01 13:59                                       ` Pantelis Antoniou
2012-11-01 22:05                                       ` Felipe Balbi
2012-11-01 22:05                                         ` Felipe Balbi
2012-11-01 23:49                                         ` Russ Dill
2012-11-02  8:57                                           ` Felipe Balbi
2012-11-02  8:57                                             ` Felipe Balbi
2012-11-02  9:42                                             ` Russ Dill
2012-11-02 10:39                                               ` Koen Kooi [this message]
2012-11-02 10:39                                                 ` Koen Kooi
2012-11-02 11:00                                               ` Felipe Balbi
2012-11-02 11:00                                                 ` Felipe Balbi
2012-11-02 16:44                                                 ` Russ Dill
2012-11-02 11:21                                           ` Alan Cox
2012-11-02 12:32                                             ` Pantelis Antoniou
2012-11-05  0:37                                               ` Grant Likely
2012-11-05 15:37                                                 ` Pantelis Antoniou
2012-11-05 15:37                                                   ` Pantelis Antoniou
2012-11-05 19:10                                                   ` Grant Likely
2012-11-05 19:54                                                     ` Pantelis Antoniou
2012-11-05 19:54                                                       ` Pantelis Antoniou
2012-11-05 20:14                                                       ` Grant Likely
2012-11-05 22:59                                                         ` Joel A Fernandes
2012-11-05 23:58                                                           ` Grant Likely
2012-11-05 23:58                                                             ` Grant Likely
2012-11-06  3:06                                                             ` Joel A Fernandes
2012-11-06  8:14                                                               ` Pantelis Antoniou
2012-11-06  8:14                                                                 ` Pantelis Antoniou
2012-11-06 11:16                                                                 ` Grant Likely
2012-11-06 13:54                                                                   ` Pantelis Antoniou
2012-11-06 13:54                                                                     ` Pantelis Antoniou
2012-11-02 16:07                                             ` Jason Kridner
2012-11-02 16:07                                               ` Jason Kridner
2012-11-02 16:28                                               ` Alan Cox
2012-11-05  1:05                                               ` Grant Likely
2012-11-01 11:26                       ` Cousson, Benoit
2012-11-01 11:26                         ` Cousson, Benoit
2012-11-01 11:39                         ` Pantelis Antoniou
2012-11-01 11:39                           ` Pantelis Antoniou
2012-11-01 12:00                         ` Koen Kooi
2012-11-01 12:00                           ` Koen Kooi
2012-11-01 13:06                           ` Felipe Balbi
2012-11-01 13:06                             ` Felipe Balbi
2012-11-01 13:33                             ` Koen Kooi
2012-11-01 13:33                               ` Koen Kooi
2012-11-02  8:15                           ` Cousson, Benoit
2012-11-02  8:15                             ` Cousson, Benoit
2012-11-02  8:43                             ` Pantelis Antoniou
2012-11-03  8:23                               ` Kevin Hilman
2012-11-05  0:22                               ` Grant Likely
2012-11-05  0:22                                 ` Grant Likely
2012-11-05 13:25                                 ` Pantelis Antoniou
2012-11-05 13:25                                   ` Pantelis Antoniou
2012-11-05 14:34                                   ` Grant Likely
2012-11-05 15:34                                     ` Tony Lindgren
2012-11-05 15:34                                       ` Tony Lindgren
2012-11-05 15:56                                     ` Rob Herring
2012-11-05 15:56                                       ` Rob Herring
2012-11-05 19:40                                       ` Grant Likely
2012-11-01 15:18 ` [PATCH 1/3] omap-device: Remove __init from omap_device_build family functions Pantelis Antoniou
2012-11-01 15:18 ` [PATCH 2/3] da8xx-dt: Create da8xx DT adapter device Pantelis Antoniou
2012-11-01 14:36   ` Tomi Valkeinen
2012-11-01 14:38     ` Pantelis Antoniou
2012-11-01 15:18 ` [PATCH 3/3] ti-tscadc-dt: Create ti-tscadc-dt " Pantelis Antoniou
2012-11-01 18:50 [PATCH 0/3] capebus moving omap_devices to mach-omap2 Jason Kridner
2012-11-01 19:07 ` Tony Lindgren
2012-11-02  9:26 ` Cousson, Benoit
2012-11-02  9:26   ` Cousson, Benoit
2012-11-02 10:19   ` Koen Kooi
2012-11-02 10:19     ` Koen Kooi
2012-11-05  0:32     ` Grant Likely

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=041C30E9-0CD2-4CF4-823A-E27B7BFF1BE1@dominion.thruhere.net \
    --to=koen@dominion.thruhere.net \
    --cc=Russ.Dill@ti.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=b-cousson@ti.com \
    --cc=balbi@ti.com \
    --cc=khilman@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=mporter@ti.com \
    --cc=panto@antoniou-consulting.com \
    --cc=paul@pwsan.com \
    --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.