Hi all, As I already mentioned, I have ported the xilinx_iic driver from the penguin ppc distribution to uClinux. Attached to this post you will find 3 files 2 of them are the patch files (uClinux-dist.i2c_patch and uClinux-2.4.x.i2c_patch) which are be applied angainst the uClinux-2.4.x and uClinux-dist dicrectories. The third (uClinux-2.4.x.xilinx_i2c.tar.gz) one contains the tarred and zipped files for the driver, which are to be untarred from the uClinux-2.4.x directory. In case one does not want the device nodes automatically created during the build process, the patch uClinux-dist.i2c_patch may be omitted. I am using this driver on our custom hardware and it seems to work quite ok. I only had problems with on specific i2c device (Microchip PIC16F873A). The PIC hangs after the first command received an does not recover until reset. It seems as if The start command from the xilinx i2c core does not meet the specified timing. All the other devices I have tested are working quite happily together with the xilinx i2c core and the xilinx_iic driver. INSTALL ======= After appliying the patches some modifications still have to be done in order to tailor the i2c driver to your needs. First of all one will have to make shure that your xparameters.h contains the information about the i2c core. Secondly one will either have to copy the xiic_g.c file generated by xps to the linux.2.4.x/drivers/i2c/xilinx_iic directory or modify this file by hand. There has to be a record for every iic core used in the design. I guess the can be done by using some defines, i will have a closer look at this later on. Another place being to woth to have a look at is i2c_algo_xilinx.c. At line 71 is an definition of static int scan = 1; I found it quite useful to scan the i2c bus when the driver is loaded in order to see whether the bus is ok or not. In oder to switch this initial scan of scan has to be set to 0. After the modification the kernel may be compiled. In Menuconfig one has to activate the following options: Processor Type and Features -> Xilinx IIC driver Character Devices -> i2c support -> i2c support Character Devices -> i2c support -> i2c device interface Character Devices -> i2c support -> i2c /proc interface After all this the kernel should compile without further modifications :) During start up linux will print the following messages (the second part only if scan is set to 1) [...] i2c-core.o: i2c core module i2c-dev.o: i2c /dev entries driver module i2c-core.o: driver i2c-dev dummy driver registered. i2c-proc.o version 2.6.1 (20010825) [...] i2c-dev.o: Registered 'Xilinx IIC adapter' as minor 0 i2c-core.o: adapter Xilinx IIC adapter registered as adapter 0. Xilinx IIC adapter #0 at 0xA0005000 mapped to 0xA0005000, irq=5 Xilinx IIC adapter #0 Bus scan: 0x2e 0x51 0x57 responded. i2c-dev.o: Registered 'Xilinx IIC adapter' as minor 1 i2c-core.o: adapter Xilinx IIC adapter registered as adapter 1. Xilinx IIC adapter #1 at 0xA0006000 mapped to 0xA0006000, irq=6 Xilinx IIC adapter #1 Bus scan: 0x2e 0x3c 0x50 responded. [...] USAGE ===== Right at the moment I am using IIC for several puposes. First of all I am using the routines from xiic_l.* during startup in order to read the mac address from an i2c eeprom. So I can uses the same kernel for several devices. Secondly I have stored all the other netword interface information (IP, Gateway, Netmask ...)on the eeprom as well. They are read by a program started in the rc script using the dev interface (open, ioctl, read, write and close) an used to set up the network. And finally all i2c devices are controlled over this interface by a little program i wrote. By now I have not written any special drivers for every i2c device. I always used the dev interface. Thats it for the moment :) I will be glad to hear of anyone who tested this. For those who still are in their x-mas and new years holiday i wish a nice holiday. Cherrs Erik ******************************************** Erik Hansen SHF Communication Technologies AG Amalienstr. 14 12247 Berlin Germany phone: +49 (0)30 / 77 20 51 0 fax : +49 (0)30 / 75 31 07 8 mail : e.hansen@shf.biz ******************************************** -- Diese Nachricht wurde auf Viren und andere gefaehrliche Inhalte untersucht und ist - aktuelle Virenscanner vorausgesetzt - sauber.
Attachment:
uClinux-dist.i2c_patch
Description: uClinux-dist.i2c_patch
Attachment:
uClinux-2.4.x.xilinx_i2c.tar.gz
Description: uClinux-2.4.x.xilinx_i2c.tar.gz
Attachment:
uClinux-2.4.x.i2c_patch
Description: uClinux-2.4.x.i2c_patch