LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices

Reply
 
Search this Thread
Old 03-30-2010, 11:34 AM   #16
Restless86
LQ Newbie
 
Registered: Jan 2010
Posts: 4

Rep: Reputation: 0

Quote:
Originally Posted by nsaba View Post
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.
First of all, thanks for your answer and sorry for my late reply.
I was finishing another part of my project this last week.

So, related to this topic..
I think my main problem is actually inexperience. :|
I'm a student and I've only had lessons for learning VHDL and working with FPGAs during one semester.. on top of that I've only worked with a Nexys-2 board so far.
So basically I've already a few projects developed and working on a Nexys-2. What I'm want to do for now is to adapt this projects to work on the Virtex-5 (which is all new to me) and use the PCI Express bus for data input.
From what I've read so far before I start developing the driver for Linux I think I should have the FPGA module working.. I've run into this "LogiCORE™ IP Endpoint Block Plus for PCI Express" at Xilinx website. Is this were I should start? Or do you have another suggestion?
I only have about 1 month to get this working so I would really appreciate any help from you.


Best regards.
 
Old 07-13-2010, 05:25 AM   #17
dudu1102
LQ Newbie
 
Registered: Jul 2010
Posts: 1

Rep: Reputation: 0
Smile

Quote:
Originally Posted by nsaba View Post
.. 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.
====
hello nsaba,
Great to hear you succeeded to make it working. Now I meet same situation where I want to develop one PCIe EP driver, connected to my board RC .. So your job is very interesting really ..

Also i'm interesting to your userspace testing method, could you share with us about your:
1. driver code if posisble ;
2. userspace testing method ;

Thanks veyr much!!

Du
 
Old 08-31-2010, 06:31 AM   #18
nsaba
LQ Newbie
 
Registered: Jul 2009
Posts: 4

Rep: Reputation: 0
Quote:
Originally Posted by Restless86 View Post
First of all, thanks for your answer and sorry for my late reply.
I was finishing another part of my project this last week.

So, related to this topic..
I think my main problem is actually inexperience. :|
I'm a student and I've only had lessons for learning VHDL and working with FPGAs during one semester.. on top of that I've only worked with a Nexys-2 board so far.
So basically I've already a few projects developed and working on a Nexys-2. What I'm want to do for now is to adapt this projects to work on the Virtex-5 (which is all new to me) and use the PCI Express bus for data input.
From what I've read so far before I start developing the driver for Linux I think I should have the FPGA module working.. I've run into this "LogiCORE™ IP Endpoint Block Plus for PCI Express" at Xilinx website. Is this were I should start? Or do you have another suggestion?
I only have about 1 month to get this working so I would really appreciate any help from you.


Best regards.
Hi,
Sorry for such a late reply;
I was not aware of this thread being updated .
But about your question "LogiCORE™ IP Endpoint Block Plus for PCI Express" is the right way to begin.

Sincerely.
 
Old 08-31-2010, 06:44 AM   #19
nsaba
LQ Newbie
 
Registered: Jul 2009
Posts: 4

Rep: Reputation: 0
Quote:
Originally Posted by dudu1102 View Post
====
hello nsaba,
Great to hear you succeeded to make it working. Now I meet same situation where I want to develop one PCIe EP driver, connected to my board RC .. So your job is very interesting really ..

Also i'm interesting to your userspace testing method, could you share with us about your:
1. driver code if posisble ;
2. userspace testing method ;

Thanks veyr much!!

Du
Hi Du,
I saw your reply to xilinx forums thread today. Sorry for late reply.

But now about your questions:
1. I will share part of my driver code as soon as possible. But for now as a quick reply, in driver I wrote data to some registers of device and read from those. For registers to be accessible you must first map some BAR of device that is created during generating of PCIe endpoint block plus using xilinx ISE.


2. In user space, as I said before, you must prepare some tool to make transfer of data between kernel and user space possible. I used char device mechanism for this goal. This provides you a node in file system e.g /dev/your_pci. Then you must open that node just like any ordinary file, read from and write to it. The format of data to be written to device might be dependent of the device architecture or simply raw data for testing purpose only.
I'll be glad if I can help you.

Good luck;
 
Old 10-18-2010, 01:27 AM   #20
muralidharan84
LQ Newbie
 
Registered: Oct 2010
Posts: 2

Rep: Reputation: 0
Hi,

