I2C drivers (for AMBA)

Hi. I am working on a custom design that is based on ARM926EJ and AMBA bus. OS of choice is uCLinux, patched with RTAI for RT performance. I have to implement now I2C support, but looking at the existing driver things seem a bit unclear for me.

Here is what I unserstood: i2c-core.c is independent of the bus and is kernel module. This should be working. But what about AMBA bus? Is it supported? Is this file for support of AMBA located in 'busses' directory? What are algos files? As I undersand, these are bus dependent. Is AMBA supported by these?

If there are not, does anyone have idea how these can be written?

How can a proper working of I2C be tested? Can some dummy I2C peripheral be created in Linux?

Also, if you have any eperiance with I2C linux drivers, please share it. I do not know much about these, so any links to documentation abuot writing these drivers, or explanation how they work will be more than helpful!

Thanks, Drasko

Reply to
drasko
Loading thread data ...

formatting link

That book should have pretty much everything you need to know about Linux device drivers. If you want more beyond that, perhaps pick up "Understanding the Linux Kernel," but I don't believe that one is online (well worth the money, however).

Brian

Reply to
Brian

I suggest also to look at

formatting link

In the picture you can find the relationship between the various modules.

In your environment you probably will have to write the algo part (I guess that you have an i2c adapter connected to the amba bus with registers to access i2c functionality). The algo-bus split is used when adapters share some common parts (like the bit-banging adapter).

Ale

Reply to
pmst

pmst, thanks for the waypoints. ARM has Amba Peripheral I2C Bus Controller (ApI2c), which I guess is a bridge between Amba and I2C (which comes out of the chip on two pins). So, can you tell me:

1) what abot 'buses' part? It has to be dependeant on Amba? 2) what about 'chips part? Does it have to depend on ApI2c? 3) Do I have to write only adapter part -- is this the peice of code that is ApI2c dependant, and not 'chips' part?

I am still not clear which part of driver ('algos', 'busses', and 'chips') depends on what... And waht of existing I can use and what I have to write by myself.

Cheers, Drasko

Reply to
drasko

The OpenCore I2C driver with Wishbone interface has now a driver excepted in the official kernel:

formatting link

--
Uwe Bonnes                bon@elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
Reply to
Uwe Bonnes
1) The bus part is were I would implement the support for ApI2C, Linux has support for AMBA bus (as I see in drivers/amba) 2) The chips part is bus-independent and handles devices (i.e. slaves) connected to the bus.

I would start off with something like i2c-ali* or i2c-s3c2410 as a starting point/example to follow.

Cheers, Ale

Reply to
pmst

FYI, a couple more links that are more Linux/I2C specific:

formatting link
formatting link

Brian

Reply to
Brian

Thanks all for support!

As I see for now, I'll have to write 'busses' part of the driver to suppport ApI2c interface. I gusess some kind of simple alogorithm will be implemented within it. I'll check out existing code and try to figure out something.

Maybe someone would know which bus adapter from 'buses' directory can be godd for a start (that it resembles ApI2c, so can be easily rewritten)? pmst sugessted i2c-ali* or i2c-s3c2410, but did not say wahy these two...

lm-sesnors have several userspace tools for checking I2C functionality, so this can be used as a rudimentary testing base...

Reply to
drasko

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.