LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Embedded & Single-board computer (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/)
-   -   How to write a PCI Express device driver for Xilinx Virtex-5 LXT/SXT Dev Kit? (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/how-to-write-a-pci-express-device-driver-for-xilinx-virtex-5-lxt-sxt-dev-kit-690529/)

magda 12-14-2008 12:00 PM

How to write a PCI Express device driver for Xilinx Virtex-5 LXT/SXT Dev Kit?
 
Hello all,

I am new in the Forum and this is my first post! I would like to say that I have used this Forum in the past and that there is very useful information.
I am a software engineer with experience developing Linux device drivers (USB 2.0). I used the usb-skeleton template by Greg Kroah-Hartman, which was of great help.
I need to develop now a device driver for a PCI express board: the Xilinx Virtex-5 LXT/SXT and I am a little bit lost... I know nothing about PCIe.

So my first question is: Is there a similar template for PCIe to start with?

Any advice would be more than welcome!

Happy Christmas!

Magda

unseulensemble 01-14-2009 05:10 PM

Writing PCI driver for Xilinx Virtex 5
 
Hi magda,
I'm an electrical engineer an I don't know a lot of thing about the inside of the linux kernel and how to make device drivers.
But, me too I am trying to develop a PCI express device driver for Xilinx Virtex-5 SXT. I was reading books "Linux Device Drivers" and "PCI Express system architecture" but I don't think there is enough info in these book to do that. I will firstly try to make an USB driver (If you use ML-506 evaluation board or equivalent there is already an USB device port.) If you have any more info about pci express let me know.

Thank you.

unseulensemble

rashmikant 02-08-2009 12:27 PM

Hi,
Did any one got any success with PCI-express driver for Xilinx Virtex-5 board? Can you guide me if there are any sources which I can go through or I can refer to? Is there a source available for the driver so that I can tweak it for custom needs?

I would really appreciate any help thats available.

Thanks,
Rk

magda 02-13-2009 08:48 AM

Hi, here you have links to pci skeletons that I've found useful, from the simplest to the most complicated:

http://www.cs.fsu.edu/~baker/devices...pci/pci_skel.c
http://true-random.com/homepage/proj...pci_template.c
http://www.gelato.unsw.edu.au/lxr/so...pci-skeleton.c

Linux Device Drivers is quite complete boot, just follow chapter 9 and edit pci_skel.c (first of the previous links) accordingly in order to get simple read and write operations.

Also you need to decide if you want your driver to be a Character or a Block device, here you have some discussions:

http://www.cab.u-szeged.hu/linux/doc/khg/node18.html
http://www.linuxhq.com/guides/LKMPG/node14.html
http://www.faqs.org/docs/kernel/x571.html

In case you go for Character Device then you will need to create it from a linux terminal. I donīt have the info on how to do that yet.

I hope this helps,

Magda

gcurwen 03-03-2009 03:12 PM

Thanks for the Links!
 
Hi,

I am a software engineer who has been tasked with implementing a PCI device driver for a custom FPGA. I have used the USB skeliton before, and was hoping I could find a similar piece of code for PCI. I was very glad to find the links provided in this post. It will save me a lot of time.

Thanks again...

Greg

rashmikant 03-03-2009 05:31 PM

Thanks a ton..
 
Thanks a lot for the info..
I have started building driver for fpga thru PCI interface..I will post the link for the code in-case if someone else is looking for it.
Thanks once again for the help.
Rashmikant

magda 03-04-2009 03:25 AM

You are welcome, I am glad the info was useful.
Let me know if you have any problem.


Magda

Mahmoud_eltahawy 04-28-2009 04:27 AM

How I could test my code
 
Quote:

Originally Posted by magda (Post 3464321)
You are welcome, I am glad the info was useful.
Let me know if you have any problem.


Magda

Dear All,

First, Thank u very much for this great discussion , I am new for PCI driver development, I write a simple PCI driver and I need to test it, in other words I need to do simple read/write/ioctl operations, but I have no hardware(PCI development board) for doing this, I tried to use any of the PCI cards connected to my PC, I understand that ,to invoke the Driver probe method, the VEDNER_ID and DEVICE_ID of my driver should match one of the IDs of the cards connected to PC, so I used the lspci utility to list all vendor and device IDs . and I used one of these IDs in my code to make the kernel invoke my driver probe method,
inside the probe, I tried to get the address of BAR0 and BAR1 using pci_resource_start to allocate my data structure in BAR0 of the PCI, but It fails and returns NULL from pci_resource_start.