I am supposed to send/receive data from xilinx spartan 6 to PC (this is atom processor running on Ubuntu embedded edition[UME]) through a PCIe port. I am currently struck as the basic hello world given in ldd3 doesnt compile in UME..It comes up with can't find file errors in /usr/block/Kconfig.iosched.. when i compare the source kernel files and the kernel files present in the UME, i find there are more files missing. But the UME loads the ubuntu interface properly. The UME has linux kernel version 2.6.22-menlow-default. I could find the missing files in my PC ubuntu .. I am booting the linux using an USB in the UME.. Since i can connect to internet from the UME device, can i download the latest kernel using apt-get directly..?? will the changes get installed in USB itself?

Basically i am new to linux..kindly help me..

Thanks,
Murali
 
Old 01-29-2011, 02:54 AM   #21
miyatake
LQ Newbie
 
Registered: Jan 2011
Location: Arcadia CA
Distribution: Scientific Linux 5.4
Posts: 3

Rep: Reputation: 0
Quote:
Originally Posted by nsaba View Post
Hi Du,
I saw your reply to xilinx forums thread today. Sorry for late reply.

But now about your questions:
1. I will share part of my driver code as soon as possible. But for now as a quick reply, in driver I wrote data to some registers of device and read from those. For registers to be accessible you must first map some BAR of device that is created during generating of PCIe endpoint block plus using xilinx ISE.


2. In user space, as I said before, you must prepare some tool to make transfer of data between kernel and user space possible. I used char device mechanism for this goal. This provides you a node in file system e.g /dev/your_pci. Then you must open that node just like any ordinary file, read from and write to it. The format of data to be written to device might be dependent of the device architecture or simply raw data for testing purpose only.
I'll be glad if I can help you.

Good luck;
Hi there,
I'm hoping someone can help me.
I did step one and most of two- I wrote a driver based on pci_skel.c modeled as a char device. I've got a Virtex 5 with the
pci-express endpoint core on the other end.
I can access it via /dev/mytoy. I mapped BAR0 to be serviced by read() and write() and BAR1 to be done via ioctl()
I didn't do anything ambitious- writew/readw to/from the device. This appears to be working BUT...
I have one task that does nothing but ioctl()s to the device. Running cat bigfile >/dev/mytoy simultaneously works.
Running a task that does writes eventually hangs- in a manner that a reboot is required to get out. I can see the debug
messages that the /dev/mytoy was opened, but the subsequent writes are not there. The ioctl transactions have also stopped.
processes attached to /dev/mytoy are hung. Attempts to remove the driver return a refusal of being busy.

I've put in mutexes around all the write/reads to/from the hardware. Anything else I ought to be doing?
Thanks
Carl
Once I get past this- I got to look at the DMA stuff here. I never did figure out to send large pci-e transaction buffers.
 
Old 02-07-2011, 12:49 AM   #22
ira
LQ Newbie
 
Registered: Sep 2010
Posts: 5

Rep: Reputation: 0
Have anybody tried to do this with a network driver instead of a char driver?
 
Old 10-12-2011, 09:02 PM   #23
ThreeZhiWang
LQ Newbie
 
Registered: Oct 2011
Posts: 8

Rep: Reputation: Disabled
Quote:
Originally Posted by magda View Post
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
Hi.
I have a problem in PCI driver.
I have a PCI Driver in 2.4 keneral work well.
But when I transplant it to 2.6 keneral.
The problem appear.
lseek() is not work.
I look PCI driver code in 2.4 keneral.
I don't see lseek().
same code .


static struct file_operations rubicon_fops = {
owner: THIS_MODULE,
read: rubicon_read,
write: rubicon_write,
poll: rubicon_poll,
ioctl: rubicon_ioctl,
open: rubicon_open,
release: rubicon_close,
};

My PCI is a Character Device.
Everyone know different in PCI driver with 2.4 keneral and 2.6 keneral.
Thanks.
 
  


Reply

Tags
driver, pcie


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PCI Express Graphics Card and /dev/agpgart (AGP Support) (Gentoo) silentray Linux - Newbie 2 10-01-2008 02:10 AM
A problem with audiohd driver arised with Solaris express Dev. ed. 5/07 crisostomo_enrico Solaris / OpenSolaris 4 08-13-2007 01:58 AM
Graphics Card: PCI Express x16 Detected as PCI Express Link width: 4X deepclutch Linux - Hardware 3 06-09-2007 10:10 AM
ATI Radeon X1050 PCI Express graphics driver? Erik_FL Linux - Hardware 10 04-22-2007 02:21 PM
xilinx system ace driver for compact flash on a fpga based pci card doesnt work urwithsudheer Programming 0 03-22-2006 02:28 AM


All times are GMT -5. The time now is 03:50 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration