--- In [email protected], "Stéphane Herraiz"
<[EMAIL PROTECTED]> wrote:
>
> Hello,
> Ok I have done this :
> - copy i2c.c, i2c.h, and i2c_errno.h in
> ../devboard-R2_01/target/cris-axis-linux-gnu/include/asm
> - copy etraxi2c.h in /devboard-R2_01/target/cris-axis-linux-gnu/include/
> - do a make
> and when I execute my test program I have a problem to open
"/dev/i2c"...
> 
> In the system log I have this :
> 
> Jan  1 00:00:06 axis kernel: I2C driver v2.2, (c) 1999-2004 Axis
> Communications AB
> Jan  1 00:00:06 axis kernel:   ==> Improvements done by Geert
> Vancompernolle - December 2006
> Jan  1 00:00:06 axis kernel: I2C Major: 254 / I2C Name: i2cgvc
> 
> What I'm doing wrong...
> 
> BR

I'm a bit confused now.  I'm not sure any more where your problem
exactly is.

What I do see, is that you've opted for the dynamic allocation of the
major number for the I2C driver.  If you do this, then there are other
things that have to be changed too.  I don't want to repeat it here,
since it's described on my Wiki
(http://www.gevawebsolutions.com/wiki/index.php?title=FB_General_Issues#Adding_a_dynamic_MAJOR_number:_the_steps_to_take...).
I must admit, it's quite a lot of work to do.  But for me, it was
merely a way to understand the major and minor way of working of the
Linux environment.

You can save yourself all that hassle by not using the dynamic
allocation of the major number for the I2C driver.  Therefore, in the
file i2c.c, comment out the #define DYNAMIC_MAJOR_... and comment in
the #undef DYNAMIC_MAJOR_....

This way, you should have only the I2C driver improvements (and that
is, after all, the most important thing, I guess...).  
For the rest, it should be similar to the way the I2C driver was
compiled and used in the past (except for the improvements and the
extra functionality added, of course).

So, I would give this a try first.  And for this, you don't have to
copy the files i2c.c and i2c.h at all to any other location.
The only thing you must make sure of, is that the header files
i2c_errno.h and etraxi2c.h are located in
./devboard-R2_01/target/cris-axis-linux-gnu/include/asm (this is to be
able to compile user space applications and kernel).  Can you verify
this?  If they're not there, then something went wrong during the
kernel compilation.

In contradiction to what I said in a previous reply, the make
mechanism is *indeed* copying those files from
./devboard-R2_01/os/linux/include/asm into
./devboard-R2_01/target/cris-axis-linux-gnu/include/asm.  So, you *do
not* have to do it yourself.  Sorry for the confusion it might have
caused... :-(

Attention: this only happens when you (re)compile the kernel!  The
make process will wipe out completely the directory
./devboard-R2_01/target/cris-axis-linux-gnu/include/asm (and possibly
others too) and then rebuild it from the bottom up.

i2c_errno.h contains the possible error return values, while
etraxi2c.h the I2C structure and the extra ioctl() calls contains.

They're both needed for kernel driver compilation as well as user
space applications.

Pls. recompile the kernel, reprogram it and restart it.  Have a look
again to the I2C message that appears in the terminal window during
boot time and make sure it's not taking the dynamic major number any
more (just verify).  It should show you the static major number (123
if I'm not mistaken) iso. 254 (as it was the case for you).

Let's see what this gives.

Best rgds,

--Geert

Reply via email to