* Driver for pca9541 bus master selector
@ 2010-09-28 14:33 Guenter Roeck
[not found] ` <20100928143302.GA7593-IzeFyvvaP7pWk0Htik3J/w@public.gmane.org>
0 siblings, 1 reply; 11+ messages in thread
From: Guenter Roeck @ 2010-09-28 14:33 UTC (permalink / raw)
To: linux-i2c-u79uwXL29TY76Z2rM5mHXA
Hi all,
I am in the process of writing a driver for the pca9541 bus master selector.
I using the i2c multiplexer framework, which fits the requirements quite nicely.
If anyone happens to know about an existing driver for this chip, please let me know.
I would love to get some input for the arbitration mechanism needed to determine
if and when to switch bus ownership from one master to the other.
Thanks,
Guenter
^ permalink raw reply [flat|nested] 11+ messages in thread[parent not found: <20100928143302.GA7593-IzeFyvvaP7pWk0Htik3J/w@public.gmane.org>]
* Re: Driver for pca9541 bus master selector [not found] ` <20100928143302.GA7593-IzeFyvvaP7pWk0Htik3J/w@public.gmane.org> @ 2010-09-28 15:16 ` Jean Delvare [not found] ` <20100928171607.395f7736-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org> 0 siblings, 1 reply; 11+ messages in thread From: Jean Delvare @ 2010-09-28 15:16 UTC (permalink / raw) To: Guenter Roeck Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA, Michael Lawnick, Rodolfo Giometti Hi Guenter, On Tue, 28 Sep 2010 07:33:02 -0700, Guenter Roeck wrote: > I am in the process of writing a driver for the pca9541 bus master selector. > I using the i2c multiplexer framework, which fits the requirements quite nicely. > > If anyone happens to know about an existing driver for this chip, please let me know. > I would love to get some input for the arbitration mechanism needed to determine > if and when to switch bus ownership from one master to the other. See drivers/i2c/muxes/pca954x.c in 2.6.36-rc2 and later. -- Jean Delvare ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <20100928171607.395f7736-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>]
* Re: Driver for pca9541 bus master selector [not found] ` <20100928171607.395f7736-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org> @ 2010-09-28 16:07 ` Guenter Roeck [not found] ` <20100928160746.GB7976-IzeFyvvaP7pWk0Htik3J/w@public.gmane.org> 0 siblings, 1 reply; 11+ messages in thread From: Guenter Roeck @ 2010-09-28 16:07 UTC (permalink / raw) To: Jean Delvare Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Michael Lawnick, Rodolfo Giometti On Tue, Sep 28, 2010 at 11:16:07AM -0400, Jean Delvare wrote: > Hi Guenter, > > On Tue, 28 Sep 2010 07:33:02 -0700, Guenter Roeck wrote: > > I am in the process of writing a driver for the pca9541 bus master selector. > > I using the i2c multiplexer framework, which fits the requirements quite nicely. > > > > If anyone happens to know about an existing driver for this chip, please let me know. > > I would love to get some input for the arbitration mechanism needed to determine > > if and when to switch bus ownership from one master to the other. > > See drivers/i2c/muxes/pca954x.c in 2.6.36-rc2 and later. > Yes, I know. I use it as basis. But it doesn't support pca9541, unfortunately. I use the select/deselect mechanism to trigger arbitration, but I still need a mechanism to communicate between the masters. After all, the problem to solve is that I have two masters and one slave, not one master and multiple slaves as with the other chips. Note that I do have a solution which I think will work. Just figured it might save time if someone else already solved the same problem, and especially it might help me to determine arbitration time constants. There was mention of a pca9541 driver several years ago, but I have not been able to find details. Thanks, Guenter ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <20100928160746.GB7976-IzeFyvvaP7pWk0Htik3J/w@public.gmane.org>]
* Re: Driver for pca9541 bus master selector [not found] ` <20100928160746.GB7976-IzeFyvvaP7pWk0Htik3J/w@public.gmane.org> @ 2010-09-28 16:42 ` Jean Delvare [not found] ` <20100928184215.00f82717-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org> 0 siblings, 1 reply; 11+ messages in thread From: Jean Delvare @ 2010-09-28 16:42 UTC (permalink / raw) To: Guenter Roeck Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Michael Lawnick, Rodolfo Giometti On Tue, 28 Sep 2010 09:07:46 -0700, Guenter Roeck wrote: > On Tue, Sep 28, 2010 at 11:16:07AM -0400, Jean Delvare wrote: > > Hi Guenter, > > > > On Tue, 28 Sep 2010 07:33:02 -0700, Guenter Roeck wrote: > > > I am in the process of writing a driver for the pca9541 bus master selector. > > > I using the i2c multiplexer framework, which fits the requirements quite nicely. > > > > > > If anyone happens to know about an existing driver for this chip, please let me know. > > > I would love to get some input for the arbitration mechanism needed to determine > > > if and when to switch bus ownership from one master to the other. > > > > See drivers/i2c/muxes/pca954x.c in 2.6.36-rc2 and later. > > > Yes, I know. I use it as basis. But it doesn't support pca9541, unfortunately. Oh, my bad. I had not noticed the PCA9541 was of a totally different kind. > I use the select/deselect mechanism to trigger arbitration, but I still need > a mechanism to communicate between the masters. After all, the problem to solve > is that I have two masters and one slave, not one master and multiple slaves > as with the other chips. > > Note that I do have a solution which I think will work. Just figured it might > save time if someone else already solved the same problem, and especially it > might help me to determine arbitration time constants. There was mention of > a pca9541 driver several years ago, but I have not been able to find details. -- Jean Delvare ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <20100928184215.00f82717-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>]
* Re: Driver for pca9541 bus master selector [not found] ` <20100928184215.00f82717-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org> @ 2010-09-28 17:16 ` Guenter Roeck [not found] ` <20100928171627.GA8415-IzeFyvvaP7pWk0Htik3J/w@public.gmane.org> 0 siblings, 1 reply; 11+ messages in thread From: Guenter Roeck @ 2010-09-28 17:16 UTC (permalink / raw) To: Jean Delvare Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Michael Lawnick, Rodolfo Giometti Hi Jean, On Tue, Sep 28, 2010 at 12:42:15PM -0400, Jean Delvare wrote: > On Tue, 28 Sep 2010 09:07:46 -0700, Guenter Roeck wrote: > > On Tue, Sep 28, 2010 at 11:16:07AM -0400, Jean Delvare wrote: > > > Hi Guenter, > > > > > > On Tue, 28 Sep 2010 07:33:02 -0700, Guenter Roeck wrote: > > > > I am in the process of writing a driver for the pca9541 bus master selector. > > > > I using the i2c multiplexer framework, which fits the requirements quite nicely. > > > > > > > > If anyone happens to know about an existing driver for this chip, please let me know. > > > > I would love to get some input for the arbitration mechanism needed to determine > > > > if and when to switch bus ownership from one master to the other. > > > > > > See drivers/i2c/muxes/pca954x.c in 2.6.36-rc2 and later. > > > > > Yes, I know. I use it as basis. But it doesn't support pca9541, unfortunately. > > Oh, my bad. I had not noticed the PCA9541 was of a totally different kind. > Actually, I fell into the same trap. I was quite happy that someone else wrote the driver for me ... until I realized that the chips solve the opposite problem. Time goes by ... have a look at http://lists.lm-sensors.org/pipermail/lm-sensors/2004-June/008023.html I wasn't sure if you (or someone else) ever had a driver for 9541, or if you referred to 9540 in above post. The links in the post don't work anymore. Thanks, Guenter ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <20100928171627.GA8415-IzeFyvvaP7pWk0Htik3J/w@public.gmane.org>]
* Re: Driver for pca9541 bus master selector [not found] ` <20100928171627.GA8415-IzeFyvvaP7pWk0Htik3J/w@public.gmane.org> @ 2010-09-29 7:19 ` Jean Delvare [not found] ` <20100929091928.16256bb7-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org> 2010-10-13 15:45 ` Guenter Roeck 0 siblings, 2 replies; 11+ messages in thread From: Jean Delvare @ 2010-09-29 7:19 UTC (permalink / raw) To: Guenter Roeck Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Michael Lawnick, Rodolfo Giometti On Tue, 28 Sep 2010 10:16:27 -0700, Guenter Roeck wrote: > On Tue, Sep 28, 2010 at 12:42:15PM -0400, Jean Delvare wrote: > > Oh, my bad. I had not noticed the PCA9541 was of a totally different kind. > > Actually, I fell into the same trap. I was quite happy that someone else wrote > the driver for me ... until I realized that the chips solve the opposite problem. > > Time goes by ... have a look at > > http://lists.lm-sensors.org/pipermail/lm-sensors/2004-June/008023.html I didn't remember that discussion (unsurprisingly.) > I wasn't sure if you (or someone else) ever had a driver for 9541, or if you referred > to 9540 in above post. The links in the post don't work anymore. I was speaking of the PCA9540. I don't think anyone ever wrote a driver for the PCA9541. And in all honestly I don't think the new i2c-mux infrastructure is ready for this. It was written with single-master topologies in mind. You'll have to rethink a lot of things if you want to add support for "inverted" multiplexers. And I don't have the time to help, sorry. I don't quite see the point of such chips, BTW. I2C supports multi-master already, so two masters talking to the same slave sequentially is already supported. -- Jean Delvare ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <20100929091928.16256bb7-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>]
* Re: Driver for pca9541 bus master selector [not found] ` <20100929091928.16256bb7-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org> @ 2010-09-29 13:54 ` Guenter Roeck [not found] ` <20100929135401.GA11771-IzeFyvvaP7pWk0Htik3J/w@public.gmane.org> 0 siblings, 1 reply; 11+ messages in thread From: Guenter Roeck @ 2010-09-29 13:54 UTC (permalink / raw) To: Jean Delvare Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Michael Lawnick, Rodolfo Giometti On Wed, Sep 29, 2010 at 03:19:28AM -0400, Jean Delvare wrote: [ ... ] > > I was speaking of the PCA9540. I don't think anyone ever wrote a driver > for the PCA9541. And in all honestly I don't think the new i2c-mux > infrastructure is ready for this. It was written with single-master > topologies in mind. You'll have to rethink a lot of things if you want > to add support for "inverted" multiplexers. And I don't have the time > to help, sorry. > Actually, the infrastructure works quite nicely. I use select_chan to acquire the slave, and release_chan to initiate release. It behaves like a one-channel multiplexer. > I don't quite see the point of such chips, BTW. I2C supports > multi-master already, so two masters talking to the same slave > sequentially is already supported. > Tell that to our HW team, and to them: http://www.lineagepower.com/oem/pdf/CPLI2C.pdf Guenter ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <20100929135401.GA11771-IzeFyvvaP7pWk0Htik3J/w@public.gmane.org>]
* Re: Driver for pca9541 bus master selector [not found] ` <20100929135401.GA11771-IzeFyvvaP7pWk0Htik3J/w@public.gmane.org> @ 2010-09-30 5:59 ` Michael Lawnick [not found] ` <4CA42750.5020500-Mmb7MZpHnFY@public.gmane.org> 2010-10-13 16:05 ` Guenter Roeck 1 sibling, 1 reply; 11+ messages in thread From: Michael Lawnick @ 2010-09-30 5:59 UTC (permalink / raw) To: Guenter Roeck Cc: Jean Delvare, linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Rodolfo Giometti Guenter Roeck said the following: > On Wed, Sep 29, 2010 at 03:19:28AM -0400, Jean Delvare wrote: > [ ... ] >> >> I was speaking of the PCA9540. I don't think anyone ever wrote a driver >> for the PCA9541. And in all honestly I don't think the new i2c-mux >> infrastructure is ready for this. It was written with single-master >> topologies in mind. You'll have to rethink a lot of things if you want >> to add support for "inverted" multiplexers. And I don't have the time >> to help, sorry. >> > Actually, the infrastructure works quite nicely. I use select_chan > to acquire the slave, and release_chan to initiate release. > It behaves like a one-channel multiplexer. > >> I don't quite see the point of such chips, BTW. I2C supports >> multi-master already, so two masters talking to the same slave >> sequentially is already supported. >> > Tell that to our HW team, and to them: > > http://www.lineagepower.com/oem/pdf/CPLI2C.pdf > I only took a rough look, but it seemed to me that the pca is part of the main device. >From abstraction side of view your problem seems a matter of synchronization of two independent computer systems. You will need a shared resource. The access to it could either be part of driver code or by introducing a 'one-channel multiplexer' as you did. But the sync needs to be done by your code via a shared data object. -- KR Michael ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <4CA42750.5020500-Mmb7MZpHnFY@public.gmane.org>]
* Re: Driver for pca9541 bus master selector [not found] ` <4CA42750.5020500-Mmb7MZpHnFY@public.gmane.org> @ 2010-09-30 7:48 ` Guenter Roeck 0 siblings, 0 replies; 11+ messages in thread From: Guenter Roeck @ 2010-09-30 7:48 UTC (permalink / raw) To: Michael Lawnick Cc: Jean Delvare, linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Rodolfo Giometti On Thu, Sep 30, 2010 at 01:59:44AM -0400, Michael Lawnick wrote: [ ... ] > I only took a rough look, but it seemed to me that the pca is part of > the main device. Yes > From abstraction side of view your problem seems a matter of > synchronization of two independent computer systems. You will need a > shared resource. The access to it could either be part of driver code or > by introducing a 'one-channel multiplexer' as you did. But the sync > needs to be done by your code via a shared data object. > Actually, the pca9541 has a bit in its register set which I can use. See NTESTON in its control register. That is visible as interrupt status at the other master. That is all I need, and reduces complexity significantly. Thanks, Guenter ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Driver for pca9541 bus master selector [not found] ` <20100929135401.GA11771-IzeFyvvaP7pWk0Htik3J/w@public.gmane.org> 2010-09-30 5:59 ` Michael Lawnick @ 2010-10-13 16:05 ` Guenter Roeck 1 sibling, 0 replies; 11+ messages in thread From: Guenter Roeck @ 2010-10-13 16:05 UTC (permalink / raw) To: Jean Delvare Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Michael Lawnick, Rodolfo Giometti On Wed, Sep 29, 2010 at 03:19:28AM -0400, Jean Delvare wrote: [ ... ] > I don't quite see the point of such chips, BTW. I2C supports > multi-master already, so two masters talking to the same slave > sequentially is already supported. To follow up on this, turns out there are (at least) two good reasons for having such a chip. First, not all i2c masters support multi-master configuration. The second reason is much more important. In a redundant system, one would not want redundant masters to be on the same i2c bus. If one of the two fails and blocks the bus, access to all slaves would be blocked. Not a good idea. Much better to have two i2c busses, and select the current master on the slave side. Turns out both reasons apply in my use case. Testing shows that master selection works quite well with the driver I just submitted. I can persistently access all slaves from both masters even under high contention (both masters trying to access the same slave at the same time). If one of the masters fails while having access to the connected slaves, the other simply takes over after arbitration times out. Guenter ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Driver for pca9541 bus master selector 2010-09-29 7:19 ` Jean Delvare [not found] ` <20100929091928.16256bb7-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org> @ 2010-10-13 15:45 ` Guenter Roeck 1 sibling, 0 replies; 11+ messages in thread From: Guenter Roeck @ 2010-10-13 15:45 UTC (permalink / raw) To: linux-i2c-u79uwXL29TY76Z2rM5mHXA Jean Delvare <khali@...> writes: [...] > > I don't quite see the point of such chips, BTW. I2C supports > multi-master already, so two masters talking to the same slave > sequentially is already supported. > To follow up on this, turns out there are (at least) two good reasons for having such a chip. Firts, not all i2c masters support multi-master configuration. The second reason is much more important. In a redundant system, one would not want redundant masters to be on the same i2c bus. If one of the two fails and blocks the bus, access to all slaves would be blocked. Not a good idea. Much better to have two i2c busses, and select the current master on the slave side. Turns out both reasons apply in my use case. Testing shows that master selection works quite well with the driver I just submitted. I can persistently access all slaves from both masters even under high contention (both masters trying to access the same slave at the same time). If one of the masters fails while having access to the connected slaves, the other simply takes over after arbitration times out. Guenter ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2010-10-13 16:05 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-28 14:33 Driver for pca9541 bus master selector Guenter Roeck
[not found] ` <20100928143302.GA7593-IzeFyvvaP7pWk0Htik3J/w@public.gmane.org>
2010-09-28 15:16 ` Jean Delvare
[not found] ` <20100928171607.395f7736-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2010-09-28 16:07 ` Guenter Roeck
[not found] ` <20100928160746.GB7976-IzeFyvvaP7pWk0Htik3J/w@public.gmane.org>
2010-09-28 16:42 ` Jean Delvare
[not found] ` <20100928184215.00f82717-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2010-09-28 17:16 ` Guenter Roeck
[not found] ` <20100928171627.GA8415-IzeFyvvaP7pWk0Htik3J/w@public.gmane.org>
2010-09-29 7:19 ` Jean Delvare
[not found] ` <20100929091928.16256bb7-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2010-09-29 13:54 ` Guenter Roeck
[not found] ` <20100929135401.GA11771-IzeFyvvaP7pWk0Htik3J/w@public.gmane.org>
2010-09-30 5:59 ` Michael Lawnick
[not found] ` <4CA42750.5020500-Mmb7MZpHnFY@public.gmane.org>
2010-09-30 7:48 ` Guenter Roeck
2010-10-13 16:05 ` Guenter Roeck
2010-10-13 15:45 ` Guenter Roeck
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox