LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   ioread32 returns 0xffffffff; pci driver (http://www.linuxquestions.org/questions/linux-general-1/ioread32-returns-0xffffffff%3B-pci-driver-656418/)

niteshg 07-17-2008 01:27 PM

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

pinniped 07-18-2008 06:55 AM

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?

niteshg 07-18-2008 07:42 AM

Quote:

Originally Posted by pinniped (Post 3218686)
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

orback 12-02-2009 05:48 AM

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


All times are GMT -5. The time now is 07:35 AM.