FPGA-FAQ    0044

How to get the Xilinx parallel cable to work on Linux kernels 2.6.x





Vendor Xilinx
FAQ Entry Author Hein Roehrig
FAQ Entry Editor Philip Freidin
FAQ Entry Date 2/10/2005
FAQ Entry Updated 2/25/2005
FAQ Entry Updated 3/18/2005
FAQ Entry Updated 4/24/2005
FAQ Entry Updated 6/14/2005

Q.

    How to get the Xilinx parallel cable to work on Linux kernels 2.6.x?

A.

Lifted from this URL: http://www.fpga.de/tiki/tiki-index.php?page=XilinxSoftwareLinux on 2/7/2005


My system: Debian testing/unstable with kernel 2.6.9. Also incorporates some notes from Joerg Ritter <ritter AT informatik.uni-halle.de>.

1) Install ISE 6.3 from CDs.

  * Make sure your ulimits are permissive. 

  * Make sure portmap is running — for me it was not possible to
    have portmap listen only to the loopback interface.

  * export DISPLAY=:0

  * if there are problems, rm -fr ~/.windu*

  * I ran the installation as non-root user, just /cdrom/setup. The
    "error" about the missing WINDU ini file can be ignored.

  * Run /cdrom/setup for the second disk too and ignore the errors
    towards the end when it tries to install the kernel modules and
    can't because of permissions.

2) Install a current WinDriver

  * install the kernel sources for your current kernel.  
    On SuSE: install kernel-sources, cd /usr/src/linux ;  
    make cloneconfig; make prepare 

  * I downloaded from http://www.jungo.com/dnload.html  the 
    WinDriver? for Linux x86 Version 6.23. This requires a free 
    registration. 

(Note 6/14/2005 by Greg Eckersley)
    >   The latest "Windrvr" from  http://www.jungo.com/dnload.html , WD700LN.tgz now compiles
    >   and installs without patches on debian 2.6.11 . Best to make sure the kernel is compiled
    >   on the same host with gcc >= 3.3 . 


  * tar xzf WD623LN.tgz 
    cd WinDriver/redist 
    ./configure 

  * on Debian, just run make. On SuSE: edit makefile 
     -change KERNEL_DIR:  KERNEL_DIR = /usr/src/linux/ 
     -modify CFLAGS: 
        i) delete all -I flags 
        ii) add to start of CFLAGS  -I/usr/src/linux/include 
        iii) add next in CFAGS  -I/usr/src/linux/include/asm-i386/mach-default/ 

  * as root:  make install 

  * I was so far too lazy to figure out how to recreate the correct 
    devices in /dev after a reboot, so I just run make install in the 
    redist directory again after each reboot 

 * change the permissions of /dev/windrvr6 so that you (non-root 
   user) has rw permissions to it. 


3) get the Xilinx driver to work

 * according to
   <http://www.xilinx.com/xlnx/xil_ans_printfriendly.jsp?getPagePath=18612 (cache)>
   you can get the source to the Xilinx driver from
   <ftp://ftp.xilinx.com/pub/utilities/fpga/linuxdrivers.tar.gz>

 * unpack, cd linuxdrivers/xpc4drvr

 * mv Makefile Makefile.old

 * add the following new Makefile. The file needs to be named
   Makefile and you need to adjust the variable pointing to the
   kernel source for your current(!) kernel.


KERNEL_SOURCE=/home/hein/src/kernel/kernel-source-2.6.9

obj-m := xpc4drv.o

xpc4drv-objs := xpc4.o ioctl_3.a

default:
       make -C ${KERNEL_SOURCE} M=`pwd` modules

.PHONY: default


 * in xpc4.c, make the following two changes

     - change #include <linux/modversions.h> into 
       #include <config/modversions.h>

     - add #include <linux/netdevice.h>, e.g. after #include
       <asm/uaccess.h>

 * run make. This should produce a file xpc4drv.ko

 * insmod ./xpc4drv.ko should work and give you a kernel log message
   "xpc4drvr: init_module"

4) make sure your parallel port is enabled in the BIOS (with ECP?) and
  that /dev/parport0 has rw permissions for you.

5) source /path/to/xilinx/installation/settings.sh
  /path/to/xilinx/installation/bin/lin/impact should find the
  parallel cable now



UPDATE from Tyson Harding on 3/18/2005
The WinDriver redist code does not work with the 2.6.11 kernel, the 
remap_page_range function has been removed. Until the driver is fixed,
here is the fix:

in linux_wrapper.c
change line 234 to

if(remap_pfn_range(

and change line 238 to
vma->vm_start, vma->vm_offset >> PAGE_SHIFT, size, vma->vm_page_prot))

here is the output of diff on original and changed files.

< if (remap_page_range(
---
> if (remap_pfn_range(
238c238
< vma->vm_start, vma->vm_offset, size, vma->vm_page_prot))
---
> vma->vm_start, vma->vm_offset >> PAGE_SHIFT, size, vma->vm_page_prot))

Hope this can help someone.

Tyson Harding

UPDATE from Matthias Alles on 4/20/2005
When compiling the Xilinx driver there might be problems because of
MOD_INC_USE_COUNT; and MOD_DEC_USE_COUNT;
They don't exist in kernel 2.6 anymore. Just remove them, the kernel fulfils
this task now.

FPGA-FAQ FAQ Root