cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
wenweizha
Contributor
Contributor
10,277 Views
Registered: ‎02-25-2009

How to use the icap driver in Linux kernel 2.6.30?

It is said that " This is the code behind /dev/icap* -- it allows a user-space  application to use the Xilinx ICAP subsystem ...  The simplest way to use this interface is simply: cp foo.bit /dev/icap0 ..."

 

However, after booting up with ram disk, there is no such "icap0" nod in /dev, so "cp foo.bit /dev/icap0" is just a file copy.

 

I tried make nod manually by "mknod icap c Major# Miner#", but then "cp foo.bit /dev/icap" gives me error: <3>icap 86800000.xps-hwicap: Failed to open file'./icap' exists.

 

So how to use the icap driver in user space with bash? (I have already mounted /sys and I can see info there. I have no problem using the gpio following Document/gpio.txt. But I can not find any document on how to use icap driver ...)

0 Kudos
20 Replies
wenweizha
Contributor
Contributor
10,254 Views
Registered: ‎02-25-2009

Orginially, I do not have "mdev". Then I recompiled busybox and I have "mdev" now.

 

By executing "mdev -s", a nod for icap is generted in /dev. However, I still get the error icap 86800000.xps-hwicap: Failed to open file'./icap' ... I went through the xilinx icap driver source code and realized the error is due to iniitilizatoin faliure. I guess I have to enable the debug message ...

 

Another problem is that, buy defaule, icap has a major number 259. But it is too large for my root file system - only number < 256 is accepted. If I change 259 to 249, "mdev -s" generates icap nod with major # 249; if not, a nod with major #3. Is this because my busybox is too old (1.1.0).?

0 Kudos
wenweizha
Contributor
Contributor
10,228 Views
Registered: ‎02-25-2009

Xilinx icap driver has some problem working with hardware IP opb_icap 1.10a (as I experimented, my Virtex 4 FX60 only works with opb_icap 1.10a - 1.01b does not work.)

 

According to stand-alone software drivers of hwicap v1.01a, for Virtex4, the first attempt to read device IDCode is a dummy read and should be discarded. The second try of readying device IDCode returns the desired IDCode.

 

However, this is not implemented in Xilinx icap driver for Linux.

 

I'm debugging "xilinx_hwicap.c". Hopefully I can work out something useful for those who use ML405/410 board.

0 Kudos
linnj
Xilinx Employee
Xilinx Employee
10,212 Views
Registered: ‎09-10-2008

I'll ask around Xilinx on this as I don't know hardly anyone using this driver. 

 

-- John

0 Kudos
wenweizha
Contributor
Contributor
10,208 Views
Registered: ‎02-25-2009

thanks for your reply.

 

I just found that for opb_icap 1.10a (work fine with ML410 board), I need to disable the alignment check in the initilization. Then the driver works.

 

But it has a few "flaws"

1. it only takes "simplifed format", the .bin file, but not the .bit file - it does not perform head information trim;

