LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-17-2008, 12:27 PM   #1
niteshg
LQ Newbie
 
Registered: Nov 2004
Location: NJ
Posts: 29

Rep: Reputation: 15
ioread32 returns 0xffffffff; pci driver


I am writing a driver for a pci card. The pci card has got a powerspan II on it as a pci bridge.
The configuration space contains 4096 bytes:
The driver was working properly with ioread32 before. but now it gives me a problem.
I am copying the following lines relevant to the configuration of pci



np = kmalloc(sizeof(struct my_dev), GFP_KERNEL);
if (!np) {
result = -ENOMEM;
printk(KERN_ALERT "mydev registered1");
}

printk(KERN_ALERT "mydev registered");

memset(np, 0,sizeof(struct my_dev));

init_MUTEX(&np->sem);

if (!pci_enable_device(pdev))
printk(" device enabled \n");
if(request_mem_region(pci_resource_start(pdev,1),4096,"pci_skel"));
printk("device given memory\n");

pci_set_drvdata(pdev, np);

np->base_addr=ioremap(pci_resource_start(pdev,1),4096);

iowrite32( 0x00000000,np->base_addr+0x004);
t= ioread32(np->base_addr + 0x004);
printk(KERN_DEBUG " yhu %x: %x",np->base_addr, t);



When I write 0 to 0x004 and read it back it returns 0xffffffff

Could comeone help me otu here please.
I am using fedora core 2 , kernel 2.6.13

Thanks,
N
 
Old 07-18-2008, 05:55 AM   #2
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
What do you mean the driver was working before but not now? How did you test it? What changed?

Since you're getting all those Fs, it looks like you're not writing to writable memory (a 'read-only' register or else you have no access to the region).

Did you check the value you got from ioremap() to see if it's valid?

Last edited by pinniped; 07-18-2008 at 05:57 AM.
 
Old 07-18-2008, 06:42 AM   #3
niteshg
LQ Newbie
 
Registered: Nov 2004
Location: NJ
Posts: 29

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by pinniped View Post
What do you mean the driver was working before but not now? How did you test it? What changed?

Since you're getting all those Fs, it looks like you're not writing to writable memory (a 'read-only' register or else you have no access to the region).

Did you check the value you got from ioremap() to see if it's valid?
The driver just had a few lines where I was enabling the interrupt mask bits in the configuration register and then waiting for a interrupt. I had a interrupt service subroutine in the driver.
The configuration registers were writable since I was able to read the registers and the change them.
The initializztion of the powerspanII was done by the powerpc in the FPGA(The pci card is a FPGA card).

Now I have disabled the powerpc inside the fpga and am trying to initialize the powerspan II from the probe function of the driver.
I dont have interrupt so I have disabled the service routine.

I was getting a ioremap output of something like 0xebeef000. How can I confirm if its valid or not?
Thanks,
N
 
Old 12-02-2009, 04:48 AM   #4
orback
LQ Newbie
 
Registered: Oct 2009
Posts: 7

Rep: Reputation: 0
I know that this thread was posted longago but I have exactly the same problem when trying to read from a FPGA board, the return value from ioread32 is always 0xffffffff. I am very interesed in how you solved the problem.

Thanks
 
  


Reply


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem in using ioread32() and iowrite32() func for devive driver in linux misbah Linux - Software 1 05-10-2007 10:43 AM
Problem in using ioread32() and iowrite32() functions for device driver for 2.6 kerne misbah Linux - Software 1 05-09-2007 05:24 AM
problem in using ioread32() function in device driver for version 2.6 misbah Linux - Networking 1 05-09-2007 05:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:48 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration