Adding "host as slave" support
Hi,
I'm in the process of building a robot using a gumstix as the main processor. My gumstix is currently running 2.6.9-rc1. I'd like to use the i2c bus to hook together a bunch of I/O processors to the gumstix and I'd like to have the I/O processors act as masters to send information to the host (gumstix) asynchronously.
I'm primarily interested in using the dev interface
I found the i2c TODO list:
http://www2.lm-sensors.nu/~lm78/cvs/browse.cgi/i2c/TODO
And, I think I'd like to work on this particular item (I'm still trying to come to terms with all of the terminology so I could be wrong :)
97 * Host-as-slave mode in i2c adapters may need to be integrated
98 with the adapter host code, because the lm_sensors-type chip driver
99 architecture is not well suited to implementing a chip slave,
100 the slave mode will require locking with the master mode, and 101 specialized commmunication such as "Notify ARP Master". 102 Adapters may respond to one or more host-as-slave addresses. The 103 functionality bits and the rest of the API will have to be extended 104 to support slaves embedded in host adapters.
I saw the recent thread on multiple master
http://archives.andrew.net.au/lm-sensors/msg27650.html
I don't quite understand the "Notify ARP Master". I searched through the i2c sources (drivers/i2c) and could find no references to "arp".
From my recent readings about i2c, here's my naive brain dump (my terminology could be off - please correct) of what might be required.
- The host would leave the i2c adapter in slave mode so that it could accept incoming data from another master.
- Sending data would switch into master mode and proceed as it dows now.
- Loss of arbitration on a send would need to try sending again when the bus isn't busy.
- The adapter would need to know it's address so it can detect if an incoming request is for it.
- The dev interface would need an ioctl to set the adapter address
- The dev interface would need an ioctl to get the data from another master. This would need to include the address used (in the event that the general call address is supported or multiple addresses are assigned to the host)
That should be enough to start some discussion....
Signature · 3 lines
Dave Hylands Vancouver, BC, Canada http://www.DaveHylands.com/
The SMBus host is generally the 'ARP Master' if ARP is used (see the SMBus 2.0 spec for details...), so host-as-slave must be implemented to support the 'Notify ARP Master' function.
What chip are you considering implementing this on?
see other comments below
Quoted 31 lines · Dave Hylands
Hi,
I'm in the process of building a robot using a gumstix as the main processor. My gumstix is currently running 2.6.9-rc1. I'd like to use the i2c bus to hook together a bunch of I/O processors to the gumstix and I'd like to have the I/O processors act as masters to send information to the host (gumstix) asynchronously.
I'm primarily interested in using the dev interface
I found the i2c TODO list:
http://www2.lm-sensors.nu/~lm78/cvs/browse.cgi/i2c/TODOAnd, I think I'd like to work on this particular item (I'm still trying to come to terms with all of the terminology so I could be wrong :)
97 * Host-as-slave mode in i2c adapters may need to be integrated
98 with the adapter host code, because the lm_sensors-type chip driver
99 architecture is not well suited to implementing a chip slave,100 the slave mode will require locking with the master mode, and 101 specialized commmunication such as "Notify ARP Master". 102 Adapters may respond to one or more host-as-slave addresses. The 103 functionality bits and the rest of the API will have to be extended 104 to support slaves embedded in host adapters.I saw the recent thread on multiple master
http://archives.andrew.net.au/lm-sensors/msg27650.htmlI don't quite understand the "Notify ARP Master". I searched through the i2c sources (
drivers/i2c) and could find no references to "arp".
Quoted 6 lines
Quoted 1 line
From my recent readings about i2c, here's my naive brain dump (my
terminology could be off - please correct) of what might be required.
- The host would leave the i2c adapter in slave mode so that it could accept incoming data from another master.
- Sending data would switch into master mode and proceed as it dows now.
The datasheets I've seen can support master and slave at the same time, there isn't any 'mode' selection possible or necessary
Quoted 2 lines
- Loss of arbitration on a send would need to try sending again when the bus isn't busy.
All SMBus drivers check for busy busses and wait for the bus to be free already; SMBus is inherently mulit-master;
no code changes necessary.
Quoted 7 lines
- The adapter would need to know it's address so it can detect if an incoming request is for it.
- The dev interface would need an ioctl to set the adapter address
- The dev interface would need an ioctl to get the data from another master. This would need to include the address used (in the event that the general call address is supported or multiple addresses are assigned to the host)
sounds right to me.
Quoted 3 lines
That should be enough to start some discussion....
Hi Mark,
Quoted 2 lines · Mark Studebaker
The SMBus host is generally the 'ARP Master' if ARP is used (see the SMBus 2.0 spec for details...), so host-as-slave must be implemented to support the 'Notify ARP Master' function.
Ahhh. I see I have some more reading to do :) My original intention was just adding support for i2c. I knew that smbus tied in there somewhere, but my impression was that it was just a simplified physical layer with a more defined protocol layer. I will research more before continuing.
Quoted 1 line
What chip are you considering implementing this on?
The PXA255 (which is the ARM XScale processor used in the gumstix).
Ok - I've downloaded and read through most of the SMBus 2.0 spec. It seems that to implement an arp capable SMBus device requires being able to respond to two addresses, the slave address and the SMBus ARP Address (1100 001).
So far all of the i2c hardware support that I've seen (including the AVR ATmega series and the PXA255) can only respond to the general call address and the slave address. The PCF8584 has a monitor mode which allows it to detect any slave address, but I haven't seen any other i2c hardware that can support this (which isn't to say that it doesn't exist, I just haven't found anything).
So am I missing something? Has anybody come up with a way of implementing an SMBus device using hardware i2c support? Obviously, this could be done using bit banging.
Quoted 6 lines
Quoted 2 lines
- Loss of arbitration on a send would need to try sending again when the bus isn't busy.
All SMBus drivers check for busy busses and wait for the bus to be free already; SMBus is inherently mulit-master;
no code changes necessary.
Well if I can use the smbus code/drivers then that might make the Linux side of things easier (well it might actually make it work such that I don't even need to make any driver changes - we'll see).
Quoted 9 lines
Quoted 7 lines
- The adapter would need to know it's address so it can detect if an incoming request is for it.
- The dev interface would need an ioctl to set the adapter address
- The dev interface would need an ioctl to get the data from another master. This would need to include the address used (in the event that the general call address is supported or multiple addresses are assigned to the host)sounds right to me.
Thanks for the thought provocation...
Signature · 3 lines
Dave Hylands Vancouver, BC, Canada http://www.DaveHylands.com/