--- In [email protected], Thomas Treyer <[EMAIL PROTECTED]> wrote: > > Hi Geert, > > I am still struckling with the I2C driver and I have problems to > install your code correctly.
Hi Thomas, Did you carefully followed the guidelines I wrote down here: http://www.gevawebsolutions.com/wiki/index.php?title=FB_General_Issues#Adding_a_dynamic_MAJOR_number:_the_steps_to_take...? Pls. take into account this was based on Beta1 of the Phrozen SDK delivered by John Crispin. I didn't have the time yet to install the latest SDK (I'm downloading and installing it at this very moment), so I don't know if the story still holds. I assume you're working on that Beta2 SDK, if I see the kernel config options you have? Or am I mistaken? > First a list what I did: > > 1. I checked the configuration of the kernel: > > kernelconfig -->Drivers for built-in interfaces ---> > x x [*] I2C support > x x [*] I2C uses PB not PB-I2C > x x (0) I2C SDA bit number > x x (1) I2C SCL bit number > x x [ ] I2C EEPROM (non-volatile RAM) support > > 2. I copied your files: > cp -v /Volumes/DEVBOARD/bigblue/drive_led/i2c.h /Volumes/DEVBOARD/os/ > linux-2.6/arch/cris/arch-v10/drivers/ > cp -v /Volumes/DEVBOARD/bigblue/drive_led/i2c.c /Volumes/DEVBOARD/os/ > linux-2.6/arch/cris/arch-v10/drivers/ > cp -v /Volumes/DEVBOARD/bigblue/drive_led/etraxi2c.h /Volumes/ > DEVBOARD/os/linux-2.6/include/asm-cris/ > cp -v /Volumes/DEVBOARD/bigblue/drive_led/i2c_errno.h /Volumes/ > DEVBOARD/os/linux-2.6/include/asm-cris/ > > (Please note that /Volumes/DEVBOARD/ is just a mount point of a samba > share.) > So far, so good, I would say at first glance. You copied the files where they have to be. > 3. I changed the code in i2c.c to use static major number: > //#define DYNAMIC_MAJOR_I2CDEV_NUMBER_ALLOC > #undef DYNAMIC_MAJOR_I2CDEV_NUMBER_ALLOC > OK, then you don't need all the other changes I made to get that dynamic MAJOR number allocation. Fair choice. This should also lead to the least problems... > 4. I added a debug function to read out the actual level of the SDA > and SCL pins. > Can you show me the code you added into the driver? > With this setup your code is compiled when I run make of a new > fimage, but the code is not in effect. Whatever changes I do in the > source code of i2c.c, there is no effect to the execution of code. I > do not know what i2c.c file is installed in the fimage, but it is not > the one in DEVBOARD/os/linux-2.6/arch/cris/arch-v10/drivers/. > Could it be because of the selections you made for I2C into the kernel configuration? Again, I didn't see those options with the Beta1 when executing a "make menuconfig". 2 suggestions: 1. to be sure it's my code which is compiled and not some other file, can you add deliberately a mistake in the source code (I know, as a professional programmer, you shouldn't do this, but sometimes it makes a bit of sense...) 2. can you just select items 2-3-4 in the kernel configuration and see what it does? Since we're anyhow not using the I2C facilities from the Axis chip (PB_I2C it's called), you might try by not activating the "default" I2C stuff in the kernel, but really yours and only yours. > There are more than 20 locations in the file tree, where a file i2c.c > is located. In the following there is a list I created with "locate > i2c.c": I've struggled with this too in the very beginning I jumped on the FoxBoard train. I agree, it looks like a mess, but there's anyhow logic behind it (well, what's in a name...). There's a need for another I2C module if you're using another architecture, that's one. Next to this, there might be other abstraction levels used for those other I2C drivers (I didn't study them in detail, due to lack of time: analysing one driver is more than enough for the moment...). However, the one and only correct one for the FoxBoard, is the one located in "os/linux-2.6/arch/cris/arch/drivers". So, yours is located at the right place. Hoped to help. In case of any further problems, don't hesitate to ask for help. If possible (time and knowledge), I certainly will. Best rgds, --Geert