My question: Does anyone know how I could fix this problem ??


Appreciate your help

Thanks
Regards
Mahmoud

mellob 04-30-2009 11:09 AM

Quote:

Originally Posted by rashmikant (Post 3463867)
Thanks a lot for the info..
I have started building driver for fpga thru PCI interface..I will post the link for the code in-case if someone else is looking for it.
Thanks once again for the help.
Rashmikant


hi all,

no news on this way?

i'm in troble with writing a similar driver. i got to stop myself because there's something wrong in my code, if anybody of you reached in writing this driver, please tell, i've a lot of question.

rashmikant 06-10-2009 08:17 AM

1 Attachment(s)
I did manage to get something running.
I can get the basic stuff up and running but am having some problems with the status bit handling in the DMA address space mapped in kernel for the fpga. will have to look more into that.

I had used the links which magda posted and got a .tar files somewhere from the forums which had driver code which implemented something similar to this. I will try to search for it and will see if i can find it..

Let me post my source file for the driver..

hope this helps.

enjoy.
rk

maveric4745 07-16-2009 01:33 PM

all,
i have similar dev env:
V5 FPGA with 440 PPC and PCIe Endpoint <-> PPC 8548 with Linux 2.6.24.7 and PCIe RC

will post when i have something more than just PCI header info ...

nsaba 07-22-2009 12:29 AM

Quote:

Originally Posted by maveric4745 (Post 3609821)
all,
i have similar dev env:
V5 FPGA with 440 PPC and PCIe Endpoint <-> PPC 8548 with Linux 2.6.24.7 and PCIe RC

will post when i have something more than just PCI header info ...

Hi ,

It's an interesting work , I'm interested in your results.

Restless86 03-22-2010 03:07 PM

Any results?
 
Quote:

Originally Posted by magda (Post 3442325)
Hi, here you have links to pci skeletons that I've found useful, from the simplest to the most complicated:

(...)

Linux Device Drivers is quite complete boot, just follow chapter 9 and edit pci_skel.c (first of the previous links) accordingly in order to get simple read and write operations.

Also you need to decide if you want your driver to be a Character or a Block device, here you have some discussions:

(...)

In case you go for Character Device then you will need to create it from a linux terminal. I donīt have the info on how to do that yet.

I hope this helps,

Magda

Hi.

I kinda need to do the same thing as you.. develop a device driver for a PCI express board: the Xilinx Virtex-5 LXT.
But I'm kind stuck on this.. I'm looking into the books referred in topics and I've now started taking a look at the example codes posted here. Even so I didn't manage to get anything running yet. :(

Did you manage to get this working? Any advice?

Thanks in advance.
Best regards.

nsaba 03-23-2010 02:59 AM

Quote:

Originally Posted by Restless86 (Post 3907921)
Hi.

I kinda need to do the same thing as you.. develop a device driver for a PCI express board: the Xilinx Virtex-5 LXT.
But I'm kind stuck on this.. I'm looking into the books referred in topics and I've now started taking a look at the example codes posted here. Even so I didn't manage to get anything running yet. :(

Did you manage to get this working? Any advice?

Thanks in advance.
Best regards.

I was in a similar situation as you are in, a few months ago; In general, in your driver you must enable PCI/PCI-Express device, initialize it and all its features need to be initialized for operation, provide access method/s to it and in from here comes special section that depends on your hardware internal architecture that you provide by programming FPGA.
I started with ldd3, Linux essential device drivers, and some kernel development knowledge. Now that the device is getting ready to operate, I've developed driver as well in an incremental manner in parallel with device. I've provided access to device from user space through a character device node in File System (for testing device functionality) and, access from kernel space from kernel crypto api.

Please give more description about your current status, errors you are involve and device architecture and functionality.

I'll be pleased if I could help you.

Bhupal 03-30-2010 10:10 AM

Linux Terminal for PC's connected with PCI Express
 
Hi Friends,

I want to use Linux terminal or console in order to communicate other system which is connected with PCI Express bus. I dont know how to make this.
I have Linux PC which is connected to PowerPc

We usually use ssh in order to communicate or access power pc by which are connected with Ethernet cable.

I need to make similar stuff but both the PC's are connected with PCI Express Bus.

Do i need to make any changes in PCI Express driver in order to do this?

Can anyone please help me how to do this!!


All times are GMT -5. The time now is 05:00 AM.