2. it does not do CRC check after sending a configuration bit file.

 (Our lab's icap driver for kernel 2.4 did 1&2.)

0 Kudos
vekin06
Visitor
Visitor
9,742 Views
Registered: ‎05-21-2009

Hi,

 

It seems that I have the same problem as you.

 

If we are removing the header from the bitstream, how can we get the size of it?

 

Regards

0 Kudos
wenweizha
Contributor
Contributor
9,737 Views
Registered: ‎02-25-2009

If you use it in command line, like "cat pr.bin > /dev/icap0", the size does  not matter; the driver taks car of everything.

 

If you use it in a user application use fread / fwrite, you can easily handle size.

0 Kudos
czlilac
Visitor
Visitor
8,791 Views
Registered: ‎08-11-2009

I didn't find thd icap0 under /dev to , and there was no icap0 as well after I executed "mdev -s". Can you help me,and give me some usefull imformation to resovle it.Thanks.

0 Kudos
wenweizha
Contributor
Contributor
8,781 Views
Registered: ‎02-25-2009

I'm executing:

 mount -t sysfs sysfs /sys

 

You should be able to find /dev/icap0.

0 Kudos
czlilac
Visitor
Visitor
8,773 Views
Registered: ‎08-11-2009

but when I input "mount -t sysfs sysfs /sys", it shows "/sys failed: No such file or directory".
0 Kudos
czlilac
Visitor
Visitor
9,359 Views
Registered: ‎08-11-2009

Now, I create a sys folder by hand and mount sysfs to it, then I find there is a "icap" under /sys/devices/platform/xilinx_icap.0/subsystem/drivers , but there is still no "icap0" under /dev.

Message Edited by czlilac on 04-08-2010 05:50 PM
0 Kudos
wenweizha
Contributor
Contributor
9,350 Views
Registered: ‎02-25-2009

Are you using Xilinx's distribution of Linux 2.6.30? Are you making correct config (CONFIG_BLK_DEV=y CONFIG_XILINX_HWICAP=y? Are your dts file correct?

 

 

You shoud see icap successfully map to memory during booting.



0 Kudos
czlilac
Visitor
Visitor
9,348 Views
Registered: ‎08-11-2009

I am using the linux2.6.25-rc9, and the CONIFG_BLK_DEV,=Y, CONFIG_XILINX_HWICAP=y in my .config.  it shows "Registering device xilinx_icap:0" when booting the linux kernel.

By the way, I can see the icap when execute "cat /proc/devces"

0 Kudos
czlilac
Visitor
Visitor
9,319 Views
Registered: ‎08-11-2009

Hello, I still have not resovled the problem , and I manully cross compiled the xhwicap, then insmod it to linux2.6.25 ,it can be seen under /proc/devices , but could not show under /dev .

 

Now , I mannully make a icap node with "mknod /dev/icap c 211 0" command, 211 is the major device number. but when I excute "cp enc.bit > /dev/icap", it shows "cp: unable to open `/dev/icap': No such device or address".

 

Can you give me any hints about this ?

 

Thanks a lot !

0 Kudos
wenweizha
Contributor
Contributor
9,314 Views
Registered: ‎02-25-2009

I forgot to mention that I'm not using Xilinx's newest icap core. I'm using a ML410 board, so I choose "opb_hwicap" v1.10.a (the whole system is build with default BSB in XPS_PLB bus, and a plbv46_opb_bridge is needed). It seems that I had trouble in using xps_icap. (Indeede, icap is very tricky to use ...)

 

The file driver/char/xilinx_hwicap should be added with one more line: (I don't remember by default whether v1.10a is supported.)

 { .compatible = "xlnx,opb-hwicap-1.10.a", .data = &buffer_icap_config},

 

If everything is OK (your icap hardware works correctly, your kernel is built correctly), you should see this  during boot up:

 

icap 40200000.opb-hwicap: Xilinx icap port driver
icap 40200000.opb-hwicap: ioremap 40200000 to d1020000 with size 10000

 

(It seems that you saw differnt message abot icap.)

 

I'm not so good at linux driver, especially when we go into kernel 2.6. (In 2.4, it's kind of "simple" to wirte our own driver program and use "insmod" to install a device; but in 2.6, too much seems to be changed).

0 Kudos
czlilac
Visitor
Visitor
9,309 Views
Registered: ‎08-11-2009

Maybe this is problem, I am using EDK9.1 to build the BSB, and it is opb bus. Thanks for your reply , I will try it.

0 Kudos
wenweizha
Contributor
Contributor
9,306 Views
Registered: ‎02-25-2009

I didn't try EDK9.1.

 

BSB of 10.1 / 10.3 / 11.X wokrs fine, though I need to manually add opb_icap core.

 

good luck!

0 Kudos
czlilac
Visitor
Visitor
9,297 Views
Registered: ‎08-11-2009

I have tried it without any success,  it can't add plbv46_opb and xhwicap_v_1.10_a,  during  creating the BSB in the EDK10.1, but it can't find them when execute project->recan user respositories after i put into pcores,.

 

And how did you add the opb_hwicap and the plbv46_opb , and did you witer down the whole process? If there are some document , can you send it to me ? My email is zhichen1986@gmail.com, Thank you a lot!

Message Edited by czlilac on 04-14-2010 03:01 AM
0 Kudos
czlilac
Visitor
Visitor
9,286 Views
Registered: ‎08-11-2009

Or could you send me your system.bit , zImage.elf and .config?Thanks!
0 Kudos
ritanagar
Adventurer
Adventurer
7,898 Views
Registered: ‎09-20-2010

Hi,

I m having the same using hwIcap,Plz help me to resolve this.

In /dev.icap0 is there,I m using ML507 board.After confuring linux with HwIcap, how can we do partial reconfigurtion?

Plz give me some idea.

 

you have written  "cat pr.bin > /dev/icap0".

 

How to pass partial bit files to icap0?

 

Plz help me

0 Kudos
wenweizha
Contributor
Contributor
2,878 Views
Registered: ‎02-25-2009

I'm sorry but that project has been dead for 10 months and I do not even have the ML410 board now.

 

My only suggestion is to have some patience, and then luck shall come!

0 Kudos